rasProject_01 / weSweetHome  R. 146 2026-09-26
process control       /     RasPi software         by   weinert-automation
Loading...
Searching...
No Matches
sweetHome.h File Reference

Common types, values and functions for a smart home project. More...

#include "arch/config.h"
#include <stdint.h>
#include "weShareMem.h"

Data Structures

struct  cmdLookUp_t
 Structure for a defined remote command. More...
struct  dayStrtVal_t
 Day start values. More...
struct  meterVal_t
 One smart meter's readings. More...
struct  phPckSwSet_t
 Simple Structure for phase packet switching. More...
struct  valFilVal_t
 Smart meters' and other process values. More...
struct  valsSharMem_t
 Structure for shared memory. More...

Macros

#define Amsk
 would give away
#define ANZmodSLAVES
 Number of smart Modbus meters.
#define AUTO_PPSWI_COMMAND
 auto control (ON=manual)
#define BALL_CARLOAD_COMMAND
 car load as PV surplus ballast
#define bat2unload(x)
 The battery load/undoad line (30A fuse) is connected to the unload step up converter and, hence, not to the PWM controlled charger.
#define BAT_COMMANDS
 all battery commands mask
#define BATLOAD_COMMANDS
 battery loading commands mask
#define BATUNL_COMMANDS
 battery unloading commands mask
#define Bmsk
 Controlled load battery (as ballast up to maximal U).
#define C250W_COMMANDS
 give 250 W command mask
#define CARLOAD_COMMANDS
 car load command mask
#define CHSBmsk
 CHS mode ballast (1: on at 0.. max power at surplus).
#define CHScarC
 CHS loading station: car connected to EVSE.
#define CHScPow
 CHS loading station: power line connected to car.
#define CHSiLhi
 CHS current limit at hi border.
#define CHSiLiM
 CHS current limit at one border mask.
#define CHSiLlo
 CHS current limit at lo border (usually 6A fixed).
#define CHSMmsk
 CHS mode manual (1: on at max power).
#define CHSphas
 CHS number of phases: 1..6; 0, 7 not used; 3 default.
#define CHSphHi
 CHS number of phases at hi limit (1..6).
#define CHSphLo
 CHS number of phases at lo limit (usually 1 fixed).
#define CHSphMs
 CHS number of phases at limit mask.
#define cmdBits_t
 Type for command bits.
#define DEC_CARLOAD_COMMAND
 car load decrease max. current
#define DECLIM_PPSWI_COMMAND
 reduce PPSWI limit (by 300W)
#define DECR_PPSWI_COMMAND
 decrement (-1) PPSWI power
#define EFNY
 Start position of date in evtFilNam.
#define getNoPhas()
 Get number of phases.
#define GIVE250_COMMANDS
 commands concerning Plg01 & Rel5
#define Gmsk
 Give away: Alarm / add ballast / etc.
#define HIPPO_COMMANDS
 Mask for all Hippogreiff commands.
#define HWPUMP_COMMANDS
 comfort pump command mask
#define IL1
 Current [A] in of line 1 (L1 R) the array vals.
#define IL2
 Current [A] in of line 2 (L2 S) the array vals.
#define IL3
 Current [A] in of line 3 (L3 T) the array vals.
#define INC_CARLOAD_COMMAND
 car load increase max. current
#define INC_PPSWI_COMMAND
 increment (+1) PPSWI power
#define INCLIM_PPSWI_COMMAND
 increase PPSWI limit (by 200W)
#define inv2RelOff(x)
 The two relays to switch + and - inverter input plugs are off.
#define Kmsk
 Keep battery (to hold a minimal load level).
#define Lmsk
 Load battery (normal program to middle level).
#define LOWER_BATLOAD_COMMAND
 lower battery loading power
#define LOWER_PPSWI_COMMAND
 lower PPSWI power
#define OFF_C250W_COMMAND
 off control give 250 W
#define OFF_CARLOAD_COMMAND
 E-car load off.
#define OFF_HIPPO_COMMAND
 Hippogreiff off.
#define OFF_PLG1_COMMAND
 off Plug01 give 250 W
#define OFF_PLG2_COMMAND
 off Plug02
