question

Pinakin K avatar image
0 Likes"
Pinakin K asked Aaron C commented

Can we use list like the decide activity?

The logical conditions in my decide activity use If loops to check the conditions. But for this I need to have a dummy delay activity with a non zero delay, to loop into the decide every time the condition is false. Just like wait for event. So in that case can we use Listys to specify the conditions, and if those conditions are true, the tokens can be pulled from the list?

ex. In the decide I have the following code:

  1. Object obj = token.station1;
  2.  
  3. if(obj.stats.state().value == 3)
  4. { return 1;}
  5. else
  6. { return 2;}

Here the Object just a shape, so the state is given through the process flow.

Is there a way to do this with Lists?

Please let me know if the question is clear enough

Thank You!

FlexSim 18.1.2
listsdecide
5 |100000

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

Jordan Johnson avatar image
3 Likes"
Jordan Johnson answered Pinakin K commented

You should not use State to drive model logic. Your real question is "how can I know when an object is available for a task?" You should have all the objects available on a list. As tasks come in to the model, they should pull the object off the list. Once they are finished with the resource, they should push it back on the list.

· 3
5 |100000

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

Brendon N avatar image
0 Likes"
Brendon N answered Aaron C commented

Yes, make sure every station object is pushed to the list and create an expression field called "state" within the custom code value

  1. Variant value = param(1);
  2. Variant puller = param(2);
  3. treenode entry = param(3);
  4. double pushTime = param(4);
  5.  
  6. Object obj = value;
  7. return obj.stats.state().value;

And within the block that attempts to pull stations from the list write in the query field:

  1. WHERE state = 3

I've attached a sample model showing how to do this.'

pullfromlist.fsm


pullfromlist.fsm (65.7 KiB)
· 8
5 |100000

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