Hello,
I hope this email finds you well. I am reaching out to you because I am currently using CR1000 and CR1000x data loggers to acquire the intensity of flashing lights that flash 20 times per minute, with each flash lasting 200 ms.
My goal is to measure the intensity when the light flashes and provides a value of 0.8 mA. However, I have encountered difficulties with the "VoltSe" function as it fails to capture all the flashes, and sometimes, even when the light is flashing, no flash is detected. To try and address this issue, I have implemented a "SubScan" of 125 ms, but the results remain unsatisfactory. Here is an excerpt from the program I am using for acquiring the flashing light data:
'Attribution de la plus haute valeur d'intensite de la balise 2000cd lors du flash SubScan (125, mSec, 4) VoltSe (I_balise_2000cd_detect_flash(detect_flash_compteur), 1, mV5000, 16, 1, 0, _50Hz, 0.0096, -24) If I_balise_2000cd_detect_flash(detect_flash_compteur) > detect_flash Then detect_flash = I_balise_2000cd_detect_flash(detect_flash_compteur) detect_flash_compteur = detect_flash_compteur + 1 NextSubScan
If detect_flash > 0 Then I_balise_2000cd = detect_flash
My intention is to scan four times per second and retain the highest detected intensity. However, I am concerned that this may lead to synchronization issues between the "SubScan" and the overall scan, given that I am recording data in a table at one-second intervals.
Therefore, I am reaching out to inquire if you have any ideas to address this problem or if it might be a limitation inherent to the CR1000x that is causing this situation.
Thank you in advance for your assistance.
Ben Omar
To catch every flash, I would suggest main scan of 125ms if all the instructions in the scan can complete fast enough.
To have the maximum, either use MaxRun() or do a maximum in a data table.
Public Intensity 'Main Program BeginProg Scan (125,mSec,0,0) VoltSe (Intensity,1,mV5000,16,1,0,50,0.0096,-24) NextScan EndProg
hello;
The issue is that I need to acquire data in a main scan of 1 second, so I'm using a subscan. Below is a part of the program. I have managed to detect all the flashes, but the problem is that I'm encountering skip scans. This is because I take 4 measurements and only extract a single value of flash intensity, skipping the other values
The coding principle is that I scan within an interval. If I don't capture anything, I wanted to wait a bit for the flash to occur and then scan. However, if I add delays, it results in skip scans
PipeLineMode BeginProg Scan (1,Sec,0,0) SubScan (70,mSec,4) i = 0 i = 4 VoltSe(I_balise_2000cd_detect_flash(i), 1, mV5000, 16, 1, 0, _50Hz, 0.0096, -24) MaxRun(I_balise_2000_cd_max, 1, I_balise_2000cd_detect_flash(i), 4, False) If I_balise_2000_cd_max < 0 Then I_balise_2000_cd_max = 0 AvgRun(I_balise_2000_cd_moy, 1, I_balise_2000_cd_max, 10, False, 0) ' I_balise_2000cd = I_balise_2000_cd_max NextSubScan If I_balise_2000_cd_moy <0.1 Then SubScan (70,mSec,4) i = 0 i = 4 VoltSe(I_balise_2000cd_detect_flash(i), 1, mV5000, 16, 1, 0, _50Hz, 0.0096, -24) MaxRun(I_balise_2000_cd_max, 1, I_balise_2000cd_detect_flash(i), 4, False) If I_balise_2000_cd_max < 0 Then I_balise_2000_cd_max = 0 AvgRun(I_balise_2000_cd_moy, 1, I_balise_2000_cd_max, 10, False, 0) NextSubScan I_balise_2000cd = I_balise_2000_cd_max EndIf NextScan EndProg
Here is an example that will save every flash, and also provide a 1 minute running max of intensity.
I expect your final program would do something different for the table. This example will allow you to see raw data of the flashes.
'CR1000X Series Datalogger Public I_balise_2000cd_detect_flash Public I_balise_2000_cd_max Const Threshold = 0.1 'Theshold to trigger saving record DataTable (Flashes,I_balise_2000cd_detect_flash > Threshold,-1 ) Sample (1,I_balise_2000cd_detect_flash,IEEE4) EndTable PipeLineMode BeginProg Scan (125,mSec,0,0) VoltSe(I_balise_2000cd_detect_flash, 1, mV5000, 16, 1, 0, _50Hz, 0.0096, -24) 'Maximum intensity in 1 minute MaxRun (I_balise_2000_cd_max,1,I_balise_2000cd_detect_flash,480) CallTable Flashes NextScan EndProg
Here's a simplified version of the code. We're using CR1000x and CR1000 for the Eoleine and wind measurement projects. In the "subscan" function, I perform four scans, resulting in four values. I scan every 100 ms. If I detect a peak in intensity, it indicates that I've captured a lightning flash, and that's good. Otherwise, I wait for 30 ms in anticipation of capturing the flash, considering that the flashes occur 20 times per second, with each flash lasting 200 ms. With this program, I capture the flashes for a certain period of time, but eventually lose them.
Public Temp_int 'Tensions et courants Public Batterie_DL Public Batterie_Balise Public I_balise_32cd Public I_balise_2000cd Public I_balise_2000_cd_max Public I_balise_2000_cd_moy Public V_LOGGER Public V_BALISE Public I_balise_2000cd_detect_flash(5) Public i '-------------------- 'Unites des variables '--------------------- Units Temp_int= deg C Units Batterie_DL ,Batterie_Balise = Volts '----------------------------- 'Declaration table de donnees '----------------------------- DataTable (Donnees_Osne_Le_Val2,1,-1) DataInterval (0,1,Min,10) 'Temperature interne moyenne Average (1,Temp_int,FP2,0) FieldNames ("Temp_int_moy") 'Tension moyenne batterie Average (1,Batterie_DL,FP2,False) FieldNames ("Tens_DL_moy") 'Tension moyenne batterie balise Average (1,Batterie_Balise,FP2,False) FieldNames ("Tens_balise_moy") 'Intensite moyenne balise 2000cd Average (1,I_balise_2000cd,FP2,False) FieldNames ("I_balise_2000cd") 'Intensite moyenne balise 32cd Average (1,I_balise_32cd,FP2,False) FieldNames ("I_balise_32Cd") EndTable '----------------------------------- 'Declenchement des feux de balisage '----------------------------------- 'PipeLineMode BeginProg 'Activer l'interface Ethernet pour l'envoi des emails IPRoute ("smtp.autanvrt.com",0) Scan (1,Sec,0,0) '-------- 'Mesures '-------- 'Mesure de la tension batterie CR1000 Battery (Batterie_DL) 'Mesure TEMPERATURE INTERNE CR1000 PanelTemp (Temp_int,_50Hz) 'Mesure de la tension batterie CR1000 Battery (V_LOGGER) 'Mesure de la tension 24 VDC de la balise 1 et 2 VoltSe (V_BALISE,1,mV5000,14,True,0,_50Hz,0.010,0) If V_BALISE < 0 Then V_BALISE = 0 '------------------------------ 'Detection flash balise 2000cd '------------------------------ ''If TimeIsBetween(17,8,24,Min) Then SubScan (100,mSec,5) i=0 i=5 VoltSe(I_balise_2000cd_detect_flash(i), 1, mV5000, 13, 1, 0,_50Hz, 0.0096, -24) MaxRun ( I_balise_2000_cd_max,1, I_balise_2000cd_detect_flash(i) ,5,false) If I_balise_2000_cd_max < 0 Then I_balise_2000_cd_max = 0 AvgRun ( I_balise_2000_cd_moy ,1,I_balise_2000_cd_max,5,false) If I_balise_2000_cd_moy <0.3 Then Delay(1,20,mSec) VoltSe(I_balise_2000cd_detect_flash(i), 1, mV5000, 13, 1, 0,_50Hz, 0.0096, -24) MaxRun ( I_balise_2000_cd_max,1, I_balise_2000cd_detect_flash(i) ,5,false) If I_balise_2000_cd_max < 0 Then I_balise_2000_cd_max = 0 AvgRun ( I_balise_2000_cd_moy ,1,I_balise_2000_cd_max,10,false) I_balise_2000cd = I_balise_2000_cd_max EndIf I_balise_2000cd = I_balise_2000_cd_max NextSubScan '------------------------- 'Consommation balise 32cd '------------------------- VoltSe (I_balise_32cd,1,mV5000,15,1,0,_50Hz,0.0096,-24) If (I_balise_32cd) < 0.2 Then I_balise_32cd = 0 CallTable(Donnees_Osne_Le_Val2) NextScan EndProg