DASYLab

cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop and restart a measurement with a specific criteria using python?

Hi all,

I am new to DASY lab and I would like to automate measurements of all 16 channels for every second from the signal starts using a script block which supports python.

 

Herewith i have attached an image of a signal.

There are two red dots in that. First red dot is start of the signal with time t=0.

Second red dot is the time that the signal starts triggering, let us imagine t=x.

From x, every second signal has to be recorded and writes data in a file.

 

Kindly help me with your inputs how can i proceed to automate it.

 

Thanks in advance.

 

0 Kudos
Message 1 of 6
(4,748 Views)

First, before programming, have you evaluated the Trigger modules? 

 

If these do not work, and you want to attempt the Python Scrip approach, then I would recommend that you use it like a Trigger, where the input is evaluated based on your criteria (time = x). The output would then be a control signal, 0 or 5 (Off or On) that would control a Relay. Of course, you can decide how you want to have it work. 

 

Start with the basic "As many Inputs as Outputs" script settings. Take some time to review the Help and the simple example that the Help describes. Other examples can be found at kb.mccdaq.com (search for DASYLab Script). 

 

You will want to be able to extract the time stamp from the data block header. This will give you seconds since Measurement Start. 

 

If you would rather set the Script module up to directly output the data, rather than using a control signal/relay approach, you'll have to manipulate the ProcessData data function to skip every other data value. Take note of block sizes and sample rates as you do this data reduction and reduce them accordingly. 

 

 

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
Message 2 of 6
(4,719 Views)

Hi CJ,

Thanks for your information.

I have worked out few examples like creating a package for a function f=ax+b.

 

I have a measured data files(*.asc) of the signal from worksheet and i would like to extract the data with the conditions(related to timestamp) using script module. I thought creating a package can be reused for all the measurements.

I would like to monitor all the available channels (16), since each signal from a particular channel will have different start trigger time.

 

-Sangeetha

Kongsberg Automotive

Munich

 

0 Kudos
Message 3 of 6
(4,717 Views)

Sangeetha,

 

If you are in Munich, it might make sense to contact www.measx.com directly for assistance. They have excellent resources and experience with DASYLab and the Script module. You will get more personal assistance, as well as good suggestions for how to proceed. 

 

 

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 4 of 6
(4,715 Views)

Hi CJ,

I will contact them and thanks a lot for detailed information.

 

Thanks,

Sangeetha.

0 Kudos
Message 5 of 6
(4,713 Views)

I am not sure if I understand the request correctly, but here's a "rapid prototyped" solution.

Explicitly offered as alpha/untested, use at own risk!

But it might guide the direction for your own script.

 

The script module blocks data until the "wait time" has expired.

Then, it outputs blocks of size 1 repeatedly: The "peak time" is the pause time between outputs.

 

The screenshot shows an example.
Red signal waiting 3 seconds, then 1 value per second

Blue signal waiting 5 seconds, then 1 value per 2 seconds

 

wait_and_peak.jpg

 

M.Sc. Holger Wons | measX GmbH&Co. KG, Mönchengladbach, Germany | DASYLab, DIAdem, LabView --- Support, Projects, Training | Platinum NI Alliance Partner | www.measx.com
Message 6 of 6
(4,695 Views)