From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID output issue

I have a VI in which I am Doing PID control for temperature control by manuplating the power (as denoted by PID output). While at the sametime I am controlling the reflected power by controlling frequency based on simple algorightm that states that if Power>0 let frequency = 4V and if Power=0 let Frequency = 0. And I am using DAQ card USB6211 for this process. However I have just simulated the DAQ but not actually connected the DAQ card to my computer via usb. I have written program in labview 2009 but PID output is increasing temperature for some random period and then decreases the temperature and this continues in a loop and it seems like its not even looking at setpoint. Seems like PID is unable to solve some prroblems. I would appericiate some help here greatly.

 

Thank you.

Download All
0 Kudos
Message 1 of 15
(3,594 Views)

When you simulate a DAQ device, it reads back a sine wave.  You may be seeing the PID response to that sine wave.

0 Kudos
Message 2 of 15
(3,569 Views)

Thanks for you reply. Appericiate it, however, do you mean to say that its giving a sine wave response becasue my DAQ is actually not attached to my Microwave system and therefore DAQ is simulating a sine wave response on its own? Or should I also initialize my error using a shift register? If so hwo shoudl I go about doing that or would it be poissible for you to make that change in my VI as my temperature first goes up to a certain number and then reduces to a certain number in a oscillating manner.

 

Thanks

 

Kunj

0 Kudos
Message 3 of 15
(3,557 Views)

When you set up a simulated device in MAX (Measurement and Automation Explorer), the data that you read from the DAQ Assistant will be a sine wave (with an amplitude equal to the input range, if I remember correctly).  I would expect that a sine wave input will cause your PID output to oscillate.  You can check the values you are reading from the DAQ device by putting a chart indicator on your front panel and connecting it to the output of the DAQ assistant.

 

EDIT: you've got me curious.  What output did you expect from the simulated DAQ device?  I shouldn't even have mentioned the PID here since you're not looking at the controller output.  You're looking at the value you read from the DAQ, so you're seeing the simulated sine wave.

0 Kudos
Message 4 of 15
(3,548 Views)

Hi thanks again, As per you suggestions I have included a wavegraph-form for DAQ output as well as one for PID output. If u see my Vi you will notice that the graph for the PID output just shoots directly to the minimum value of the output range of PID. while the DAQ output just shoots directly to value of 0 to 10 and then reduces directly to 1 in a vertical line type of graph and its not a Sine-Wave form. Feel free to give me anyother suggestions please.

 

Thank you

0 Kudos
Message 5 of 15
(3,534 Views)

Can you post a screenshot (as a PNG, please)?  What sort of suggestion are you looking for?  I don't have DAQmx installed on this computer so I can't run your code, and I don't understand what you believe the problem to be.  You can't get useful results without either modeling your system or connecting to the real system.  Are you using a simulated device, or do you have the DAQ card plugged into the computer but not connected to your actual system?  Are you plotting after or before the temperature conversion?  Where did you get your PID gains, since you aren't connected to the real system?  I don't see a problem with the logic in your LabVIEW code.

0 Kudos
Message 6 of 15
(3,525 Views)

Hello,

 

Many thanks for all your help.

 

I have posted 2 screen shots and wrote a paragraph in word doc inorder to follow the screen shots. And yes I am using simulated device, I have not yet purchased the DAQ-6211 as I would like to get the simulation working before purchasing DAQ card. I am plotting after the conversion, for example I have plotted the temperature of PV after the volts were converted into PV-temperature. And I have plotted the temp output after it was converted to volts. The PID gains value I obtained by using MATLAB. I ran few experiments in the Microwave system and then imported these data into System identification tool (ident) in Matlab to approximate the process model. Then in Simulink I designed the PID-control loop and tuned by PID based on my process model to obtain the PID parameters that are given in the screen shot. Only change I made to Matlab model was as follows: P-value I kep the same for Labview since P = Kp but I = Kp/Ti(min) and D = Td*Kp. And since Matlab gives P, I and D values I had to determine Ti and Td values for inputting it into Labview. One last this is I then divided Ti and Td by 60 to get their values in minutes.So to answer your question, Yes I had model the data before running PID. However, I am not sure why my Td value is negative.

 

