05-11-2017 06:59 AM
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
Solved! Go to Solution.
05-11-2017 08:22 AM - edited 05-11-2017 08:31 AM
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.
05-11-2017 10:19 AM
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
05-12-2017 03:57 AM
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.
05-16-2017 04:20 AM
Hi Christian,
thank you for the example. It helped a lot.
Cengaver