04-27-2009 05:47 PM
Dear Sir
I posted these files before but I added again under the simulation loop discussion because I need any help about:
I. Modifying the clear button to clear the graph and also initialize the simulation time to restart again.
2. Modifying Pause button to let the chart to pause during simulation
04-27-2009 08:28 PM
Can't read your file because I only have 8.2 here at work. 😞
but...
Clear button: Hook it up so that it writes an empty array to the history property of the graph (you will need to add a property node and select the history property). Should work if I understand you correctly.
Pause button: Can't address without seeing code.
04-27-2009 10:25 PM
Hi Ahmad
I am not clear about your problem.Explain briefly
04-28-2009 08:47 AM
Briefly, when pressing the pause button the value of chart comes to zero but I don't like that I just want to pause the graph and when pressing again it starts again.
Also, for clear button, it clears the graph but the simulation time still continue but I want to restart the simuation time after each pressing of cleara button to clear chart and counts the time from initial time zero.
I hope anyone to solve it for me quickly
04-28-2009 10:46 PM
04-29-2009 09:36 AM
Hey Ahmad,
One of the things that may prevent you from doing the pause and clear like you are wishing to do is the fact that you are using a simulation loop. Is there a particular reason why you chose to use a simulation loop? Perhaps you could use a simple timed loop (available from Functions»Programming»Structures»Timed Structure) instead. This would give you the same timing control as with the simulation loop, but you could also implement some of the suggestions made by Baji.
Hope this helps.
-Ben
04-29-2009 09:48 AM
Dear
The reason for using the simulation loop that I have two differential equations dependent on each other. I sent to the forum before to use the simple timed loop but I still have problem about how to convert the subvi to strictly vi reference because when I used the ODE function the input of F(x,t) requires my subvi to be a strictly vi reference but no one in the forum helped me about this problem so that I made a simulation loop to implement a differential equation using integrator or differentiator.
04-29-2009 03:46 PM
Hey Ahmad,
Since you are looking to work with ODE, the simulation loop may be a better choice for your application. One of the problems you are seeing in your example code in regards to pausing, when you press your 'pause' button, you are getting zero's because you are not pausing your simulation. You are simply not passing your calculated values to your waveform. So what you really want to do is pause your application. This would be very do-able with that timed loop or as Baji has done in his example. However, like Baji pointed out, you cannot use the front panel objects in a simulation loop. So, pausing you application would be difficult. One possibility would be to simply use the 'Pause' option on your execution toolbar.
Also, in terms of the clear button. It sounds like you are more interested in restarting the simulation so it may be useful to stop your simulation loop using the Halt vi (Functions»Control Design and Simulation»Simulation»Utilities»Halt Simulation). Then, since your simulation loop is within a while loop, you will restart the simulation.
Hope this helps.
-Ben