question

Cetim C avatar image
0 Likes"
Cetim C asked Cetim C commented

Modify emulation sensor variable since dashboard

Hello,
How can I modify the value of a sensor emulation variable since a dashboard?
I want that if I write a value of a variable, this value changes in my PLC, but I don´t know how reference the variable.

I am using an edit box in the dashboard and if I reference the variable like this, It does not work.

1661413975919.png

I tried to reference it from the tree but it did not work either.

1661414138926.png

Thanks in advance.



FlexSim 22.1.3
emulationsensor variable
1661413975919.png (3.8 KiB)
1661414138926.png (4.0 KiB)
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

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Cetim C commented

You cannot link to the variable value directly because it is stored as part of an sdt-node (SimpleDataType) and not as a value of a separate node.

1661418070543.png

You can still use the edit field to update the variable, but there will be not direct link between the field and the value. So if the value gets changed by another part of the simulation, this change will not be reflected by in the edit field. Not sure if this is the only way to do it, but this is how we managed sensor variables when we experimented with emulation some time ago (similar anyway).

If the sensor variable does not have an "Associated Object" yet, add a dummy object (for example a plane or BasicFR) and connect it to the variable.

Then link the dashboard edit field to that object as well and send a message to it in the "On Apply" trigger, with the first message parameter containing the value of the edit field.

1661417785411.png

You can use this message being send as a "Write Event" for the sensor variable, setting the value to that of the first message parameter.

1661417860625.png


1661417785411.png (14.6 KiB)
1661417860625.png (23.3 KiB)
1661418070543.png (24.1 KiB)
· 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.

Cetim C avatar image Cetim C commented ·
Thanks, it works

0 Likes 0 ·