Page 1 of 1

logging

Posted: Thu May 07, 2015 4:38 pm
by coreyg
I looked but couldnt find it. Is there something out there that will log each time my controller does a scheduled action. i have my dosers set up from the wizard but I dont know when they dose so if I can see a log of each action I can see when it doses.

Re: logging

Posted: Fri May 08, 2015 1:00 am
by pandimus
You can check on the portal, problem is ir only logs in five minutes incriminates. So you generally wont see a doser because it doesnt run long enough. I do recall someone had a line of code that setup a fake relay that would be triggered every time a port a port was on and it would stay on long enough for it to be seen by the portal

Re: logging

Posted: Sat May 09, 2015 5:29 am
by cosmith71
Here you go.


Put this up top in the globals section.

Code: Select all

unsigned long LastUpdate1=0;    
unsigned long LastUpdate2=0;
Put this in loop.

Code: Select all

if (ReefAngel.Relay.Status(AlkPump) && LastUpdate1==0)
  {
    LastUpdate1 = now();
    ReefAngel.Relay.On (VirtAlk);
  }
  if (now() - LastUpdate1 >= 300 && LastUpdate1 != 0)
  {
    LastUpdate1 = 0;
    ReefAngel.Relay.Off (VirtAlk);
  }
  if (ReefAngel.Relay.Status(CalPump) && LastUpdate2==0)
  {
    LastUpdate2 = now();
    ReefAngel.Relay.On (VirtCal);
  }
  if (now() - LastUpdate2 >= 300 && LastUpdate2 != 0)
  {
    LastUpdate2 = 0;
    ReefAngel.Relay.Off (VirtCal);
  }
Replace AlkPump and CalPump with the ports you are using to control your dosing pumps. Replace VirtAlk and VirtCal with ports on an expansion box you don't actually have, like Box2_Port1 and Box2_Port2 for the second expansion box. You can then look on the portal and these imaginary ports will show when your dosing pumps actuate.

--Colin

Re: logging

Posted: Sat May 09, 2015 9:41 pm
by pandimus
Cool bookmarking for later use

Re: logging

Posted: Sun May 10, 2015 6:04 am
by cosmith71
I edited my above post. I left out a section of code at the end. :oops:

--Colin

Re: logging

Posted: Tue May 12, 2015 6:24 pm
by coreyg
Thanks, now how do I put it into the reef angel, lol. I'm a noob never messed with any coding just use the reef wizard.

Re: logging

Posted: Thu May 14, 2015 6:44 am
by cosmith71
Sorry for the late reply, been busy with work.

In the Wizard generated code, you'll see a couple of lines like this near the top.

Code: Select all

////// Place global variable code below here


////// Place global variable code above here
Put the first two lines in between those two like this:

Code: Select all

////// Place global variable code below here

unsigned long LastUpdate1=0;    
unsigned long LastUpdate2=0;

////// Place global variable code above here
Farther down, in the void loop() section, you'll see these lines:

Code: Select all

////// Place your custom code below here
    

    ////// Place your custom code above here
Put the rest of the code between them, like this:

Code: Select all

////// Place your custom code below here

if (ReefAngel.Relay.Status(AlkPump) && LastUpdate1==0)
  {
    LastUpdate1 = now();
    ReefAngel.Relay.On (VirtAlk);
  }
  if (now() - LastUpdate1 >= 300 && LastUpdate1 != 0)
  {
    LastUpdate1 = 0;
    ReefAngel.Relay.Off (VirtAlk);
  }
  if (ReefAngel.Relay.Status(CalPump) && LastUpdate2==0)
  {
    LastUpdate2 = now();
    ReefAngel.Relay.On (VirtCal);
  }
  if (now() - LastUpdate2 >= 300 && LastUpdate2 != 0)
  {
    LastUpdate2 = 0;
    ReefAngel.Relay.Off (VirtCal);
  }
    

////// Place your custom code above here
Now, you'll need to replace CalPump and AlkPump with the relay ports you have your dosing pumps on. Say if your calcium pump is plugged into port 1 on your relay box and your alkalinity pump is plugged into port 2, replace CalPump with Port1 and AlkPump with Port2.

Now replace VirtCal and VirtAlk with ports on another, non-existent expansion relay box. You can use Box2_Port1 and Box2_Port2 assuming you don't have 3 relay boxes (this would be the second expansion relay, or the third relay box in the system). If we're doing stuff with a port, the RA assumes it exists even if there is no hardware attached. So the software reacts even though nothing is happening in the real world.

What we're doing here is checking to see if the ports the pumps are plugged into are running, and if they are, turn on another port for 5 minutes so the portal can catch it (portal only updates every 5 minutes so it often misses short things like dosing pump activations). This will only show you that it activated at around a certain time. It won't show how long it ran.

--Colin

Re: logging

Posted: Thu May 14, 2015 6:49 am
by cosmith71
Here's a little tutorial on coding. It's not meant to make you a great programmer, but you'll at least have some idea of what you're looking at. :mrgreen:

http://forum.reefangel.com/viewtopic.php?f=14&t=3353

--Colin

Re: logging

Posted: Thu May 14, 2015 3:21 pm
by coreyg
Thanks I'll give it a shot tonight and report back. I appreciate the help

Re: logging

Posted: Fri May 15, 2015 8:51 pm
by coreyg
Well the code seems to load by the portal doesnt work for me, I've searched and tried all the suggestions but nothing

Re: logging

Posted: Sat May 16, 2015 5:36 am
by cosmith71
How does the portal not work?