Central Heating controller using the real time clock, PHY module for internet, 1-wire interface for temperature sensors, a system log and a configuration file

Dependencies:   net 1-wire lpc1768 crypto clock web fram log

/media/uploads/andrewboyson/heating.sch

/media/uploads/andrewboyson/heating.brd

/media/uploads/andrewboyson/eagle.epf

Committer:
andrewboyson
Date:
Tue Feb 23 20:35:07 2021 +0000
Revision:
105:1899f7ed17ec
Parent:
104:46ce1aaf8be7
Child:
106:41ed3ea0bbba
Added ability to set the minimum flow rate and removed the correction to delta T relative to speed. Adding the round circuit time and linked to speed. Next task is to linearize the flow.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andrewboyson 47:229338b3adcb 1 "//Boiler script\n"
andrewboyson 47:229338b3adcb 2 "'use strict';\n"
andrewboyson 47:229338b3adcb 3 "\n"
andrewboyson 91:8b192efd0288 4 "let dateTime = '';\n"
andrewboyson 91:8b192efd0288 5 "let tankTemperature = '';\n"
andrewboyson 91:8b192efd0288 6 "let blrOutTemperature = '';\n"
andrewboyson 91:8b192efd0288 7 "let blrRtnTemperature = '';\n"
andrewboyson 105:1899f7ed17ec 8 "let blrAlnTemperature = '';\n"
andrewboyson 105:1899f7ed17ec 9 "let blrDeltaT = '';\n"
andrewboyson 105:1899f7ed17ec 10 "let boilerEnable = false;\n"
andrewboyson 91:8b192efd0288 11 "let boilerCall = false;\n"
andrewboyson 91:8b192efd0288 12 "let boilerPump = false;\n"
andrewboyson 105:1899f7ed17ec 13 "let fullSpeedSecs = '';\n"
andrewboyson 91:8b192efd0288 14 "let tankSetPoint = '';\n"
andrewboyson 91:8b192efd0288 15 "let tankHysteresis = '';\n"
andrewboyson 91:8b192efd0288 16 "let blrRunOnDeg = '';\n"
andrewboyson 91:8b192efd0288 17 "let blrRunOnTime = '';\n"
andrewboyson 104:46ce1aaf8be7 18 "let blrPumpSpeed = '';\n"
andrewboyson 104:46ce1aaf8be7 19 "let blrPumpPwm = '';\n"
andrewboyson 104:46ce1aaf8be7 20 "let pumpSpeedCalling = '';\n"
andrewboyson 104:46ce1aaf8be7 21 "let pumpSpeedRunOn = '';\n"
andrewboyson 104:46ce1aaf8be7 22 "let blrOutputTarget = '';\n"
andrewboyson 104:46ce1aaf8be7 23 "let riseAt0 = '';\n"
andrewboyson 104:46ce1aaf8be7 24 "let riseAt50 = '';\n"
andrewboyson 104:46ce1aaf8be7 25 "let riseAt100 = '';\n"
andrewboyson 47:229338b3adcb 26 "\n"
andrewboyson 47:229338b3adcb 27 "function parse()\n"
andrewboyson 47:229338b3adcb 28 "{\n"
andrewboyson 47:229338b3adcb 29 " let lines = Ajax.response.split('\\n');\n"
andrewboyson 104:46ce1aaf8be7 30 " tankTemperature = Ajax.hexToSignedInt16(lines[ 0]);\n"
andrewboyson 104:46ce1aaf8be7 31 " blrOutTemperature = Ajax.hexToSignedInt16(lines[ 1]);\n"
andrewboyson 104:46ce1aaf8be7 32 " blrRtnTemperature = Ajax.hexToSignedInt16(lines[ 2]);\n"
andrewboyson 105:1899f7ed17ec 33 " blrAlnTemperature = Ajax.hexToSignedInt16(lines[ 3]);\n"
andrewboyson 105:1899f7ed17ec 34 " blrDeltaT = Ajax.hexToSignedInt16(lines[ 4]);\n"
andrewboyson 105:1899f7ed17ec 35 " boilerCall = Ajax.hexToBit (lines[ 5], 0);\n"
andrewboyson 105:1899f7ed17ec 36 " boilerPump = Ajax.hexToBit (lines[ 5], 1);\n"
andrewboyson 105:1899f7ed17ec 37 " boilerEnable = Ajax.hexToBit (lines[ 5], 2);\n"
andrewboyson 105:1899f7ed17ec 38 " fullSpeedSecs = Ajax.hexToSignedInt16(lines[ 6]);\n"
andrewboyson 105:1899f7ed17ec 39 " tankSetPoint = Ajax.hexToSignedInt16(lines[ 7]);\n"
andrewboyson 105:1899f7ed17ec 40 " tankHysteresis = Ajax.hexToSignedInt16(lines[ 8]);\n"
andrewboyson 105:1899f7ed17ec 41 " blrRunOnDeg = Ajax.hexToSignedInt16(lines[ 9]);\n"
andrewboyson 105:1899f7ed17ec 42 " blrRunOnTime = Ajax.hexToSignedInt16(lines[10]);\n"
andrewboyson 105:1899f7ed17ec 43 " blrPumpSpeed = Ajax.hexToSignedInt16(lines[11]);\n"
andrewboyson 105:1899f7ed17ec 44 " blrPumpPwm = Ajax.hexToSignedInt16(lines[12]);\n"
andrewboyson 105:1899f7ed17ec 45 " pumpSpeedCalling = Ajax.hexToSignedInt16(lines[13]);\n"
andrewboyson 105:1899f7ed17ec 46 " if (pumpSpeedCalling == -1) pumpSpeedCalling = 'A';\n"
andrewboyson 105:1899f7ed17ec 47 " if (pumpSpeedCalling == -2) pumpSpeedCalling = 'T';\n"
andrewboyson 105:1899f7ed17ec 48 " pumpSpeedRunOn = Ajax.hexToSignedInt16(lines[14]);\n"
andrewboyson 105:1899f7ed17ec 49 " blrOutputTarget = Ajax.hexToSignedInt16(lines[15]);\n"
andrewboyson 105:1899f7ed17ec 50 " riseAt0 = Ajax.hexToSignedInt16(lines[16]);\n"
andrewboyson 105:1899f7ed17ec 51 " riseAt50 = Ajax.hexToSignedInt16(lines[17]);\n"
andrewboyson 105:1899f7ed17ec 52 " riseAt100 = Ajax.hexToSignedInt16(lines[18]);\n"
andrewboyson 47:229338b3adcb 53 "}\n"
andrewboyson 47:229338b3adcb 54 "function display()\n"
andrewboyson 47:229338b3adcb 55 "{\n"
andrewboyson 47:229338b3adcb 56 " let elem;\n"
andrewboyson 92:2d1ca4dcbca7 57 " elem = Ajax.getElementOrNull('ajax-tank-html' ); if (elem) elem.textContent = OneWire.DS18B20ToString(tankTemperature);\n"
andrewboyson 92:2d1ca4dcbca7 58 " elem = Ajax.getElementOrNull('ajax-blr-out-html' ); if (elem) elem.textContent = OneWire.DS18B20ToString(blrOutTemperature);\n"
andrewboyson 92:2d1ca4dcbca7 59 " elem = Ajax.getElementOrNull('ajax-blr-rtn-html' ); if (elem) elem.textContent = OneWire.DS18B20ToString(blrRtnTemperature);\n"
andrewboyson 105:1899f7ed17ec 60 " elem = Ajax.getElementOrNull('ajax-blr-aln-html' ); if (elem) elem.textContent = OneWire.DS18B20ToString(blrAlnTemperature);\n"
andrewboyson 105:1899f7ed17ec 61 " elem = Ajax.getElementOrNull('ajax-blr-rise-html' ); if (elem) elem.textContent = OneWire.DS18B20ToString(blrDeltaT);\n"
andrewboyson 91:8b192efd0288 62 " \n"
andrewboyson 104:46ce1aaf8be7 63 " elem = Ajax.getElementOrNull('ajax-blr-pump-speed-html'); if (elem) elem.textContent = blrPumpSpeed;\n"
andrewboyson 104:46ce1aaf8be7 64 " elem = Ajax.getElementOrNull('ajax-blr-pump-pwm-html' ); if (elem) elem.textContent = blrPumpPwm;\n"
andrewboyson 104:46ce1aaf8be7 65 " \n"
andrewboyson 105:1899f7ed17ec 66 " elem = Ajax.getElementOrNull('ajax-blr-call-toggle' ); if (elem) elem.setAttribute('dir', boilerCall ? 'rtl' : 'ltr');\n"
andrewboyson 105:1899f7ed17ec 67 " elem = Ajax.getElementOrNull('ajax-blr-pump-toggle' ); if (elem) elem.setAttribute('dir', boilerPump ? 'rtl' : 'ltr');\n"
andrewboyson 105:1899f7ed17ec 68 " elem = Ajax.getElementOrNull('ajax-blr-enable-toggle' ); if (elem) elem.setAttribute('dir', boilerEnable ? 'rtl' : 'ltr');\n"
andrewboyson 105:1899f7ed17ec 69 " elem = Ajax.getElementOrNull('ajax-full-speed-secs' ); if (elem) elem.value = fullSpeedSecs;\n"
andrewboyson 104:46ce1aaf8be7 70 " elem = Ajax.getElementOrNull('ajax-tank-set-point' ); if (elem) elem.value = tankSetPoint;\n"
andrewboyson 104:46ce1aaf8be7 71 " elem = Ajax.getElementOrNull('ajax-tank-hysteresis' ); if (elem) elem.value = tankHysteresis;\n"
andrewboyson 104:46ce1aaf8be7 72 " elem = Ajax.getElementOrNull('ajax-blr-run-on-deg' ); if (elem) elem.value = OneWire.DS18B20ToString(blrRunOnDeg);\n"
andrewboyson 104:46ce1aaf8be7 73 " elem = Ajax.getElementOrNull('ajax-blr-run-on-time' ); if (elem) elem.value = blrRunOnTime;\n"
andrewboyson 104:46ce1aaf8be7 74 " \n"
andrewboyson 104:46ce1aaf8be7 75 " elem = Ajax.getElementOrNull('ajax-pump-speed-calling'); if (elem) elem.value = pumpSpeedCalling;\n"
andrewboyson 104:46ce1aaf8be7 76 " elem = Ajax.getElementOrNull('ajax-pump-speed-run-on' ); if (elem) elem.value = pumpSpeedRunOn;\n"
andrewboyson 104:46ce1aaf8be7 77 " elem = Ajax.getElementOrNull('ajax-blr-output-target' ); if (elem) elem.value = blrOutputTarget;\n"
andrewboyson 104:46ce1aaf8be7 78 " \n"
andrewboyson 105:1899f7ed17ec 79 " elem = Ajax.getElementOrNull('ajax-pump-rise-at-0' ); if (elem) elem.value = riseAt0;\n"
andrewboyson 105:1899f7ed17ec 80 " elem = Ajax.getElementOrNull('ajax-pump-rise-at-50' ); if (elem) elem.value = riseAt50;\n"
andrewboyson 104:46ce1aaf8be7 81 " elem = Ajax.getElementOrNull('ajax-pump-rise-at-100' ); if (elem) elem.value = OneWire.DS18B20ToString(riseAt100);\n"
andrewboyson 47:229338b3adcb 82 "}\n"
andrewboyson 47:229338b3adcb 83 "\n"
andrewboyson 47:229338b3adcb 84 "Ajax.server = '/boiler-ajax';\n"
andrewboyson 47:229338b3adcb 85 "Ajax.onResponse = function() { parse(); display(); };\n"
andrewboyson 47:229338b3adcb 86 "Ajax.init();\n"
andrewboyson 47:229338b3adcb 87 ""