Sign in to follow this  
Followers 0
jpratik92

Rslogix Array Search

4 posts in this topic

Hello, 

I have 30 recipes(g_Blend_Recipes) and want to search for an item number in the recipes and compare it with what the operator enters on the HMI. The recipes itself is an array and there are 5 item numbers in each recipe.

I read about the FSC instruction but did not figure a way out yet. I am attaching a picture of the recipe. Any help would be appreciated. 

 

 

recipe.PNG

Share this post


Link to post
Share on other sites

You are going to have to probably write a nest For Next loop in structured text to accomplish the functionality of the FSC.

In the outer loop, index the array value for g_Blend_Recipe[y]

In the nested loop, index the array value for ItemNumbers[x].  If the comparator is true, set a flag and exit both loops and report back the g_Blend_Recipe[y].ItemNumbers[x] that it found and the corresponding x and y values.

Share this post


Link to post
Share on other sites

 

14 hours ago, pcmccartney1 said:

You are going to have to probably write a nest For Next loop in structured text to accomplish the functionality of the FSC.

In the outer loop, index the array value for g_Blend_Recipe[y]

In the nested loop, index the array value for ItemNumbers[x].  If the comparator is true, set a flag and exit both loops and report back the g_Blend_Recipe[y].ItemNumbers[x] that it found and the corresponding x and y values.

I think this is going to be the best way to do it. It can also be done in ladder (I would have to since we only have one seat of the multi-language pack and we would want everyone to be able to see what's going on).

 

Share this post


Link to post
Share on other sites

I have never programmed in Structured Text. Can someone give me an example for the above image? Thank you 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0