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.
This commit is contained in:
+20
-11
@@ -17,19 +17,30 @@
|
||||
|
||||
#include "tests.h"
|
||||
|
||||
Dcdc dcdc = {};
|
||||
DcBus hv_terminal = {}; // high voltage terminal (solar for typical MPPT)
|
||||
DcBus lv_bus_int = {}; // internal low voltage side of DC/DC converter
|
||||
DcBus lv_terminal = {}; // low voltage terminal (battery for typical MPPT)
|
||||
DcBus load_terminal = {}; // load terminal
|
||||
DcBus *bat_terminal = NULL; // pointer to terminal where battery is connected
|
||||
DcBus *solar_terminal = NULL; // pointer to above terminal where solar panel is connected
|
||||
DcBus hv_bus;
|
||||
PowerPort hv_terminal(&hv_bus); // high voltage terminal (solar for typical MPPT)
|
||||
PowerPort dcdc_port_hv(&hv_bus); // internal high voltage side port of DC/DC converter
|
||||
|
||||
DcBus lv_bus;
|
||||
PowerPort dcdc_port_lv(&lv_bus); // internal low voltage side of DC/DC converter
|
||||
PowerPort lv_terminal(&lv_bus); // low voltage terminal (battery for typical MPPT)
|
||||
PowerPort load_terminal(&lv_bus); // load terminal (also connected to lv_bus)
|
||||
|
||||
PowerPort *bat_terminal = NULL; // pointer to terminal where battery is connected
|
||||
PowerPort *solar_terminal = NULL; // pointer to above terminal where solar panel is connected
|
||||
|
||||
Dcdc dcdc(&dcdc_port_hv, &dcdc_port_lv, DCDC_MODE_INIT);
|
||||
|
||||
PwmSwitch pwm_switch = {}; // only necessary for PWM charger
|
||||
|
||||
Charger charger(&lv_terminal);
|
||||
LoadOutput load(&load_terminal);
|
||||
|
||||
BatConf bat_conf; // actual (used) battery configuration
|
||||
BatConf bat_conf_user; // temporary storage where the user can write to
|
||||
Charger charger; // charger state information
|
||||
LoadOutput load;
|
||||
|
||||
LogData log_data;
|
||||
|
||||
extern ThingSet ts; // defined in data_objects.cpp
|
||||
|
||||
time_t timestamp; // current unix timestamp (independent of time(NULL), as it is user-configurable)
|
||||
@@ -38,8 +49,6 @@ int main()
|
||||
{
|
||||
bat_terminal = &lv_terminal;
|
||||
solar_terminal = &hv_terminal;
|
||||
dcdc_init(&dcdc, &hv_terminal, &lv_bus_int, MODE_MPPT_BUCK);
|
||||
load_init(&load, &lv_bus_int, &load_terminal);
|
||||
|
||||
adc_tests();
|
||||
bat_charger_tests();
|
||||
|
||||
Reference in New Issue
Block a user