thanks a lot for your code.
I just managed to install linknx on a debian PC without a glitch.
Will try to move to a Asus WL-500g Premium and Speedport W900V later.
Is it possible to do arithmetic operations with linknx ?
Minimum and Maximum operations would be also very useful.
What about operations with memories, e.g. counters.
Functions for sunset/sunrise would be also nice.
I will try to code an PID-controller on my own,
and keep you informed about any success.
thanks again
Michael
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I already think of implementing arithmetic operations for a long time, but still didn't find out what would be the best solution. I would like to first have a good idea of what the users need, so if you (or anybody else) can just give detailed examples of possible use for arithmetic operations it would be very helpful.
The possible implementations I can imagine now are:
1) Integrate it in the condition of the rule system: Instead of returning true or false, a condition could then return any object value, conditions like "greater", "less", "equals", and arithmetic would be added.
2) Integrate it in objects: It would then be possible to create an object (local or associated with a group address) for which the value is computed by an arithmetic operation (and recomputed everytime an input is changed)
3) Create a separate subsystem defining arithmetic formulas between group objects. This is more or less the same as solution 2, but the config would not be integrated to the config of the object storing the result of the operation.
I still have to analyze the complexity of these solutions to choose the one that makes the best compromise between ease of use and resource consumption (program binary size and RAM usage).
Just tell me if you see another possibility or some improvements to the above solutions.
Here's an example of what solution 3 could look like:
It takes the maximum value between 3 objects (with conversion from bool to number for the 3rd one) than divide it by 2.55 to transform the original value (in range 0-255) into a percentage
<objects>
<object id="heat_act1" gad="1/1/51" type="EIS6">Value of heating actuator 1</object>
<object id="heat_act2" gad="1/1/52" type="EIS6">Value of heating actuator 2</object>
<object id="heat_act3" gad="1/1/53" type="EIS1">Binary heating actuator 3</object>
<object id="heat_act_max" type="EIS6">Max Value of heating actuators</object>
</objects>
<formulas>
<formula target="heat_act_max">
<divide>
<max>
<object id="heat_act1"/>
<object id="heat_act2"/>
<bool2num object="heat_act3" iftrue="150" iffalse="0"/>
</max>
<constant value="2.55"/>
<divide>
<formula>
</formulas>
For the sunrise/sunset, I found a formula somewhere that seems to work (the time reported for today is 2 minutes different from what I get from wheather website). How do you think I should implement it? Somthing similar to a timer, that would become true on sunrise and false on sunset? Or a kind of arithmetic operation that would take a date as input and output sunrise or sunset time for that day (that you can in turn use in a timer with a variable timespec)?
Kind regards,
Jean-François
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
as you said it might a tough question to decide on a specific solution.
And of course all aspects, e.g. understandability, versatility and complexity should be evaluated before coding.
Personally I like your proposal 3) at most.
1) seems a little bit odd to me, since conditions and arithmetic operations are usually not really mixed together in most programming languages
2) the same applies to combining arithmetic operations into objects; but thats just my personal feeling
I like 3) at most because it seems to be the most flexible.
I don't understand how you would initiate the computation of your heat_act_max object.
What about implementing the execution of arithmetic operations into actions,
type would be the arithmetic operation.
Guess you would need unconditional actionslists.
From the perspective of an enduser I would like to have variable offsets.
So for example as an extension to Bernhards example,
some logic which calculates an offset, e.g. dependent on weekday.
Have you thought about randomness?
I would like to implement some kind of presence simulation,
which randomly operates specific lightning patterns in the house.
For this an easy way to specify time offsets (in other words "delays") would be really nice.
Not just for patterns which simulate some walking through the house (from the living room to the toilet and back),
but I also like to sequentially open the shades.
Guess I am paranoid on overloading the power net/actuators.
best regards
Michael
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> I don't understand how you would initiate the computation of your heat_act_max object.
I would just register the formula as change listener for all the objects involved in the computation and re-calculate it every time one of the input changes.
> Guess you would need unconditional actionslists.
I don't understand what you mean. When would the action be performed if there is no condition to tell it?
> From the perspective of an enduser I would like to have variable offsets.
I don't see exactly where the variable offset is used in your example, I just see that you use a variable timespec, (this is already implemented in the recent releases).
The problem I see with sunrise/sunset, is that you have to know the day for which you have to compute it. If you want for example to close/open the blinds at sunrise/sunset only during the weekend, on sunday evening, just after closing the blinds, the system will try to compute the next sunrise time, and we have to take care to calculate it for next saturday and not next monday (first compute the next execution date, then use it to compute sunrise time).
> Have you thought about randomness?
If we implement arithmetic operations, it will be very easy to add an operator that outputs a random number in a given range.
>For this an easy way to specify time offsets (in other words "delays") would be really nice.
>Not just for patterns which simulate some walking through the house (from the living room to the toilet and back),
>but I also like to sequentially open the shades.
>Guess I am paranoid on overloading the power net/actuators.
For that, you can already use fixed delays using the "delay" parameter of each action in the actionlist.
For the arithmetic operations, I think I'll try to implement a combination of proposal 3) and 4) (4 is your proposal to integrate arithmetic into actions). I'll create objects (and related XML structures) that allows to compute a value. Once we have these objects, it' very easy to use it in a "set-value" action and/or to create formulas like in proposal 3).
Regards,
Jean-François
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I didn't know the delay attribute, but found it know in the code, thanks to your comments.
Is there somewhere an example for a variable timespec ?
My comment about an unconditional actionlist stems from my fixed time frame thinking.
Usually I am working with code which is executed in a specific time frame.
I am still not used to think event-based.
take care
Michael
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello Jean-François,
thanks a lot for your code.
I just managed to install linknx on a debian PC without a glitch.
Will try to move to a Asus WL-500g Premium and Speedport W900V later.
Is it possible to do arithmetic operations with linknx ?
Minimum and Maximum operations would be also very useful.
What about operations with memories, e.g. counters.
Functions for sunset/sunrise would be also nice.
I will try to code an PID-controller on my own,
and keep you informed about any success.
thanks again
Michael
Hi,
I already think of implementing arithmetic operations for a long time, but still didn't find out what would be the best solution. I would like to first have a good idea of what the users need, so if you (or anybody else) can just give detailed examples of possible use for arithmetic operations it would be very helpful.
The possible implementations I can imagine now are:
1) Integrate it in the condition of the rule system: Instead of returning true or false, a condition could then return any object value, conditions like "greater", "less", "equals", and arithmetic would be added.
2) Integrate it in objects: It would then be possible to create an object (local or associated with a group address) for which the value is computed by an arithmetic operation (and recomputed everytime an input is changed)
3) Create a separate subsystem defining arithmetic formulas between group objects. This is more or less the same as solution 2, but the config would not be integrated to the config of the object storing the result of the operation.
I still have to analyze the complexity of these solutions to choose the one that makes the best compromise between ease of use and resource consumption (program binary size and RAM usage).
Just tell me if you see another possibility or some improvements to the above solutions.
Here's an example of what solution 3 could look like:
It takes the maximum value between 3 objects (with conversion from bool to number for the 3rd one) than divide it by 2.55 to transform the original value (in range 0-255) into a percentage
<objects>
<object id="heat_act1" gad="1/1/51" type="EIS6">Value of heating actuator 1</object>
<object id="heat_act2" gad="1/1/52" type="EIS6">Value of heating actuator 2</object>
<object id="heat_act3" gad="1/1/53" type="EIS1">Binary heating actuator 3</object>
<object id="heat_act_max" type="EIS6">Max Value of heating actuators</object>
</objects>
<formulas>
<formula target="heat_act_max">
<divide>
<max>
<object id="heat_act1"/>
<object id="heat_act2"/>
<bool2num object="heat_act3" iftrue="150" iffalse="0"/>
</max>
<constant value="2.55"/>
<divide>
<formula>
</formulas>
For the sunrise/sunset, I found a formula somewhere that seems to work (the time reported for today is 2 minutes different from what I get from wheather website). How do you think I should implement it? Somthing similar to a timer, that would become true on sunrise and false on sunset? Or a kind of arithmetic operation that would take a date as input and output sunrise or sunset time for that day (that you can in turn use in a timer with a variable timespec)?
Kind regards,
Jean-François
Dear JF,
Sunrise/sunset would be great as a timer with the possibility of an offset: 20min before/after sunrise/sunset do ....
You could drive blinds without the need of a light sensor.
Thanks for linknx!
Bernhard
Hello Jean-François,
as you said it might a tough question to decide on a specific solution.
And of course all aspects, e.g. understandability, versatility and complexity should be evaluated before coding.
Personally I like your proposal 3) at most.
1) seems a little bit odd to me, since conditions and arithmetic operations are usually not really mixed together in most programming languages
2) the same applies to combining arithmetic operations into objects; but thats just my personal feeling
I like 3) at most because it seems to be the most flexible.
I don't understand how you would initiate the computation of your heat_act_max object.
What about implementing the execution of arithmetic operations into actions,
type would be the arithmetic operation.
Guess you would need unconditional actionslists.
From the perspective of an enduser I would like to have variable offsets.
So for example as an extension to Bernhards example,
some logic which calculates an offset, e.g. dependent on weekday.
An example code with an variable (object):
<object id="open_time" Opening time</object>
<condition type="timer" trigger="true">
<at open_time exception="no" wdays="12345" />
</condition>
Have you thought about randomness?
I would like to implement some kind of presence simulation,
which randomly operates specific lightning patterns in the house.
For this an easy way to specify time offsets (in other words "delays") would be really nice.
Not just for patterns which simulate some walking through the house (from the living room to the toilet and back),
but I also like to sequentially open the shades.
Guess I am paranoid on overloading the power net/actuators.
best regards
Michael
> I don't understand how you would initiate the computation of your heat_act_max object.
I would just register the formula as change listener for all the objects involved in the computation and re-calculate it every time one of the input changes.
> Guess you would need unconditional actionslists.
I don't understand what you mean. When would the action be performed if there is no condition to tell it?
> From the perspective of an enduser I would like to have variable offsets.
I don't see exactly where the variable offset is used in your example, I just see that you use a variable timespec, (this is already implemented in the recent releases).
The problem I see with sunrise/sunset, is that you have to know the day for which you have to compute it. If you want for example to close/open the blinds at sunrise/sunset only during the weekend, on sunday evening, just after closing the blinds, the system will try to compute the next sunrise time, and we have to take care to calculate it for next saturday and not next monday (first compute the next execution date, then use it to compute sunrise time).
> Have you thought about randomness?
If we implement arithmetic operations, it will be very easy to add an operator that outputs a random number in a given range.
>For this an easy way to specify time offsets (in other words "delays") would be really nice.
>Not just for patterns which simulate some walking through the house (from the living room to the toilet and back),
>but I also like to sequentially open the shades.
>Guess I am paranoid on overloading the power net/actuators.
For that, you can already use fixed delays using the "delay" parameter of each action in the actionlist.
For the arithmetic operations, I think I'll try to implement a combination of proposal 3) and 4) (4 is your proposal to integrate arithmetic into actions). I'll create objects (and related XML structures) that allows to compute a value. Once we have these objects, it' very easy to use it in a "set-value" action and/or to create formulas like in proposal 3).
Regards,
Jean-François
Hello Jean-François,
I didn't know the delay attribute, but found it know in the code, thanks to your comments.
Is there somewhere an example for a variable timespec ?
My comment about an unconditional actionlist stems from my fixed time frame thinking.
Usually I am working with code which is executed in a specific time frame.
I am still not used to think event-based.
take care
Michael