07-15-2020 02:28 PM
Hi all, I am currently struggling with the attached VI, it was working perfect for a while but now I keep getting mixed results.
Basically, a valves position is sensed by 1 of 2 position sensors, which are magnetic/transistor based. Those positions are fed into a 9375 card. That signals the state machine to go to the correct case, which sends duty cycles to the signal simulators, which output a square wave to a 9264 card. Which then sends a 5V pulse to a stepper motor controller.
It was working perfect, the valve was stopping right where it should be every time. But now I will get 4 or 5 good valve cycles, then the positions will be slightly off, then accurate again. Any help would be greatly appreciated. Sorry if my VI is a complete mess.
07-16-2020 02:36 AM - edited 07-16-2020 03:20 AM
Hi AELCA,
@AELCA wrote:
Any help would be greatly appreciated. Sorry if my VI is a complete mess.
Yes, that VI is a mess. The first step to get a reliable VI is to cleanup that VI and to get rid of any Rube-Goldberg code!
Example:
All the code you create from comparisons to case structure to OR-Multiply is exactly the same as that simple ToI32 node above! (Well maybe not "exactly" the same, but that could be done with a simple test afterwards.)
(Why is there a local variable? Why is that value a DBL when it should be an integer? Why do you compare floats for equality?)
That part of code including the case structure called after the OR can be done like this:
I didn't spend the time to put all values for each of the 9 cases into those array constants, do the typing for yourself!
Other things to change:
Example:
07-17-2020 08:55 AM
Thank you for taking the time to write all of that out. I have learned quite a bit! The improvements you suggested have definitely streamlined my code greatly. I am getting better results now. The Local variable for C02 is actually coming from another loop. And the differences from the signal generations vi's to the daq assistant vi was a mistake.