1-phase PV router
Loading...
Searching...
No Matches
config_system.h
Go to the documentation of this file.
1
11
12#ifndef CONFIG_SYSTEM_H
13#define CONFIG_SYSTEM_H
14
15#include <Arduino.h>
16
17#include "type_traits.hpp"
18
19inline constexpr uint8_t NO_OF_PHASES{ 1 };
20
21// Physical constants, please do not change!
22inline constexpr uint16_t SECONDS_PER_MINUTE{ 60 };
23inline constexpr uint16_t MINUTES_PER_HOUR{ 60 };
24inline constexpr uint32_t JOULES_PER_WATT_HOUR{ 3600 };
25
26// Change these values to suit the local mains frequency and supply meter
27inline constexpr uint8_t SUPPLY_FREQUENCY{ 50 };
28inline constexpr uint32_t WORKING_ZONE_IN_JOULES{ 360 };
29inline constexpr int16_t REQUIRED_EXPORT_IN_WATTS{ 0 };
30
31// to prevent the diverted energy total from 'creeping'
32inline constexpr uint8_t ANTI_CREEP_LIMIT{ 5 };
33
35
36inline constexpr uint8_t DATALOG_PERIOD_IN_SECONDS{ 5 };
37
38inline constexpr typename conditional< DATALOG_PERIOD_IN_SECONDS * SUPPLY_FREQUENCY >= UINT8_MAX, uint16_t, uint8_t >::type
40
41// Computes inverse value at compile time to use '*' instead of '/'
42inline constexpr float invSUPPLY_FREQUENCY{ 1.0f / SUPPLY_FREQUENCY };
44
45inline constexpr uint16_t delayBeforeSerialStarts{ 1000 };
46inline constexpr uint16_t startUpPeriod{ 3000 };
47
48//--------------------------------------------------------------------------------------------------
49#ifdef EMONESP
50#undef SERIALPRINT
51#undef SERIALOUT
52#undef DEBUGGING
53#include <ArduinoJson.h>
54#endif
55
56#ifdef SERIALOUT
57#undef EMONESP
58#undef SERIALPRINT
59#undef DEBUGGING
60#endif
61//--------------------------------------------------------------------------------------------------
62
63#endif /* CONFIG_SYSTEM_H */
constexpr uint16_t startUpPeriod
constexpr int16_t REQUIRED_EXPORT_IN_WATTS
constexpr uint16_t SECONDS_PER_MINUTE
constexpr uint32_t WORKING_ZONE_IN_JOULES
constexpr uint32_t mainsCyclesPerHour
constexpr float invDATALOG_PERIOD_IN_MAINS_CYCLES
constexpr float invSUPPLY_FREQUENCY
constexpr conditional< DATALOG_PERIOD_IN_SECONDS *SUPPLY_FREQUENCY >=UINT8_MAX, uint16_t, uint8_t >::type DATALOG_PERIOD_IN_MAINS_CYCLES
constexpr uint32_t JOULES_PER_WATT_HOUR
constexpr uint16_t MINUTES_PER_HOUR
constexpr uint8_t DATALOG_PERIOD_IN_SECONDS
constexpr uint8_t ANTI_CREEP_LIMIT
constexpr uint8_t NO_OF_PHASES
constexpr uint16_t delayBeforeSerialStarts
constexpr uint8_t SUPPLY_FREQUENCY
Some useful but missing stl functions templates.