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: 

Case structure on design and simulation loop

Hi all,

 

I am trying to create a user friendly panel to convenient myself in control and minotor a plant performance from several PI tuning method. For example when i selected A tuning method, then the graph should appear A performance, then when i select B tunign method, the graph should appear B performance.

 

I had attempt to work out but the result is shown in different graph and the result cannot run continuously as i change the input, the output is only change when i re-run the whole Vi. (picture below).

1.png

2.png

 

So i move out the graph and the input outside the case structure, consequently, the graph is not working ooutside the design and simulation loop.

 

3.png

Do anyone can help me solve my problem above? Thankyou very much.

 

0 Kudos
Message 1 of 14
(2,924 Views)

Waveform charts "collect" a signal when their input wire gets data. So in the last screenshot, your chart will only get a data point when you exit the case structure. When LV exits the case structure, the input wire to the waveform gets data and the waveform chart collects it. Therefore, you'll want to keep your charts on the simulation diagram so they collect every data point. Perhaps you can write to a local variable of the chart in the other diagram.

0 Kudos
Message 2 of 14
(2,918 Views)

Yuki

 

As usual, there are several ways to solve the problem you are running into. Maybe the simplest change to have one graph and simulation running on the same graph, change the SimTime Waveform by a 'Utilities >> Collector' and use a XY Graph outside the loop. This should allow you to change graphs and plot on the same location.

 

Hopefully that should do the trick.

Barp - Control, Simulation, RTT and HIL - National Instruments
0 Kudos
Message 3 of 14
(2,916 Views)

Hi dbohls,

 

Thankyou for your reply, what you  mean by a local variable of the chart in other diagram?

0 Kudos
Message 4 of 14
(2,904 Views)

Hi barp,

 

Thankyou for your reply. I had attempt to work out as what you mention, but the graph does not show any response. Is picture below shows i am doing the right way?

4.png

0 Kudos
Message 5 of 14
(2,903 Views)

If you right click you XY graph on of the options is create. If you go to that you will see the option to create a local varible. Is is like and extra copy of your graph so you can have one in each loop.

 

Example.png

Tim
GHSP
0 Kudos
Message 6 of 14
(2,900 Views)

Yuki,

 

From the block diagram, you can right click on a control/indicator and create a local variable that can you can use to read from or write to the control/indicator. Read about it in LabVIEW's help file if you need more info on that.

 

Regarding your trouble with the collector, can you post your VI?

0 Kudos
Message 7 of 14
(2,898 Views)

Dbohls,

 

Thanks you for your reply,

ok, while i try to read the help file, this is the regarding VI.

0 Kudos
Message 8 of 14
(2,893 Views)

Hi dbohls,

 

I had try to use the XY graph local variable inside the loop and remove the wire to the XY graph,but the graph still not responding.

0 Kudos
Message 9 of 14
(2,892 Views)

Yuki,

 

You had a couple of problems.

 

1) You have your sim loops set to run for infinity. When a simulation loops executes, it runs the entire simulation from the start time to the finish time. If you run to infinitiy, it will keep running until you halt the VI, halt the simulation using a halt block, or the sim loop encounters an error. How can the result from the collector get to your graph on the outside of the sim loop if you never let the sim loop finish?

 

2) The collector does not produce any output until the final step of the simulation.

 

I attached an example that uses some local variables.

0 Kudos
Message 10 of 14
(2,885 Views)