Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Cr1 files


MM81 Feb 6, 2017 06:32 PM

Please excuse this question if you find it trivial. I am a beginner and am trying to move my steps trough this.

I have understood that cr1 files are command files that contain instructions regarding the tasks to be performed by the datalooger to which these files are eventually sent, after being compiled -Is that correct?

I have found an example on the Campbell Scientific webpage and I think it might be a good point to start from: I have one SD12 wind sensor that has to be connected to the data logger and I tought I could adapt the following cr1 file:

 

'CR1000 Series Datalogger
'5 November 2006

'WindSonic (Option 4); SDI addresses set to 0.


'*** Wiring ***

'CONTROL PORTS
'C1		WindSonic #1 SDI-12 data (green)
'C3		WindSonic #2 SDI-12 data (green)
'C5		WindSonic #3 SDI-12 data (green)

'POWER OUT
'12V				WindSonic #1 power (red)
'				WindSonic #2 power (red)
'				WindSonic #3 power (red)
'G				WindSonic #1 power reference (black)
'				WindSonic #2 power reference (black)
'				WindSonic #3 power reference (black)
'				WindSonic #1 shield (black)
'				WindSonic #2 shield (black)
'				WindSonic #3 shield (black)


Public windsonic(3,3)
Alias windsonic(1,1) = wind_direction_1
Alias windsonic(1,2) = wind_speed_1
Alias windsonic(1,3) = diag_1
Units wind_direction_1 = degrees
Units wind_speed_1 = m/s
Units diag_1 = unitless %<------what is diag??????

Alias windsonic(2,1) = wind_direction_2
Alias windsonic(2,2) = wind_speed_2
Alias windsonic(2,3) = diag_2
Units wind_direction_2 = degrees
Units wind_speed_2 = m/s
Units diag_2 = unitless

Alias windsonic(3,1) = wind_direction_3
Alias windsonic(3,2) = wind_speed_3
Alias windsonic(3,3) = diag_3
Units wind_direction_3 = degrees
Units wind_speed_3 = m/s
Units diag_3 = unitless

Dim disable_flag(3) AS Boolean
Dim one


DataTable (stats,TRUE,-1)
	DataInterval (0,30,Min,10) %<-----average data over 30 mins time?

	WindVector (1,wind_speed_1,wind_direction_1,IEEE4,disable_flag(1),0,0,0)
	FieldNames ("mean_wind_speed_1,mean_wind_direction_1,std_wind_dir_1")
	Totalize (1,one,IEEE4,disable_flag(1))
	FieldNames ("n_1_TOT")
	Totalize (1,one,IEEE4,diag_1<>1)
	FieldNames ("diag_1_1_TOT")
	Totalize (1,one,IEEE4,diag_1<>2)
	FieldNames ("diag_1_2_TOT")
	Totalize (1,one,IEEE4,diag_1<>4)
	FieldNames ("diag_1_4_TOT")
	Totalize (1,one,IEEE4,diag_1<>8)
	FieldNames ("diag_1_8_TOT")
	Totalize (1,one,IEEE4,diag_1<>9)
	FieldNames ("diag_1_9_TOT")
	Totalize (1,one,IEEE4,diag_1<>10)
	FieldNames ("diag_1_10_TOT")
	Totalize (1,one,IEEE4,NOT (wind_direction_1=NaN))
	FieldNames ("no_data_1_TOT")

	WindVector (1,wind_speed_2,wind_direction_2,IEEE4,disable_flag(2),0,0,0)
	FieldNames ("mean_wind_speed_2,mean_wind_direction_2,std_wind_dir_2")
	Totalize (1,one,IEEE4,disable_flag(2))
	FieldNames ("n_2_TOT")
	Totalize (1,one,IEEE4,diag_2<>1)
	FieldNames ("diag_2_1_TOT")
	Totalize (1,one,IEEE4,diag_2<>2)
	FieldNames ("diag_2_2_TOT")
	Totalize (1,one,IEEE4,diag_2<>4)
	FieldNames ("diag_2_4_TOT")
	Totalize (1,one,IEEE4,diag_2<>8)
	FieldNames ("diag_2_8_TOT")
	Totalize (1,one,IEEE4,diag_2<>9)
	FieldNames ("diag_2_9_TOT")
	Totalize (1,one,IEEE4,diag_2<>10)
	FieldNames ("diag_2_10_TOT")
	Totalize (1,one,IEEE4,NOT (wind_direction_2=NaN))
	FieldNames ("no_data_2_TOT")

	WindVector (1,wind_speed_3,wind_direction_3,IEEE4,disable_flag(3),0,0,0)
	FieldNames ("mean_wind_speed_3,mean_wind_direction_3,std_wind_dir_3")
	Totalize (1,one,IEEE4,disable_flag(3))
	FieldNames ("n_3_TOT")
	Totalize (1,one,IEEE4,diag_3<>1)
	FieldNames ("diag_3_1_TOT")
	Totalize (1,one,IEEE4,diag_3<>2)
	FieldNames ("diag_3_2_TOT")
	Totalize (1,one,IEEE4,diag_3<>4)
	FieldNames ("diag_3_4_TOT")
	Totalize (1,one,IEEE4,diag_3<>8)
	FieldNames ("diag_3_8_TOT")
	Totalize (1,one,IEEE4,diag_3<>9)
	FieldNames ("diag_3_9_TOT")
	Totalize (1,one,IEEE4,diag_3<>10)
	FieldNames ("diag_3_10_TOT")
	Totalize (1,one,IEEE4,NOT (wind_direction_3=NaN))
	FieldNames ("no_data_3_TOT")
EndTable


BeginProg
	one = 1
	Scan (1,Sec,3,0)
		SDI12Recorder (wind_direction_1,1,0,"R0!",1,0)
		If ( wind_direction_1 = NaN ) Then
			wind_speed_1 = NaN
			diag_1 = NaN
		EndIf
		disable_flag(1) = (wind_direction_1=NaN) OR (diag_1<>0)

		SDI12Recorder (wind_direction_1,3,0,"R0!",1,0)
		If ( wind_direction_2 = NaN ) Then
			wind_speed_2 = NaN
			diag_2 = NaN
		EndIf
		disable_flag(2) = (wind_direction_2=NaN) OR (diag_2<>0)

		SDI12Recorder (wind_direction_1,5,0,"R0!",1,0)
		If ( wind_direction_3 = NaN ) Then
			wind_speed_3 = NaN
			diag_3 = NaN
		EndIf
		disable_flag(3) = (wind_direction_3=NaN) OR (diag_3<>0)

		CallTable stats
	NextScan
EndProg

 

Instead of including 3 sensors, like in the example above, I could focus on one and load that code up to the datalogger. Would that make any sense? Also, I see that in the file there seem to be instruction regarding a 30 minutes average data aquisition (see code). Is that so?
And what is DIAG (see code)? It has no units of measure. Is it something related to quality control?


I have nother question about the wiring:

Red------12V

Black----G

Green---C7 (Tx of COM4)

and what about the other remaining wire? Is it ground or should I connect that to G?

Thank you
Mark


jra Feb 6, 2017 06:45 PM

Mark, I'd recommend that you go through our QuickStart video tutorials

These will show you how to use ShortCut to generate a program including a wiring diagram.  


MM81 Feb 6, 2017 06:47 PM

Thank you. Will do.


MM81 Feb 7, 2017 04:02 PM

Janet! I got it! Fixed the wiring, changed the address of my ultrasonic wind sensor (from 1 to 0) and after getting some frustrating NaN, I am getting meanigful numbers!

Log in or register to post/reply in the forum.