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

Update

parent 9bd0a3fc
No related branches found
No related tags found
No related merge requests found
...@@ -80,6 +80,13 @@ public: ...@@ -80,6 +80,13 @@ public:
print_states(); print_states();
} }
float excess_power()
{
auto sum_prod = m_production.conventional + m_production.renewable.solar + m_production.renewable.wind;
auto sum_used = m_usage.industry + m_usage.village;
return sum_prod - sum_used;
}
private: private:
void update_time() void update_time()
{ {
...@@ -101,16 +108,12 @@ private: ...@@ -101,16 +108,12 @@ private:
double wind_by_sun = m_sun * 5.0 / 100.0; // wind by sun should by 5 max. double wind_by_sun = m_sun * 5.0 / 100.0; // wind by sun should by 5 max.
auto random_wind = ((std::rand() * 1.0) / RAND_MAX) * 7.0; auto random_wind = ((std::rand() * 1.0) / RAND_MAX) * 7.0;
m_wind = power_wind[static_cast<int>(wind_by_sun + random_wind)]; m_wind = power_wind[static_cast<int>(wind_by_sun + random_wind)];
spdlog::debug("wind: {} {} {}", random_wind, wind_by_sun, m_wind);
} }
void update_power_production() void update_power_production()
{ {
m_production.renewable.solar = m_sun * solar_size; m_production.renewable.solar = m_sun * solar_size;
spdlog::debug("wind power {} {}", m_production.renewable.wind, m_wind);
m_production.renewable.wind = m_wind * windpark_size; m_production.renewable.wind = m_wind * windpark_size;
m_production.conventional = MaxPower::conventional; m_production.conventional = MaxPower::conventional;
spdlog::debug("wind power {} {}", m_production.renewable.wind, m_wind);
} }
void update_power_consumption() void update_power_consumption()
{ {
...@@ -142,6 +145,7 @@ private: ...@@ -142,6 +145,7 @@ private:
spdlog::debug("Time <{}> Sun <{}> Wind<{}>", m_time, m_sun, m_wind); spdlog::debug("Time <{}> Sun <{}> Wind<{}>", m_time, m_sun, m_wind);
spdlog::debug("Power Conv <{}> Solar <{}> Wind<{}>", m_production.conventional, m_production.renewable.solar, m_production.renewable.wind); spdlog::debug("Power Conv <{}> Solar <{}> Wind<{}>", m_production.conventional, m_production.renewable.solar, m_production.renewable.wind);
spdlog::debug("Usage Village<{}> Industry<{}>", m_usage.village, m_usage.industry); spdlog::debug("Usage Village<{}> Industry<{}>", m_usage.village, m_usage.industry);
spdlog::debug("excess_power<{}>", excess_power());
} }
}; };
...@@ -163,6 +167,7 @@ void run_sim() ...@@ -163,6 +167,7 @@ void run_sim()
spdlog::debug("Modell created"); spdlog::debug("Modell created");
modell.put_modell_into_state(SmartGridModell::DefaultState::Off); modell.put_modell_into_state(SmartGridModell::DefaultState::Off);
Day day{}; Day day{};
bool active {true}; bool active {true};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment