Redundant temp probe

Do you have a question on how to do something.
Ask in here.
Post Reply
Smotz
Posts: 412
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Redundant temp probe

Post by Smotz »

How would I code my overheat functions to check 2 temp probes before acting?
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Redundant temp probe

Post by lnevo »

You'd need to make your own overheat function and run it checking both temp probes. What do you have now? Just the overheat ports defined? I can write you up a function tomorrow if you need it
Smotz
Posts: 412
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: Redundant temp probe

Post by Smotz »

lnevo wrote:You'd need to make your own overheat function and run it checking both temp probes. What do you have now? Just the overheat ports defined? I can write you up a function tomorrow if you need it
Yes, just the overheat - wow. That would be great. Thank you as always.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Redundant temp probe

Post by lnevo »

Just want to confirm. Do you want it to overheat when both probes are over or if only one goes over? Right now the code below is for either. If you want to change it switch the || to &&

Code: Select all


void myOverheat() 
{
    static byte Overheatmillis;

    // if overheat probe exceeds the temp
    if ( ReefAngel.Params.Temp[T1_PROBE] <= InternalMemory.OverheatTemp_read() ||
         ReefAngel.Params.Temp[T2_PROBE] <= InternalMemory.OverheatTemp_read() )
         Overheatmillis=millis();
    if (millis()-Overheatmillis>3000) // Only flag overheat if we have overheat for 3 seconds
    {
        ReefAngel.LED.On();
        bitSet(ReefAngel.AlertFlags,OverheatFlag);
        // invert the ports that are activated
        ReefAngel.Relay.RelayMaskOff &= ~ReefAngel.OverheatShutoffPorts;
#ifdef RelayExp
        for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
        {
            ReefAngel.Relay.RelayMaskOffE[i] &= ~ReefAngel.OverheatShutoffPortsE[i];
        }
#endif  // RelayExp
    }
}
[code]

On a side-note. Roberto how does the Overheatmillis get reset so that if the temp goes over for just a blip it doesn't trigger... you are checking to see if 3 seconds has gone by, but if the temp drops back down we aren't resetting Overheatmillis... therefore the 3 seconds is just a delay? Am I reading that properly?
Smotz
Posts: 412
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: Redundant temp probe

Post by Smotz »

If both flip.

Perfect - I am going to use this. Thank you.
lnevo wrote:Just want to confirm. Do you want it to overheat when both probes are over or if only one goes over? Right now the code below is for either. If you want to change it switch the || to &&

Code: Select all


void myOverheat() 
{
    static byte Overheatmillis;

    // if overheat probe exceeds the temp
    if ( ReefAngel.Params.Temp[T1_PROBE] <= InternalMemory.OverheatTemp_read() ||
         ReefAngel.Params.Temp[T2_PROBE] <= InternalMemory.OverheatTemp_read() )
         Overheatmillis=millis();
    if (millis()-Overheatmillis>3000) // Only flag overheat if we have overheat for 3 seconds
    {
        ReefAngel.LED.On();
        bitSet(ReefAngel.AlertFlags,OverheatFlag);
        // invert the ports that are activated
        ReefAngel.Relay.RelayMaskOff &= ~ReefAngel.OverheatShutoffPorts;
#ifdef RelayExp
        for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
        {
            ReefAngel.Relay.RelayMaskOffE[i] &= ~ReefAngel.OverheatShutoffPortsE[i];
        }
#endif  // RelayExp
    }
}
[code]

On a side-note. Roberto how does the Overheatmillis get reset so that if the temp goes over for just a blip it doesn't trigger... you are checking to see if 3 seconds has gone by, but if the temp drops back down we aren't resetting Overheatmillis... therefore the 3 seconds is just a delay? Am I reading that properly?[/quote]
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Redundant temp probe

Post by lnevo »

Actually... there's an issue with the code above!!!

Just realized what I had asked Roberto and the way it's written is that if either probe is less than the overheat temp it will reset the overheat counter... therefore an update is required to measure both probes...

Forthcoming momentarily...
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Redundant temp probe

Post by lnevo »

Ok, only change was the || needed to become &&. So now both probes need to be less than the overheat temp to trigger the overheat condition. if either probe goes under it will start the countdown to 3 seconds. If it stays over then the overheat will trigger.

Please test it :)

Code: Select all

void myOverheat() 
{
static byte Overheatmillis;

// if overheat probe exceeds the temp
if ( ReefAngel.Params.Temp[T1_PROBE] <= InternalMemory.OverheatTemp_read() &&
ReefAngel.Params.Temp[T2_PROBE] <= InternalMemory.OverheatTemp_read() )
Overheatmillis=millis();
if (millis()-Overheatmillis>3000) // Only flag overheat if we have overheat for 3 seconds
{
ReefAngel.LED.On();
bitSet(ReefAngel.AlertFlags,OverheatFlag);
// invert the ports that are activated
ReefAngel.Relay.RelayMaskOff &= ~ReefAngel.OverheatShutoffPorts;
#ifdef RelayExp
for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
{
ReefAngel.Relay.RelayMaskOffE[i] &= ~ReefAngel.OverheatShutoffPortsE[i];
}
#endif // RelayExp
}
}
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Redundant temp probe

Post by lnevo »

Roberto, thinking on this. Is this something we can put in the variable for overheat ports? maybe so we can specify something like this:

ReefAngel.OverheatProbe = T1_PROBE | T2_PROBE;

Could be simple enough to add possibly, though I suspect it would need to change a few things...
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Redundant temp probe

Post by rimai »

We would need to create new definitions like this:

Code: Select all

#define T1_PROBE_BIT 1<<0
#define T2_PROBE_BIT 1<<1
#define T3_PROBE_BIT 1<<2
Which then could be used as you mentioned.
Otherwise, T1_PROBE | T2_PROBE would result in the value 3, which is actually T3_PROBE
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Redundant temp probe

Post by lnevo »

Ok, let me raise an issue and we can see what happens. :)
Smotz
Posts: 412
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: Redundant temp probe

Post by Smotz »

lnevo wrote:Ok, let me raise an issue and we can see what happens. :)
Nice - I will hold out to see if it becomes mainstream.

Redundancy seems like a good idea, I think..
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Redundant temp probe

Post by lnevo »

Well it may take a while...use that code in the meantime and help make sure no issues
User avatar
joshlawless
Posts: 138
Joined: Thu May 23, 2013 2:52 pm

Re: Redundant temp probe

Post by joshlawless »

I like this idea!
Post Reply