question

Patrick Zweekhorst avatar image
1 Like"
Patrick Zweekhorst asked Patrick Zweekhorst commented

Kinetic tracked var on change does not fire

Hi,

Attached is an example model where the wait for event does not fire, where is should.
I am waiting on the OnChange of a kinectic tracked variable.

In this simple example model there is no rate yet, I am only setting the value of the tracked variable.
This problem might be very similar as the other question I posted today.

Why is the wait for event not working?

Thanks,

Patrick

kineticchange.fsm

FlexSim 19.0.3
wait for eventkinetic tracked variable
kineticchange.fsm (20.7 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.

Jordan Johnson avatar image
1 Like"
Jordan Johnson answered Patrick Zweekhorst commented

I have looked at the code, and manually changing the value of a TrackedVariable (e.g. tv.value = 5) will not fire the OnChange event. However, setting the rate will:

tv.rate = tv.rate

This will fire the OnChange event, if the listener's Change Rule is set to Update.

In C++ you can use the set(double value, double rate) method to set the value and rate simultaneously, which will also fire the OnChange event.

It looks like this is by design. I will add a card to the dev list so that we discuss this issue. If it is a bug, we will get it fixed.

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

Patrick Zweekhorst avatar image Patrick Zweekhorst commented ·

Hi @jordan.johnson,

Thanks, we think it would be nice if setting the tracked variable would also trigger the OnChange.

0 Likes 0 ·
Joseph Gillespie avatar image
0 Likes"
Joseph Gillespie answered Patrick Zweekhorst commented

@Patrick Zweekhorst

This problem is a bug that has been added to the dev list. Note that OnChange still works when changing the rate, just not when changing the value of the variable.

You can see this question for more information: Statistics Collector and kinetic tracked variable. Mischa's comment at the bottom has the same problem.

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

Patrick Zweekhorst avatar image Patrick Zweekhorst commented ·

Hi @Joseph Gillespie,

Mischa and I already thought is was the same problem, but we were not completely sure it was the same situation.

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.