LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

pid advanced, number of inputs is different from number of output

I'm working on a PID controller at the moment. my system is a 2-input / 6 states/outputs.

can anyone, please tell me how to handle such a difference in the number of inputs/outputs using PID advanced? as the PID advanced.VI makes the number of its outputs (control signals) to be the same as the number of inputs that you feed in it on the process variable terminal. so that makes my control signals to be 6 instead of 2. any suggestions? however, i noticed that the last four control signals are always zero but this might be something wrong with my design since the PID advanced is giving a different output dimension.


0 Kudos
Message 1 of 11
(6,216 Views)

Jzee,

Each function of the PID Toolkit has two modes: single channel and multi-channel. The single channel has one input/output available as scalar.

The multi-channel mode, the input and output are 1D array and it represents placing a PID to each input/output pair that you have. In other words, the first element of the 1D array feeds to a independent PID and the result goes to the first element of the output 1D array.

When you have a system that has 2 inputs and 6 outputs, the PID Advanced.vi will receive a 1D array with 6 elements and it will map an independent PID to each one of them. That is the reason you have 4 values that are always zero.

What you have to do is find out in which input/output pair you want to have you PID placed in and use Index array to do the selection. In the picture in attachment, I mapped the output 0 of the system to input 0 and output 5 to input 1.

Hope this help!

Barp - Control and Simulation Group - LabVIEW R&D - National Instruments

 

Barp - Control, Simulation, RTT and HIL - National Instruments
0 Kudos
Message 2 of 11
(6,203 Views)
Barp

Thank you for your reply but i've already tried this before and it's not what i'm looking for really. this means that you don't make use of all the information you have on the output of the system because you only fed back a subset of the available outputs which doesn't really help in my system at all (highly unstable). correct me if i'm wrong?

actually i should note something to you, when the PID advanced take 6 inputs it will produce 6 PID outputs as you said but the reason why i had only two working is i set the third one to zero "all its gain values" and hence all the PIDs in the sequence after the third will have a zero output. i mean if your third PID has (0,0,0) values then the 4th, 5th, and 6th will generate an output of zero even if they have values for the K's which is kinda weird.... i guess that depends on how the PID advanced was actually programmed. again correct me if i'm wrong.

What i'm looking for is a way to combine the information from the all the six controllers in a way to produce 2 inputs to the system.

any idea?
0 Kudos
Message 3 of 11
(6,200 Views)

Jzee,

Well, you are right about the more information is better to control the system.  However, now you are stepping into an Advanced Control System to take 6 measurements and act on 2 outputs. If you look into Control Theory, this is Multi-Input and Multi-Output (MIMO) system and, as such, you will have to come with a Control Strategy to better use this information, as for example, Cascade PID, Feedforward control, decoupler, filtering and/or combination of it to control the plant. You could also use Fuzzy for this purpose, however, our current implementation only uses 4 inputs. Without knowing what kind of plant your are trying to control, it is hard for me to advice in any control strategy right now.

However, if you are have the Model of the plant that you are trying to control, you could easily upgrade to the Control Design Toolkit, and you can use more advanced techniques to control your plant. You can use state feedback control algorithms as Pole-Place or LQR where you just need to provide the matrix multiplication to obtain the controller that you need. This is very easy to use, as long as you have the model. If you want to know more about it, look at our manual online, in special Chapter 11 and 12:

http://digital.ni.com/manuals.nsf/websearch/1B2AF86E66AD7F61862571060055D6AB

If you don't have the model, AND your plant is linear, you also could use System Identification Toolkit to obtain the model of it. However, IF your plant is nonlinear (most of them are), you could use Simulation Module to model it and linearize it around the operating point or use System Identification to "fit" the parameters through measurement.

This is Model-Based Control Design Techniques and you could have access with the Developer Suite with Control Design and Simulation Option. 🙂

Anyway, if you can give more information about your plant, maybe we could better advice on what to do next.

Hope this helps!

Barp - Control and Simulation Group - LabVIEW R&D - National Instruments

Barp - Control, Simulation, RTT and HIL - National Instruments
0 Kudos
Message 4 of 11
(6,186 Views)


@Barp wrote:

Jzee,

Well, you are right about the more information is better to control the system.  However, now you are stepping into an Advanced Control System to take 6 measurements and act on 2 outputs. If you look into Control Theory, this is Multi-Input and Multi-Output (MIMO) system and, as such, you will have to come with a Control Strategy to better use this information, as for example, Cascade PID, Feedforward control, decoupler, filtering and/or combination of it to control the plant. You could also use Fuzzy for this purpose, however, our current implementation only uses 4 inputs. Without knowing what kind of plant your are trying to control, it is hard for me to advice in any control strategy right now.

However, if you are have the Model of the plant that you are trying to control, you could easily upgrade to the Control Design Toolkit, and you can use more advanced techniques to control your plant. You can use state feedback control algorithms as Pole-Place or LQR where you just need to provide the matrix multiplication to obtain the controller that you need. This is very easy to use, as long as you have the model. If you want to know more about it, look at our manual online, in special Chapter 11 and 12:

http://digital.ni.com/manuals.nsf/websearch/1B2AF86E66AD7F61862571060055D6AB

If you don't have the model, AND your plant is linear, you also could use System Identification Toolkit to obtain the model of it. However, IF your plant is nonlinear (most of them are), you could use Simulation Module to model it and linearize it around the operating point or use System Identification to "fit" the parameters through measurement.

This is Model-Based Control Design Techniques and you could have access with the Developer Suite with Control Design and Simulation Option. 🙂

Anyway, if you can give more information about your plant, maybe we could better advice on what to do next.

Hope this helps!

Barp - Control and Simulation Group - LabVIEW R&D - National Instruments



Barp

first, i've access to all LabVIEW toolkits, including the CD and identification toolkits through my university.

I tried actually earlier to use pole placement technique (and currently trying with LQR). i'm more interested in my system tracking a reference signal rather than just u=-kx strategy!  the thing is using (u=-kx+r) as a strategy is not actually sufficient because this will make a steady state error. so i tried the tracking procedure in Franklin, Powel, and Emami, i guess that was p.380 (not sure) but it's in the state space chapter. anyway, i was faced with  some problems, that this strategy only works if the number of inputs is >= the number of inputs (I knew that after few days of designing the controller and faced with weird errors!). anyway, i guess i learnt the hard way.

so that was the reason i resorted for PID but after some reading i found another procedure to track a reference signal with no tracking error to a step signal which is augmenting the integral of the error with the states while calculating the gain K matrix as follows

e_dot= r - y  where the dot means it's differential of the actual signal, r: input, y:output, e: error
e_dot=r - Cx where x: states,C: C-matrix

then the full states would be (written with matlab syntax), the ";" means a new row and the 0 is a zero matrix of compatable dimensions
[x; e]=[A 0;-C 0]+[B;0]u+[0;i]r
 where A,B,C are the original matrices of the system, i: is identity matrix depending on the number of signals required to track.

i was unlucky enough that my linearised system (originally nonlinear but i linearised it by hand about an operating point) was "ill posed" when i used LQR and wanted to track 6 reference signals. i mean when i added the six other rows of e_dot to the actual system. so i finally decided that i want only 2 outputs to track 2 reference signals. so instead of adding 6 rows of e_dot i added only 2 with the requirement that the 1st, and last output track the reference signals. so far, as i'm testing each part of the design, it's going ok and i got a matrix of the gains from the LQR but didn't complete anything further yet. I'll implement an observer/kalman filter as well but this will be at a later stage as i've all my outputs measured. i will implement the observer only to check the correctness/reliability of the sensors signals.

i'll be soon faced with the problem of implementing an integrator - not able to use the simulation integrator because my controller will work on an fpga of the cRIO, so i've to get an integrator that fits in a while loop. also my design is in the continuous system so not able to use the discrete integrator.

i don't know how to use a cascade PID, or what is the advantage of a feedforward to be honest. also, not sure if i'm able to implement any other strategy than the ones i've previously mentioned, as it seems that my control knowledge sucks 😞

my system is a control of a uni-cycle, to at least stabilize it as a first stage. i've a motor driving the wheel to control the pitch direction, and another motor driving a flywheel to control the uni in roll/yaw directions. think of it as an inverted pendulum over a cart but this is harder because it can fall off in direction perpendicular to the wheel movement direction. this is why i've the flywheel. The thing is the system is big and heavy so the control strategy has to be well designed. any help/idea is much appreciated?

 
0 Kudos
Message 5 of 11
(6,184 Views)
Jzee, The Control Design toolkit has the feature to add the output errors as states of the compensator/regulator. The extra set of states that corresponds to such errors require gains that are not calculated by the LQR. You may want to try such a block (find an example attached in this reply) > I suggest if you go through a standalone implementation, where the model used by the controller does not match the one providing the response 'y' to the estimator/controller (process model mismatch). The reference manual is very useful to understand all the variants of these functions. In relation to the FPGA part - we have not designed these blocks to be used in FPGA - neither verify its deterministic behaviour in RT. Hope this helps - let me know if you have further questions
0 Kudos
Message 6 of 11
(6,093 Views)

Dear All, Iam trying to design the PID control for the Quancer Inverted Pendulum, after modelling i got it as a SIMO. How to design the PID controller for this. Iam having 4 rows 1 column. I can able to design the PID for the SISO system. If iam entering the all four transfer function, its showing the bad connection.

 

Whether i need to decoupling, some prof said its not coupled system since we are having only one column.

 

A =
         0         0    1.0000         0
         0         0         0    1.0000
         0  123.9570   -1.5700         0
         0  111.5900   -0.7200         0
B =
         0
         0
   56.3900
   25.9300

C =
     1     0     0     0
     0     1     0     0
     0     0     1     0
     1     0     0     0

D =
     0
     0
     0
     0
[num,den]=SS2TF(A,B,C,D)
 
num =
1.0e+003 *
         0   -0.0000    0.0564   -0.0000   -3.0784
         0    0.0000    0.0259    0.0001         0
         0    0.0564   -0.0000   -3.0784         0
         0   -0.0000    0.0564   -0.0000   -3.0784
den =
    1.0000    1.5700 -111.5900  -85.9473         0
can any one help me in this. Kindly mail me in it_arasu@yahoo.co.in . i will be greatful to you.
regards
I.T.Arasu
0 Kudos
Message 7 of 11
(4,654 Views)

Hello. i use regelateur PI .but i have same problem  in number  input more than number output. i want us method ANN but it need have same number in input and output . how can fixed that 

 

0 Kudos
Message 8 of 11
(457 Views)

Hi dz,

 


@dz39 wrote:

 it need have same number in input and output . how can fixed that 


By providing the required number of inputs - on all required (and optional) input connectors!

 

As you forgot to attach your VI you need to debug on your own…

Best regards,
GerdW


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

But i have one input and 1 output from regulateur PI 

IMG_20240902_122455_544.jpg

0 Kudos
Message 10 of 11
(438 Views)