LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LQR regulator for an object with a Blower, PLC

Hi there,

I've to write a LQR regulator for an object which is a tube -- 130 cm with a ball. This is on the picture. The 0-6000 is a range of input/output from PLC.

 

I've identified an object via MatLAB and got a transmitantion, which is made a default value at Regulatorrrr.vi. I'm contactingwith an object via OPC server and getting two data from it, input and output.for a step signal I get a nice response

 

This object have characteristic that for example when I make and 2300 and more on Blower it will go up  to the top - 130 cm but with a different speed. So when I would like to stop at 75 cm I need algorithm to change input on Blower to less and more. But I've no idea what an input signal should be to this regulator, as state space which is in  this VI is for closed loop so I thought that it could be all, but I got stupid responses, maybe just some convert of Input signal from sensor, then LQR regulation and then to Blower?

 

Download All
0 Kudos
Message 1 of 9
(4,621 Views)

Hi Ryzyk,

 

if I had to control such a system I would use your 0-6000 value range as input for a control algorithm and output a 0-10V signal for your fan.

 

LabVIEWs PID control functions can use such ranges without problems…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(4,614 Views)

There is no difference between 0-6000 and 0-10V as PLC is conveting it by itselft. But when I tested today this object when I made an input from sensor and output to my fan I got a very strange responses, maybe I need to convert input from sensor before it goes to regulator? As for input sensor 6000  is 0 cm and 0 is 135 cm, but for my fan it is reverse.

0 Kudos
Message 3 of 9
(4,599 Views)
Hi Ryzyk,

that doesn't matter. More important is reaction time of your control loop: it should be faster than your "object".
You can have your control algorithm work with percentages for in/out and adapt to "real world" by scaling...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 9
(4,589 Views)

Here is a graph which I measured today when an input was a steady signal on fan and the output from system space in control loop (figure 1) and second graph is data from distance sensor (figure2). I don't remember at what frequency were those graphs taken but I think it was 20ms - 1. on time axis

 

I'm not able now to check the performance of my VI as I'm not in a lab.Can I do that by Tools > Profiles > Performance and Memory?

 

But my program can't be faster than 10 Hz, as a minimum UpdateRate from OPC server is 100ms I think if I'm wrong then please correct me.

 

Bez tytułu.png

0 Kudos
Message 5 of 9
(4,569 Views)

Hi Ryzyk,

 

we still don't know much about your control loop…

 

Do you switch the fan on/off or can you control it's speed continuously?

Using that OPC connection will not make your life easier as it introduces additional delays in your control algorithm (data transfer, limited sample rate of 10Hz as you wrote).

The images don't tell use so much with missing axis labels - every engineer learns in the first lessons to provide meaningful axis labels for each graph. Atleast I was tought so in (high) school…

Are those two images related to each other? Are they using the same time scale - and the same starting point?

There are steps visible in the sensor readings: are they due to limited sample rate or is the sensor limited in some other way?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 9
(4,547 Views)

Hi,

 

Control Loop is in the regulatorrr.vi.

In those images I was changing the value of the fan manualy. And then this signal went to controll loop and the response is in green. I also registered the the data from the distance sensor and this is the second graph. Yeh, those steps are due to the limited sample.

 

y axis is a value of signal, which was registered and the x  axis is time. Timescale and  starting points are not the sameass this is a different measurementt number. When  I'll be able to do the same, in Thursday/Friday, I'll do.

I know that the OPC have it's limitation but I have to chose this or making this algorithm on PLC, which is kind of terrible in OMRON syntax.

0 Kudos
Message 7 of 9
(4,541 Views)

Hi Ryzyk,

 

I would recommend to implement the control loop algorithm "at the source" - in the PLC.

Here you should be able to run control loops with ~1kHz loop rate, atleast that's my experience with PLCs! No need to transfer data over network with very limited sample rates to control a very fragile system…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 9
(4,535 Views)

I wanted to use LabView to check this algorithm and the implement to PLC to see if it is any good as in PLC it is pain in the ... to make a matrixes operation. Eg for only defining a matrix 2x2 I need 4 line of codes, where here I can do all Ricatti equation in 4 lines and then multiply those matrixes cell by cell.

 

Okay  this is doable, but I don;t have a working algorithm anyways. I could define Matrixes A,B,C,D or instead of A a A-BK, but then I don't what to do, as the feedback law in LQR is

u = K * x

and the matrix K is [1x2].

0 Kudos
Message 9 of 9
(4,530 Views)