Novice Posted May 30, 2006 Report Share Posted May 30, 2006 Hello, For a project I need to control (PID) some servo motors by reading the set point from a file at intervals of 0.1 seconds (10 S/s). Beside that the process variable is, or should be, readed at about 10 kS/s from the DAQ 1 in. The control output should writing to the DAQ OUT at 150 S/s. The DAQ 2 IN and DAQ 3 IN are readed at 48 kS/s and forwarded to a calculation and a file block. See att. for a simplified block diagram. Because of the blocks running at different time intervals, I was wondering which architecture (master / slave or producer and consumer) would be most suitable for this kind of project? Beside that, is it possible to achieve some kind of synchronisation of the different DAQ IN blocks so the recorded data can be compared in a meaningful way? Could someone give me some ideas and maybe some examples? Many thanks in advance. Greets, Maarten Quote Link to comment
didierj Posted May 31, 2006 Report Share Posted May 31, 2006 You'll have to make several processes, that run separated from each other. Communicate via queues or notifiers. Since your PID-task has to run 150 times a second (and most probably hiccuping won't be allowed due to the control work it does) and actual "office"-OS's are in no way "realtime" capable, I would recommend to perform the DAQ- & PID-tasks on a realtime system, like RIO: Combine the DAQ in/out and PID control into one loop and run this loop in the RT-environment. File-IO and ion calculation can be done by your PC. Communication between the two environment can be done with dual port IO or globals (even that globals are not "realtime" in their core, they are sufficient when you have a loop that runs at 150Hz) To combine the two sampling rates between DAQ1 and DAQ2/3 you have different options and will depend on how you build your system. I don't know RIO very well but think that different sampling rates are not a big deal for it. It is also doable with a normal DAQ-card, I did it a few years ago with a E-series card (at these times they were known as MIO-E-16) and... wait was it LV5.x . Finally if your budget allows it and for simplicity you can put 2 cards in your computer. Quote Link to comment
Novice Posted May 31, 2006 Author Report Share Posted May 31, 2006 Hello Didierj, At first, thank you for your fast reply! :worship: Regarding the PID task which should running at 150 Hz is not a big issue because the output (DAQ OUT) is forwarded to a servo controller which has a much faster PID controller by itself. Some tests already show me that the PID task is "very" stable. I was more curious about the fact how people deal with "communicating" between the different processes (DAQ reading, PID controlling, DAQ writing, etc.). In LV there are a lot of possible solutions for that kind of projects I think, but maybe people have some good experiences with a certain approach? Maybe someone has some examples of similar projects? Thanks in advance. Regards, Maarten Quote Link to comment
Neville D Posted May 31, 2006 Report Share Posted May 31, 2006 Hello Didierj,At first, thank you for your fast reply! :worship: Regarding the PID task which should running at 150 Hz is not a big issue because the output (DAQ OUT) is forwarded to a servo controller which has a much faster PID controller by itself. Some tests already show me that the PID task is "very" stable. I was more curious about the fact how people deal with "communicating" between the different processes (DAQ reading, PID controlling, DAQ writing, etc.). In LV there are a lot of possible solutions for that kind of projects I think, but maybe people have some good experiences with a certain approach? Maybe someone has some examples of similar projects? Thanks in advance. Regards, Maarten Just to simplify matters, I would sample everything at the highest rate required, and reduce the sampling rate when either writing to file, or displaying on a plot. There is a decimate array function that you can use to display/write every 10th (or whatever you choose..) point. You anyway won't be able to sample at different rates on channels if you are using the same DAQ card, since they use the same scan clock. Synchronizing data from different sample rates and writing them to files is quite difficult and ultimately not worth the effort. Write everything at a high sample rate to start with, figure out what is the lowest sample rate you can live with and write all data at this rate to 1 file. Make the PID loop a timed loop that wakes up when data is ready for it to process. Read and write data in chunks of 500 to 1000 pts instead of trying to read points individually and writing to file. I think you will be ok with windows; no need for any RT hardware, so long as you don't try to use excel, check your email and browse the web at the same time. In the past, I have written a sort of DAQ daemon. It is a separate simple VI that just reads the AI channels at a fast rate, and writes averaged data to a Q. You can call this VI in a sub-panel (so you can see its working). The main app reads the DAQ data from Q and processes it. Analog Output is best used software timed. Read AI, process, spit out AO value, within a timed loop or regular loop with a wait until next ms multiple block. Neville. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.