06-09-2014 11:43 AM
Hi there,
I just realized there's probably a much more straightforward way to do this. In the Control Design & Simulation palette in LabVIEW there is a ramp signal VI. It's under Simulation >> Signal Generation >> Ramp Signal. Since you should have a solid knowledge of the rate your loop is running at you should be able to do some math to set the slope to ramp up at the rate you desire. Do you think that will work for you?
06-30-2014 09:59 AM
Hi,
I'm also trying to create a clock similar to the one in Simulink, but It's because I cannot be sure how long my loop takes to run. Is there a way to measure how long a loop takes to execute before it restarts? Or possibly some way to read the system time?
Sorry to hop on this question, but this is the first time I've found someone trying to emulate the simulink clock in labview.
07-01-2014 12:51 PM - edited 07-01-2014 12:53 PM
ash007- You've probably discovered this already, but the reason your local variable wasn't updating was because your CD&Sim loop didn't have the correct simulation parameters. It looks like it wasn't updating or reading the local variable at a useful rate. If you change the simulation time to run in actual time, ie running with a .001 time step and 1 KHz source, the value updates correctly.
NA7 - You can determine the executition time of a loop by using our standard benchmarking tools. Here are a few examples:
https://decibel.ni.com/content/docs/DOC-11078
http://www.ni.com/example/25532/en/
You can read the system time with a Get Date/Time In Seconds.vi
If you are using a Control & Simulation loop take note of the simulation parameters to make sure simulation time is what you intend it to be, because it can be faster or slower than actual time.
MATLAB®, Simulink®, and Real-Time Workshop® are registered trademarks of The MathWorks, Inc. All other trademarks are the property of their respective owners.