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: 

PID instrumentation and application

Solved!
Go to solution

Hi Milon,

 

when you want to switch on/off those pumps I would go like this:

check.png

I don't have LINX/LIFA installed, so cannot comment on the related functions. It seems "wrong" to me when you try to control two different pumps using the very same inputs on those Arduino functions…

 

I also don't have any book.

There even is no library at your school/university/factory/town?

Not even access to Wikipedia?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 21 of 35
(1,169 Views)

Hello Mr. GerdW

Sorry, I am replying a long time later. How can I set a duty cycle in this PID code? Thanks in advance.

0 Kudos
Message 22 of 35
(1,142 Views)

Hello Mr. GerdW

Greetings. I am trying to add a duty-cycle in my PID code. Previously you gave some hinds. But I failed to understand. I am sorry for my foolishness... In the attached code, I tried to follow your instruction but didn't succeed...

0 Kudos
Message 23 of 35
(1,097 Views)

Hi Chowdhury_Milon,

 

I suspect you can move the "Set Digital Pin Mode" VIs outside of the loop, and I wonder if it might be better to serialize the two value setting VI calls (Digital Write Pin).

That aside, what do you mean by Duty Cycle in this context? Do you only want the PID loop to function some of the time? Or you want to pulse the digital output?


GCentral
0 Kudos
Message 24 of 35
(1,078 Views)

Hi Milon,

 

did you understand the logic behind that adding with "i" and using Q&R with 40?

 

Try this:

check.png

This will create a slow PWM signal with a frequency of 0.1Hz (40*0.25s wait time), and it will switch to your other relay when the PID output changes sign…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 25 of 35
(1,068 Views)

Hello Mr. GerdW,

First I want to beg pardon because I am replying to you continuously. I should try myself but I can't understand some mysterious problems...

1. I made a basic data acquisition code for some nutrients quantification of a nutrient/fertilizer control system (attachment 1). Then I added an on/off based pump control option using Arduino for automatic fertilizer supply and mixing (attachment 2). To improve nutrient mixing efficiency, I am trying to apply PID/PID advance options (attachment 3). Attachment 2 works well but attachment 3 doesn't work. I showed ERROR -200279. The error message is different form general. I tried to solve the problem but couldn't. 

 

 2. The data/reading of the basic PID code (pic 1, attachment 4) and the basic data acquisition code are different (pic 2, attachment 1) are different. However, experimental setup, sensor connection all were the same.

 

Actually, I am giving help post frequently. I have to complete my experiment very soon as my annual progress report submission deadline is 30 Oct 2019. Please help me...

0 Kudos
Message 26 of 35
(1,033 Views)
Solution
Accepted by topic author Chowdhury_Milon

Hi Milon,

 


@Chowdhury_Milon wrote:

1. I made a basic data acquisition code for some nutrients quantification of a nutrient/fertilizer control system (attachment 1). Then I added an on/off based pump control option using Arduino for automatic fertilizer supply and mixing (attachment 2). To improve nutrient mixing efficiency, I am trying to apply PID/PID advance options (attachment 3). Attachment 2 works well but attachment 3 doesn't work. I showed ERROR -200279. The error message is different form general. I tried to solve the problem but couldn't. 


Error -200279 says: you are calling DAQmxRead not fast/often enough…

 

I recommend to place another consumer: do the DAQmxRead call, process the data into the PID call. Send the PID output to your next consumer to actually drive your digital outputs.

Don't do any file writing in the DAQ loop - as you do right now!

Don't fiddle with buffer size at DAQmxTiming - read the LabVIEW help for this function carefully!

 

And last, but not least: DON'T ADD A WAIT FUNCTION INTO THE DAQ LOOP, THAT WAITS FOR 5 SECONDS!

 

Simple example:

check.png

For simplicity I used a local variable to transfer data to consumer loop, use a queue/notifier/channel here…

(For simplicity I also removed that LINX code, I don't have this toolkit installed.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 27 of 35
(1,018 Views)

Hello Mr. GerdW

Greetings. Although, I marked this problem as solved, but newly facing another minor problem. The attached picture is the result of the attached code. The code is working very good, but the problem is, after getting the target K ion level steady (I have to show minimum 30 s in steady condition), this control code needs to be stopped and go the next step (attached code has been added in another 'Flat Sequence structure.vi')... I have added an "In Range and Coerce" but not working as I am expecting. The code is stopped when the K ion level first crossing of the target level (1. Red circle), not in the steady-state condition. How can I solve this problem?

Thanks in advance.

Download All
0 Kudos
Message 28 of 35
(974 Views)

Hi Milon,

 


@Chowdhury_Milon wrote:

the problem is, after getting the target K ion level steady (I have to show minimum 30 s in steady condition), this control code needs to be stopped and go the next step (attached code has been added in another 'Flat Sequence structure.vi')... I have added an "In Range and Coerce" but not working as I am expecting. The code is stopped when the K ion level first crossing of the target level (1. Red circle), not in the steady-state condition. How can I solve this problem?


Your loops stop as soon as "K ion" is between 210 and 220. So probably the loops stop once "K ion" is getting larger than 210 the first time. Atleast this is the way you programmed this…

 

When you need a different stop condition then you need to give a different expression for this. When should the loop stop? Can you define this using clear words?

 

On your VI:

  • What is the purpose of those classic Rube-Goldberg contructs? Why do you need two Select nodes, wired with TRUE/FALSE constants as inputs? They mimic a basic NOT functions! And when you need a NOT, then you can also exchange the comparison before: NOT(smaller than) == larger or equal…
  • Why are the missing subVIs just named "untitled x" (with "x" being a number)? Why don't you give meaningful names to those subVIs?
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 29 of 35
(960 Views)

Mr. GerdW

I am sorry for my poor explanation and poor English efficiency. I have to do two main tasks.

1. Preparation of a target nutrient solution for plants.

2. Supply of that nutrient solution in a fixed interval.

 

I can prepare my targer nutrient solution using the existing code (as showed in the picture). But after that I need to supply that to the plants. For this purpose, I want to stop the nutrient solution preparation and go to the next step. I am using Flat Sequences Structure for this purpose (that code is not attached here). 

 

As I said before, after getting the process value (PV) steady state (after 190 s in the picture), I want to stop this code and go to the supply step. How can I go to the supply step by stopping this nutrient solution preparation code?

0 Kudos
Message 30 of 35
(954 Views)