12-20-2006 07:35 AM
12-20-2006 09:01 AM
12-20-2006 10:34 AM
12-20-2006 11:16 AM
12-20-2006 11:19 AM - edited 12-20-2006 11:19 AM
Message Edited by altenbach on 12-20-2006 09:20 AM
12-20-2006 11:27 AM
12-20-2006 11:32 AM
12-20-2006 11:48 AM
I am not sure what "strange" results are. Because I have no idea what it is supposed to do all I can tell you is that the first run takes awhile and the second run is extremely fast. I can get both runs to take about the same amount of time by reinitializing the PID loops.
I am not a PID expert so that may be way off, but like I said, what is "strange." To reinitialize the loops I would wire into them an =0, so that when each step starts you re-start the loops.
I also noticed that you are calling some PID VIs, but not using the outputs at all. Is that on purpose, I am not sure what good a control loop does you if you don't use the results?
12-20-2006 12:02 PM
Hi youngster,
You said that turning the "light bulb" aka "execution highligting" on made your code work.
This is an (almost) sure indicator of a race condition. Execution highlighting slows down the execution in the vi or vis it is enabled in and may (not for sure, just may) alter the order in which code (that is not otherwise constrained by the wiring) will execute.
You should make sure that if a particular piece of code, sub vi, etc depends on getting the results from 'earlier' there should be some means to enforce that ordering, such as being connected by a wire, or enclosing both the read and the write in another structure such as a loop, and connecting the structures by a wire. The error in / error out terminals on many NI-supplied vi's are useful in this regard.
An easy way to get a race condition error is by use of local or global variables. If you (say) write to a local variable in one part of a vi and read from its control in another part of the vi, and there is no means to specifically control the order in which the read and write take place, there is a possibility of reading the control before the write has taken place (or perhaps after - you just don't know)
The system I'm on doesn't have the right revision of LabVIEW loaded for me to see your code, so these are just general comments, and not specific to the code you have wired.
Rod,
12-20-2006 05:13 PM