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.

put data in USR


schouten Mar 22, 2013 11:37 AM

hello,

i have a cr100 with working program and a working ftp server.
i can acces the CPU and USR files and see the running program.

but i have al little problem, the data is not stored in CPU ore USR. how can i do this?
when i can acces the data in USR i need a ftp client what also not works. how can i do that?

these are the files i got from file generator.


' Number of SAAs to be monitored:
Const NUM_SAAS = 1

' Number of raw data samples to average for each measurement:
' Samples can range from 100-25500; samples are collected at 400 Hz, thus ~64 seconds are required for NUM_TO_AVG = 25500
Const NUM_TO_AVG = 1000

' Maximum number of octets (8 segment units) of any single SAA being used:
Const MAX_NUM_OCTETS = 1

' Number of octets for each SAA (each SAA must have an entry):
Const SAA1_NUM_OCTETS = 1

' COM port index for each SAA (each SAA must have an entry) COM1=1, COM2=2, COM3=3, COM4=4, RS232=5
Const SAA1_COM_PORT = 1

' Number of masked segments. Meaning, how many segments at the "top", "near", or "cable" end of the SAA are to be ignored
' - as of 1 May 2010, this function is not used
Const SAA1_NUM_MASKED_SEGMENTS = 0
Const NUM_MASKED_SEGMENTS = 0

' Tilt alarm in degrees
' - as of 1 May 2010, this function is not used
'*** NOT USER-EDITABLE ***
Const TILT_ALARM_COUNTS = 20

' Reference measurement: (1 = initial readings, 2 = previous readings)
' - as of 1 May 2010, this function is not used
'*** NOT USER-EDITABLE OR SAA-Depedent***
Const REF_MEAS = 2

' SAA orientation (1 = horizontal, 2 = vertical)
Const SAA1_ORIENTATION = 1

' Email parameter strings (as constants), Message String & Result Variable
Const ServerAddr=""
Const ToAddr=""
Const FromAddr=""
Const Subject=""
Const Attach=""
Const UserName=""
Const Password=""
Const CRLF = CHR(13)+CHR(10)

' Name of 'Include' file
'Data Logger: CR1000
Include "CPU:SAA_Include_V2_3.CR1"

Dim Num

'DECLARE PUBLIC VARIABLES (must be modified by user to match application specifications):
'---------------------------------------------------------------------------------------------------------------------------------

'SAA1
Public SAA1_ACC_VALUES(MAX_NUM_OCTETS,NUM_SENSORS_PER_OCTET) As Float
Public SAA1_TEMP_VALUES(MAX_NUM_OCTETS) As Float
Public SAA1_REF_ACC_VALUES(MAX_NUM_OCTETS,NUM_SENSORS_PER_OCTET) As Float

'DEFINE DATA TABLES:
'-------------------------------------------------------------------------------------------------------------------------

' Project Descriptor Info:
DataTable(PROJECT_INFO,FIRST_SCAN,-1)
Sample(1,PROGRAM_VERSION_NUM,Float)
Sample(1,AVERAGING,Long)
Sample(1,PROJECT_NAME,String)
Sample(1,NUMBER_SAAS,Long)
Sample(NUM_SAAS,NUM_OCTETS_INDEX(),Long)
Sample(NUM_SAAS*MAX_NUM_OCTETS,SERIAL_NUMS(),Long)
EndTable

' Serial Port Errors:
DataTable(SERIAL_ERRORS,true,-1)
Sample(1,NUM_CRC_ERRORS,Long)
Sample(1,NUM_COM_ERRORS,Long)
EndTable

'SAA Data Table Values (each SAA requires a data table):

'SAA1
DataTable (SAA1_DATA,True,-1)
Sample(1,SERIAL_NUMS(1,1),Long)
Sample(SAA1_NUM_OCTETS * NUM_SENSORS_PER_OCTET, SAA1_ACC_VALUES(), Float)
Sample(SAA1_NUM_OCTETS, SAA1_TEMP_VALUES(), Float)
EndTable


'DEFINE MAIN PROGRAM:
'-------------------------------------------------------------------------------------------------------------------------

BeginProg

' Project Title
PROJECT_NAME = "nl120 test"
NUMBER_SAAS = NUM_SAAS
AVERAGING = NUM_TO_AVG
PROGRAM_VERSION_NUM = VERSION_NUM

' Alarm Settings
'*** NOT USER-EDITABLE ***
ALARMS_SET = false

' High-res (AIA) Option
HIGH_RES_SAA = false

TILT_ALARM_DEG = TILT_ALARM_COUNTS *1

' Serial numbers for each SAA (SubArray or Octet S/N):
'SAA1 - S/N: 46925
SERIAL_NUMS(1,1) = 46925

