23 Commits
Author SHA1 Message Date
Martin Jäger 483e09d1a2 Use generic Copyright notice in all files 2021-03-12 18:40:22 +01:00
Martin Jäger b63cdaa06d DC/DC: Use high/low DcBus instead of PowerPort for control
This makes more sense because the DC/DC converter actually connects two
DcBuses and does not need separate PowerPorts. Also makes the code look
more clean as variable access like dcdc.hvs->bus->voltage is avoided.

The DcBus pointers in the Dcdc are now called hvb and lvb for high-
voltage side bus and low-voltage side bus.
2020-11-05 20:42:34 +01:00
Martin Jäger 0756341b29 Rename src/sink_voltage_bound to _intercept
These variables define the voltage at zero current, which is the y axis
intercept of the droop curve (voltage vs. current).
As they do not always specifiy minimum or maximum boundary depending on
the sign of the droop resistance, intercept is a more suitable name.
2020-11-05 20:42:00 +01:00
Martin Jäger db9c9c5b1c Rename DC/DC operation mode and control names
New control states allow to specify the reason for derating more detailed,
also considering the input side.

The operation mode is now also used as a return value for
check_start_conditions function to get rid of magic numbers.
2020-10-14 10:03:34 +02:00
Martin Jäger 9a5004e81d Fix DC/DC start check for 24V batteries (#95) 2020-05-11 11:01:47 +02:00
Martin Jaeger 6af8e6d93d Improve load voltage limits setup and update 2020-02-19 14:34:40 +01:00
Martin Jaeger 68e0336279 Add debounce counter for UV error detection
This prevents switching off the load output due to short undervoltage
events during startup of pumps etc. when the battery is at low SOC.
2020-02-19 14:34:40 +01:00
Martin Jaeger 5f1d76ef74 Dedicated setup.cpp to clean up main.cpp
Also includes update of timestamp calculation in Zephyr.
2020-02-08 11:08:58 +01:00
Martin Jaeger 43f90eea7c Move voltage control parameters to DcBus class
The sink and source voltage boundaries for droop control and battery
charge voltage management are now part of the DcBus class.
Also added source and sink current margins, which will be used by the
DC/DC for control targets instead of port current limits, which were
difficult to synchronize before.
2020-02-07 12:03:25 +01:00
Martin Jaeger f0e99cd80f Voltage replaced by DcBus ptr in PowerPort class
Preparation to separate current and voltage measurements and control
parameters into DcBus and PowerPort classes. This will help to
manage current from different sources (grid, solar) going towards
one bus and control the battery voltage. It will also help to align
multiple charge controllers in parallel, communicating via CAN bus.
2020-02-07 11:55:51 +01:00
Martin Jaeger 53ae6d4608 File headers shortened using SPDX-License-Identifier 2019-12-20 11:40:10 +01:00
Martin Jaeger 74b765e801 Trailing white spaces removed 2019-11-21 07:44:15 +01:00
Martin Jaeger a7239fa9bb Enabled all warnings for unit-test builds 2019-10-24 16:10:35 +02:00
Martin Jaeger 42751c83c2 PowerPort member variables renamed
Previous naming with chg/dis didn't make much sense e.g. for load output or solar panels. Voltage
targets are now named with source or sink. Current limits are defined based on their direction
(negative or positive). ASCII art graphic added for better explanation of passive sign convention.
2019-10-23 10:32:48 +02:00
Martin Jaeger f879dc9c5d DC bus integrated into PowerPort class
Reason: Previous idea with storing the voltage only once and not in every port
doesn't work well for droop settings, e.g. the DC/DC output port doesn't know
the actual battery current, which should be used to calculate the droop caued
by wire resistance.
2019-10-22 18:23:19 +02:00
Martin Jaeger b5c7f396e1 PowerPort configuration for different charger types improved
- Solar and battery ports now defined as references to actual hardware ports at very beginning of main.cpp, allowing to use the references also in data_objects.cpp
- Different charger types (PWM / MPPT) are configured more clearly by switching on/off features (DC/DC, PWM switch and load) in PCB configuration
2019-10-20 17:44:32 +02:00
Martin Jaeger 0399c4e877 PowerPort added to store current independent from DC bus type
The DC bus type caused issues because current limits could not be defined individually for each
connection to a junction, as described in issue #50.

With this commit, also some structs were converted to C++ classes to improve readibility of the
code and make sure that pointers (e.g. to PowerPort objects) are always assigned during
initialization.
2019-10-20 14:52:35 +02:00
Martin Jaeger f33146e9de Battery discharging control restructured
- Discharging control separated from charger state machine
- Unit-tests for discharging control added
- DC bus chg/dis_enabled flags removed, control now only based on chge/dis_current_limit values
- _current_max values renamed to _limit to make more clear that values for discharging direction must be negative
- Load output struct now stores pointer to internal and external DC bus objects
2019-10-16 16:04:21 +02:00
Martin Jaeger 0545131a99 Equalization charging phase added 2019-10-16 10:02:27 +02:00
Martin Jaeger 25e469516c DC/DC control functions cleaned up 2019-10-15 14:00:20 +02:00
Martin Jaeger ae51d7a0d7 Unit tests for DC/DC control added 2019-10-15 13:59:48 +02:00
Martin Jaeger e7317ae1d8 DC bus and terminal naming improved
- DcBus representing actual screw terminals renamed
- Internal DC bus at DC/DC low voltage side added for correct DC/DC control
- DC/DC struct now stores pointers to HV and LV bus objects. Redundant voltage and current measurement variables removed.
- Unit tests updated

DC/DC control needs further improvements to make use of the changes
2019-10-15 13:57:23 +02:00
Martin Jaeger cb206b6864 DC/DC startup check reworked and unit-tests added 2019-10-15 13:54:05 +02:00