03-07-2014 09:58 AM - edited 03-07-2014 10:00 AM
Dear
I really confuse about the difference between control simulation loop and traditional while loop
their is no an information about such difference in NI web or user guide
The labview Control and Simulation Module contains a block diagram for simulation of linear and nonlinear continuous-time and discrete-time dynamic systems
but also we can use traditional while loop for simulation of linear and nonlinear continuous-time and discrete-time dynamic system
so what are the difference ??
is my information for traditional while loop is wrong ???
please for any member can list his difference as he see to see all possible differences
thank in advance
best regards
03-08-2014 09:39 AM - edited 03-08-2014 09:43 AM
mangood,
The While Loop is LabVIEW is used to just 'repeat' the operation inside the loop until the boolean is change to ON. It does not have notion of time or, the most important, it does not have a solver unless if you code this up. You can use 'wait until next ms' to enforce time and, then, you can try to do integration by any method obtained in text book.
Now, the Control and Simulation loop was designed to solve nonlinear equations. It has a 'solver' under the hood that evaluate the expressions inside the loop. It also has notion of time and it keep track of several states. Also, it allows the signal flow feedback where this would be a broken wire in LabVIEW dataflow. (http://zone.ni.com/reference/en-XX/help/371894G-01/lvsim/sim_simulation_loop/). One more thing: if you are using simulation functions (from the Simulation Palette), most of those functions can only be dropped inside the SIM loop.
So, in general, if you do not have any Simulation function (like the integrator) or you don't need to solvers, you should just use the for loop. We have several examples in PID and Fuzzy Logic that don't require the simulation loop since they are solved by using simple discrete time-steps and we used pure LabVIEW code for doing simulation. However, as you start to get more complex system, you will notice that discrete time-steps could not be good enough to solve complex plants, so then you would need to model and use the Control and Simulation loop.
Hope this helps to clarify,
03-08-2014 09:41 AM - edited 03-08-2014 09:47 AM
One more thing... you information about While loop is not incorrect, but it would need a lot of coding to make this simulation to work (you have to develop your own solver). The Control and Simulation loop help you to have this coded for you and you can just focus on the nonlinear equation to be solved.
Of course, this is true if you are not using the Single-stepping subsystem. In the mode, we allow you to drop the Subsystem into a simple while, for loop or Timed-loop and we would script the solver 'under the hood' for you. The major difference in this mode is that you only allow you to use "fixed step size" solver. Here is the documentation:
03-10-2014 06:40 AM
@Barp wrote:
One more thing... you information about While loop is not incorrect, but it would need a lot of coding to make this simulation to work (you have to develop your own solver). The Control and Simulation loop help you to have this coded for you and you can just focus on the nonlinear equation to be solved.
Of course, this is true if you are not using the Single-stepping subsystem. In the mode, we allow you to drop the Subsystem into a simple while, for loop or Timed-loop and we would script the solver 'under the hood' for you. The major difference in this mode is that you only allow you to use "fixed step size" solver. Here is the documentation:
thank you barp
i note the second differnce between the loops is the feedback node as shown below
where thier is no feedback node in simulation loop if wire feedbacked to input