#define OFF_PLG3_COMMAND
 off Plug03
#define OFF_PLG4_COMMAND
 off Plug04
#define OFF_PPSWI_COMMAND
 off PPSWI (Power packet switching)
#define ON_C250W_COMMAND
 on control give 250 W
#define ON_CARLOAD_COMMAND
 E-car load on.
#define ON_HIPPO_COMMAND
 Hippogreiff on.
#define ON_PLG1_COMMAND
 on Plug01 give 250 W
#define ON_PLG2_COMMAND
 on Plug02
#define ON_PLG3_COMMAND
 on Plug03
#define ON_PLG4_COMMAND
 on Plug04
#define ONMAN_PPSWI_COMMAND
 on and manual PPSWI PPSWI
#define P2sPmsk
 PPS element 2 power * 50% (0:0% .. 2:100%).
#define PCK100PERC_POWER
 Phase packet switching device.
#define PCK1PERC_POWER
 phase packet switch 1% power / W
#define PCK50PRC_POWER
 phase packet switch 50% power / W
#define PHDEC_CARLD_COMMAND
 assume E-cars using 1 phase less
#define PHINC_CARLD_COMMAND
 assume E-cars using 1 phase more
#define PL1
 Power [W] in of line 1 (L1 R) the array vals.
#define PL2
 Power [W] in of line 2 (L2 T) the array vals.
#define PL3
 Power [W] in of line 3 (L3 T) the array vals.
#define PLG1_COMMANDS
 Plug01 command mask.
#define PLG2_COMMANDS
 Plug02 command mask.
#define PLG3_COMMANDS
 Plug03 command mask.
#define PLG4_COMMANDS
 Plug04 command mask.
#define PPSMmsk
 PPS mode manual (0: automatic, default).
#define PPSUmsk
 PPS power at limit PCK_POWER_LIM_MAX.
#define PPSWI_COMMANDS
 Power packet switching commands.
#define PPsXmsk
 PPS max at limit (1: at 0.0 or PCK_POWER_LIM_MAX).
#define PUMP_STRT_FOR
 Blocking interval to re-start comfort pump for equalising.
#define PUMP_STRT_POWR
 Water (tank) heating power / W to start comfort pump for equalising.
#define PUMP_STRT_TEMP
 Water (tank) temperature to start comfort pump when heating.
#define RFNY
 Start position of date in retFilNam.
#define RISE_BATLOAD_COMMAND
 rise battery loading power
#define RISE_PPSWI_COMMAND
 rise PPSWI power
#define SAFE_TEMP_MID
 Upper limit of safe water (tank middle) temperature.
#define SAFE_TEMP_UP
 Upper limit of safe water (tank top) temperature.
#define SHARED_MEM_DATA_SIZE
 Size of defined master slave communication data in shared memory.
#define SHARED_MEM_FILL_SIZE
 Size of extra fill array to have a standard shared memory size.
#define Smsk
 Solar power is generated.
#define START_BATKEEP_COMMAND
 start battery keep alive (with load)
#define START_BATKPLD_COMMAND
 start battery keep or load
#define START_BATLOAD_COMMAND
 start battery loading
#define START_BATUNL_COMMAND
 start battery unloading
#define START_HWPUMP_COMMAND
 start hot water comfort pump
#define STD_CARLOAD_COMMAND
 set 3 phases and 16A (11kW)
#define STOP_BAT_COMMAND
 stop battery unloading & loading
#define STOP_HWPUMP_COMMAND
 stop hot water comfort pump
#define tempTankSafe()
 Condition to heat up the water tank.
#define U_ENDRANGE
 Upper limit of battery operating range LiFePo.
#define U_ENDRANGE_SOC
 SOC value assigned to U_ENDRANGE.
#define UBLKmsk
 ORed battery handling status bits.
#define UL1
 Voltage [V] in of line 1 (L1 R) the array vals.
#define UL2
 Voltage [V] in of line 2 (L2 S) the array vals.
#define UL3
 Voltage [V] in of line 3 (L3 R) the array vals.
#define Umsk
 Unload battery.
#define UNUSED_COMMANDS
 4 unused command bits (June 2023)
