I found an example of an On-Off controller on Labview that I am attaching. I wanted to see how it would work the same VI replacing the thermostat a PID block and using the simplified model of a room in the form of the transfer function (R / (RCS +1)) but I'm not sure the right way to proceed. the integrator is to stay? I have to modify the VI? I hope in your kind suggestion
Solved! Go to Solution.
Spanish discussion here
Unfortunately, I did not install the add-ons necessary to explore the attached example.
It depends how you want the model to behave... The integrator keeps the temperature tight (within a range) using the controiller hysterisis. How do you plan to use the transfer function to maintain the room temperature? Do you simply adjust it based on the difference from the temperature reference?
The example is part of the LabVIEW Control Design and Simulation Module. To use a PID controller, you can use the PID that is already available in the Simulation Palette (under Controllers) and, afterwards, you need to convert the output signal into a PWM modulation, which can be done by making the Pulse Signal Function (in the Signal Generation palette) and change the duty cycle.
For the plant, you can just use the 'transfer function' block and remove all the code of the plant. With a bit of block diagram control algebra, you will see that the feedback code from the "Room Temperature" into the positive junction makes this a first order system. It just happen to be layed out this way so we can use the 'outside temperate' to change over time and have a more realistic simulation.
Hope this helps...
One more thing... on the 'italian' discussion, you posted some code back. I have to do some corrections here:
1. the Control and Simulation Loop is running a Runga-Kutta 45, which is a variable step size. The PID VI is designed to run in a 'fixed step' size. You have two option to correct that: you can make the solver to run as Runga-Kutta (RK) 1 or you have make PID VI to run in a 'discrete' step size. For the first, double-click on the simulation node left 'dog ear' and change the solver. For the second, right-click on the PID VI, go to SubVI node setup and choose discrete. The -1 means it will try to get the sampling time from the Simulation parameters (or you can just put the value there). Then, you need to create a constant from the "dt (s)" input of the PID and use the same value. This will make the PID to run correctly and you can try to change the parameters.
2. your transfer function before the 1/s is not quite a good representation of a termal system, unless if you are trying to just increase the order of the system. Again, the feedback node on the Room Temperature into the Positive junction will make a first order transfer function. If you want to make that a transfer function, you can try to modify the Termal Resistance, and Gain of the system to try to match the Transfer Functions Parameter and, make the profile fixed. If your intention is to make a second order model, you probably want to put your transfer function between the Furnace and the Junction (outside the closed-loop).
hello bart. I apologize for my bit correct English. I would need further help, I try to explain better what I want to achieve with Labview. I want to simulate my room with a transfer function of the first order, not of the second. what are the correct values of thermal resistence and gain?
the integrator after the transfer function does not take? I thought I would serve to switch from thermal power at room temperature.
why I have to use a pulse generator? the output of the pid cannot communicate directly with the furnace?
I ask thanks in advance, and I hope for your kind help. I am attaching the file again, in case you want to check or correct it firsthand. I like you a big help. thanks
I forgot to ask you one last thing: to find the PID parameters, I have to use a step response of the system defined by the transfer function? or I can do it inside the same VI?
thanks a lot
well, if you just want a transfer function and PID autotuning, why don't you use this shipping example?
C:\Program Files (x86)\National Instruments\LabVIEW 2013\examples\control\PID\Autotuning PID Online.vi
To change the "Plant" parameters, go to the block diagram and double-click on the cluster at the bottom of the VI and make:static gain = 0.5 and lag time = 5 ?
Those values are implementing you transfer function 1/(10s+2) to 0.5/(5s+1).
The Control and Simulation is better to use, but for so simple simulation, maybe you can just use that model. Notice also that this 'pid' function also has the 'autotuning code' with different types Would this work for you?
I'm looking for some help setting up a simple autotuning PID controller to control a heater element. My set up is as follows
1) Heating element power supply running into a relay that is controlled by a digital line from a NI USB DAQ board.
2) Temperature of the heating element is being monitored via a thermocouple being read into the same board.
All I want to do is set up an autotuning PID loop that will control the temperature of the heating element by turning on and off the relay via a digital line from the DAQ board. I have found a number of examples in the labview examples folders, but they all seem more complicated than what I need. A lot of the examples use some type of plant simulator. I have tried to replace that plant simulator with my process variable, but I do not have enough experience with labview and PIDs to make this work. Any advice or direction would be greatly appreciated.
To give a little more information I have been looking at the Autotuning SMith predictor example. This example would be useful to me if I could switch the plant subvi out and feed in my process variable, and then use PWM of the control output to turn my relay on and off. But I can't figure out what I need to replace/modify to get this to work.