Comfort Automation/ Security System Forums

Full Version: Counters
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Is it possible to do basic arithmatic on counters?

I have a counter with Temperature in Farenheit but want to convert to Celcius.

ie C= (F-32)x(5/9)

Not currently possible?
Multiplication not possible at present

I have a similar request. I would like to do division of a counter value for a start. EG. Counter02 = (Counter01 / 2). Would these functions be available at some stage?

As an added bonus, would it then be possible to set a CBus command value to the value of a Counter? EG. CBUS Ramp4 2 117 <Counter02>
This can be considered but there is a limitation to the use of mulitplication and division operations on counters which are integer values from 0 to 255
Multiplication may end up with overflow, and there may not be an easy way to test for this. Division may end up with a quotient that has a limited range.
Floating point operations are not feasible within this system

What is your application. do you just need a divide by 2 operation?
As a matter of fact, ending with a fraction is of no concern. If it\'s dropped it will still work. My current application is a logic module to dim the Cbus lights to half the original value, the original value can be anything from 1-255. EG. 255/2 = 127 or 128, you choose.

The next step would be to save the original value to a different counter location so when I restore the value I can just use the saved value. I haven\'t tried this so I don\'t know if it\'s possible at all.
I would have thought that this type of automation would be better achieved in Cbus

And just let Comfort kick it off

Mike
I would have thought that this type of automation would be better achieved in Cbus

And just let Comfort kick it off

Mike
Exactly, in CBus it works like a charm but you need a logic unit. Mine (Homegate PC) is not very reliable as it\'s my normal home PC as well (Reboots, hung programs etc.). I\'ve been trying to migrate all my logic to Comfort with varying degrees of success, most of the stuff can be migrated but this one is a sticky one.
You can use logic to achieve this for now
If Counter X >= 240 then
 set Counter X = 120
Endif

If Counter X >= 224 then
 Set Counter X = 112
Endif

etc
This divides the counter values into bands and sets a dim level of 1/2 of the valudof the bands
It may not be perfect and requires a bit of code but may achieve what you want, as our eyes are not so sensitive to the exact dimming level
Hmmmm.... That is an option. How about restorring the original value back. If the light is dimmed and movement is detected I want to restore the light to the original brightess. Is there a way do that as well? Me trying to use Copy Counters and then trying to set a counter value doesn\'t seem to work.
Pages: 1 2