question

Patrick Cloutier avatar image
0 Likes"
Patrick Cloutier asked Patrick Cloutier commented

How to access the operator load time variable ?

I need an operator to have a different load time depending on the item it is loading.

I did a "values by case" in the operator load time drop box but it doesn't seem to work.

So to confirm I'm trying to read the value of the "load time" variable but I can't figure out how.

I tried, getvarnum, getnodenum, operator1.attrs.variables.value."load time", etc. and nothing works.

If this is something I should be able to find in the manual let me know where because I searched and searched...

FlexSim 17.1.4
load time
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

·
Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered Patrick Cloutier commented

The variable name is "loadtime", but it is a code node as you can see in the tree:

Calling getvarnum on a node with code (string) data won't return anything.

Using the Values By Case pickoption is the correct way to do what you want. The code in that field will be evaluated whenever the operator loads an item. Post a model if you still can't get it working.


loadtime.png (9.4 KiB)
· 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.

Patrick Cloutier avatar image Patrick Cloutier commented ·

I've confirmed some other way that it works (values by case).

But do you mean that there is no way to read the value of the loadtime if I really needed to?

And is it the same for every variable that is a "code node"?

0 Likes 0 ·
Jeff Nordgren avatar image Jeff Nordgren Patrick Cloutier commented ·

@Patrick Cloutier

There is no way to lookup or access the value of a flexscript code node. The reason why is that is just that, code. Which could evaluate to anything during the running of a model. It is a returned value but not saved value. If you wanted to go into the code and save the calculation to a label on the object, you could then reference that label for the latest "code" value. But that code value is otherwise not saved, it is calculated on the spot. And yes, that is the same for any "code" node.

1 Like 1 ·
Patrick Cloutier avatar image Patrick Cloutier Jeff Nordgren commented ·

Very good idea ! Thanks.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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