question

Steven Hamoen avatar image
2 Likes"
Steven Hamoen asked Jordan Johnson commented

How to set a parameter in the parameters table

I always used to have a global table containing all parameters for my model. In recent history FlexSim introduced the parameters table for that. Which is nice to have a single interface with some advantage like value checking etc.

But now I'm not able to change the value of a parameter via code. Things like "Model.parameters.xxxx.value = 1" in the script window give an error. So how to do this? I use a parameter to sometimes use transport and other times not and this is based on a date. So I want to set this parameter dynamically.


FlexSim 21.1.4
model parameters tablesetting a parameter
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

·
Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered Noah Z commented

You need code either like this:

Model.parameters.xxx = 1

or like this:

Model.parameters["xxx"].value = 1

Like labels on an object, using the top syntax deals with the value, while the second syntax deals with the parameter itself.

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

Steven Hamoen avatar image Steven Hamoen commented ·

Hi @Jordan Johnson ,

The 2nd solution works. The first one don't:


settingparams2.png


0 Likes 0 ·
settingparams2.png (40.2 KiB)
Jordan Johnson avatar image Jordan Johnson ♦♦ Steven Hamoen commented ·
That is a bug, then. I'll get it on the dev list.
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.