Hi all,
I am trying to write a script that saves maxium and minimum value out of each 100ms of measurement to the file. Here's what I came up with:
// Time settings
Scope1.Time.Position.value = 0
Scope1.Time.Samples.value = 10000
Scope1.Time.Rate.value = 30000
Scope1.Time.Base.value = 0.1
// Channel 24V settings
Scope1.Channel1.Range.value = 100
Scope1.Channel1.Attenuation.value = 10
// Channel 84V settings
Scope1.Channel2.Range.value = 200
Scope1.Channel2.Attenuation.value = 10
Scope1.Trigger.Type.text = "Transition"
Scope1.run()
for(i = 0; i < 10; i++){
var file_CH1 = File("C:/AD_Data/Voltage_24V_"+i+".csv")
var file_CH2 = File("C:/AD_Data/Voltage_84V_"+i+".csv")
file_CH1.appendLine("Channel 1 Maximum value measurements day "+i)
file_CH2.appendLine("Channel 2 Maximum value measurements day "+i)
for(j = 0; j < 3600; j++){
var date = new Date()
var time = date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
file_CH1.appendLine(time+","+Scope1.Channel1.measure("Maximum"))
file_CH2.appendLine(time+","+Scope1.Channel2.measure("Maximum"))
wait(0.1)
}
}
Scope1.stop()
The problem is that getting the time and saving data to the file takes a lot of time which is not constant. As a result I am getting from 2 to 4 measurements each second and loose some data. Do you have an idea how to do make it work?