LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID tuning array instance

Hi 

 

Thank you for the kudo and the reply. 

 

I am currently trying to tune the PID the moment, but I can replace all the measured values with constants and repost it at ASAP. I will uploads the whole code to this might provide some more insight to project. I also have another general question: 

 

I read that when a multi-parallel loop PID controller is being tuned and if only one array of parameters is adjusted, the PID controller will then apply those values to all of the PID loops. When I attempt this, I see the following image where the non-edited loops have non-zero values by defult. 

 

My question is, which values are applied to the (greyed out loops) the ones that are in there already or the ones I am adjusting (top loop)? 

Multi-Loop Control - LabVIEW 2018 Help - National Instruments (ni.com) 

Have I misunderstood? 

 

Best Wishes 

Andrew

0 Kudos
Message 11 of 65
(1,426 Views)

@AndrewIons01 wrote:

Thank you for the kudo and the reply. 


Well, they are free to give 😉.

 


@AndrewIons01 wrote:

My question is, which values are applied to the (greyed out loops) the ones that are in there already or the ones I am adjusting (top loop)? 

Multi-Loop Control - LabVIEW 2018 Help - National Instruments (ni.com) 

Have I misunderstood? 


But what is the code that created those indicators?

 

I don't recall any NI PID VI in the first VI, and frankly, didn't go through the 2nd (because it's huge).

0 Kudos
Message 12 of 65
(1,422 Views)

Hi Andrew,

 


@AndrewIons01 wrote:

I read that when a multi-parallel loop PID controller is being tuned and if only one array of parameters is adjusted, the PID controller will then apply those values to all of the PID loops. When I attempt this, I see the following image where the non-edited loops have non-zero values by defult. 

 

My question is, which values are applied to the (greyed out loops) the ones that are in there already or the ones I am adjusting (top loop)? 

Have I misunderstood? 


Where are "greyed out loops"?

All I see is a greyed out element in an array indicator! Basic LabVIEW knowledge: a greyed out element in an array is a non-existing element!

 

So a non-existing element cannot be applied somewhere in your code…

Best regards,
GerdW


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

Hi Gerd 

 

First of all the PID loops are there in the array inputs in the block diagram. When I created the control for the PID gains, they appeared greyed out. If I double clicked on them I could interact with them.

 

 Can you please show me a picture. 

 

Best Wishes 

Andrew

 

0 Kudos
Message 14 of 65
(1,414 Views)

Hi 

 

I know the second one is huge, I have been trying to condense this thing but its becoming harder and harder. I have attached what I think (might be) a better version that includes everything. I have also attached the PID VI separately too. 

 

If anything is unclear please do tell me (am eager to find a solution). 

 

Best wishes 

Andrew 

0 Kudos
Message 15 of 65
(1,411 Views)

Hi Andrew,

 

see this from your "PID…" VI:

It makes absolutely NO SENSE to index 4 elements from an array consisting of just one element! (The same applies to the "PID gains": when you want to control 4 systems then you should supply 4 sets of PID gains!)

 

Did you take those Training resources at the top of the LabVIEW board to learn the very basics?

Best regards,
GerdW


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

Hi Gerd

 

Yes I did take the basic training in LabVIEW.

 

 

And I didn't realise that those were only consisting of 1 element. I thought in included all 4 but must have made made a mistake and not double checked it. It is meant to be 4 not 1.

 

Best wishes 

Andrew 

0 Kudos
Message 17 of 65
(1,395 Views)

@AndrewIons01 wrote:

And I didn't realise that those were only consisting of 1 element. I thought in included all 4 but must have made made a mistake and not double checked it. It is meant to be 4 not 1.


Normally things in LabVIEW that accepts arrays will use the shortest array to iterate.

 

So, a for loop with auto indexing, will iterate until the smallest array is done.

 

A PID loop with a 1 element array and a 4 element array will only iterate 1 time.

 

So to answer your earlier question about values used for the other loops: they are not even considered. But if you index them, using Index Array, you will get the default value for the type. So for doubles, indexing 2, 3 and 4, you will get 0.

 

Note that extracting Index Array will automatically give you the next index. So, 0 is the default 1st index, then you index 2, 3 and 4. 2, 3 and 4 will all return 0 (because the array is only 1 element).

0 Kudos
Message 18 of 65
(1,383 Views)

Hi Andrew,

 


@AndrewIons01 wrote:

And I didn't realise that those were only consisting of 1 element.


You can avoid such simple problems by cleaning up your code, similar to what I did for the image in my last message.

"Clean" block diagrams are easier to understand and there is less space for errors to hide!

 

There's a reason why I insist on "cleanup!" so often in the forums… 🙂

Best regards,
GerdW


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

BTW, Index & Bundle Cluster Array is great for what you're doing:

 


Index and Bundle.png

The big difference is that with IBCA, the solution grows automatically if your array grows. If you ever go from 4 to 7 PID controllers (or from 4 to 2), this code doesn't need to be adjusted at all. That's what you should want as a programmer: code that is care free.

 

Still, if one array is 4 elements, and the other is 1 element, the output is 1 element.

0 Kudos
Message 20 of 65
(1,376 Views)