diff --git a/src/SmartGridModell.cpp b/src/SmartGridModell.cpp index 32313cdc3c2bbf540a4bfd2eb41ee7643df22a00..c8ca1a71505b66fe59eef1bd353d81c3a1cf1a46 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 7dfba6700f3f0cb5a7ee0b9c88aa3a4e6fc40bcc..d916a98e6dca4548772d720c54525f3990f31275 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)); } }