LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loop iteration without FoR loop...

I am designing a LabVIEW software for PID control algorithm. In the manual mode operation, due to the criticality of the system, the valve % should not suddenly jump to the new valve % value in one go, instead it should go at a rate of 1%/second. For example, if the current valve % is 30% and we want to set it to 50% then it must open the valve in steps of 1, that is, 31, 32, 33 and so on till 50%. How can I achieve this without using a 'for' loop? I am using different subVIs (e.g. to read/write P,I,D values, to read/write Setpoint etc) in the main VI program. Read/Write valve% value is also one of the subVIs. The attached images show the basic idea, but I am not able to do it properly (without using For loop). Can anyone help me out?

Download All
0 Kudos
Message 1 of 7
(2,909 Views)

I don't see a for loop in those pictures. If you attach the VI, we can actually help.

Certified LabVIEW Architect
0 Kudos
Message 2 of 7
(2,869 Views)

The vi in the images shown should work - but I don't know the context of how you're calling them. If you would share your code you would get a lot better quality help.

 

While I do not think a FOR loop is required for your application, nor even how a FOR loop would be beneficial (again, I've not seen your code so I don't know), I do wonder why the arbitrary requirement to do this without a FOR loop was implemented. It's usually better to use the tools that work than to add some arbitrary requirement.

0 Kudos
Message 3 of 7
(2,859 Views)

@rajesh111 wrote:

In the manual mode operation, due to the criticality of the system, the valve % should not suddenly jump to the new valve % value in one go, instead it should go at a rate of 1%/second. For example,


Isn't the point of the PID to limit the ramp rate, overshoot, etc?  Design your PID correctly and this should not be an issue.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 7
(2,845 Views)

Anything you do with a For Loop you can do with a While Loop.  Both iterate, using an "index" labeled "i" in the lower left corner that increments by 1.  The While Loop stops when the Stop indicator is set to True, the For Loop stops on various "counting" conditions (depending on whether N is wired or not, or whether inputs are brought in through an Indexing Tunnel).  There are a few "specializations" that you can mimic with additional code:

  • A While Loop always executes what's inside at least once, while a For Loop might never execute what is inside (for example, if you bring an empty array into a Tunnel).
  • Hmm, can't think of other significant differences ...

Bob Schor

0 Kudos
Message 5 of 7
(2,842 Views)

In the PID pallette there's also a rate limiter that will achieve this.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 7
(2,833 Views)

@crossrulz wrote:

@rajesh111 wrote:

In the manual mode operation, due to the criticality of the system, the valve % should not suddenly jump to the new valve % value in one go, instead it should go at a rate of 1%/second. For example,


Isn't the point of the PID to limit the ramp rate, overshoot, etc?  Design your PID correctly and this should not be an issue.


Reading between the lines...

 

"PID Advanced.vi" has a manual input that allows us to set the output manually and will allow for bump-less transition to PID control.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 7
(2,810 Views)