Showing results for 
Search instead for 
Did you mean: 

integrator block for PI control

I was looking about for information on a integrator block. Is it true to say that labview does not have a block that can function like the integrator block in matlab. This is the closest I have to the answer.

however I will not be in the lab again until monday so just thought I would throw this up here and see if there is anyone who had a similar problem and could talk about it further. 


I use a recent labview(more recent than labview 8.series. (i googled it there and there are 2009,2010 and 2011 versions, I cant check until monday).

It does not have the PID control add on. When i search for PID nothing comes up and the control design menu is empty. 


I could find if the university would allow me use the add on. the lecturer assumed it was there and thats what he uses. 

however I thought a simple integrator block would do the trick rather than using an entire licence. little did i know it was not like matlab at all at all at all.


What I am doing is the speed of a physical motor is fed in to the labview program. The user will have set a speed that it should be going at and the difference (the error) was to go through a P controller. For this I literally just used a multiplier block as the gain. Now the problem was, the output is capped as I dont want to send a torque that is too great to the physical machine. What I found was that if the gain was being adjusted by a slider, it had to start off very low;about 0.05 of the error. If it was too great the output would be too large and a warning sign would pop up. So I was confined to a low gain while the error was at its highest. Then the error gets smaller but does not reach zero. i found that if I manually adjusted the gain to start at 0.05 and as the error got smaller and smaller I could increase the gain until eventually the error reached zero and everything moves onto the next state and teh controller no longer matters. 

So at first I thought surely there is some ramp (or for loop as I saw someone suggested elsewhere) I could use that could increase the gain over the course of 10 seconds. This will just do what I was doing. However it was recommended I just use PI control instead. I can leave the P appropriately low for the start, and the integrator will continue to reduce the steady state error. 


In the grand scheme of things this part of the project is for a wind turbine simulator. It is hoped that I could build a Maximum Power Point tracking system to control the wind turbine simulator. 

So if I NEED the control add on at a later stage let me know and if so I will request it and do other stuff. 

However if one could recommend something simple with the integrator blocks will I would be more than happy to do that. I was playing with all of them the last day for ages. Either getting nothing or having problems when some of the blocks require arrays as the input. One integrator block that I could connect up just gave out the input as it was and I did not inderstand the help explanation.

Or if you think I should go ahead with a simple loop to increase the gain over a few seconds?


0 Kudos
Message 1 of 6

Using PI control is the right way to go here.  You can create a simple integrator with a shift register; just keep adding the new error value to the existing shift register value, and store the sum back to the shift register.  For many control purposes that will be enough.  If for some reason you need to make it more complex you can do that, of course - for example, you can use the trapezoidal rule: track both the current and previous error, average them, and add that to the shift register.  If you need more help, please post your code with an explanation of what you've tried and what isn't working about it.

0 Kudos
Message 2 of 6

I'm confused. In my labview experience I'm just using formula nodes and daq things. I have not used labview before this project.

To integrate an error, is this what i must do: build a loop. add a shift register. input the error into the loop. the error is sent to the output of the shift register so each error becomes the last error value on each iteration. then i add an integral block. do i use the Numeric Integration VI? or the Integral x(t) VI? i need an array to use on the input of these. Must i build an array with the two values(present error and last error)? all i'm trying to do now is look for something that allows me to do just that but i'm not sure what i'm looking for. and the value that comes out? is there an opposite block to turn that into a number from an array so that I can use add it to the proportional gain value?

0 Kudos
Message 3 of 6

You're treating this as though it's Simulink, and it's not.  A Simulink model is a graphical representation of series of equations that Simulink can solve.  A LabVIEW block diagram is a computer program that may not have a mathematical solution.


Once you realize this, it's not nearly so complicated.  A simple integrator is just a running sum.  There is a built-in function, "Integral x(t) PtbyPt", that does point-by-point integration, or you can write your own very easily:

integrator options.png

0 Kudos
Message 4 of 6

One thing to add in situations like this where the torque is capped is to study the concept of integrator windup.  No time for a long expose, but in the simplest case you have three situations:


Startup (far from setpoint):  Here you should be sending the maximum torque to reach the setpoint.  You should not be accumulating error (ie. integrating) at this stage.

Approaching setpoint: Here the P term should no longer saturate and you should begin to control the approach.  This is when you should begin integration to handle the offset inherent to P regulation.

At setpoint:  PI control should be nice and happy.  If it seems like it takes too long to settle, a little D goes a long way.


In short, PI control is pretty simple and very effective once you tune the parameters.  Just make sure you add anti-windup logic so you do not accumulate errors that you are not correcting for immediately.

0 Kudos
Message 5 of 6

thank you very much.First thing in the morning I'll be in to the lab to get this going. 


Yes i'm beginning to think of labview as less about joining boxes are more progamming now. but I still have far to go. I decided earlier to try something like that trapozoidal rule above but it was looking nothing like that! i did not get my head around it at all. Sound job. 

0 Kudos
Message 6 of 6