#define Wexp
 Work exported [Wh] in the array vals.
#define Wimp
 Work imported [Wh] in the array vals.
#define Wmsk
 Would give away 250W or more.

Functions

int batSOCbyU (float uBat)
 Battery capacity or state of charge (SOC) in % by voltage.
void chgFilNames (void)
 Set the current date in event & retain file paths.

Variables

cmdLookUp_t cmdLookUp []
 The common command look up table.
char dayFilNam []
 Path of the table to log a set of values for every day.
char evtFilNam []
 Path of the daily event file.
volatile float fLine
 Last valid power line frequency.
volatile int invHasUnloadPow
 The miniJoule inverter has battery unload power.
float const loadModUlookup [256]
 Output voltage of electronic battery load module.
float const phPckSwPow [101]
 First (or only) phase packet switching device power look up.
phPckSwSet_t const phPckSwSets [101]
 The packet switch control values.
meterVal_t const * pubSyValsPt
 Public supply meter.
char retFilNam []
 Path of the daily retain file.
smdX30modbus_t smdX30modbus [2]
 Descriptive and state array for smart meters on Modbus.
meterVal_t const * solarValsPt
 Solar, battery and heater meter.
volatile uint tempMiddleBadCnt
 Tank water upper temperature bad read count.
volatile int tempTankMiddle
 Last value of tank water middle temperature in mgrdC.
volatile int tempTankUpper
 Last value of tank water upper temperature in mgrdC.
volatile uint tempUpperBadCnt
 Tank water upper temperature bad read count.
float const uBatBySOC [113]
 Battery voltage by capacity or state of charge (SOC) in %.
valFilVal_t valFilVal
 All process values relevant for log files and HMI.

Detailed Description

Common types, values and functions for a smart home project.

Copyright (c) 2018 - 2026 Albrecht Weinert
weinert-automation.de a-weinert.de
/ / /\
/ /___ / \ |
\ /____\ /____\ | _|__
\ /\ / \ / \| |
\/ \/ \__/ \__/|_

Revision history

Rev. 147 26.09.2026
Rev. 77+ 07.12.2017 : new
Rev. 99 29.01.2018 : storage battery load module voltage handling added
Rev. 187 04.10.2018 : wSumExp in valFilVal_t (unload guarded)
Rev. 190 12.02.2019 : prepare VDE-AR-N 4105 (relays) handling
Rev. 217 05.09.2019 : phase packet switch ballast: three variants
Rev. 220 09.11.2019 : Growatt values added to valFilVal_t
Rev. 245 27.02.2023 : pps 100% power risen to 1983 W due to panel reorg.
Rev. 251 12.07.2023 : phase packet switch power limit added to valFilVal_t
Rev. 259 04.08.2023 : battery changed to ECO-WORTHY 12.8V 100Ah LiFePO4 Akku
Rev. 268 15.10.2024 : float lookup Uload(pwm) range 0..141
Rev. 270 03.11.2024 : semaphore set & shared memory defined in weShareMem.h
Rev. 86 19.06.2025 : water temperature limits reduced etc.
Rev. 89 28.07.2025 : new Uload(pwm) table
Rev. 90 06.08.2025 : battery state of charge (SOC)/% <-> Ubat
Rev. 92 15.08.2025 : load unload values and SFCs
Rev. 99 20.10.2025 : event and retain file handling changed (unified)
Rev. 116 13.05.2026 : water tank temperature handling enhanced
Rev. 119 28.05.2026 : separation of tempTankMiddle and tempTankTop
Rev. 119 28.05.2026 : separation of tempTankMiddle and tempTankTop
Rev. 123 01.07.2026 : in line macro doc comments not in html documentation
Rev. 128 28.06.2026 : PUMP_STRT_TEMP increased; comments enhanced
Rev. 131 06.08.2026 : valFilVal_t.by[11] SoC 0..100%; 120 means invalid
Rev. 145 20.09.2026 : comment corr. (and Rev. 147)
Smart meters' and other process values.
Definition sweetHome.h:611
uint8_t by[12]
Relays, outputs and states.
Definition sweetHome.h:636
volatile int tempTankMiddle
Last value of tank water middle temperature in mgrdC.
Definition sweetHome.c:503
#define PUMP_STRT_TEMP
Water (tank) temperature to start comfort pump when heating.
Definition sweetHome.h:817

