Skip to content
Snippets Groups Projects
Commit e2a64961 authored by Armin Co's avatar Armin Co
Browse files

Add renewable power to states in opc.

parent 7cac6e79
No related branches found
No related tags found
No related merge requests found
...@@ -74,7 +74,7 @@ void SmartOpcServer::setup_server() ...@@ -74,7 +74,7 @@ void SmartOpcServer::setup_server()
m_power_production = m_state.AddVariable(m_idx, "power_production", Variant(m_state_machine.m_model.get_power_production().sum())); m_power_production = m_state.AddVariable(m_idx, "power_production", Variant(m_state_machine.m_model.get_power_production().sum()));
m_usage = m_state.AddVariable(m_idx, "used_power", Variant(m_state_machine.m_model.get_power_usage().sum())); m_usage = m_state.AddVariable(m_idx, "used_power", Variant(m_state_machine.m_model.get_power_usage().sum()));
m_excess_power = m_state.AddVariable(m_idx, "excess_power", Variant(m_state_machine.m_model.get_excess_power())); m_excess_power = m_state.AddVariable(m_idx, "excess_power", Variant(m_state_machine.m_model.get_excess_power()));
m_renewable_power = m_state.AddVariable(m_idx, "renewable_power", Variant(m_state_machine.m_model.get_power_production().clean()));
m_controls = smart_grid_folder.AddObject(m_idx, "controls"); m_controls = smart_grid_folder.AddObject(m_idx, "controls");
m_time = m_controls.AddVariable(m_idx, "time", Variant(m_state_machine.m_model.get_time())); m_time = m_controls.AddVariable(m_idx, "time", Variant(m_state_machine.m_model.get_time()));
...@@ -112,7 +112,7 @@ void SmartOpcServer::run_server() ...@@ -112,7 +112,7 @@ void SmartOpcServer::run_server()
m_time.SetValue(Variant(m_state_machine.m_model.get_time())); m_time.SetValue(Variant(m_state_machine.m_model.get_time()));
m_producing.SetValue(Variant(m_state_machine.m_model.get_producing_state())); m_producing.SetValue(Variant(m_state_machine.m_model.get_producing_state()));
m_sim_mode_enabled.SetValue(Variant(m_state_machine.is_sim_mode_enabled())); m_sim_mode_enabled.SetValue(Variant(m_state_machine.is_sim_mode_enabled()));
m_renewable_power.SetValue(m_state_machine.m_model.get_power_production().clean());
std::this_thread::sleep_for(std::chrono::seconds(1)); std::this_thread::sleep_for(std::chrono::seconds(1));
} }
} }
\ No newline at end of file
...@@ -36,7 +36,7 @@ private: ...@@ -36,7 +36,7 @@ private:
OpcUa::Node m_power_production; OpcUa::Node m_power_production;
OpcUa::Node m_usage; OpcUa::Node m_usage;
OpcUa::Node m_excess_power; OpcUa::Node m_excess_power;
OpcUa::Node m_renewable_power;
OpcUa::Node m_controls; OpcUa::Node m_controls;
OpcUa::Node m_time; OpcUa::Node m_time;
......
...@@ -100,8 +100,8 @@ private: ...@@ -100,8 +100,8 @@ private:
double calc_excess_power(); double calc_excess_power();
double m_solar_size{10}; ///< scale for solar power production double m_solar_size{30}; ///< scale for solar power production
double m_windpark_size{1.0}; ///< scale the power production by wind double m_windpark_size{5.0}; ///< scale the power production by wind
double m_village_size{10}; ///< scale how much power is used by the village double m_village_size{10}; ///< scale how much power is used by the village
int m_time{0}; int m_time{0};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment