LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID tuning array instance

Hi All 

 

I am trying to tune a PID controller using the array instance of the PID vi. I have a method of tuning the PID but unfortuanatley, loops 3 and 4 seem to  show little response to the change in parameters. The goal of this is a Beam pointing Stabilization project. 

 

The process work s in the following way:

1) Setpoint and process variable go into a PID controller (camera centroid values)

2) PID produces an output that goes to a matrix calculation that produces a voltage output to move a mirror.

 

Does anyone have any thoughts as to what could be causing this problem?

 

Best Wishes 

Andrew

 

Best Wishes 
Andrew

0 Kudos
Message 1 of 65
(2,248 Views)

Hi Andrew,

 

do you really think you will get help for such a VI?

 

The frontpanel is much larger than a FullHD screen.

But the block diagram is way too large as can be seen in the navigation window:

The part with the white background marks a FullHD screen…

 


@AndrewIons01 wrote:

I have a method of tuning the PID but unfortuanatley, loops 3 and 4 seem to  show little response to the change in parameters.


Btw. what is "loop 3" and "loop 4"?

 

Recommendation:

  • Start over from scratch.
  • Avoid "value" property nodes, your block diagram is peppered with them…
  • Avoid classic Rube-Goldberg like "if TRUE then TRUE else FALSE" - I saw several of them at a first glance!
  • Modularize your code…
Best regards,
GerdW


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

Hi GerdW

 

Thank you for the reply. 

 

I am sorry about the code, I'm not a very good programmer and have not been doing it for long. I know it's frustrating for you. 

 

I am working on a condensed version but am currently on annual leave so I will try to get a better version to yo as soon as I can.

 

 

Loops 3  and 4 are beam centroid (x and y coordinates respectively). 1 and 2 are the same..

 

Best wishes 

Andrew 

0 Kudos
Message 3 of 65
(2,177 Views)

Hi Andrew,

 


@AndrewIons01 wrote:

Loops 3  and 4 are beam centroid (x and y coordinates respectively). 1 and 2 are the same..


I'm sorry, I cannot find anything labelled like this in your code.

I don't know which "loops" you are talking about…

 


@AndrewIons01 wrote:

I know it's frustrating for you. 

I am working on a condensed version but am currently on annual leave so I will try to get a better version to yo as soon as I can.


Yes, that code is "frustrating"… 😄

 

While you are busy with refactoring that code you should also read the LabVIEW style guidelines in the LabVIEW help.

Surely there are better ways to define subVIs than this:

When you need so many connector panes for a single subVI than your program design is simply wrong…

(That matrix wire is just hidden behind the subVI.)

Best regards,
GerdW


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

Hi Gerd 

 

This vi creates a 4x4 calibration matrix that is used in beam pointing stabilization. This links picomotor movements to the centroid values on the camera. This is then used to calculated the number of steps the picomotors need to move by. I have tried to look over the vi but couldn't understand the data flow to double check it. 

 

Would anyone be able to double check it. 

 

Best Wishes 

Andrew

0 Kudos
Message 5 of 65
(2,078 Views)

Hi Andrew,

 


@AndrewIons01 wrote:

This vi creates a 4x4 calibration matrix that is used in beam pointing stabilization. This links picomotor movements to the centroid values on the camera. This is then used to calculated the number of steps the picomotors need to move by. I have tried to look over the vi but couldn't understand the data flow to double check it. 


The dataflow in this VI is quite easy to understand: It's just a pile of 3 stacked FOR loops. There are even comments in the comment fields of the loops…

 

As you didn't attach all the subVIs (and control definitions) we cannot examine all the details of that VI.

(You might improve that VI and its subVIs: no sequence frame needed when using wires for DATAFLOW, autoindexing instead of IndexArray function, …)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 65
(2,074 Views)

Hi Gerd 

 

I have attached a revised code (beam pointing stability) it is still quite messy despite my best efforts. Would you be able to try to look at the PID again and see what why i could be observing the described behaviour. 

 

Best Wishes 

Andrew

0 Kudos
Message 7 of 65
(2,063 Views)

@AndrewIons01 wrote:

I have tried to look over the vi but couldn't understand the data flow to double check it. 

 

Would anyone be able to double check it. 


You want us to double check that you couldn't understand?

 

Please, explain what you want to do, explain what's not working as expected. To be sure, also explain the problem, your experiences and\or your expectations.

 

Does the code function, but you don't understand why?

 

Or does the code not function, and you don't understand why? In this case, we need to know what it's supposed to do. The code doesn't explain what you want to do, it does exactly what you programmed.

0 Kudos
Message 8 of 65
(2,056 Views)

Hi

 

Thank you for the reply. 

 

I apologise if I was unclear. I am unsure if this code will produce the 4x4 transformation matrix correctly? I don't know where to start with it. The code produces the 4x4 matrix but I don't know if is right, I'm just trying to troubleshoot a PID controller.   

 

The matrix is meant to relate changes in a beams position with voltage. The original problem however is the following:

 

I had a PID controller that is meant to communicate with a series of picomotors. This will return a beam to a desired target position (setpoint). The issue I am having with this is that the PID has an array input and therefore each loop can be tuned individually, I can tune loop 1 easily but the other PID control loops become less and less responsive to changes in the tuning parameters. I am unsure as to why this is, I am  just tying to troubleshoot it and make my codes simpler where possible. I would expect that the tuning parameters for loop 4 (for example) would have a large influence on the behaviour of loop 4, but it doesn't (its asleep almost).

 

Best Wishes 

Andrew 

Message 9 of 65
(2,042 Views)

That is clearer. Worth your first kudo.

 

It will be very hard for us to find errors without knowing anything about the measured results though.

 

The code of "CalibrateTransformationVectorTCPIP trasnpose removed.vi" isn't obviously flawed. But it's hard to say if it's correct.

 

To debug, I'd (temporarily) replace the measurements with static expected values. Start with validating iteration 1 (change the 4 to 1), then set it to 2 to check if anything unexpected changes.

 

If you do replace all measured values with constants, we can actually run the code when you post it. That would be a great way to help us help you.

0 Kudos
Message 10 of 65
(2,039 Views)