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.
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.
05-20-2017 08:32 AM
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
05-20-2017 11:46 AM
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.
05-21-2017 12:34 PM
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
05-21-2017 02:16 PM
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.
05-21-2017 02:49 PM
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?
05-21-2017 06:32 PM
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).
05-21-2017 10:12 PM
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.).
05-22-2017 06:12 AM
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.
05-22-2017 07:11 AM
I also post my try to make it work.
05-22-2017 08:09 AM
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.