Strange algorithm behavior

Continuing the discussion from Problem with coooling/heating cycles:

Not sure if this is related but:
Had realy good result in Fridge Constant and are now testing Beer Constant with a full 23litre water.
Beer probe in thermowell in the middle of bucket.
Started with a 18.3 C temp at water to see how it adjusted down to Beer Set to 18 C.
Settings:
Cooler (Kp): 5
Cooler (Ti):1800
Cooler (Td):60

Beer (Kp):5
Beer (Ti):1800
Beer (Td):60

Heater 1 PWM: 4
What is the pupose of using PWM here, the graph show a very long heating periode, but the SSR are active just 1 sec very 4th sec ?
Also:
Dead time when switching between actuators: 1800 (default)
But looking at the graph it starts cooling directly after heating ??

I also wondering about the deadtime. Think i need some explanation there. 30 minutes seems like a long time in ther first place, Probably something i do not understand.

Hi.
Well I do have a problem understanding how the algorithm works. Looking at the graph. I can not understand why it keeps on cooling after going below both the Fridge setting and the Beer setting.
The same thing happens when heating ??
Started of with a temp of 18.7 C, on my second try,and after 14 hours, still not “settling” within margins better than the 0.2.11 ver.

TomA, could you please try upgrading to 0.4.1? I improved a few things that will prevent overshoot.

Still, it is possible that the the algorithm will cool if the fridge temperature is already under setpoint, because of the integrator. Imagine if you are running the fridge at 5 degrees, the cooler should be on regularly to keep it at 5 degrees. The integrator compensates for the constant losses to the environment, while the proportional part manages fluctuations.

Hi Elco,
Did the update to 0.4.1 yesterday, worked like a charm,…


As you can see from the picture I did the update at about 12:20. My bucket with “beer” now had a temp of 13,5 °C. I deliberatly set the Beer temp to 14 °C for the test. I had a bit of an overshoot, but just 0.25 °C. And now it even out very good in the next few hours. Looks like the algorithm works very well now :smile:
But then I have a mishap. Blew a fuse in my basement…lost power to BPi, RPi and fridge at the same time.
All settings and devices was lost !!! had to do a complete reprogramming, as you see at about 16:00.
I started a new “brew” this morning and deliberately faked a power outage again. Same thing happened. All devices lost, and BPi stuck in Test Mode.When just booting the BrewPi, it itakes the 60 sec wait to load the script from RPi, and it is back up running OK.
Both my BrewPi and RPi have their own power supply.

Apart from that, I think the algorithm works fine now, on “default settings” the beer fluctuates only 0.12 °C :smile: and the fridge temp less than 0.5 °C :smile:
So, overall very happy with 0.4.1, but need to address the settings problem !!

During that 60 seconds, the Photon is in touch screen calibration. During the calibration, it is not listening to serial and missing the EEPROM reset.

Reboot your Photon and go through the calibration. Then press the reset to factory defaults button at the bottom of the advanced settings. That initializes the EEPROM properly and your settings will store.

Hi Elco,
I have tested this many times now, and when I reboot Raspberry, all installd devices are lost.


Dec 15 2015 21:25:16 Resetting controller to factory defaults
Dec 15 2015 21:25:17 controller debug message: INFO MESSAGE 15: EEPROM initialized
Dec 15 2015 21:25:46 Device updated to: {“i”:0,“t”:1,“c”:1,“b”:0,“f”:5,“h”:2,“d”:0,“p”:0,“a”:“2850F535070000F7”,“j”: 0.000}
Dec 15 2015 21:26:05 Device updated to: {“i”:1,“t”:1,“c”:1,“b”:1,“f”:9,“h”:2,“d”:0,“p”:0,“a”:“28EDAD3607000099”,“j”: 0.000}
Dec 15 2015 21:26:28 Device updated to: {“i”:10,“t”:4,“c”:1,“b”:0,“f”:3,“h”:1,“d”:0,“p”:17,“x”:0}
Dec 15 2015 21:26:38 Device updated to: {“i”:11,“t”:4,“c”:1,“b”:0,“f”:2,“h”:1,“d”:0,“p”:16,“x”:0}
Dec 15 2015 21:26:39 Installed devices received: [{“a”: “2850F535070000F7”, “c”: 1, “b”: 0, “d”: 0, “f”: 5, “i”: 0, “h”: 2, “j”: 0.0, “p”: 0, “t”: 1, “v”: 18.0}, {“a”: “28EDAD3607000099”, “c”: 1, “b”: 1, “d”: 0, “f”: 9, “i”: 1, “h”: 2, “j”: 0.0, “p”: 0, “t”: 1, “v”: 19.0}, {“c”: 1, “b”: 0, “d”: 0, “f”: 3, “i”: 10, “h”: 1, “p”: 17, “t”: 4, “v”: 0.0, “x”: 0}, {“c”: 1, “b”: 0, “d”: 0, “f”: 2, “i”: 11, “h”: 1, “p”: 16, “t”: 4, “v”: 0.0, “x”: 0}]
Dec 15 2015 21:26:40 Available devices received: [{“a”: “28FE4A3607000010”, “c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 2, “j”: 0.0, “p”: 0, “t”: 0, “v”: 14.75}, {“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 11, “t”: 0, “x”: 0}, {“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 10, “t”: 0, “x”: 0}]
Dec 15 2015 21:27:43 Notification: Fridge temperature set to 18.0 degrees in web interface
Dec 15 2015 21:27:44 controller debug message: INFO MESSAGE 12: Received new setting: mode = f
Dec 15 2015 21:27:44 controller debug message: INFO MESSAGE 12: Received new setting: fridgeSet = 18.0
Dec 15 2015 21:29:48 Opening serial port
Dec 15 2015 21:29:48 Notification: Script started for beer 'Beer Constant 0.4.1 Test’
Dec 15 2015 21:29:58 Checking software version on controller…
Dec 15 2015 21:29:59 Found BrewPi v0.4.1 build 0.4.1-0-g69ee566, running on a Particle Photon with a V2 shield on port /dev/ttyACM0

