Logging some things
Posted: Wed Sep 17, 2014 8:21 pm
Hi, I am trying to log the number of seconds that my ATO, and my dosing pumps are on, and then show them as custom variables. For the ATO, I am trying to get this to be cummulative for a day, and record the last 3 days (3 variables). Basically every midnight it should store that day's number into a different variable and the prior day's number into another.
It is not working, though. I am getting my "ATOcount" variable to show lower numbers instead of higher numbers until I get to midnight. I am not sure what is wrong. Here is the code for the logging:
Defining the variables in the global section, and the custom variables:
// Place global variable code below here
int tiempo=now();
int ATOcount=0;
int DP1count=0;
int DP2count=0;
// Define Portal Variables
#define Var_DTime 0
#define Var_LogATO 1
#define Var_LogATO2 2
#define Var_LogATO3 3
#define Var_LogDP1 4
#define Var_LogDP2 5
The logging function:
void logging()
{
if (tiempo != now()) {
if (ReefAngel.Relay.Status(ATOPump)) {
ATOcount++;
ReefAngel.CustomVar[Var_LogATO]=ATOcount;
}
if (ReefAngel.Relay.Status(DPump1)) {
DP1count++;
ReefAngel.CustomVar[Var_LogDP1]=DP1count;
}
if (ReefAngel.Relay.Status(DPump2)) {
DP2count++;
ReefAngel.CustomVar[Var_LogDP2]=DP2count;
}
tiempo = now();
}
if (now()%SECS_PER_DAY==0) {
ReefAngel.CustomVar[Var_LogATO3]=ReefAngel.CustomVar[Var_LogATO2];
ReefAngel.CustomVar[Var_LogATO2]=ATOcount;
ATOcount = 0;
ReefAngel.CustomVar[Var_LogATO]=ATOcount;
}
}
Thanks!
It is not working, though. I am getting my "ATOcount" variable to show lower numbers instead of higher numbers until I get to midnight. I am not sure what is wrong. Here is the code for the logging:
Defining the variables in the global section, and the custom variables:
// Place global variable code below here
int tiempo=now();
int ATOcount=0;
int DP1count=0;
int DP2count=0;
// Define Portal Variables
#define Var_DTime 0
#define Var_LogATO 1
#define Var_LogATO2 2
#define Var_LogATO3 3
#define Var_LogDP1 4
#define Var_LogDP2 5
The logging function:
void logging()
{
if (tiempo != now()) {
if (ReefAngel.Relay.Status(ATOPump)) {
ATOcount++;
ReefAngel.CustomVar[Var_LogATO]=ATOcount;
}
if (ReefAngel.Relay.Status(DPump1)) {
DP1count++;
ReefAngel.CustomVar[Var_LogDP1]=DP1count;
}
if (ReefAngel.Relay.Status(DPump2)) {
DP2count++;
ReefAngel.CustomVar[Var_LogDP2]=DP2count;
}
tiempo = now();
}
if (now()%SECS_PER_DAY==0) {
ReefAngel.CustomVar[Var_LogATO3]=ReefAngel.CustomVar[Var_LogATO2];
ReefAngel.CustomVar[Var_LogATO2]=ATOcount;
ATOcount = 0;
ReefAngel.CustomVar[Var_LogATO]=ATOcount;
}
}
Thanks!