question

Gabriel Morgante avatar image
0 Likes"
Gabriel Morgante asked Gabriel Morgante commented

How to get the cycletime variable

@phil.bobo
I am creating a new post as you suggested but I think your previous answer is right on the spot


The only problem is that it's not acting as it should as you can see in the following images:

Here I'm trying to store the value in a label



It should be '4000' but instead it's recording '200'

In fact this item has no variable with a value of '200'

What am I doing wrong?

I have attached the model so you can take a look if you want...operadores.fsm

FlexSim 19.0.0
scriptvariables
print0.png (17.0 KiB)
print1.png (6.2 KiB)
print3.png (13.2 KiB)
print2.png (22.0 KiB)
operadores.fsm (4.0 MiB)
5 |100000

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

Phil BoBo avatar image
2 Likes"
Phil BoBo answered Gabriel Morgante commented

You don't want to put your code in either place (OnSetupFinish or OnProcessFinish).

Move your code from OnSetupFinish into OnMessage.

In your OnSetupFinish, send a delayed message in 0 time.

OnSetupFinish fires before the Process Time field. You need a trigger right after the Process Time field. You can do that with OnMessage.

You could customize your Process Time code to store that value on a label before returning it, but again, that's still going to fire AFTER the OnSetupFinish code that would be trying to read that label. You are trying to use a value that hasn't been determined yet. You need to change it so that you are using that value after it has been calculated.

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

David Seo avatar image
0 Likes"
David Seo answered Phil BoBo converted comment to answer

@Gabriel Morgante

You need to set the command of getitemvar(item, 2) in 'OnProcessFinish' instead of OnSetupFinish.

The cycletime (process time) is set after 'SetupFinish' trigger.

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