From 09275c0e3ae09a58ad8caf087864def90f416a75 Mon Sep 17 00:00:00 2001 From: Armin Co <armin.co@hs-bochum.de> Date: Mon, 31 Aug 2020 08:55:33 +0200 Subject: [PATCH] Updates to config --- src/SmartGridModell.cpp | 6 +++--- src/smg_server.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/SmartGridModell.cpp b/src/SmartGridModell.cpp index 32313cd..c8ca1a7 100644 --- a/src/SmartGridModell.cpp +++ b/src/SmartGridModell.cpp @@ -58,13 +58,13 @@ void SmartGridModell::update_windmill_speed(uint8_t speed) { set_output_pin(Pin::WindmillMotor, speed); } - else if (speed > 20) + else if (speed == 0) { - set_output_pin(Pin::WindmillMotor, min_motor_speed); + set_output_pin(Pin::WindmillMotor, 0); } else { - set_output_pin(Pin::WindmillMotor, 0); + set_output_pin(Pin::WindmillMotor, min_motor_speed); } } diff --git a/src/smg_server.cpp b/src/smg_server.cpp index 7dfba67..d916a98 100644 --- a/src/smg_server.cpp +++ b/src/smg_server.cpp @@ -109,8 +109,8 @@ private: } void update_wind() { - 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; + double wind_by_sun = m_sun * 7.0 / 100.0; // wind by sun should by 5 max. + auto random_wind = ((std::rand() * 1.0) / RAND_MAX) * 5.0; m_wind = power_wind[static_cast<int>(wind_by_sun + random_wind)]; } void update_power_consumption() @@ -209,7 +209,7 @@ void run_sim() while (active) { day.next_hour(); - std::this_thread::sleep_for(std::chrono::seconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); } } -- GitLab