DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use SFD - functions to combine DAC and Script

Solved!
Go to solution

Hi there,

I’m measuring analog DC-Signal thorough NImax and searching for breakdown signals. I can do that, when I save the measurement to a channel and then read it with script but I have to automate this system . So I must be able to use script at ongoing measurements. Though I don’t know, how to do this with script. Until know I’ve been using the counter: for j=1 to iMaxLen
I don’t know how to determine iMaxLen at an ongoing measurement.

 

Furthermore I’m having trouble reading directly the measurement values with script. Until now I’ve been reading them like this:
set Spannung= data.Root.ChannelGroups(1).Channels("DC_SpannungKanal")

set Zeit= Data.Root.ChannelGroups(1).Channels("Zeit1")

I think I should use the SFD – functions with a Script-out driver at DAC but I don’t know how these functions actually work. I would be really appreciated, if somebody could sent me an example script for this?

Best Regards

Cengaver

0 Kudos
Message 1 of 5
(3,072 Views)

Hi,

I'm not sure if I do understand what exactly you want to do, so let me guess:

You have a specific event in your acquired signal (e.g. a positive or negative edge) that triggers another action (analysis).

 

Here's how you could do that for multiple events in your signal:

1. Start DAC block diagram from a Script

2. Use a Slope or Window block to detect events for any signal directly in DAC

3. Define post and pre triggers in a Save Data with Trigger block to save a specific range around your event that needs to be analyzed

4. DAC Block diagram execution ends here as the Save block only saves a fixed number of samples (e.g. 100 samples before and 100 after the event)

5. The script that started the block diagram continues and can analyze the acquired data

6. The same script starts the DAC block diagram again (step 1)

 

The main purpose of the Script DAC driver (which is using the SFD commands) is integrating external measurement devices, which are connected to the computer via communication interfaces like GPIB, Serial, TCP/IP.

You could also use it to do some kind of simple analysis but here it depends on what exatcly you want to do.

So what kind of analysis it it that you want to do with the SFD commands?

 

Here you can find some basic documentation about the SFD commands. Maybe it helps.

Also have a look at the example called Numeric and Tabular Display that ships with DIAdem.

It shows an easy analysis using the SFD commands.

Christian
CLA, CTA, CLED
0 Kudos
Message 2 of 5
(3,046 Views)

Hello Christian,

thank you for the quick answer, it made things more clear. I was thinking that the usage of the Script DAC driver is necessary for the transition from step 4 to 5 (by your example). In my case, I’m measuring signals through cDAQ 9181, which are between 0-10 V. (So I guess the SFD commands aren’t necessary) The measured DC-signal is variable but when the specific event  happens, it makes a peak for about 30 ms. So I have to differentiate that peak from other changes, which last like 5 to 10 seconds and I guess the best way to differentiate the peak from other changes would be succeed in script after fifth step. Actually I don’t know, if it’s even possible to do it with DAC? If yes, which blocks should be used?

One more question: Is it possible to make Save Data with Trigger on condition. Like the DAC saves only fixed number of samples, which have peaks in it and leave the continuous signal?

Best Regards

Cengaver

0 Kudos
Message 3 of 5
(3,027 Views)
Solution
Accepted by topic author Cengaver

Hi Cengaver,

Do you want to detect peaks < 30 ms or > 30 ms and then end the acquisition?

Find an example attached that shows how to detect only peaks longer than 1 seconds and then end the acquisition.

For that you can use the Stopwatch block to measure peak time like shown in the example.

You could start that block diagram from a script like this (here the script must be located in the same folder like the dac file):

Call SchemeLoad(CurrentScriptPath & "PeakDetect.DAC")
Call SchemeCheck("Normal") 
Call SchemeMeasStart()

And then put a loop around that to restart it after every peak that was detected in the block diagram.

Disadvantage is that there is a small dead time between block diagram ending and restarting.

Christian
CLA, CTA, CLED
0 Kudos
Message 4 of 5
(3,015 Views)

Hi Christian,

thank you for the example. It helped a lot.

Cengaver

0 Kudos
Message 5 of 5
(2,986 Views)