From b34174018745ebd0d740ab16dd9bdda0202f511e Mon Sep 17 00:00:00 2001 From: "David P. Chassin" Date: Thu, 1 Jul 2021 17:30:58 -0700 Subject: [PATCH] Fix RBSA object creation and initialization (#938) Co-authored-by: Alyona Teyber --- module/residential/rbsa.cpp | 21 +++++++++++++++++++-- module/residential/rbsa.h | 3 ++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/module/residential/rbsa.cpp b/module/residential/rbsa.cpp index 4b4dd4246..2797e81f8 100644 --- a/module/residential/rbsa.cpp +++ b/module/residential/rbsa.cpp @@ -395,8 +395,25 @@ rbsa::rbsa(MODULE *module) int rbsa::create(void) { - - memcpy((void*)this,defaults,sizeof(*this)); + components = NULL; + voltage_A = NULL; + voltage_B = NULL; + voltage_C = NULL; + nominal_voltage = NULL; + temperature = NULL; + price = NULL; + solar = NULL; + occupancy = NULL; + data = NULL; + power_A = NULL; + power_B = NULL; + power_C = NULL; + current_A = NULL; + current_B = NULL; + current_C = NULL; + shunt_A = NULL; + shunt_B = NULL; + shunt_C = NULL; return 1; } diff --git a/module/residential/rbsa.h b/module/residential/rbsa.h index 7447d2765..7203c047f 100644 --- a/module/residential/rbsa.h +++ b/module/residential/rbsa.h @@ -103,7 +103,6 @@ class rbsa : public gld_object SENSITIVITY occupancy; // occupancy sensitivity struct s_component *next; } COMPONENT; - COMPONENT *components; public: COMPONENT *get_first_component(); inline COMPONENT *get_next_component(COMPONENT *c); @@ -144,6 +143,8 @@ class rbsa : public gld_object else warning("unable to link property '%s' in object '%s'",name,get_object(obj)->get_name()); } +private: + COMPONENT *components; private: complex *voltage_A; complex *voltage_B;