question

Andrew McNitt avatar image
0 Likes"
Andrew McNitt asked Andrew McNitt commented

Replacing cycle time with code sequence

I am creating a model where processors and multiprocessors are created through flexscript commands. I'm attempting to also change the cycle time to a triangular distribution through flexscript, that uses the incoming items label to set the parameters on the distribution. When I try to set the cycletime node value to user command code for triangular distribution, it executes it instead of setting the value equal to the distribution command. Is there a way to have the node value equal to the distribution command so it's dynamic for each item iteration?


example:

item.Process_Time = 50

getvarnode(Model.find(stationname), "cycletime").value = triangular(item.Process_Time*.9,item.Process_Time*1.1,item.Process_Time,getstream(current))

Sets the process time to results of 50 on a triangular distribution instead of the expression below.

1704055924238.png

1704053430494.png


FlexSim 22.2.0
flexscript codingprocesstime distribution
1704053430494.png (12.5 KiB)
1704055924238.png (10.2 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.

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Andrew McNitt commented

You should be able to dynamically assign the cycletime value but there are probably better ways.

Put the triangular expression in the processor field and then open the code to see what you need to assign to the cycletime node as a string. You'll see it's this:

  1. Object current = ownerobject(c);
  2. Object item = param(1);
  3. return /**/triangular(item.Process_Time*.9,item.Process_Time*1.1,item.Process_Time,getstream(current))/**direct*/;

When you set the node to a different string you'll need to build it as flexscript using buildnodeflexscript().


Instead of this approach you could just put the cycle time function on the item itself and keep the processor's cycletime as item.Process_Time.

Example of that attached.

processTimeOnItem.fsm

Both approaches a somewhat limited in that they don't scale to multistage/step processes and equipment - for that you'll need a more complex structure involving tables or maps.


· 5
5 |100000

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

Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Andrew McNitt edited

You want exchange a compiled source code. You can try such by SDK. But inside FlexSim you will see that a cycle time is function returning a value.

You can replace function parameters by FlexsSim Parameters or labels.
You can try to let execute a string that you build somewhere else.

· 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.