Choose style:

Author Topic: Variables !  (Read 1114 times)

0 Members and 1 Guest are viewing this topic.

Offline TarpanQ

  • Newbie
  • Posts: 2
  • Thanks: 0
  • Registered : 25/03/2015
    YearsYearsYearsYears
Variables !
« on: March 25, 2015, 07:01:19 am »
I know it already has been asked in some way, but I'd like to add some requirements to the variable concept.

I'd like "variables" to be added to the automation system.

a Variable will have a name (text) and a value (integer).
in the rules, a variable can be :
- set to a specific value
- set to the value of another variable
- increased by an increment
- decreased by a decrement
- compared ( equal, different, greater than, lower than, between ) to value (or values in the case of "between")
- Compared (same operations) to value(s) of variable(s) (same comment)

Such a feature will permit to
- store status(es)
- make "scenes" -> several rules can add in the "if" that the variable has to be 0, 1, 2, ..
- make "state machines" : if variable is 1 then do something and then increase variable, if it's 2 then do something else and increase again, and so on...


Here is an explanation of what i wish to implement using this :

i have a floodable room, with a main pump  and a backup pump.
Lately both failed and it was a nightmare.

Now i placed both pumps on zWave switches with power meters, and placed a flood detector over those to detect if water gets higher than the pumps.

The idea is :
When main pump goes from "no power usage" to "power usage", increase "Main Pump Cycles" variable
when backup pump  goes from "no power usage" to "power usage", increase "Backup Pump Cycles" variable

Every midday : if "Backup Pump Cycles" > 0 and  "Main Pump Cycles" > 0 => Alert(Warning : main pump weak)
Every midday : if "Backup Pump Cycles" > 0 and  "Main Pump Cycles" = 0 => Alert(Warning : main pump fail) + switch main pump off (so i can work of the circuit)
Every midday : if "Backup Pump Cycles" = 0 and  "Main Pump Cycles" = 0 => increase "No Pumping days"
Every midday : if "Main Pump Cycles" > 0 => set "No Pumping days" to 0
Every midday : if "Backup Pump Cycles" > 0 => set "No Pumping days" to 0

Every midday+1minute : if  "No Pumping days" > 1 => alert (no pumping for two days : maybe critical failure) ( maybe pumps are out and detector too ?? )
Every midday+1minute : set  "Backup Pump Cycles" = 0 + set "Main Pump Cycles" = 0

Any time : IF flood detector signals => alert(flood detected)


this way, i have alerts if something bad is detected during normal operation.

Another problem is that backup pump may get stuck if it goes too long without being used so i also imagined a much longer list of rules so that, every Friday, both pumps are switched off, until the flood detector activates. Then both pumps are switched on. 10 seconds later a test is done to verify both pumps are using power. 10 minutes later a test is done that the flood detector is inactive
During the process, alerts are sent at key points so i can be warned if anything goes wrong of if there is a too long time between two awaited alerts.
Of course, if i do this last set of rules, it will use a variable "Test Mode" to keep a memory of which pat of the status is the current one, and the previous rules will have to be updated so they apply only while "Test Mode" is equal to 0.


 

Page created in 0.047 seconds with 21 queries.

bottleneck