08-11-2012 10:45 PM
Hi dude,
I am trying LIFA and so far so good. Since I have limited knowledge of LabVIEW so I have some problem with cooperative task scheduling in LabVIEW. Suppose, a project has three temperature sensors, three relay and three indicators(LED) and the function of the projet is simple high/low temperature sensing. But the hysteresis and delay time have to use for smooth operation of relay during thresholding of setpoint temperature. The detail explanation of process as follow:
1)The whole process takes 1 second to preform
2)There are three tasks, each task take about 333 msec.
3)Each task has a temperature sensor, relay and indicator to perform simple high/low temperature sensing.
4)Timeline is that Task 1 runs at 0 sec, Task 2 runs at 333 msec and Task 3 runs at 667 msec then Task 1 runs at 0 sec again and so on
Thanks,
pak
08-11-2012 11:56 PM
You could use a time delay and a conditional block (to choose which sensors to read).
08-12-2012 12:16 AM
08-12-2012 02:07 AM
You could use a time delay and a conditional block (to choose which sensors to read).
Any example or hint, please.
Or just use three parallel loops
parallel or cascade blocks is a simple way but accuracy is bad.
08-12-2012 11:45 AM
The 3 tasks cannot run really parallel because lifa has only one serial line to communicate.
You can however ask for 3 temperatures, calculate the new settings and tranfer the 3settings to th arduino and wait for the rest of the second.
If necessary you can read the temperatures more often and take the mean to get better accuracy.
It is even possible to adapt the arduino software so that there a beter measurement is taken.
08-12-2012 05:19 PM
This is what I was thinking:
The cases are 0, 1, and 2. Put one sensor in each.
08-13-2012 03:28 PM
I would read them as soon as possible in case 0
use case 1 for calculating and case 2 for outputting the data
but that is personal.
The first wait of this system is undefined, check description of multiple ms wait.
Mostly shorter so a special frame before the while and the output of wait multiple ms connected to the while to make sure it executes serially.
08-13-2012 06:23 PM
Albert.Geven wrote:
Mostly shorter so a special frame before the while and the output of wait multiple ms connected to the while to make sure it executes serially.
That doesn't really make much sense. If you are trying to say that there is no defined data flow for the wait VI then you would be correct. I did not mention that before because I was just giving a simple example. To ensure the timing function is executed in the same order every time you would need to put it into a single sequence structure and put some other data through it (data that is needed for the conditional.
08-13-2012 08:13 PM
Thanks for reply, Arduino can do interrupt routine and cooperative task alone. I believe it can do more if I use the power of LabVIEW since Arduino is tethered to the computer (LabVIEW). Anyway, I'll go through it.
Best regards,
pak
08-13-2012 10:29 PM
LabVIEW cannot utilize interrupts as they were intended unfortunately.
When you say "cooperative tasks" you make it sound more elaborate than your explanations. Maybe I'm missing something here? Are you really just referring to sequential code with delays? Can you post your Arduino code that does what you call "cooperative tasks" please?