FSC in add on instruction in rslogix5000

md.abdullah

Member
Join Date
Sep 2011
Location
motihari
Posts
168
hello every one agian
does any one know that how can i use FSC in add on instruction....
i used it but it does not working...i using it to search the array element by comparing but it does goes always zero
while if i use it outside the AOI logic. it is working fine
i searched many document to go throught it but did not find

thank you
 
Export and post the AOI and Forum members can have a look at it.

My first guess is that because the FSC can be set to require multiple scans to perform its file functions that this might be the issue. But I can't say without seeing how you have implemented it.

You should be able to Export the AOI, ZIP that file, and post it here. Please make a note of which version of RSLogix 5000 you are using so that members who want to look at your code can do so in the same version.
 
how can i make it to multiple scan time
also i have used a timer and through this timer done bit i am reseting it but the timer is not running while i have seen some example in the rockwell video their timer is running in the AOI
i thought i am in stuck multiscaning of the AOI
also i have putted this AOI into the prescan mode in the property of AOI
but not working
so does any one know here how to do this working...
thank you
 
I cannot diagnose your PLC logic based only on your descriptions of the PLC logic.

Please post the program.
 
Hello Ken,

You have helped more than a few times in the past and I have found that you are very knowledgeable and I'm hoping you can help me out again now. I have a

similar problem with my FSC and I'm not sure why it's not working. I'll explain what i'm wanting to do. Perhaps by writing this all out I may answer my own

question, however I've been on this for a few days and am not getting anywhere.

I want to be able to determine the next water cannon to turn on based on the surface moisture associated with all water cannons. I have an array of 22

cannons which is an array of a cannonUDT data types. One of the elements of the cannonUDT is .moisture. I also have an array of calculated surface moistures

only which I copy from the cannonUDT array.

So;
SM_Array[0] = Cannon[0].moisture,
SM_Array[1] = Cannon[1].moisture etc. etc.

For the purpose of illustration let's assume the following;

SM_Array[0] = 4.8
SM_Array[1] = 6.0
SM_Array[2] = 3.1
SM_Array[3] = 5.0

so I copy SM_Array to Sorted_Array and then sort the Sorted Array giving

Sorted_Array[0] = 3.1
Sorted_Array[1] = 4.8
Sorted_Array[2] = 5.0
Sorted_Array[3] = 6.0

I then call a FOR loop, set the index to 0 before calling the instruction and for the purpose of illustration will call the FOR index "i". The FOR loop calls

another routine called "PRIORITY".

The first rung of PRIORITY copies Sorted_Array --> LoopTest (tag within FOR loop)

then I run the FSC instruction and compare LoopTest to SM_Array[FSCcontrol.POS]

When there is a match i use the .FD bit to copy FSCcontrol.POS into Cannon.SMPriority AND to reset the FSCcontrol.POS to 0.

I have assumed that the .FD must always be found because the arrays are a copy of each other so I can't see a problem here.

I have attached an extract of the logic
 
by the way, i've just paid for membership, but for some reason the site things i haven't paid, perhaps this is because i used a different email address?
 
I should mention the desired outcome for the Cannon array.

Cannon[0].SMPriority = 1
Cannon[1].SMPriority = 3
Cannon[2].SMPriority = 0
Cannon[3].SMPriority = 2

So when trying to sequence the cannons cannon[2] will fire first because it has the lowest surface moisture, followed by cannon[0], cannon[3] then finally cannon[1]
 
When there is a match i use the .FD bit to copy FSCcontrol.POS into Cannon.SMPriority AND to reset the FSCcontrol.POS to 0.
Instead try:

Copy i into Cannon[FSCcontrol.POS].SMPriority

And as an added note: if you have two (or more) moistures which are exactly the same the FSC will find the same Cannon record for each and not assign a priority for the other(s).
 
Last edited:
I gave up trying to get this done in ladder logic and have gone for structured text. ST that i'm using is here:

FOR Can_Index := 0 TO 21 BY 1 DO
FOR SM_Index := 0 TO 21 BY 1 DO
IF SM.sorted[SM_Index] = SM.raw[Can_Index] THEN
CANNON[Can_Index].R.SMPriority := SM_Index;
EXIT;
END_IF;
END_FOR;
END_FOR;

The problem remains if there is more than one array element with the same surface moisture value. Please consider the following array as an example;

