DASYLab

cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop a measurement with calculated time criteria

Hi,

I am a new user in Dasylab 2016 and I always use the stop module to stop a measurement after a specific amount of time in seconds.

 

I want to log a sine wave signal and stop the measurement after a specific amount of cycles. I am using global variables to input the frequency of the expected signal and the amount of cycles I want to log. I calculate the total logging time before the start of the measurement. I can't find a  way to automatically stop the measurement after the time criteria is achieved.

 

To make my question easier, How to stop a measurement using a global string or a calculated time via a formula interpreter module?

 

Thank you

0 Kudos
Message 1 of 6
(2,949 Views)

Hi again,

 

I tried to solve my problem using an action module. My problem now is that the measurement doesn't stop always.

 

For example: If I setup the program to log an 1 Hz signal and 10 cycles of it then the measurement stops at 10 seconds. If I try to log 0.9 Hz and 10 cycles of it, the measurement should stop at 11.11 seconds, but this doesn't happen.

 

Don't worry about the DT input module. I transfer the worksheet to another computer.

 

Any ideas?

Download All
0 Kudos
Message 2 of 6
(2,913 Views)

Hi Corey,

 

There are a few ways to approach to this. Myself, I like to use the Combi Trigger module to generate a pulse based on some criteria. You designate how the trigger signal should go up (start) and how it comes back down (stop). If you set stop to Never, the trigger never resets. But if you set it to Direct, you can designate a time or number of samples it stays high. A simple example of this is to connect the trigger output to a Relay module. Set the trigger start to go up when the data value exceeds 0.0 volts and stay up for 5 seconds. The trigger signal will allow the relay to stay open for 5 seconds letting data flow elsewhere - like a Write Data module. 

 

In the attached DASYLab 2020 example, I use the Combi Trigger twice, once to begin data flow when the sine wave exceeds 0.0v and the other to detect 5 sine wave cycles. Action module reads a Counter that is connected to the Combi Trigger. When it detects 5 cycles it opens the relay blocking the flow of data.  You need to DASYLab FULL or Pro to use the Action module. Take a look at the example and if you have questions let me know.

 

I hope this helps...

John@MCC

0 Kudos
Message 3 of 6
(2,910 Views)

If you really want to use the Action module, you need to change the event. 

 

Input=Value could easily be missed if the time value is not exactly your computed value. 

 

You need the Exceeds Threshold value. If you need to stop exactly, then adjust your computed time by enough to make it stop on the next tick.

 

For example, if you need to stop at 11.1, then set the threshold for 11.0 or 11.09, depending on your sample rate and the actual values of the time that you're reacting to. You can see this visually by dropping a List module and connecting it to the wire going into the action to see what the actual values are. 

 

I like John's suggestion of using a trigger... that is more synchronous than the Action module... have the Trigger go high on your threshold (again, exceeds threshold is a better choice), and connect to the STOP module looking for the rising edge. 

 

Note that the Stop module is one of the original functions, and for some reason, it was never fitted up with the global variable function. That's why the Trigger module plus the Stop module will work in your scenario. 

 

--cj --DASYLab Pro -- Retired --- I am no longer employed by NI or Measurement Computing. My opinions are just that, seasoned by 25+ years of working with DASYLab. Please contact www.MeasX.com or www.mccdaq.com for active support options.
0 Kudos
Message 4 of 6
(2,905 Views)

Hi John,

 

I like the way you use combi triggers and I am sure that I am going to use this module many times in my future projects.

At the example you uploaded if the first value exceeds 0.0 v and  the input cycles setting for example is 6 then it will pass a signal between 6 and 7 cycles. In my recent project I don't know the voltage level of my signal at the exact time I start the measurement and I want to record the exact no of cycles according to my start of input signal. I only know the frequency and I can calculate the exact time of the cycles I want to log. If I could use a global variable at the stop module that would solve my problem, but this module doesn't accept global variables.

 

Thank you for your reply.

0 Kudos
Message 5 of 6
(2,897 Views)

Hi Corey,

 

It's unclear to me how the stop would work, but you can simulate the stop control using the Action module. Set the Receiver=DASYLab; Action=Measurement Stop; Event= Input=Value(+/- 0.001%) For value you can enter a number or use a global var. For the input connect, connect it to your signal or to a Global Var Read module.

 

John

0 Kudos
Message 6 of 6
(2,890 Views)