question

Suhas H2 avatar image
0 Likes"
Suhas H2 asked Joerg Vogel commented

Can processing times be assigned to the processors using code(flexscript)?

I want to assign the processing times to the processor using flexscript. Can that be done?test1.fsm

FlexSim 19.0.2
flexscriptprocessing times
test1.fsm (50.5 KiB)
· 4
5 |100000

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

Matthew Gillespie avatar image Matthew Gillespie ♦♦ commented ·

@Suhas H2,

The way this is generally done is to have the processors read their processing time from a global table. Then you can use flexscript to write different values to the global table.

0 Likes 0 ·
Suhas H2 avatar image Suhas H2 Matthew Gillespie ♦♦ commented ·

Can you please attach an example of how that is done?

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Suhas H2 commented ·

Does each processor have its own unique processing time? Or do they all use the same time?

0 Likes 0 ·
Show more comments

1 Answer

tannerp avatar image
0 Likes"
tannerp answered Joerg Vogel commented

Hi @Suhas H2,

Here's an example of what Matthew was describing. In the model, the Process Time is accessing Global Table values based on item.Type. When the model starts, the green items process slowly, while red items process quickly. Then, you'll notice that after 10 items have been processed, the Custom Code activities in Process Flow change the values in the Global Table such that red items now process slowly, while green items process quickly. Please review the code in the Processor as well as the Custom Code activities in Process Flow to understand and implement this in your models. Thanks!

How to access Global Table:

How to dynamically update Global Table (and, effectively, Process Time):

Model: update-global-table-dynamically.fsm


· 4
5 |100000

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

Suhas H2 avatar image Suhas H2 commented ·

Hi @Tanner Poulton

Thanks for the reply...

What if I have 50-100 Processors in line? All this have to be done for every single of them?

Is there any way to do using flexscript? I tried this code but not getting desired output.

0 Likes 0 ·
capture.png (14.8 KiB)
Joerg Vogel avatar image Joerg Vogel Suhas H2 commented ·

The process time isn’t just a value. It is the return value of a script by itself. The script is stored at a node.

You can copy the node of the script to every processor. If you must transfer the same script code of the process time from an highlighted object (yellow frame) to selected objects (red framed objects) you use the tool edit selected object under the View main menu.

In the manual look at Copying and Pasting 3D Objects And Properties under the headline Using the Edit Selected Objects Tool. and especially there the text box Copy Specific Variables.

0 Likes 0 ·
Suhas H2 avatar image Suhas H2 commented ·

@Jörg Vogel

Thanks for the reply...

I agree with you on this. But can that return value of the script in processor be made dynamic by using flexscript only is my question.

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Suhas H2 commented ·

You can’t directly make it dynamically. You can replace the return value by a reference as a substitute. This reference can be a table cell value, a label value, a node value. You change the reference value und thus you make the process time dynamically.

0 Likes 0 ·