question

Ashmita G avatar image
0 Likes"
Ashmita G asked Jason Lightfoot edited

Assign Station processing time on model reset trigger

Hi,

My model involves several stations, with different processing times. I came across the a model where the on Model reset trigger was employed to fetch the processing time values from a script and inserted into the processor.

The syntax I am speaking is as follows:

getvarnode("Processor1", "cycletime").value = 2; (or the number you want to assign)

When I tried the similar process for the stations however I was unable to implement it.

In the tree I could see station has a processTime mentioned, unlike in the processor where cycletime was mentioned.

Could someone guide me how to use the above syntax with respect to stations.

Thank you.

FlexSim 20.1.0
flexscriptflexsim 20.1.0stationsonresettrigger
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
1 Like"
Jason Lightfoot answered Jason Lightfoot edited

For a processor:

  1. Object proc=Model.find("Processor1");
  2. treenode varnode=getvarnode(proc,"cycletime");
  3. varnode.value="return 2;";
  4. buildnodeflexscript(varnode);

For a conveyor station:

  1. Object station=Model.find("Station1");
  2. treenode type=station.getVariable("type");
  3. treenode varnode=type.subnodes["processTime"];
  4. varnode.value="return 3;";
  5. buildnodeflexscript(varnode);
· 2
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 Joerg Vogel commented

Please, can you check, if the process time function source code returns a value? If this is the case, then you aren’t able to set a varnode, because you must write a source code to the node. For such cases where a function is more than just a number you can insert dynamic values indirectly by a label. The return value is a label value or a reference to a similar structure like a table cell. If the process time gets evaluated, then this function reads the label value. You change the number of the label whenever you like. The label is stored foe example at an object.

· 2
5 |100000

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