From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Setpoint values for PID

Hello everyone, 

I have been trying a lot lately to finish a PID control loop. In general my loop works fine, but the problem I stuggle with is the setpoint values. For now, i manually set the setpoint from a control in the front panel. What I want to do is: read a file (txt or excel) with values (one column, multiple rows) and then take this values as setpoint. Start with the first one, do a control loop and then change the setpoint with the second value, do again a control loop and then take as setpoint the third value etc.  

Pleace any suggestions? If anyone has done it previously I would appreciate uploading the vi. 

Thanks a lot

0 Kudos
Message 1 of 11
(3,577 Views)

Attaching a lvproj file does not show us your project.  That is just a file that defines all the other files in your project, it doesn't actually contain any code.  You need to attach actual VI's.  If it is a lot of files, zip up a folder of them and upload that zip file.

0 Kudos
Message 2 of 11
(3,545 Views)

Ok, I am sorry, I did not know that. I attach a rar file with the VI's. I will be glad to hear suggestions for my problem

0 Kudos
Message 3 of 11
(3,470 Views)

Thank you for actually posted a .zip file, and not a .rar file is an uncommon compressed file.

 

I see a problem with your code in that you use the tab control terminal to control a case structure.  There is hardly ever a reason to do this.  A tab control is more of a front panel element to control organization of a display, not generally meant to control the execution of the code.

 

Where the code falls part,  is that if one case is executing, the other output is using a default tunnel, and thus outputting a zero.

 

Get rid of the case structure.  I believe you really want to both control humidity and temperature at the same time, so the stuff in each case of that structure belong in parallel within the loop.

Message 4 of 11
(3,467 Views)

Ok i understand your point. It makes sense. I will start changing my vi. What about my question for having setpoint values from an array? I want to read a file (txt or excel) and then take those values and pass them as setpoint. For example if i have a file with temperatures (10, 15, 20, 25, 30), I want to read it and then use as a setpoint firstly 10, after the control loop is done, take as setpoint 15 and goes like this. Is that possible?

Message 5 of 11
(3,464 Views)

Ok i changed the Vi according to your suggestions. But i have no idea how to automatically change the setpoint with values coming from the array as i previously said. Also i would like to make clear that when i say setpoint changes after a control loop i mean, process variable becomes equal to setpoint. Then setpoint should change (take next element of the array). 

0 Kudos
Message 6 of 11
(3,460 Views)

Index the first setpoint out of the array.  Keep looping.  When the condition is met, then update the index value (you keep that in a shift register (and index out the next value from the array.).

0 Kudos
Message 7 of 11
(3,456 Views)

Could you please post a photo or vi how this is done? I dont really manage to make it. I know only to put condition in index. I have no idea how to use shift register with condition. 

0 Kudos
Message 8 of 11
(3,446 Views)

I also post my try to make it work. 

0 Kudos
Message 9 of 11
(3,436 Views)

See attached modification.

 

It probably isn't exactly what you need.  And it doesn't have any code to handle what happens when it gets to the last step.

 

But at least this should give you a visual at to what I told you in words and give you ideas.

0 Kudos
Message 10 of 11
(3,428 Views)