From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I extract a portion of a signal generated inside a control and simulation loop?

Solved!
Go to solution

I would like to extract the portion of my signal between 0 and 3 seconds. I have tried using the Extract Portion of Signal Express VI, but it is not working. I am setting the length to 3 seconds and the offset to 0. However, nothing is showing up in the output. I have used this VI before successfully, but it was not in a control and simulation loop. Is there anything special that I have to do to make it work correctly in this case?

0 Kudos
Message 1 of 9
(3,590 Views)

Or, if there is a better method for extracting a portion of a signal in a control and simulation loop, please let me know.

0 Kudos
Message 2 of 9
(3,589 Views)

I don't think this is the same as what I am looking for. I would like the portion of the signal to be extracted automatically, without input from the user.

0 Kudos
Message 4 of 9
(3,578 Views)

Did you also look at the troubleshooting provedures mentioned? If it's still not working, try this link http://forums.ni.com/t5/LabVIEW/extract-portion-of-signal-using-a-cursor/td-p/859807

0 Kudos
Message 5 of 9
(3,570 Views)

Laura

 

Could you give a bit more information of what you are trying to do? Are you trying to extract the 0 to 3 s after you simulate or you want to 'feed' 3 s for the simulation? Depending of what you are trying to do, we probably have examples that describe what you need. Did you see the examples under <LabVIEW Folder>/examples/Control and Simulation/Simulation ?

 

One thing to keep in mind is that the Control and Simulation Loop has a solver 'under the hood' and if you have VIs inside the simulation loop AND you are using a variable step size, then the simualtion won't happen as you'd expect.

Barp - Control, Simulation, RTT and HIL - National Instruments
0 Kudos
Message 6 of 9
(3,551 Views)

Hello Laura,

 

What signal are you looking to abstract the 3 seconds of information from? The best way to accomplish this in Control Design & Simulation largely depends on what you're looking to do with the 3 seconds of data. Are you looking to perform calculations on 3 seconds worth of data in the simulation loop or are you looking to simply just record that data? It may help to post your code as a reference.

 

I've personally not had experience with using the Extract Portion of Signal Express VI but I was able to get it working with a basic example. (Attached as ExtractSignal_CDSim). It is important to remember the execution nature of the Control & Simulation Loop compared to the standard LabVIEW Loop environment. Functions running inside of the Simulation loop operate on your defined simulation time. If you aren't careful about what labels you use on graphs this can get a bit confusing. Just remember to investigate the simulation and step size of your Simulation loop timing parameters.

 

Configure Simulation Parameters Dialog Box

http://zone.ni.com/reference/en-XX/help/371894G-01/lvsim/sim_configparams/

 

In any case, If you need help getting your specific code working, go ahead and post it and explain a bit further on what you're looking to achieve with the code. I'll do my best to give a recommendation and help you get everything figured out!

Tim A.
0 Kudos
Message 7 of 9
(3,546 Views)

My ultimate goal is to calculate the time between each pulse . In my attached example, the time is the same between each pulse, but it will be variable later on. I have decided to change my strategy and try the pulse measurements vi. What I want it to give me is a measure of the time between each pulse, which will then be used as an input for another process (not shown yet). I have attached my code for reference. Do you have any suggestions on how I should be doing this?

Spoiler
 

 

0 Kudos
Message 8 of 9
(3,530 Views)
Solution
Accepted by topic author Laura121

This forum shows how to measure time between digital pulses http://forums.ni.com/t5/LabVIEW/Measuring-time-between-digital-pulses/td-p/1056881

 

Also, this would be a good link https://decibel.ni.com/content/docs/DOC-12160

 

 

0 Kudos
Message 9 of 9
(3,525 Views)