I am now doing a project in which I need to real-time feedback control an instrument by analog voltage signal ranging from 0-10 V. The problem is that I have already developped the G. file through PID control toolkit. In another word, the output singal has already been produced in the g file, however, I do not know how to output this signal , how to transform this signal into real analog voltage signal and transport it into the instrument which I need to control through hardware.
The project also involves a four-channel data acqusition and processing process, so the DAQ I use in this project is USB DAQ 9233, which has a drawback that it only has four analog input channels without analog output channel. so in this situation, can I just use RS232 to output the analog voltage signal to control the instrument? do I have to buy some more hardware to implement the real-time feedback control? If so, what is your suggestion?
I do appreciate all your suggestions and advices.
I just want to check to make sure I understand your question. Are you talking about a Real-Time system in the sense that you need a deterministic system deployed on a Real-Time target, such as a PXI controller, cRIO, RTPC, etc. as described here? This is what is meant by the Real-Time Measurement and Control category. Or are you describing a system where you only need measurement and output within one feedback loop?
Thank you for your reply. Actually, we are using USB 9233 BNC to acquire four channel signals from sensor and based on these signals after processing, a PID control algorithm is developped to give a feedback control signal, the problem is that the 9233 has no analog output channel, so can we use RS232 to transport analog voltage output signal to the instrument which is controlled by 0-10 VDC signal? The system is a close-loop real time control system. we do not want to spend much money on the real time hardware, so we are considering to buy a USB 6221 with both analog input and output channel to replace USB 9233. can we just use USB 6221 BNC to do the real time control?
First of all, no, you will not be able to output 0-10 V analog output with an RS232. The USB-6221 will be able to handle both analog input and output, and can run a PID control loop. This will not be a very deterministic system unless you are running on a Real-Time operating system and using LabVIEW Real-Time Module. So it should work, but it will not be as fast as it could be, nor will it be as reliable as it could be. See this page I linked before for more information about Real-Time systems and determinism.
Thank you so much for your reply. I have one more question, can I only use labview real-time module with USB 6221 to achieve a reliable and fast real-time control instead of ordering both the labview real-time module and real-time hardware target? In another word, dose real time software have to work with real time hardware?
For a system to be a truly Real-Time system, it must run on a Real-Time Operating System, due to the lack of determinism in standard OSs, and thus must be run on a Real-Time hardware target. Only then can the Real-Time Module software take advantage of the reliability and speed capabilities of a deterministic system. Once again, you can use a USB-6221 to acquire data and output signals quickly enough that they may appear to be running at the same time, but it will not be a Real-Time system, and thus will not benefit from the Real-Time Module.
I got my USB 6221 today. But when I tried to use DAQ assistant to output the analog control signal which comes from a PID control loop, it doesn't work. The whole idear is to use USB 9233 to acquire acoutic signals and after some digital signal processings and a PID control loop, the control signal should be output to control an actuator. The control signal is an analog voltage signal which should output through analog output channel in USB 6221. But I do not know why I can not use DAQ assistant to do this output-analog-signal job. can you give me some tips on this?
Thanks so much
The DAQ assistant, while useful because it is easy to use and simple, has a lot of overhead and is not very flexible, so it is not going to work well in more complicated applications such as PID control. For this, you will need to use the DAQmx VIs. An example of how to output a signal with these can be found in Help>>Find Examples...>> Hardware Input andOutput>>DAQmx>>Analog Generation>>Voltage. Explore these examples and determine what will work best for your application.
Thanks for your reply. So from your suggestion, I need to try DAQmx instead of DAQ assistant. Then can I use both of them in one program? I mean use DAQ assistant to acquire signal while use DAQmx to output control signal. is it ok to sychronize the input and the output signal ? Another issue is that USB 6221 can output different analog voltages according to the PID feedback control signals in a real-time style, right? I mean the analog voltage signal from 6221 is not set to be constant, is that right? I am afraid that the 6221 can only output a constant voltage value.
Anyway, thank you so much for your timely help.
While it is possible to use both the DAQmx VIs and the DAQ assistant express VI in the same program, the same advice from before holds true that you will want to use the DAQmx VIs to acquire your data if you want it done within the same control loop as your signal output. The express VIs are easier to use, but do not have the same performance as the DAQmx VIs. See the DAQmx examples in the example finder for a sense of how to do this.
As for your question about outputting a constant voltage, if you are outputting an analog signal, it is by definition a variable voltage value. A digital output will be a constant value, but analog outputs are scalable.