' Number of Octets assignment for each SAA:
'SAA1
NUM_OCTETS_INDEX(1) = SAA1_NUM_OCTETS

' Com port assignment for each SAA:
COM_PORT_INDEX(1) = SAA1_COM_PORT

' Orientation assignment for each SAA:
ORIENTATION_INDEX(1) = SAA1_ORIENTATION

'initialize COM, CRC and RANGE errors:
NUM_COM_ERRORS = 0
NUM_CRC_ERRORS = 0
NUM_RANGE_ERRORS = 0

'initialize output descriptor boolean (only need 1 record of project descriptor):
FIRST_SCAN = true

' Scan interval
' Example: "Scan (3,Min,0,0)" indicates a scan of all SAAs every 3 minutes
Scan(5,Min,0,0)

' Project info table:
CallTable PROJECT_INFO

' Calls to each SAA and store data in respective tables:
'---------------------------------------------------------

' Call to each array for measurement of sensors.
For Num = 1 To NUM_SAAS

'SAA1
If Num = 1 Then
If HIGH_RES_SAA Then
Call GetHighResSAAData(SAA1_ACC_VALUES,SAA1_TEMP_VALUES,Num)
Else
Call GetSAAData(SAA1_ACC_VALUES,SAA1_TEMP_VALUES,Num)
EndIf
CallTable SAA1_DATA
EndIf


Next Num

'check if alarms are implemented
'If ALARMS_SET Then
'compare current values with reference:
'CheckAlarms(SAA1_REF_ACC_VALUES,SAA1_ACC_VALUES, FIRST_SCAN,1)
'EndIf

'record serial errors table:
CallTable SERIAL_ERRORS

'turn off outputting of project descriptor info after first run:
FIRST_SCAN = false

NextScan
EndProg


Sam Mar 22, 2013 02:22 PM

TableFile() is used to copy data from a data table to a file on the USR or CRD drive (please do not do this on the CPU drive).


schouten Mar 22, 2013 02:34 PM

can you make a example of the code i have to make for ftp client?
and can you make a example of the code how i can move the files in the USR folder?

and where can i place the codes it in the document?

thanks

* Last updated by: schouten on 3/25/2013 @ 1:36 AM *


Sam Mar 23, 2013 01:13 AM

Schouten,
Please rephrase you question and provide more detail. Is this question related the TableFile question above? I do not understand what you are asking for.


schouten Mar 25, 2013 07:37 AM

i have modified the question


aps Mar 25, 2013 09:14 AM

In the CRBasic editor open the help for the FTPClient then click on the Example link at the top of the file. This shows a simple example of the Tablefile and FtpClient instructions when used together.


schouten Mar 25, 2013 11:10 AM

hi,

i have put the example (to move to USR dir) in my code and its working. but when i try it on the real data its not working.

i have done this:

' Project Descriptor Info:
DataTable(PROJECT_INFO,FIRST_SCAN,-1)
Sample(1,PROGRAM_VERSION_NUM,Float)
Sample(1,AVERAGING,Long)
Sample(1,PROJECT_NAME,String)
Sample(1,NUMBER_SAAS,Long)
Sample(NUM_SAAS,NUM_OCTETS_INDEX(),Long)
Sample(NUM_SAAS*MAX_NUM_OCTETS,SERIAL_NUMS(),Long)
EndTable

BeginProg
SetStatus("USRDriveSize",16384)
Scan(1,Sec,3,0)
CallTable(PROJECT_INFO)
NextScan
EndProg


XxVashxX Mar 25, 2013 05:47 PM

Hello I put a data table on the USR adding the
"TableFile()" instruction:

DataTable(Min15,True,10000)
TableFile ("USR:Station",9,10,0,15,Min,OutStat,LastFileName)
DataInterval(0,15,Min,10)
Sample(1,PBar,FP2)
Totalize(1,Pluv,FP2,False)
Sample(1,Temp,FP2)
Sample(1,RH,FP2)
ETsz(Temp,RH,VelV,RadT,66.3158,-17.09944,3851,5,0,FP2,False)
FieldNames("ETos,Rso")
EndTable

And in the main program:

BeginProg
'Fix the size of the USR memory to records
SetStatus ("USRDriveSize",10240)
Scan(60,Sec,1,0)
PortSet(1,1)
Battery(BatV)
CallTable(Min15)
NextScan

Hope this can help,
read the help of loggernet for:
TableFile()
SetStatus()

Regards

* Last updated by: XxVashxX on 3/25/2013 @ 11:48 AM *


schouten Mar 27, 2013 11:19 AM

succes it works beautiful

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