SM.raw[0] = 1
SM.raw[1] = 4
SM.raw[2] = 1
SM.raw[3] = 3
SM.raw[4] = 2
SM.raw[5] = 1

so the sorted array will be;

SM.sorted[0] = 1
SM.sorted[1] = 1
SM.sorted[2] = 1
SM.sorted[3] = 2
SM.sorted[4] = 3
SM.sorted[5] = 4

with my logic above the following will be the result

CANNON[0].R.SMPriority = 0
CANNON[1].R.SMPriority = 5
CANNON[2].R.SMPriority = 0
CANNON[3].R.SMPriority = 4
CANNON[4].R.SMPriority = 3
CANNON[5].R.SMPriority = 0

but what i actually want is:

CANNON[0].R.SMPriority = 0
CANNON[1].R.SMPriority = 5
CANNON[2].R.SMPriority = 1
CANNON[3].R.SMPriority = 4
CANNON[4].R.SMPriority = 3
CANNON[5].R.SMPriority = 2

please can someone help me here....grrrr
 
Hi gibbom

I can't understand your problem
Can you please send me exact problem what you want to program.
Believe me..i have solved all type of programming challenges.
If you don't mind you can connect me vai skype...
Let me understand your problem..i am very poor in process understanding.
Thank you
 
Hello md.abdullah, i have contacted via Skype, however there are many people with similar name on skype as you. my skype name is ggiibboo and I'm in Perth, Australia
 
My current logic looks like this:

FOR Raw_i := 0 TO 5 BY 1 DO
FOR Sort_i := 0 to 5 BY 1 DO
IF CANNON.SORTED[Sort_i] = CANNON.RAW[Raw_i] THEN
CANNON.Priority[Raw_i] := Sort_i;
EXIT;
END_IF;
END_FOR;
END_FOR;

I have a UDT called CANNON which has two arrays in it:

CANNON
--> RAW[0] 6 element INT array
--> Priority[0] 6 element INT array

and I have a SORTED array which is a copy of CANNON.RAW but sorted in ascending order.

SORTED[0] = 1
SORTED[1] = 1
SORTED[2] = 1
SORTED[3] = 2
SORTED[4] = 3
SORTED[5] = 4

I want the contents of the CANNON UDT array to be like this below;

CANNON.RAW[0] = 1, CANNON.Priority[0] = 0
CANNON.RAW[1] = 4, CANNON.Priority[1] = 5
CANNON.RAW[2] = 1, CANNON.Priority[2] = 1
CANNON.RAW[3] = 3, CANNON.Priority[3] = 4
CANNON.RAW[4] = 2, CANNON.Priority[4] = 3
CANNON.RAW[5] = 1, CANNON.Priority[5] = 2

however the problem I have with my current ST logic is that the CANNON.Priority[0], CANNON.Priority[2] and CANNON.Priority[5] all get the number
0 as a priority because they all match SORTED[0] this is the output based on my current logic:

CANNON.RAW[0] = 1, CANNON.Priority[0] = 0
CANNON.RAW[1] = 4, CANNON.Priority[1] = 5
CANNON.RAW[2] = 1, CANNON.Priority[2] = 0
CANNON.RAW[3] = 3, CANNON.Priority[3] = 4
CANNON.RAW[4] = 2, CANNON.Priority[4] = 3
CANNON.RAW[5] = 1, CANNON.Priority[5] = 0
 
Swap the 'Sort' and 'Raw' indexes. Then exit the inner 'For' once a match is found.

Should 'CANNON.SORTED' in the example be just 'SORTED'? - at least according to what you have above.

Preset all the 'Priority' to a non-valid number, (-1 for example) and include it in the test.

FOR Sort_i := 0 TO 5 BY 1 DO
FOR Raw_i := 0 to 5 BY 1 DO
IF (CANNON.SORTED[Sort_i] = CANNON.RAW[Raw_i]) & (CANNON.Priority[Raw_i] = -1) THEN
CANNON.Priority[Raw_i] := Sort_i;
EXIT; <--- Does this exit the inner for loop? (If not possibly set 'Raw_i' to 5)
END_IF;
END_FOR;
END_FOR;
 
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
757
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
382
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
730
I received the following message via PM, and am posting here publicly to help others. ============================================ I had a...
Replies
10
Views
1,018
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,522
Back
Top Bottom