rasProject_01 / weSweetHome  R. 102 2025-10-31
process control       /     RasPi software         by   weinert-automation
Loading...
Searching...
No Matches
sweetHome.c File Reference

Common values for an experimental smart home (lab) project. More...

#include "sweetHome.h"
#include "weBatt.h"
#include <stdio.h>

Functions

void chgFilNames (void)
 Set the current date in event & retain file paths. More...
 

Variables

cmdLookUp_t cmdLookUp []
 The common command look up table. More...
 
char dayFilNam []
 Path of the table to log a set of values for every day. More...
 
char evtFilNam []
 Path of the daily event file. More...
 
volatile float fLine
 last valid power line frequency More...
 
volatile int invHasUnloadPow
 The miniJoule inverter has battery unload power. More...
 
float const phPckSwPow [101]
 First (or only) phase packet switching device power look up.
 
phPckSwSet_t const phPckSwSets [101]
 The packet switch control values. More...
 
char retFilNam []
 Path of the daily retain file. More...
 
smdX30modbus_t smdX30modbus [ANZmodSLAVES]
 Descriptive and state array for smart meters on Modbus. More...
 
volatile int tempTankWater
 Last value of tank water temperature. More...
 
volatile uint8_t tempWaterBadCnt
 Tank water temperature bad read count. More...
 
valFilVal_t valFilVal
 All process values relevant for log files and HMI.
 

Detailed Description

Common values for an experimental smart home (lab) project.

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

Revision history

Rev. 100 29.10.2025
Rev. 99 29.01.2018 : load module voltage handling added
Rev. 217 05.09.2019 : phase packet switch ballast three 100% values
Rev. 229 23.07.2020 : valFil (CSV) removed
Rev. 245 27.02.2023 : pps 100% power raised to 1983 W due panel reorg.
Rev. 268 15.10.2024 : float lookup Uload(pwm) range 0..141 now float
Rev. 75 09.02.2025 : remove old tables
Rev. 90 30.07.2025 : new Uload(pwm) table (pwm range 0..254)
Rev. 90 06.08.2025 : battery state of charge (SOC)/% <-> Ubat
Rev. 92 15.08.2025 : load unload values and SFCs
Rev. 94 24.09.2025 : charge module settings changed, hence loadModUlookup &c
Rev. 99 20.10.2025 : event and retain file handling changed (unified)
Rev. 100 29.10.2025 : first preliminary version of day change csv

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

Variable Documentation

◆ evtFilNam

char evtFilNam[]

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[]

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

◆ dayFilNam

char dayFilNam[]

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

◆ cmdLookUp

cmdLookUp_t cmdLookUp[]

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.

◆ fLine

volatile float fLine

last valid power line frequency

Last valid power line frequency.

◆ phPckSwSets

phPckSwSet_t const phPckSwSets[101]

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).

◆ smdX30modbus

Descriptive and state array for smart meters on Modbus.

The number of meters is ANZmodSLAVES.

◆ tempTankWater

volatile int tempTankWater

Last value of tank water temperature.

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.

◆ tempWaterBadCnt

volatile uint8_t tempWaterBadCnt

Tank water temperature bad read count.

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

In case of too many bad reads the value must be fixed at 253

◆ invHasUnloadPow

volatile int invHasUnloadPow

The miniJoule inverter has battery unload power.

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