In the smart home's PV (photovoltaic) under control, we assume one smart meter for the whole building's (public) electricity supply and one for solar generators and battery storage. The (two, cf. ANZmodSLAVES) meters are Modbus controlled.
Additionally, we have home and PV related process control.
The process IO related definitions are mostly in include/sweetHome2.h.

This include file collects some configuration and naming common to
a) the process control program (hometersControl)
b) a console HMI program (hometersConsol) and the
c) server side program(s) (meteRead, CGI) for the web interfaces

All those programs, running on the system for process control and I/O, are written in C. The client side programming for the web HMI is in Javascript.

The server side programs communicate via shared memory and a set of three (ANZ_SEMAS) semaphores.

Macro Definition Documentation

◆ ANZmodSLAVES

#define ANZmodSLAVES

Number of smart Modbus meters.

In our configuration we have two smart meters connected via one Modbus RS485 line: one for the grid (public supply, three phases) and one for solar, battery, heater etc. (three channels on two phases).

◆ Wimp

#define Wimp

Work imported [Wh] in the array vals.

The self documenting Wimp is replaces by vals[10] to reference in in the meterVal_t::vals array.

◆ Wexp

#define Wexp

Work exported [Wh] in the array vals.

The self documenting Wimp is replaces by vals[11] to reference in in the meterVal_t::vals array.

◆ cmdBits_t

#define cmdBits_t

Type for command bits.

Commands to the process control program from outside are transferred via shared memory as one bit set for every command to be executed. The bit position (0..31, as of May 2018) defines a concrete command.

"From outside" usually means from a web interface (html page with Javascript) and AJAX to a C written GCI program communicating via shared memory with the process control program. In this schema the CGI program sets bits for commands to be executed and the process control program clears the bit(s) in question on commands executed (or rejected).

Remark: On contradictory commands, ONyxz and OFFxyz, one will be executed and both will be cleared. In cases like this OFF... usually gets priority.

Remark 2: When exceeding 32 distinct commands we may switch to a uint64_t as was done from 16_t to 32_t in May 2018.

◆ HIPPO_COMMANDS

#define HIPPO_COMMANDS

Mask for all Hippogreiff commands.

Hippogreiff stands for a relay controlled 12V supply from storage battery. It should be ON at night, or more precisely either between sunset and sunrise or from dusk to dawn.
One consumer on this rail is a green LED beam to a little Hippogreiff sculpture. Hence the name.

The Hippogreiff is mythical beast with similarities to Harry Potter's Hippogreif, as long as looked at from the front. Seen from side one realises him being another species.

See also: ON_HIPPO_COMMAND OFF_HIPPO_COMMAND HYPr

◆ PCK100PERC_POWER

#define PCK100PERC_POWER

Phase packet switching device.

Since Rev. 157 (07-2018) we have one single phase heating device with then 950 W power, raised 03.2020 to 1267W and 02.2023 to 1845. It is actuated by a zero crossing electronic switch (SSR) at pin PH_P_SSR1 controlling the amount of power in 1% (PCK1PERC_POWER) steps.
For robustness and safety this electronic relay sits behind a 10A relay.

Since march 2023 we have two heater elements of 2kW each:
heater element 1 phase packet switch SSR1 PH_P_SSR1) 0..100%
heater element 1 phase packet switch SSR1 PH_P_SSR1) 0, 50, 100%

While the first one is controlled in 101 steps as before, the second one got three states: off, half and full power. This effectively gives a range of 0 to about 4kW in 201 steps. In the present configuration any PV surplus can be handled as in-house-consumption (Eigenverbrauch).

◆ SAFE_TEMP_UP

#define SAFE_TEMP_UP

Upper limit of safe water (tank top) temperature.

The integer value for safe water (tank) temperature sensor reading is +68950 m°C respectively 69 °C. Above this value all (electric) heating must stop if the relevant middle temperature is not available.

◆ SAFE_TEMP_MID

