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.

Constants in DataTable


JBecker Apr 7, 2009 12:47 PM

Hello,

I would like to save constants (calibration data) to a DataTable(CR1000, OS15). This Datatable is called every time the datalogger is starting the program.

Define a DataTable:

DataTable(LogTable,True,500)
Sample(1,v1_factor,FP2)
Sample(1,v1_offset,FP2)
EndTable

The program can be compiled with the CR Basic- Editor, but the CR1000 can't:
Error, unknown variable "v1_factor".

Is it not possible to save constants to a DataTable?

It would be easiest way... otherwise I have to write the Constants to a seperate File on the USR, which would be more complicated...

Thank you in advance,

Johannes B.


Dana Apr 7, 2009 03:55 PM

Have you declared v1_factor as a constant in the program?

If you have, can you post your entire program? (or at least variable & constant declarations, any instructions dealing with the constant in question, etc.).

Dana


JBecker Apr 7, 2009 05:27 PM

the original program is little different, but the CR1000 doesn't want to compile the program shown below too...


'--------------------------------------------------------

'CR1000 Series Datalogger - Standard Programm

StationName (Test_JB)

'------------------------------------------------------------------------------------
' Calibration Data of used Sensors
Const v1_factor = 0.048 ' height = m,
Const v1_offset = 0.2

Const v2_factor = 0.048 '
Const v2_offset = 0.237

Public v1
Public v2

'------------------------------------------------------------------------------------
Public i '

' Unit Definition
Units v1=m/s
Units v2=m/s

'------------------------------------------------------------------------------------
'Definition of Data Tables

DataTable(MeasData,True,-1)
DataInterval(0,10,Min,1) '1 = Timestamp every 10 Minutes; 6 = Timestamp only every Hour
Average(1,v1,FP2,False) '
Average(1,v2,FP2,False) '
EndTable


'Table is called every time the datalogger is switched on
DataTable(LogTable,True,500)' ueberpruefen!
Sample(1,v1_factor,FP2)
Sample(1,v1_offset,FP2)
Sample(1,v2_factor,FP2)
Sample(1,v2_offset,FP2)
EndTable


'------------------------------------------------------------------------------------
' Main Programm
BeginProg

PPPOpen()
'Write LogTable
CallTable(LogTable)

'Measurement starting here
Scan(2,Sec,1,0) ' 2s Interval for Wind Speed

ExciteV (Vx1,2500,0) ' Switch EX1 = 2,5V for D1/D2 => reducing power consumption
i = i + 1

' Wind Speed Measurement
PulseCount (v1,1,1,0,1,v1_factor,v1_offset)
If (v1 = NAN OR v1 < (v1_offset + 0.1)) Then v1 = 0

PulseCount (v2,1,2,0,1,v2_factor,v2_offset)
If (v2 = NAN OR v2 < (v2_offset + 0.1)) Then v2 = 0

i = 0 ' Reset counter for new intervall
CallTable (MeasData) ' Save Data
NextScan


'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
EndProg' END OF PROGRAM CODE!!!!
'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

* Last updated by: JBecker on 4/7/2009 @ 11:32 AM *


Dana Apr 7, 2009 06:53 PM

Download OS 16 from our web site -- the error seems to be resolved there. I checked the revision notes and I cannot locate what change specifically affects this, but there were a few changes made to the handling of constants that likely are what alleviates the error.

Regards,

Dana


JBecker Apr 7, 2009 07:06 PM

thank you for your response.

Our problem is, that we have a lot of measurement Systems, that are not easy to access and we aren't able to install the OS16 on all those Loggers.
Maybe I will try something like this:

const v1_factor = 0.0048

Public v1_factor_v

v1_factor_v = v1_factor...


and then write the "variable" to the Datatable...

thank you,

Johannes B.

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