Page 1 of 1

Custom temperature control algo

Posted: Sat Aug 19, 2017 10:10 pm
by makkie2002
Hi,

Does anyone know if it is possible to adapt the temperature control algoritm?
Just out of curiosity I want to play with different temperature control algoritms by myself.
Is the control algorithm hardcoded and compiled or is it scripted in any of the .qml files?

Maybe also helpfull if the boiler can be turned on and off from the command line (in case of an on/off boiler type).

Regards !

Re: Custom temperature control algo

Posted: Sat Aug 19, 2017 11:22 pm
by marcelr
It is always possible.

The temperature controller is part of the happ_thermstat executable, which is a piece of compiled code. It is, however, possible to intercept the communication between happ_thermstat and the boiler, and replace any commands given to the boiler and vice versa, by your own.

Once the communication is intercepted, you can tell the boiler anything from the command line.
I have the communication protocol and working interception code. Never managed to find time to merge the two, so far.

You will need a working toolchain for toon's processor and some fluency in C to pull this off, though.

BTW, the controller is a simple PID controller, with some analysis software to estimate the characteristic heating time for your home, in conjunction with your boiler.

Re: Custom temperature control algo

Posted: Sat Aug 19, 2017 11:35 pm
by makkie2002
The temperature controller is part of the happ_thermstat executable, which is a piece of compiled code.
Is the source code of this "happ_thermstat" available ?
I do not have a toolchain installed just yet, but it would already be nice to look inside :)

Re: Custom temperature control algo

Posted: Sat Aug 19, 2017 11:39 pm
by marcelr
No, that's proprietary code, by Quby.

Re: Custom temperature control algo

Posted: Sat Aug 19, 2017 11:45 pm
by makkie2002
marcelr wrote:No, that's proprietary code, by Quby.
That's a pitty :cry:

Re: Custom temperature control algo

Posted: Sun Aug 20, 2017 12:20 pm
by makkie2002
Just for experimentation sake ... is it possible to completely disable "happ_thermstat" and inject the boiler commands directly via a script?
Related to this ... is it possible to make a complete new qml gui that can be started in stead of the normal toon gui (without removing the toon gui, so that we can easily go back :idea:)?

Re: Custom temperature control algo

Posted: Sun Aug 20, 2017 12:48 pm
by marcelr
No, the communication between happ_thermstat and /dev/ttymxc2 (IIRC, could be ttymxc2 as well) can be intercepted and replaced with something else, in both directions ... still needs some work, though.

If you want to build a new GUI, be my guest ... and good luck to you ...

Re: Custom temperature control algo

Posted: Tue Aug 22, 2017 9:10 pm
by makkie2002
BTW, the controller is a simple PID controller, with some analysis software to estimate the characteristic heating time for your home, in conjunction with your boiler.
Are the PID parameters stored somewhere that is accessable from the terminal?
The "learned" parameters should be stored somewhere on the filesystem.

The problem is that I have a Toon from Marktplaats and I haven't done a factory reset before rooting.
This means that learned parameters are for the house of the previous owner of the Toon.
Is it possible to reinitiate the learning process without doing a factory reset?

Re: Custom temperature control algo

Posted: Wed Aug 23, 2017 7:38 am
by marcelr
There's no need to do a factory reset. After a factory reset, you will need to reactivate your toon, do all settings again.
The PID parameters are stored somewhere on the fileystem, in /HCv2/config/ or thereabouts. If the engineers at quby made a halfway decent algorithm for control parameter estimation, this estimation should be continuous. That it reaches a steady state solution after 2 weeks, does not necessarily mean that the estimation then stops. In other words; I think, that when you move the thermostat from one place to another, the "learning" process starts anew, only with a different set of initial parameters.

Re: Custom temperature control algo

Posted: Wed Aug 23, 2017 9:19 pm
by makkie2002
The PID parameters are stored somewhere on the fileystem, in /HCv2/config/ or thereabouts.
Probably in config_happ_thermstat.xml, there I can find some parameters with strange numbers and names:

Code: Select all

<outsideRate>-0.010000</outsideRate>
<outsideRate0>-0.001468</outsideRate0>
<outsideRate1>-0.009640</outsideRate1>
<outsideRate2>-0.010000</outsideRate2>
<heatingFactor>0.001187</heatingFactor>
<shootFactor>0.000000</shootFactor>
<profile>ThermostatInfo</profile><dp_k_1>0.045</dp_k_1><dpp_k_1>1.000</dpp_k_1><eth_k_1>1.000</eth_k_1><correctionValuesTimestamp>1503514771</correctionValuesTimestamp><heaterFuelType>gasFuel</heaterFuelType></device>
Can you check on your thermostat if you have the same or different numbers for these parameters. If they are different then this will be due to the learning proces. I will keep an eye on my values and see if they change over time as result of the learning proces.

Re: Custom temperature control algo

Posted: Wed Aug 23, 2017 9:29 pm
by marcelr
This is from my test toon:

Code: Select all

<measuredHeatingFactors>measuredHeatingFactors:[ 0.001441,0.001471,0.001433,0.000645,0.001212,0.001054,0.001311,0.001223,0.001471,0.000916]</measuredHeatingFactors>
 
and

Code: Select all

<dp_k_1>0.260</dp_k_1><dpp_k_1>1.000</dpp_k_1><eth_k_1>0.912</eth_k_1>
What it means? Search me.
I think you have a boxx, right? Different boiler interface hardware, different control software?

Re: Custom temperature control algo

Posted: Wed Aug 23, 2017 11:59 pm
by makkie2002
I have an Eneco Toon from marktplaats.nl. In the Netherlands they seem to have flooded the market and many poeple want to get rid of them (too costly ?).

I searched tweedehands.be for a Engie Boxx, but none was available! Actually, I wanted to have a Boxx because the sensor for the electric meter needs to be somewhat different in Belgium, because the meter is "sealed" inside another transparent box and the sensors from Eneco suffer from too much reflection in that case. Boxx comes with a bigger sensor for the electricty meter: https://ic.tweakimg.net/images/member/o ... 35e0p.jpeg. I will look later on how to adapt or build my own sensor. Does anyone know the signals on the cables that go to the sensors? I have opened one of the sensors and they only contain a LED and a photodiode or phototransitor, not ICs. So building my own sensor will not be too difficult. If someone from Belgium happens to read this post and has a larger sensor, please take some pictures from the sensing side and make a distance measurment between LED and phototransistor.

I also have this measuredHeatingFactors parameter, but it only contains one value. Probably this is because last night I did do a factory reset (I know you advised not to do it, but I couldn't resist :mrgreen:). The extra values that you have will be from previous learning phases, i guess.

Code: Select all

<measuredHeatingFactors>measuredHeatingFactors:[ 0.001187]</measuredHeatingFactors>

Re: Custom temperature control algo

Posted: Thu Aug 24, 2017 11:16 pm
by TheHogNL
I was trying to figure out the workings of the sensor myself (in another thread about solar power collecting). I figured out that a LED pulse can easily be simulated by connecting two out of the three wires (probably the 3v and the ground/pulled-down input) together which will count for a pulse each time you do that. I didn't figure out what the other wire is for (probably the photo transistor?). But my major problem is when the Toon module is inserted into the power. It then starts some kind of boot up procedure in which it (probably) detects if he can see a red led or need his own blue led to light up and have the reflector on the powermeter reflect it back. I can not simulate that boot up procedure yet with a home made 'sensor' (in my case a raspberry pi). The Toon module stays dark, does not detect any sensor connected.