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:

Object obj = token.station1;

if(obj.stats.state().value == 3)
{ return 1;}
else
{ 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.

Pinakin K avatar image Pinakin K commented ·

@jordan.johnson the reason I am using states to drive my logic is, because in my model, I have to make the decisions for other process flow running concurrently, when the process is complete 25%, 50%, 75% and 100%. So the only way I could think of was divide the processing time by 4 and give the state in the process flow when that percentage of time has elapsed. The 3D object who I gave the state is just a simple shape (A cube), with no triggers or any logic.

0 Likes 0 ·
Jordan Johnson avatar image Jordan Johnson ♦♦ Pinakin K commented ·

What about something like this?

If you are making decisions based on how complete something is, can you break up the wait time into four steps? Then you can set a label before each step, and you can use that label to make decisions.

checktokenprogress.fsm

0 Likes 0 ·
Pinakin K avatar image Pinakin K Jordan Johnson ♦♦ commented ·

This might be possible. I have like 16 different modules with each of them having 5 different processors. I have to sync the operations of all the stations in these modules with each other. I think this might work.

0 Likes 0 ·
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

Variant value = param(1);
Variant puller = param(2);
treenode entry = param(3);
double pushTime = param(4);

Object obj = value;
return obj.stats.state().value;

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

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.

Jordan Johnson avatar image Jordan Johnson ♦♦ commented ·

This approach will not work. First of all, you should never use an object's state to make decisions. See my answer to this post. Second, once the item creates a back order, that backorder will not be fulfilled, even when the state changes. The list doesn't "watch" dynamic fields, so it won't fulfill the backorder.

pullfromlist-modified.fsm

2 Likes 2 ·
Aaron C avatar image Aaron C Jordan Johnson ♦♦ commented ·

@jordan.johnson I'm fairly new to FlexSim and was wondering if you could give a brief explanation as to why making a decision based on an object's state is bad practice?

0 Likes 0 ·
Joshua S avatar image Joshua S Aaron C commented ·

@Aaron C

Follow the link Jordan provided in his comment above, he gives a good explanation there.

0 Likes 0 ·
Show more comments
Pinakin K avatar image Pinakin K commented ·

Thanks for the reply. I think the file has some issue, it might be of the newer version. I cannot load the file.

0 Likes 0 ·
Brendon N avatar image Brendon N Pinakin K commented ·

What version do you have?

0 Likes 0 ·
Pinakin K avatar image Pinakin K Brendon N commented ·

I have FlexSim 18.1.2

0 Likes 0 ·
Brendon N avatar image Brendon N Pinakin K commented ·

You can see all the neccesary information here.

pullfromlist.png

0 Likes 0 ·
pullfromlist.png (398.6 KiB)

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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