LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to make my waveform in control and design simulation run continuously?

Solved!
Go to solution

Hi all, i m a begineer of Labview and have some question to ask.

I am using the Labview to design and implement a controller for FOPTD system, but i found that the waveform in the "control and simulation loop" is not running continuously. I mean it keep repeat in the same graph from 0 to 10second. Is there any approach to make it run continuously? 

Thankyou very much.

 

 

Download All
0 Kudos
Message 1 of 12
(5,167 Views)
Solution
Accepted by topic author YukiWong

Each time a Control Design and Simulation loop is executed, it runs a complete simulation, from the initial time to the final time. When you drop down a new CD & Sim loop, the default values are zero seconds for initial time and 10 seconds for final time. I'm guessing what you probably want is for the simulation to not stop at 10 seconds. Double click on the left node attached to the CD & Sim loop and extend the final time. You can change the final time to "Inf" if you want it to run until the VI is stopped.

0 Kudos
Message 2 of 12
(5,116 Views)

Also, just to complement dBohls response, you could just use the "Run Continuously" button. It is on the right of the "Run" button. In using this button, it will repeat the 10 s until you are able to tune your PID controller.

 

If you decide to do dBohls solution, you will also need to change your step response by a 'pulse' response to keep changing the setpoint for infinite number of time.

 

Notice that, to run forever, you can change the final time to "inf" and you have to use the "Halt Simulation" function to stop its execution.

Barp - Control, Simulation, RTT and HIL - National Instruments
0 Kudos
Message 3 of 12
(5,110 Views)

@Barp wrote:

 you could just use the "Run Continuously" button.


BLASPHEMY!  And from a NI rep too. Smiley Sad

 

Well, I guess it's OK to use it to show a concept or for debugging but still... 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 4 of 12
(5,104 Views)

well, if the button was not useful then it would not be there....

 

He is just trying to tune the PID and using the "Run Continuously" would help him change parameters interactively WITHOUT changing his actual code. I also added the necessary information for him to change his code to run 'forever', but that requires him to change his code AND the user needs to build confidence first.

 

The reason we do not recommend (notice that we say "recommend" not "prohibit") the use the "Run Continuously" is because this mode could have performance issues when used in more complicated applications, in special Data Acquisition or file I/O system. So, in general, we recommend you to code the beginning and ending of the code and avoid using the "Run Continuously". However, maybe you don't need to do this.

Barp - Control, Simulation, RTT and HIL - National Instruments
0 Kudos
Message 5 of 12
(5,100 Views)

Smiley Happy Don't get me wrong, it was just a little friendly poke at your suggestion. My opinion is that it should be used for an occasional debug aid or just to quickly check out a programming concept.  I wouldn't suggest its use to a LV newbie though as it may be mistaken as proper programming practice.  It does have uses but the fact that you have to use the abort button to stop your VI makes it a poor choice for even the most basic VIs.  I remember the words of one wise poster on these forums: 

"Hitting the ABORT button to stop your VI is like hitting a tree to stop your car.  It works, but there are better ways!"

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
Message 6 of 12
(5,091 Views)

This made me wonder why you cannot toggle off "Run Continuously." I found that you can while the VI is paused.

 

Edit: Huh, actually pausing is not even required. Maybe the UI just wasn't responding during my first attempt.

0 Kudos
Message 7 of 12
(5,089 Views)

Hi ya, i had changed my Final Time to "inf" but the waveform run too fast, how to the make the waveform slower?

0 Kudos
Message 8 of 12
(5,068 Views)

thanks dbhols and Barp, but i had face problem that the waveform run too fast and i can't observe the result clearly.

0 Kudos
Message 9 of 12
(5,065 Views)

Well, my suggestion then is to do the following: change final time from Inf back to 10 s (or whatever number that capture the whole simulation) and do a while loop around the Control and Simulation Loop with a "wait until next ms" function to give you time to react and change parameters, like this below. This would make LabVIEW to do the whole simulation, wait for 1000 ms and then, run the simulation again with new parameters. If you need more time, just need to change the constant wired to the "wait until next milisecond".

 

Run Continuously Programmatically.png

Barp - Control, Simulation, RTT and HIL - National Instruments
0 Kudos
Message 10 of 12
(5,047 Views)