FSC Invaild Expression

Dlaudy

Member
Join Date
Apr 2017
Location
Allentown
Posts
19
Hello all, I'm trying to use the FSC function in Studio 5000, but i keep getting the error "Invalid Expression". I am hoping one of you might be able to help me with this issue.

Some notes, the "Always_True" bit is a BOOL = 1
The other is an array of 800 BOOL's that I am trying to compare.

Any help would be appreciated!!

FSC_Block.PNG
 
Can you explain "EW_Conveyors_Faults.Triggers"?

Is this supposed to be a BOOL[800] array?

If so, then each member would supposedly be...

EW_Conveyors_Faults.Triggers[0]
EW_Conveyors_Faults.Triggers[1]
EW_Conveyors_Faults.Triggers[2]
EW_Conveyors_Faults.Triggers[3]
...

What or where is ".Triggers" coming from?

Should it be...

EW_Conveyors_Faults_Triggers[0]
EW_Conveyors_Faults_Triggers[1]
EW_Conveyors_Faults_Triggers[2]
EW_Conveyors_Faults_Triggers[3]
...

Change "." > "_" ???

Regards,
George
 
I'm not overly familiar with RS5K but it would appear that the expression results in a bool, this is a FILE SEARCH so the expression needs to result in a file (INT,DINT,REAL) not a bool.
You could try the FBC Which is a bit compare.


Steve
 
So,

EW_Conveyor_Faults is a UDDT which has a tag, Triggers, which is an BOOL[800] array. Im trying to compare values within the array contained withing the UDDT. Hope that makes sens, I'll attach a picture as well.

FSC_Tag.PNG
 
Steve,
I think you might have a point, I am looking into using a FBC rather than a FSC now, i will report back if it does or doesn't work.
 
I'm not sure if that will work with a BOOL array within a UDT?
You may need individual BOOL members within the UDT?

BOOL arrays have very limited instruction support, the FBC instruction being one they will not work with.
The FSC I cannot remember off hand?

G.
 
Thank you all for your help! I ended up not using the FBC, but instead created logic to move a BOOL into a DINT. This is a first attempt at this, but figured i would finish up this thread in case someone in the future runs into the same issue and is looking for an example solution.

FSC_Working.PNG
 
Yes, your logic triggered a memory I had on having seen this before...

521445 - Extracting a Boolean Array from a UDT
Access Level: TechConnect

That technote similarly instructs you to monitor the BOOL array in a looping fashion with an XIC instruction and then, if any are TRUE, MOV a 1 to a comparator SINT, INT or DINT to compare with an equivalent reference tag, such as your <Always_False_DINT> tag.

As you are just starting out "doing" something here, might I ask what your end goal actually is? It's just that "if" it were what I think it might be then there may be a simpler way or ways to do the same thing?

G.
 
George,
Basically have a BOOL[800] array of fault bits, corresponding to different faults within the system, and I want to loop through and see if any are active. If they are, then it will latch a bit saying that there is a fault within that particular system or systems. These fault bits can be activated by different systems. The logic Ive added to the original logic I sent also looks to see if all of the fault bits are off, and if so, unlatches the fault active bit
 
For the logic in post #8 to work, you will need to use Incremental mode on the FSC, meaning it will take 800 scans to fully search the array. (Even then I'm not 100% sure it will work. Seems like it should, though I rarely use Incremental mode on file instructions.)

Another option to consider, though probably too late to avoid a lot of rework, is to use bits within an array of DINTs as the fault triggers (e.g., 25 DINTs for 800 status bits). There is more flexibility working with DINTs, though you will add the burden of calculating a word/offset instead of directly addressing the 0 to 799 faults by fault number.
 
Mispeld,
On your first point, i did end up trying that an it didn't work, just for future reference.

What I ended up doing was scrapping the FSC and Having an easy loop that will increment each scan. Attached is a screenshot of this.

On your second point, unfortunately I had to work with what was already there, and that's how it was implemented initially.

FSC_Loop.PNG
 
OK. You are attempting to do what I had expected you were.

Along the lines of what Mispeld has suggested...

Use 25 DINTs to represent the 800 BOOL fault status bits.

Let's say FaultTrigger_DINT01.[0]-[31] represents BOOL[0]-[31] of your array
FaultTrigger_DINT02.[0]-[31] represents BOOL[32]-[63] of your array, and so on.

Create logic to constantly index through each of the 25 DINTs in a looping fashion while comparing the word value of each DINT to "0". If one or more bit elements within any of the DINTs is active "1", then the word value with be a non-zero value. This will tell you when you have 1 or more global alarms or faults active. This is achieved over 25 scans rather than 800 individual moves or compares. It may also be accomplished more quickly using the FAL instruction I'm sure.

I'm just on smartphone here. I'll throw up a simple example tommorow if I've time and you'd like.

G.
 
Last edited:

Similar Topics

Maybe this is just not possible, or maybe I am doing something wrong. Background; I have a data array of over 1500 products. For sorting I...
Replies
6
Views
727
I am trying to use the FSC to count how many numbers in my real array are less than a certain value but not sure why I cant for the life of me get...
Replies
11
Views
363
I have a FSC instruction that won't enable. I check tags and data type and can't find the problem. I'm trying to pull index numbers for data...
Replies
4
Views
705
I received the following message via PM, and am posting here publicly to help others. ============================================ I had a...
Replies
10
Views
972
Good Morning, New poster here, i'm looking to get my FSC working for some reason it is only looking at the data in the 0 dint instead of the full...
Replies
10
Views
2,493
Back
Top Bottom