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.

Calculation of variables within a time interval


JCaycho May 21, 2011 04:42 PM

I want to make some calculations with the minimum, maximum and average of one initial variable and that these new data correspond to the values of the initial variable to be saved in the same row and same hour.

The values minimum, maximum and average to use in the calculations must be equal to:
Minimum (1, initial variable, FP2, False, False)
Average (1, initial variable, FP2, False)
Maximum (1, initial variable, FP2, False, False)

I have tried to recover data of the tables but they use data of the previous hour.
For example:
'CR1000
'Created by Short Cut (2.8)
'Declare Variables and Units
Public BattV
Public AT
Public Zeta_1
Public Zeta_2

Units BattV=Volts
Units AT=Deg C


'Define Data Tables
DataTable(Horario,True,-1)
DataInterval(0,2,Min,10)
Minimum(1,BattV,FP2,False,False)
Minimum(1,AT,FP2,False,False)
Average(1,AT,FP2,False)
Maximum(1,AT,FP2,False,False)
???(1,Zeta_1,FP2...)'to save the calculation
???(1,Zeta_2,FP2...)'to save the calculation
EndTable

'Main Program
BeginProg
Scan(10,Sec,1,0)
'Default Datalogger Battery Voltage measurement BattV
Battery(BattV)
VoltSe(AT,1,mV2500,2,0,0,_60Hz,0.1,-40)
'Calculation for Zeta_1,
maximun_AT= ????..'The maximun value of AT of the hour..
minimun_AT= ????..'The minimun value of AT of the hour..
average_AT= ????..'The average value of AT of the hour..
Zeta_1=(maximun_AT+minimun_AT)/average_AT
Zeta_2=(maximun_AT+minimun_AT)/2
'Call Data Table and store data
CallTable(Horario)
NextScan
EndProg


I appreciate the help you can give me,


Sam May 23, 2011 04:34 AM

'Define Data Tables

DataTable(Horario_Temp,True,10)
TableHide
DataInterval(0,2,Min,10)
Minimum(1,AT,FP2,False,False)
Average(1,AT,FP2,False)
Maximum(1,AT,FP2,False,False)
EndTable

DataTable(Horario,True,-1)
DataInterval(0,2,Min,10)
Minimum(1,BattV,FP2,False,False)
Minimum(1,AT,FP2,False,False)
Average(1,AT,FP2,False)
Maximum(1,AT,FP2,False,False)
Sample(1,Zeta_1,FP2)
Sample(1,Zeta_2,FP2)
EndTable

'Main Program
BeginProg
Scan(10,Sec,1,0)
'Default Datalogger Battery Voltage measurement BattV
Battery(BattV)
VoltSe(AT,1,mV2500,2,0,0,_60Hz,0.1,-40)

'Call "temp" Data Table
CallTable(Horario_Temp)

'Calculation

maximun_AT= Horario_Temp.AT_Max(1,1)
minimun_AT= Horario_Temp.AT_Min(1,1)
average_AT= Horario_Temp.AT_Avg(1,1)

Zeta_1=(maximun_AT+minimun_AT)/average_AT
Zeta_2=(maximun_AT+minimun_AT)/2

'Call Data Table and store data
CallTable(Horario)

NextScan
EndProg


JCaycho May 24, 2011 01:27 AM

Sam:

I have tried and works according to the sequence that you sent to me.

Thanks for the fast and intelligible answer.

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