From f32b1efb1896723b47103a4a85db3d7add4597cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=B3lik=20Uszasty?= Date: Sun, 3 Jan 2021 19:46:04 +0100 Subject: [PATCH] Additional parameters for cooling fans --- McZapkie/MOVER.h | 3 +++ McZapkie/Mover.cpp | 25 +++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h index 68fc4bed..5b44f128 100644 --- a/McZapkie/MOVER.h +++ b/McZapkie/MOVER.h @@ -821,8 +821,11 @@ private: struct cooling_fan : public basic_device { // config float speed { 0.f }; // cooling fan rpm; either fraction of parent rpm, or absolute value if negative + float sustain_time { 0.f }; // time of sustaining work of cooling fans after stop + float min_start_velocity { -1.f }; // minimal velocity of vehicle, when cooling fans activate // ld outputs float revolutions { 0.f }; // current fan rpm + float stop_timer { 0.f }; // current time, when shut off condition is active }; // basic approximation of a fuel pump diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index 95764ae0..f612f759 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -1997,7 +1997,26 @@ void TMoverParameters::OilPumpCheck( double const Timestep ) { void TMoverParameters::MotorBlowersCheck( double const Timestep ) { // activation check for( auto &blower : MotorBlowers ) { - + auto disable = blower.is_disabled; + if (blower.min_start_velocity >= 0) + { + if ( Vel < 0.5 && Im < 0.5 ) + { + blower.stop_timer += Timestep; + if (blower.stop_timer > blower.sustain_time) + { + disable = true; + } + } + else if (Vel >= blower.min_start_velocity && Im > 0.5) + { + blower.stop_timer = 0; + } + else + { + disable |= !blower.is_active; + } + } blower.is_active = ( // TODO: bind properly power source when ld is in place ( blower.start_type == start_t::battery ? Power24vIsAvailable : @@ -2005,7 +2024,7 @@ void TMoverParameters::MotorBlowersCheck( double const Timestep ) { Mains ) // power source // breaker condition disabled until it's implemented in the class data // && ( true == blower.breaker ) - && ( false == blower.is_disabled ) + && ( false == disable) && ( ( true == blower.is_active ) || ( blower.start_type == start_t::manual ? blower.is_enabled : @@ -10743,6 +10762,8 @@ void TMoverParameters::LoadFIZ_Engine( std::string const &Input ) { // traction motors extract_value( MotorBlowers[ end::front ].speed, "MotorBlowersSpeed", Input, "" ); + extract_value( MotorBlowers[ end::front ].sustain_time, "MotorBlowersSustainTime", Input, "" ); + extract_value( MotorBlowers[ end::front ].min_start_velocity, "MotorBlowersStartVelocity", Input, "" ); MotorBlowers[ end::rear ] = MotorBlowers[ end::front ]; // pressure switch extract_value( HasControlPressureSwitch, "PressureSwitch", Input, ( TrainType != dt_EZT ? "yes" : "no" ) );