LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simulation loop inside subVI inside a simulation loop

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

0 Kudos
Message 1 of 8
(3,199 Views)

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?

0 Kudos
Message 2 of 8
(3,177 Views)

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,

Tori
Student
Message 3 of 8
(3,159 Views)

Don't forget the profiling tool.  It can break down how much time each .vi is using.

 

Message 4 of 8
(3,157 Views)

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...

0 Kudos
Message 5 of 8
(3,151 Views)

Forgot to add my period for the simulation loop is 1.

0 Kudos
Message 6 of 8
(3,149 Views)

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...

0 Kudos
Message 7 of 8
(3,144 Views)

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,

Tori
Student
0 Kudos
Message 8 of 8
(3,131 Views)