04-22-2012 06:19 PM
First of all, let me just say, I've got to hand in my work in 24 hours so please any help will be appreciated.
I've got a simulation loop inside a subVI inside a simulation loop. If I give the inner loop enough time to run, i.e make its duration smaller than the time step of the outer simulation loop. Shouldn't everything run smoothly? Or is this just a no-no with labview?
Thank you
04-23-2012 07:47 AM
Or if I make my outer loop run as fast as possible and make the inner loop run at a specified speed, as long as my outer loop isn't too computationally heavy, should it more or less run at the inner loop speed?
04-24-2012 10:37 AM
Hi VicMackie,
Hope you make your deadline on time!!
In theory, your outer loop should also run at inner loop speed although as there's some coding in the outer loop it is likely to be at least marginally slower.
Thisuser guide for the simulation interface toolkit may help you a little too.
Kind regards,
04-24-2012 10:46 AM
Don't forget the profiling tool. It can break down how much time each .vi is using.
04-24-2012 12:30 PM
Cheers people. Both good points. My main problem now (which is so weird because I thought I had solved this) is the loop timing. I've now scrapped the idea of having a simulation inside a simulation loop. However now my loop wont work properly. If I synchronize the loop with a 1khz timing source, surely making the step timing 1e-3 should make everything run second by second (if you get what I mean). My loop seems to be running slower for some reason...
04-24-2012 12:33 PM
Forgot to add my period for the simulation loop is 1.
04-24-2012 12:47 PM
Sorry not to keep bumping this but just to make my problem clear to you guys. I'm simulating the basic operations of an engine; torque generation, then distribution to wheels, acceleration, then integrate this with respects to time to find the new speed. For every second in real time I want my sim loop to have simulated 1 second. How do I manage this??
I've tried making my step size a milli second, making my period a milli second but its going too slow...
04-30-2012 04:35 AM
Hi VicMackie,
This help file on the properties of the Simulation Loop is likely to help you out.
I believe from you posts that you're wanting the loop to run every second.
Therefore you want to check "Synchronize loop to timing source" and set your 1kHz clock or set a 1kHz <reset> so that it'll reset on every invocation of the loop. From your post, I understand that you've already done this.
As the period is in milliseconds, for a period of a second you'd want to set your period to 1000 milliseconds, which is the default (1000).
I'd recommend leaving the step size at the default for now and just modifying the Timing Parameters tab to confirm whether the loop will execute every second if you set the period to 1000.
Best wishes,