#define SAFE_TEMP_MID

Upper limit of safe water (tank middle) temperature.

The integer value for safe water (tank) temperature sensor reading is +59950 m°C respectively 60 °C. Above this value all (electric) heating must stop.

◆ tempTankSafe

#define tempTankSafe ( )

Condition to heat up the water tank.

The condition to allow heating is

#define SAFE_TEMP_MID
Upper limit of safe water (tank middle) temperature.
Definition sweetHome.h:784

OR

tempTankTop <= SAFE_TEMP_TOP

.

◆ PUMP_STRT_TEMP

#define PUMP_STRT_TEMP

Water (tank) temperature to start comfort pump when heating.

The integer value for pump start water (tank) temperature sensor reading is +65001 m°C respectively 65 °C (since 18.07.2026; was 64 °C). Above this value electric heating with >= 1.3kW (surplus) power shall start the (comfort) circulation pump for PUMP_STRT_FOR minutes.

This is done in the hope to disturb the temperature layers in the tank and, hence, reduce hot water outlet temperature. The disadvantage is heating the house in probably hot summer besides the intended equalising the temperature within the tank.

A second condition to start the pump (for equalising) is the heating power being greater than PUMP_STRT_POWR. The pump will run for an interval of PUMP_STRT_FOR and the next re-start will be blocked for at least 30 minutes.

See also
PUMP_STRT_POWR PUMP_STRT_FOR

◆ PUMP_STRT_POWR

#define PUMP_STRT_POWR

Water (tank) heating power / W to start comfort pump for equalising.

The current value is 1300 W ; see PUMP_STRT_TEMP.

◆ PUMP_STRT_FOR

#define PUMP_STRT_FOR

Blocking interval to re-start comfort pump for equalising.

The current value is 3 min; see PUMP_STRT_TEMP.

◆ Umsk

#define Umsk

Unload battery.

The co-responding bit in valFilVal_t.by[4] in valFilVal is on while the SFC batUnloadSeq is on / running.

See also
UBLKmsk, Umsk, Bmsk, Lmsk and Kmsk.

◆ Bmsk

#define Bmsk

Controlled load battery (as ballast up to maximal U).

The co-responding bit in valFilVal_t.by[4] in valFilVal is on while the SFC batBalLodSeq is on / running.

See also
UBLKmsk, Umsk, Bmsk, Lmsk and Kmsk.

◆ Lmsk

#define Lmsk

Load battery (normal program to middle level).

The co-responding bit in valFilVal_t.by[4] in valFilVal is on while the SFC batCntLodSeq is on / running.

See also
UBLKmsk, Umsk, Bmsk, Lmsk and Kmsk.

◆ Kmsk

#define Kmsk

Keep battery (to hold a minimal load level).

The co-responding bit in valFilVal_t.by[4] in valFilVal is on while battery voltage is kept on a reasonable low level by BAT_KEEP_PWM. See UBLKmsk, Umsk, Bmsk, Lmsk and Kmsk.

◆ UBLKmsk

#define UBLKmsk

ORed battery handling status bits.

Only one or none of the four battery operations and their associated bits, Umsk, Bmsk, Lmsk and Kmsk, can be On at one time.

◆ getNoPhas

#define getNoPhas ( )

Get number of phases.

Returns
number of (set) phases available for car loading

◆ inv2RelOff

#define inv2RelOff ( x)

The two relays to switch + and - inverter input plugs are off.

Since 30.05.2025, by replacing a miniJoule by a two input Growatt inverter those relays are without function and unused.

◆ bat2unload

#define bat2unload ( x)

The battery load/undoad line (30A fuse) is connected to the unload step up converter and, hence, not to the PWM controlled charger.


Since 30.05.2025 this replaced the miniJoule input switching relays state.
N.b.: The Enversys two input inverter may now deliver power from PV panel

  • battery unloading at the same time. Hence, its power meter (inherited from the miniJoule inverter) won't show battery unload power unambiguously when this function yields true and some seconds after due to the capacitors in the chain.

◆ SHARED_MEM_DATA_SIZE

#define SHARED_MEM_DATA_SIZE

Size of defined master slave communication data in shared memory.

