Fire on Change events

This forum contains common answers to questions and tutorials produced for the community.
Jstoner
Posts: 8
Joined: Tue Jan 25, 2011 12:46 pm

Fire on Change events

Post by Jstoner » Mon Mar 21, 2011 12:06 pm

Hello,

I am using a number of events that I want to fire on change from a J1939 variable. While this all works just fine after the display has already started up, these do not seem to fire at all while the display is starting up.

For instance, if I have a J1939 variable representing a transmission gear, I want to fire an event that starts a state machine in motion to display the correct torque gauge on the screen. This variable has three values for low/med/high, 0-2 respectively. All three gauges start hidden, and the correct gauge is turned on as the state machine completes it's cycle. When the display starts up, none of the gauges are shown despite the variable having the correct value. When I change the gear, the variable changes correctly and the gauges pop up on the screen.

This happens whether I have the variable initialized as invalid, or if I give it a value (-1 for example) and then have this overwritten. For whatever reason, Fire on Change events simply do not fire early on in the booting process. Additionally, variables do not seem to fire these events when a variables goes from valid to invalid and then back.

Additionally, timer events also do not fire early on, so I expect this has something to do with the booting order of the OS services like CCM. If I configure a one shot timer to fire after 5 seconds and start it on an initial state, the event does not fire. If I change that to 7.5 seconds, the event will fire. I haven't gotten it any finer grain than that.

This is really quite a problem for me. I'd like to at least know what is going on here, since it's not documented anywhere. Thanks!
mbowdich
Posts: 209
Joined: Tue Oct 05, 2010 10:54 am

Re: Fire of Change events

Post by mbowdich » Tue Mar 22, 2011 12:27 pm

Here are 2 methods I use to overcome this same issue:

Have the particular view that the display boots up to fire the same event(s) that you are firing on variable changes. This is done by right clicking on the page view and selecting advanced. This will update the gauges each time that view is called, including startup.

The other way I have done it is to have my initial state in the state machine trigger a 1 time update that eventually cycles back to waiting state. This way, the update happens every boot, and then never goes back to the initial state.
jpurdum
Enovation Controls Development
Enovation Controls Development
Posts: 153
Joined: Mon Jun 21, 2010 11:19 am

Re: Fire of Change events

Post by jpurdum » Tue Mar 22, 2011 3:35 pm

We are also investigating this here...
Stay tuned...
jpurdum
Enovation Controls Development
Enovation Controls Development
Posts: 153
Joined: Mon Jun 21, 2010 11:19 am

Re: Fire on Change events

Post by jpurdum » Wed Mar 23, 2011 5:45 am

One of our test engineers tried to repeat both the fire on event issue and the timer issue with a simple config and neither problem was repeated. I've attached his simple config and below is his explanation of the config. Feel free to build it and load it to see if it works the same for you.

If you are willing to share your config with us, please send it to me in a Private Message. Something else may be going on.

Here is Brad's example config:
FireOnChange.zip
(1.96 MiB) Downloaded 93 times
Here is Brad's explanation of the attached config:
I tested both the Fire-On-Change event and timers during boot-up. Both seem to work fine. Attached is the config I used.

The Engine Speed variable is initialized to 0 and fires an event when it’s changed. This triggers a state machine to show three gauges and then hide them. If J1939 for Engine Speed is sent to the display during start up, you’ll see that the variable is changed from its initial state, and the three gauges show up (and then hide). If J1939 for Engine Speed is not sent from start up, then the gauges do not show since the variable doesn’t change.

I also have another state machine that has a timer for 3 seconds. After three seconds “Hi” is displayed on the screen. You should see this 3 seconds after boot up. I verified that “Hi” shows up after boot-up even if I put 0 seconds in for the timer.