08-10-2007 08:52 AM
08-10-2007 09:12 AM
08-10-2007 09:16 AM - edited 08-10-2007 09:16 AM
Nice, I'll undo that conversion.
Actually I really don't need these to happen at any specific time or in any specific sequence, I just need to make sure they're all running roughly at the same iteration and not firing concurrently. This is going to run unattended 24 hours a day and I can't have hardware conflicts causing stops. Beyond that, everything else is trivial.
And can you point me in the direction of some info on how to use semaphores?
Message Edited by Ralph@NES on 08-10-2007 10:17 AM
08-10-2007 09:17 AM
08-10-2007 09:24 AM
Timed loops let you define loop rates and offsets between execution of each (provided the code executed finishes before the next one fires).
Ben
08-10-2007 09:29 AM
08-10-2007 10:07 AM - edited 08-10-2007 10:07 AM
Ralph@NES wrote:
What's the secret to this loop timing?
Dennis and otheres already gave you some good advice on the DAQ part, so I won't repeat it.
There are some real glaring errors besides the problems you are telling us.
FIrst, your idea to run both a wait and a wait next ms multiple in the same loop is flawed, because they will both run in parallel and the longer of the two will fully and exclusively determine the loop time. The shorter of the two will complete earlier and will have absolutely no influence on the loop timing. You need to familiarize yourself better with dataflow programming.
Notice that you open all these files, but depending on the cases, you loose the file reference when exiting case structures (tunnel set to use default if unwired). The default is an invalid reference and this means that the "file close" cannot complete under this condition.
From an UI perspective, it seem ridicuous that the user needs to press a dozen stop buttons to stop the program, with no way to recover if e.g. one of the stop buttons has been pressed only by accident.
I am pretty sure your entire code could be reduced in complexity by 90% with a bit of effort. You are doing way too many duplicate things. A state machine comes to mind. It would automatically protect states for executing concurrently.
Your FP could be simplified by using arrays of indicators for example.
I would probably not try to fix the current code. This is a case where a complete teardown and rebuild would be approriate. Good luck! 🙂
Message Edited by altenbach on 08-10-2007 08:09 AM
08-10-2007 10:41 AM
08-10-2007 11:46 AM
08-10-2007 12:57 PM - edited 08-10-2007 12:57 PM
OK, I just spent the past couple hours trimming and aligning everything so that it makes more sense. I've only got three loops now (historically the timing loops containing the stopwatch VI's work better separately). Hit the run button a couple of times and noticed no exceptions.
Now, I have multiple DAQ assistants calling the same two cards and resources. Thus far, none of them seem to be causing conflicts but as was mentioned, this is probably by sheer luck.
How can I go about using the error function or similar to make sure none of these are going to conflict? Also, I am a little concerned about the case structures that are connected to analog out for fan control. Once those are on, I would like them to stay on until the low temperature is reached. Since they're in a loop, will they not reset every iteration?
Message Edited by Ralph@NES on 08-10-2007 02:23 PM