question

Maria B17 avatar image
0 Likes"
Maria B17 asked Joerg Vogel commented

How set Cycle Time value with FlexScript

Hello good afternoon all right ?


We are building a facilitating model here at the company and we have a small problem, we are adding items from a globaltable and storing these items in a variable, but we are not able to find the code to assign this value in the Cycle Time of the processor object, What we would like is for the process processing time to be this variable without us having to input it manually (we don't want to change the processor for any changes, just changing the cycle time automatically), could you give us an example of how to do this?

FlexSim 23.1.1
flexscriptprocessormodelprocesstimetreenode
5 |100000

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

1 Answer

Felix Möhlmann avatar image
2 Likes"
Felix Möhlmann answered Joerg Vogel commented

I'm afraid I don't quite understand your description. Where exactly should the value for the process time come from?

In general you can put any expression into the process time field as long as it returns a number value > 0.

You can read from a global table:

1683267977274.png

From a global variable:

1683267997109.png

From an item label:

1683268014322.png

And many more...

The expression will be evalualed for item. If you instead want to set the process time to a fixed number that is used for all items until the value is changed again, you can use the setProperty method.

// Example
Object processor = Model.find("Processor1");
processor.setProperty("ProcessTime", 123);

1683267977274.png (2.0 KiB)
1683267997109.png (1.4 KiB)
1683268014322.png (1.6 KiB)
· 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.

Joerg Vogel avatar image Joerg Vogel commented ·
@Felix Möhlmann, the question is about replacing a property. But a process time function is not a property. It is a node of evaluated source code during model runtimes. Your examples show how to inserts a property attribute into a source code function.
-1 Like -1 ·