question

Alex H4 avatar image
0 Likes"
Alex H4 asked Jeff Nordgren edited

Conditionally set a label in processor

Hello,

I am simulating a cell and need some help with a few issues I am currently running into. I need to know how to conditionally set a label in a processor. Currently Processor 2 sets a label OP_Code = 11 but when same material passes through this processor again I need to set the OP_Code label to 21. I tried to insert if and else statements into the code for the set label trigger but this created errors.

The other issue I am having is when the robot is unloading the material at OP10_Load it stays in the unload position until the material is removed from the queue, this is not correct. I would like the robot to go back to an intermediate “perch” position on the network.

Lastly I have an error come up inside the compiler that I do not know where it is being created from.

Attached is the current simulation that is incomplete. Thank you for any help and have a great day.

fsq.jpg

fsq.fsm

FlexSim 18.2.0
labelsrobotflow
fsq.jpg (18.7 KiB)
fsq.fsm (65.6 KiB)
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Joshua S avatar image Joshua S commented ·

After the second item is processed through processor 2, what do you want the material label to change to for the 3rd item and on? Also the error that occurs is because of what you have in the expression area in your list as show below.

0 Likes 0 ·
pic1.png (17.7 KiB)

1 Answer

Jeff Nordgren avatar image
1 Like"
Jeff Nordgren answered Jeff Nordgren edited

@Alex H4,

Attached is your model with the changes that I've made. As far as setting a new OP_Code value in Processor2, as the model sits now, the code was on the OnExit trigger of Processor2 and when the first "returning" flowitem comes to Processor2, it never leaves. It is blocked because of downstream objects. So the OnExit trigger never fires, changing the label value. So I moved that code to the OnEntry trigger so that you can see that in fact, the label is being changed.

In the Robot, it was just a matter of adding an "On Resource Available" trigger to reset its position. And as for the compiler error you were getting, you had a value of (1,2) in a field that is expecting a single value (see @Joshua S comment). So that was invalid. I changed that to (duniform(1,2), which returns a value between 1 and 2). Not sure if that is right for your model or not. If you need to change it, it needs to be a single value. It does not know how to interpret "1,2".

Take a look at the model and see if it is behaving like you want it to. If not, please give us more detailed information on what needs to happen in the model.

Thanks.

fsq-jn1.fsm


fsq-jn1.fsm (65.8 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.