Dec 15 2015 21:31:26 Installed devices received: []
Dec 15 2015 21:31:28 Available devices received: [{“a”: “2850F535070000F7”, “c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 2, “j”: 0.0, “p”: 0, “t”: 0}, {“a”: “28FE4A3607000010”, “c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 2, “j”: 0.0, “p”: 0, “t”: 0}, {“a”: “28EDAD3607000099”, “c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 2, “j”: 0.0, “p”: 0, “t”: 0}, {“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 17, “t”: 0, “x”: 0}, {“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 16, “t”: 0, “x”: 0}, {“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 11, “t”: 0, “x”: 0}, {“c”: 1, “b”: 0, “d”: 0, “f”: 0, “i”: -1, “h”: 1, “p”: 10, “t”: 0, “x”: 0}]


Also, BrewPi stops in Test Mode.
If just booting the BrewPi, this error shows in the log:


Dec 15 2015 21:14:12 Serial Error: [Errno 5] Input/output error)
Dec 15 2015 21:14:12 Serial Error: [Errno 5] Input/output error)
Dec 15 2015 21:14:13 Serial Error: [Errno 5] Input/output error)
Dec 15 2015 21:14:13 Serial Error: [Errno 5] Input/output error)
Traceback (most recent call last):
File “/home/brewpi/brewpi.py”, line 725, in
ser.write(‘l’)
File “/usr/local/lib/python2.7/dist-packages/serial/serialposix.py”, line 518, in write
raise SerialException(‘write failed: %s’ % (v,))
serial.serialutil.SerialException: write failed: [Errno 5] Input/output error
Dec 15 2015 21:15:02 Opening serial port
Dec 15 2015 21:15:02 Notification: Script started for beer 'Beer Constant 0.4.1 Test’
Dec 15 2015 21:15:12 Checking software version on controller…
Dec 15 2015 21:15:12 Found BrewPi v0.4.1 build 0.4.1-0-g69ee566, running on a Particle Photon with a V2 shield on port /dev/ttyACM0


User rights problem ??

Rebooting the Raspberry Pi should have nothing to do with the stored devices. These are stored in EEPROM on the Photon. Can you PWM me your Skype details, I’d like to investigate this one on one.
It looks like the EEPROM reset is carried out correctly, but new data is not written to EEPROM.

I’m helping a friend which I think experience a similar problem. Almost all settings are gone. Device settings, control settings and control constants settings. Before I discovered that most of the settings were gone, I tried to configure three temp devices and to output devices. No devices were stored.

Now I’m home looking at my own BrewPi system. I tried to look for the “reset to factory defaults button at the bottom of the advanced settings.” as you described, but I’m not able to find it.
I’m running on a Spark Core and he’s running Photon.

Can I use Reset Button at the back of BrewPi, and if so, do I need to re-install something?

It is under ‘maintenance panel -> advanced settings’.

I’m releasing a fix for loosing settings in the next release. It’s because the controller received the reset command from the pi. In the next release, ‘E\n’ will be required instead of just ‘E’, so it doesn’t happen by accident.

As I suspected, brewpi was running an older version of web interface without the “Reset controller to factory defaults”-button. After updating BrewPi, but still on firmware 0.2.11, I found it :slight_smile:

No problem to add and store devices now.