10-20-2013 11:44 PM
In attached VI I want to initialize the SP value to zero for a couple seconds when transitioning from case 1,2,3, and 4 to case 0 (manual set point), Actually, its not necessary to initialize when transitioning from case 1 to case 0 (value is set to zero case 1) but if that bit of redundancy makes it easier I am ok with that.
In the future SP will be an output voltage sent to hardware and RO will be a voltage read from hardware.
Suggested techniques appreciated.
Thx
Solved! Go to Solution.
10-21-2013 01:48 AM
Please post the code in 2011 version
10-21-2013 03:57 AM - edited 10-21-2013 03:58 AM
Well, the right way would be to implement a proper state machine that is aware of all the transitions.
In a simple case like this, you could just do something like in the attached modification.
(Note that I took the liberty to simplify a few things: Why do you need so many diagram constant with the same value? Don't be afraid to branch the wire and use only one each. Even simpler would be to combine all the nonzero cases into one. property nodes are relatively expensive, so use them only if the input actually has changed, and not over and over. Instead of value properties, use local variables. Much more efficient! You write to RO with every iteration, so that belongs after the case structure. No need for value properties or local variables at all, right?
I think the case structure stack could be further simplified, but this should get you started. Good luck!)
10-21-2013 08:57 PM
Altenbach:
Thanks for the solution !!
Now I can see why I couldn't figure out how to capture this condition. I will do my best to reverse engineer your method so I can use some of those techniques in the future.
I intend to learn event structures next. Maybe then a simple intuitive solution will be more obvious to me.
Thx