This macro calculates the size in bytes of the shared memory area, see valsSharMem_t. The size of the shared memory SHARED_MEMORY_SIZE should be chosen as a multiple of 256 (512) bytes. The extra bytes are usable as an array uint8_t fill[] of size SHARED_MEM_FILL_SIZE.

Function Documentation

◆ chgFilNames()

void chgFilNames ( void )

Set the current date in event & retain file paths.

The current date from actRTmTxt is set into the file names evtFilNam and retFilNam

◆ batSOCbyU()

int batSOCbyU ( float uBat)

Battery capacity or state of charge (SOC) in % by voltage.

This function yields the SOC (capacity) in % as integer 0..100 for a LiFePo4 12V battery. Values 101..111 cover the upper band of the operating range, where 110 (14.5V) is the max. charging voltage.

A value of -1 says Ubat is < 10.00V the 0% value meaning really empty and outside the battery's operating range 10.0V (soc = 0) to 14.5V (soc = 110). A value of 111 says Ubat may be 14.6V which is the upper end of the allowed operating range. 112 says above 14.6V and hence outside allowed operation.

The values 101 to 110 may very well occur during charging and some time afterwards.

The index 0..100 is the SOC in % for the the idle state. That is no charging or discharging current worth mentioning, say less than 2A.

The values for 0, 10, 20 ... 90, 100, 109, 110 and 111 are from the EcoWorthy manual. The gaps were filled by linear interpolation.

The accuracy of the SOC values and the voltage measurement is about 10 mV and probably below. Hence two decimal places for U values as in the EcoWorthy manual are adequate. Nevertheless we partly use three decimal places for interpolated U values, to avoid equal values in adjacent entries in table uBatBySOC. So, this look up function batSOCbyU may yield any value in the range -1 .. 111 by binary search.

Parameters
uBatbattery voltage / V

Variable Documentation

◆ dayFilNam

char dayFilNam[]
extern

Path of the table to log a set of values for every day.

This is the text file in csv format where a set of day start values is recorded for every day shortly after midnight.
It will be used "endlessly". To set an end respectively close that diary just rename the file. A new "dayFile" will then be created an used hence on.
See also evtFilNam, retFilNam

◆ evtFilNam

char evtFilNam[]
extern

Path of the daily event file.

The current date in the format 2025-09-30 has to be set at position EFNY by chgFilNames().
The event file outLog is a text file used for one day for events and currently (see useOutLog4errLog) for errors, also.

See also
dayFilNam EFNY retFilNam

◆ retFilNam

char retFilNam[]
extern

Path of the daily retain file.

The current date in the format 2025-10-20 has to be set at position RFNY by chgFilNames().
The retain file is currently a short binary file for just one day kept in the file name. It contains start values for shortly after midnight for this day, only. It will be read in the case the program would be re-start at that day instead of running on 24-7.
The values stored are (example):

daystart v. 1760911318 : Mo 2025-10-20 00:01:58 UTC+02 work / kWh :
StdW in: 45398.22, ex: 5462.48; SolB in: 17512.06, ex: 6333.54
midnight UTC 1760918400, loc 1760911200; dayInY: 292
UTC sun rise 1760941246, set 1760978310


See also RFNY, dayFilNam, evtFilNam

◆ uBatBySOC

float const uBatBySOC[113]
extern

Battery voltage by capacity or state of charge (SOC) in %.

This table is the Ubat(SOC) function of the LiFePo4 12V battery. The index 0..100 is the SOC in % for the the idle state. That is no charging or discharging current worth mentioning, say less than 2A.

The values for 0, 10, 20 ... 90, 100 are from the EcoWorthy manual. The gaps were filled by linear interpolation. The values for [101..110] goto the limit of the charging voltage 14.6V. The value [111] is the upper end of the battery's operating range 10..14V.
See also batSOCbyU, U_ENDRANGE_SOC, U_ENDRANGE

◆ loadModUlookup

float const loadModUlookup[256]
extern

Output voltage of electronic battery load module.

This table (09.2025) is based on some 95 measurements (Fluke) and linear interpolation over the small gaps. The accuracy is about +/-15mV.

