diff --git a/DynObj.cpp b/DynObj.cpp index 9ebf2bfa..d3571f05 100644 --- a/DynObj.cpp +++ b/DynObj.cpp @@ -4184,6 +4184,21 @@ void TDynamicObject::RenderSounds() { sConverter.stop(); } + // Odtworzenie dzwieku wentylatora rezystora hamowania + + if (MoverParameters->BRVentilators) + { + sBRVent.play(sound_flags::exclusive | sound_flags::looping); + } + else + { + sBRVent.stop(); + } + + + + + if( MoverParameters->CompressorSpeed > 0.0 ) { // McZapkie! - dzwiek compressor.wav tylko gdy dziala sprezarka if( MoverParameters->CompressorFlag ) { @@ -5976,6 +5991,13 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co sConverter.deserialize( parser, sound_type::multipart, sound_parameters::range ); sConverter.owner( this ); } + + // Dzwiek wentylatora rezystora hamowania + else if (token == "brakingresistorventilator:") + { + sBRVent.deserialize(parser, sound_type::multipart, sound_parameters::range); + sBRVent.owner(this); + } else if( token == "heater:" ) { // train heating device @@ -6740,7 +6762,7 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co // other engine compartment sounds auto const nullvector { glm::vec3() }; std::vector enginesounds = { - &sConverter, &sCompressor, &sCompressorIdle, &sSmallCompressor, &sHeater, &m_batterysound + &sConverter, &sBRVent, &sCompressor, &sCompressorIdle, &sSmallCompressor, &sHeater, &m_batterysound }; for( auto sound : enginesounds ) { if( sound->offset() == nullvector ) { diff --git a/DynObj.h b/DynObj.h index 840238d6..32207ab9 100644 --- a/DynObj.h +++ b/DynObj.h @@ -486,6 +486,7 @@ private: // engine sounds powertrain_sounds m_powertrainsounds; sound_source sConverter { sound_placement::engine }; + sound_source sBRVent {sound_placement::engine}; sound_source sCompressor { sound_placement::engine }; // NBMX wrzesien 2003 sound_source sCompressorIdle { sound_placement::engine }; sound_source sSmallCompressor { sound_placement::engine }; diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h index 73a9df50..cb601888 100644 --- a/McZapkie/MOVER.h +++ b/McZapkie/MOVER.h @@ -1341,6 +1341,9 @@ public: double InvertersRatio = 0.0; std::vector Inverters; //all inverters int InverterControlCouplerFlag = 4; //which coupling flag is necessary to controll inverters + int Imaxrpc = 0; // Maksymalny prad rezystora hamowania chlodzonego pasywnie + int BRVto = 0; // Czas jaki wentylatory jeszcze dodatkowo schladzaja rezystor + double BRVtimer = 0; // Timer dla podtrzymania wentylatora std::map EIM_Pmax_Table; /*tablica mocy maksymalnej od predkosci*/ /* -dla pojazdów z blendingiem EP/ED (MED) */ double MED_Vmax = 0; // predkosc maksymalna dla obliczen chwilowej sily hamowania EP w MED @@ -1471,6 +1474,7 @@ public: bool ConverterAllow = false; /*zezwolenie na prace przetwornicy NBMX*/ bool ConverterAllowLocal{ true }; // local device state override (most units don't have this fitted so it's set to true not to intefere) bool ConverterFlag = false; /*! czy wlaczona przetwornica NBMX*/ + bool BRVentilators = false; /* Czy rezystor hamowania pracuje */ start_t ConverterOverloadRelayStart { start_t::manual }; // whether overload relay reset responds to dedicated button bool ConverterOverloadRelayOffWhenMainIsOff { false }; fuel_pump FuelPump; diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index 1b9bfbfe..886209a9 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -1597,6 +1597,26 @@ void TMoverParameters::compute_movement_( double const Deltatime ) { } } + // Uproszczona symulacja wentylatorow rezystora hamowania + + // Prad oddawany na rezystor + double Irh = abs(eimv[eimv_Pe]) - abs(eimv[eimv_Ipoj]); + + // Wlacz wentylator jesli prad rekuperacji przekroczy maksymalny dla pasywnego chlodzenia rezystora + if (Irh > Imaxrpc && eimv[eimv_Ipoj] < 0) + { + BRVtimer = 0; + BRVentilators = true; + } + else { + BRVtimer += Deltatime; + if (BRVtimer > BRVto) + BRVentilators = false; + } + + + + // automatyczny rozruch if( EngineType == TEngineType::ElectricSeriesMotor ) { if( AutoRelayCheck() ) { @@ -6408,6 +6428,7 @@ double TMoverParameters::TractionForce( double dt ) { 0.007 * (std::abs(EngineVoltage) - (EnginePowerSource.CollectorParameters.MaxV - 100))); Itot = eimv[eimv_Ipoj] * (0.01 + std::min(0.99, 0.99 - Vadd)); + EnginePower = abs(eimv[eimv_Ic] * eimv[eimv_U] * NPoweredAxles) / 1000; // power inverters auto const tmpV { std::abs( eimv[ eimv_fp ] ) }; @@ -11019,7 +11040,8 @@ void TMoverParameters::LoadFIZ_Engine( std::string const &Input ) { extract_value( EIMCLogForce, "eimclf", Input, "" ); extract_value( InvertersNo, "InvNo", Input, "" ); extract_value( InverterControlCouplerFlag, "InvCtrCplFlag", Input, "" ); - + extract_value(Imaxrpc, "Imaxrpc", Input, ""); + extract_value(BRVto, "BRVto", Input, ""); extract_value( Flat, "Flat", Input, ""); if (eimc[eimc_p_Pmax] > 0 && Power > 0 && InvertersNo == 0) {