Also, I feel that when the volt to temp conversion or temp to volt conversion occurs it might be knocing my data off. Do I have to find out my system characterisatics in order to do it? I mean how do I calibrate my system for temp vs volt and make my on T-V switch converter? Any tips as I do not kwno how to do this?

 

Thanks for all yoru replies.

 

 

0 Kudos
Message 7 of 15
(3,510 Views)

I think there are a bunch of problems here, but not with the logic of your LabVIEW code.  First, is your front panel indicator a chart, or a graph?  I can't tell from the screen shots.  It should be a chart, otherwise you'll only be graphing one point (which is what it looks like you may be doing).

 

It's possible that the simulated device will return what looks like noise, rather than a sine wave, when run in single-point acquisition mode.  As far as I can tell, the sine wave is generated relative to the sampling frequency, so if that frequency is set much, much faster than you actually sample and you only read the latest point, it will look like noise.  You can play with this a bit in the DAQ assistant - try acquiring N samples, say 1K samples at 1K/s and when you run the task you should see a sine wave on the graph.  Then go back to the single-sample acquisition and you'll get what looks like noise - the result of sampling only a small number of points from the overall sine wave.  This will all be irrelevant once you connect to the real hardware but may be useful for understanding what you're seeing now.

 

In your Word document (next time, just put the text in the forum message), you wrote: "PID outputs a value which I believe is in temperature as well (since both my PV and Setpoint are in degree Celsius)."  This is incorrect.  Think of the Proportional gain as having units of [output units]/[input units], because it's a ratio of error to output.  In your case that would be degrees/V.  I have no idea if this matches how you fed the data to Matlab.

 

Thermocouples generate a very small voltage, and will not read well on a 10V scale.  I do not recommend using a 0-10V range to read a thermocouple on a real system.  Related to this, feeding 0-10V into the V-T calculation (as returned by the simulated DAQ) is likely to return ridiculous values since the calculation expects inputs much less than 0.1V.

0 Kudos
Message 8 of 15
(3,488 Views)

You will not be able to get this working with just a simulated DAQ device. As nathand mentioned, you will not be able to see any change in the process variable with a simulated DAQ device because they will only "read" a sine wave. You should take a look at the General PID Simulator.vi example, which you can find in the Example Finder under Toolkits and Modules >> PID and Fuzzy Logic Control >> PID >> General PID Simulator. If you replace the plant model in that VI with a model of your system, you should get a decent facsimile of what to expect with the hardware actually attached. As for changing the voltages you are reading into temperatures, that might be best done with a custom scale.

John B.
Embedded Networks R&D
National Instruments
Certified LabVIEW Developer
0 Kudos
Message 9 of 15
(3,472 Views)

Hi Guys,

 

Thank youf for your inputs. However, would you please guide me where I can get more information on the plant model that is presented in the "General PID simulator.vi" as I do not understand wht the inputs to the plant model means, for example static gains, lag, dead cycle, load, deadband, noise-level%, initial PV. Mine is just a 1st order [  k/(ts +1) where K is gain and t is first order time constant  ] plant model that I have obtained, and it has no time delay so how can I input these parameters in Plant model. Also, my model is in s-domain.

 

Secondly, once I get the "General PID simulator.vi" working, then should I assume that my system will behave in a similar manner with NI-6211 DAQ attached to Microwave system? I mean I do not have a plant model in my labview-program, I only have PID-controller, but I guess when I plug the hardware to the system, and my system it self will represent the Plant model it self so its ok that I do not have the plant model drwan in my vi right?

 

Thanks again

0 Kudos
Message 10 of 15
(3,444 Views)