Depending on the (400Hz) PMW signal width 0..255 (/255 * 100% width) the battery load module will deliver about 11 to 14V. These values are taken behind Schottky Diodes under load causing a drop of about 0.4V. If the battery voltage is higher no current will flow.

This current limit (20 A nominally) is implemented by the power supply module. Hence, getting less current respectively power requires a fine control of the PWM signal on Pin POWH.

◆ smdX30modbus

smdX30modbus_t smdX30modbus[2]
extern

Descriptive and state array for smart meters on Modbus.

The number of meters is ANZmodSLAVES.

◆ pubSyValsPt

meterVal_t const* pubSyValsPt
extern

Public supply meter.

This pointer to the three phase meter values might be used like

meterVal_t const * pubSyValsPt
Public supply meter.
Definition sweetHome.c:257

to get the current sum of all imported, i.e. buyed electric work in Wh.

See also
Wimp, Wexp, PL1 .., IL1 .., UL1 .., solarValsPt

◆ solarValsPt

meterVal_t const* solarValsPt
extern

Solar, battery and heater meter.

This pointer to the three phase meter values might be used like

meterVal_t const * solarValsPt
Solar, battery and heater meter.
Definition sweetHome.c:266

to get the L1/R = miniJoul and battery discharge power, e.g., in W.

See also
Wimp, Wexp, PL1 .., IL1 .., UL1 .., solarValsPt

◆ cmdLookUp

cmdLookUp_t cmdLookUp[]
extern

The common command look up table.

It must end with an entry {"", 0}.

The current (CGI) program uses linear search for the command mnemonic. Hence, and cause of structure, alphabetic sorting is of no avail.

◆ phPckSwSets

phPckSwSet_t const phPckSwSets[101]
extern

The packet switch control values.

The array holds the number of on and off phases (i.e. 20 ms periods at 50 Hz line frequency) for each percentage of full power. The array length is 101; the index [0..100] is, hence, directly the percentage wanted.

To avoid too visible flicker, for no set (phPckSwSets[i].onPhases, phPckSwSets[i].offPhases) the smaller of the two values would be greater than 4 (80 ms); in most cases it is 1 or 2 (40 ms).

◆ fLine

volatile float fLine
extern

Last valid power line frequency.

last valid power line frequency

The measurement is taken from the more precise home three phase meter if communicative via Modbus. Otherwise the other meter's value is taken if available. Due to slow Modbus communication the values may be older than two seconds worst case.
This low sampling rate won't comply with VDE-AR-N 4105 cut off rules requiring a 0.1s reaction outside 47.5..51.5Hz. Nevertheless the current experimental set-up is a working proof-of-concept implementation (with very low power) — and a faster frequency measurement could easily be implemented.

Last valid power line frequency.

◆ invHasUnloadPow

volatile int invHasUnloadPow
extern

The miniJoule inverter has battery unload power.

Or at least may still have due to step up converter capacitors.

◆ tempTankUpper

volatile int tempTankUpper
extern

Last value of tank water upper temperature in mgrdC.

This value will be the last good .tempTankTop (see valFilVal_t) or the last good .tempPipe. If neither is good for 251 measurements BAD_TEMP_READ (an incredibly high value) will be set.
This last tank water temperature will be checked against a safety limit to allow electric heating as ballast.
The value is in units of 1/1000 grdC.

◆ tempUpperBadCnt

volatile uint tempUpperBadCnt
extern

Tank water upper temperature bad read count.

This last tank water temperature will be checked against a safety limit to allow electric heating as ballast.

◆ tempTankMiddle

volatile int tempTankMiddle
extern

Last value of tank water middle temperature in mgrdC.

This value will be the last good .tempTankMiddle (see valFilVal_t) or the last good .tempPipe. If neither is good for 251 measurements BAD_TEMP_READ (an incredibly high value) will be set.
This last tank water temperature will be checked against a safety limit to allow electric heating as ballast.
The value is in units of 1/1000 grdC.

◆ tempMiddleBadCnt

volatile uint tempMiddleBadCnt
extern

Tank water upper temperature bad read count.

This last tank water temperature will be checked against a safety limit to allow electric heating as ballast.