Creating If statement in labelling

Creating If statement in labelling

william_a4
Not applicable
105 Views
3 Replies
Message 1 of 4

Creating If statement in labelling

william_a4
Not applicable

[ FlexSim 19.2.4 ]

For part of my senior design project, I am trying to build a system for detecting defects in an assembly line. At the moment I have a label "Defect" that is 1 base or 2 defective. I want my processors on entry to check defective items. If the processor would catch the defect, I want it to go to a caught scrap queue, and if not I want it to go to an uncaught scrap queue. But I don't want non-defective materials to be run through this check. Is there any way to have an on entry check based on the label value? Example,

If Defect == 2:
set value by percent: Defect
(% detection) = 2
(1-%detection) = 3
Else pass:


That way the program isn't checking non-defective items and calling them defective, and it is determining whether the defect would be detected or not for purposes of my simulation calculation.


I attached a photo of the simulation if that helps. For record's sake, I am on an educational key. 27427-flexsim-annotation.png

0 Likes
Accepted solutions (1)
106 Views
3 Replies
Replies (3)
Message 2 of 4

tanner_p
Not applicable

@William A4,

Could you attach the model you're working with? It might help us get a better idea of what's going on so we can provide the best solution.

That said, I suggest either using a label on the processor or a Tracked Variable to track the number of defects. These can be incremented conditionally when the item's "Defect" label is "2".

0 Likes
Message 3 of 4

william_a4
Not applicable

DIS Simulation.fsm

The percents for my failure rates and the like are wrong right now, so ignore them

0 Likes
Message 4 of 4

tanner_p
Not applicable
Accepted solution

Hi @William A4,

This is an interesting model - I don't think I've seen the entry trigger used this way before. I think it can work, though. I added an On Entry trigger on the WS4_SP Assmebly__1 Processor that sets a label called "Port" to the value of the "Defect" label. This way, if Defect == 2, the Port is also set to 2 when the item enters so that when the item leaves, it's sent to the Defect Queue even if the Defect label changes because of the On Exit trigger you have set up.

Hopefully this works. Let me know if I misunderstood what you wanted to have happen.

dis simulation updated.fsm