question

Paul M4 avatar image
0 Likes"
Paul M4 asked Paul M4 commented

Change value of variable while running simulation

Hello,

Is it possible to change a value of a variable while running a model? I change the value in a table, the code looks in the table to retrieve that value and make a subsequent decision. The value doesn't seem to take effect, i.e., the expected behavior change only occurs when I reset the model completely.

Is there an option to actively modify model behavior while running the model, based on a user interaction?

Regards,

Paul

FlexSim 19.2.4
simulationvariablevalue
· 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.

Allister Wilson avatar image Allister Wilson commented ·

Changing a table value at runtime should work fine.
Could you upload an example model that demonstrates this issue?

0 Likes 0 ·
Paul M4 avatar image Paul M4 commented ·

Hi @Allister Wilson,

The setting I'm trying to change is in the column "GradeString". As it is currently set up, the first station accepts green items (value 2). I tried to change this into value 3, thinking it starts accepting blue items. Instead it keeps accepting green items until I reset the model.

model-14.fsm

0 Likes 0 ·
model-14.fsm (1.1 MiB)
Allister Wilson avatar image Allister Wilson Paul M4 commented ·

I did a search in the model tree but wasn't able to find any references to "GradeString".
Where exactly are you reading / using values from that column?

On your end, you could set a breakpoint in the code which reads that value. You can then use the Local Variables window to check the value that was read from the table.
My expectation is that you'll see that read works fine and the problem is in the logic that uses it.

0 Likes 0 ·

1 Answer

·
Paul M4 avatar image
0 Likes"
Paul M4 answered

I did some more looking around for myself. Turns out that the input variable I'm supposed to use is transferred into another variable which is the one actually used by the model.

Changing that variable works as I expected. It's just set up a little awkward.

Regards,

Paul

5 |100000

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

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.