16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 22:59:19 +02:00

Add braking resistor ventilator sound and simple simulation

This commit is contained in:
2025-01-03 17:39:54 +01:00
parent 63a7fa55eb
commit a01a63c8bf
4 changed files with 40 additions and 2 deletions

View File

@@ -4184,6 +4184,21 @@ void TDynamicObject::RenderSounds() {
sConverter.stop(); 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 ) { if( MoverParameters->CompressorSpeed > 0.0 ) {
// McZapkie! - dzwiek compressor.wav tylko gdy dziala sprezarka // McZapkie! - dzwiek compressor.wav tylko gdy dziala sprezarka
if( MoverParameters->CompressorFlag ) { if( MoverParameters->CompressorFlag ) {
@@ -5977,6 +5992,13 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
sConverter.owner( this ); 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:" ) { else if( token == "heater:" ) {
// train heating device // train heating device
sHeater.deserialize( parser, sound_type::single ); sHeater.deserialize( parser, sound_type::single );
@@ -6740,7 +6762,7 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
// other engine compartment sounds // other engine compartment sounds
auto const nullvector { glm::vec3() }; auto const nullvector { glm::vec3() };
std::vector<sound_source *> enginesounds = { std::vector<sound_source *> enginesounds = {
&sConverter, &sCompressor, &sCompressorIdle, &sSmallCompressor, &sHeater, &m_batterysound &sConverter, &sBRVent, &sCompressor, &sCompressorIdle, &sSmallCompressor, &sHeater, &m_batterysound
}; };
for( auto sound : enginesounds ) { for( auto sound : enginesounds ) {
if( sound->offset() == nullvector ) { if( sound->offset() == nullvector ) {

View File

@@ -486,6 +486,7 @@ private:
// engine sounds // engine sounds
powertrain_sounds m_powertrainsounds; powertrain_sounds m_powertrainsounds;
sound_source sConverter { sound_placement::engine }; sound_source sConverter { sound_placement::engine };
sound_source sBRVent {sound_placement::engine};
sound_source sCompressor { sound_placement::engine }; // NBMX wrzesien 2003 sound_source sCompressor { sound_placement::engine }; // NBMX wrzesien 2003
sound_source sCompressorIdle { sound_placement::engine }; sound_source sCompressorIdle { sound_placement::engine };
sound_source sSmallCompressor { sound_placement::engine }; sound_source sSmallCompressor { sound_placement::engine };

View File

@@ -1341,6 +1341,7 @@ public:
double InvertersRatio = 0.0; double InvertersRatio = 0.0;
std::vector<inverter> Inverters; //all inverters std::vector<inverter> Inverters; //all inverters
int InverterControlCouplerFlag = 4; //which coupling flag is necessary to controll inverters int InverterControlCouplerFlag = 4; //which coupling flag is necessary to controll inverters
int Imaxrpc = 0; // Maksymalny prad rezystora hamowania chlodzonego pasywnie
std::map<double, double> EIM_Pmax_Table; /*tablica mocy maksymalnej od predkosci*/ std::map<double, double> EIM_Pmax_Table; /*tablica mocy maksymalnej od predkosci*/
/* -dla pojazdów z blendingiem EP/ED (MED) */ /* -dla pojazdów z blendingiem EP/ED (MED) */
double MED_Vmax = 0; // predkosc maksymalna dla obliczen chwilowej sily hamowania EP w MED double MED_Vmax = 0; // predkosc maksymalna dla obliczen chwilowej sily hamowania EP w MED
@@ -1471,6 +1472,7 @@ public:
bool ConverterAllow = false; /*zezwolenie na prace przetwornicy NBMX*/ 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 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 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 start_t ConverterOverloadRelayStart { start_t::manual }; // whether overload relay reset responds to dedicated button
bool ConverterOverloadRelayOffWhenMainIsOff { false }; bool ConverterOverloadRelayOffWhenMainIsOff { false };
fuel_pump FuelPump; fuel_pump FuelPump;

View File

@@ -6408,6 +6408,19 @@ double TMoverParameters::TractionForce( double dt ) {
0.007 * (std::abs(EngineVoltage) - (EnginePowerSource.CollectorParameters.MaxV - 100))); 0.007 * (std::abs(EngineVoltage) - (EnginePowerSource.CollectorParameters.MaxV - 100)));
Itot = eimv[eimv_Ipoj] * (0.01 + std::min(0.99, 0.99 - Vadd)); Itot = eimv[eimv_Ipoj] * (0.01 + std::min(0.99, 0.99 - Vadd));
// Uproszczona symulacja rezystora hamowania
if (eimv[eimv_Ipoj] < 0)
{
// Prad oddawany na rezystor
double Irh = abs(eimv[eimv_Pe]) - abs(eimv[eimv_Ipoj]);
// Wlacz wentylator jesli prad przekroczy maksymalny dla pasywnego chlodzenia
BRVentilators = Irh > Imaxrpc;
}
else
BRVentilators = false;
EnginePower = abs(eimv[eimv_Ic] * eimv[eimv_U] * NPoweredAxles) / 1000; EnginePower = abs(eimv[eimv_Ic] * eimv[eimv_U] * NPoweredAxles) / 1000;
// power inverters // power inverters
auto const tmpV { std::abs( eimv[ eimv_fp ] ) }; auto const tmpV { std::abs( eimv[ eimv_fp ] ) };
@@ -11019,7 +11032,7 @@ void TMoverParameters::LoadFIZ_Engine( std::string const &Input ) {
extract_value( EIMCLogForce, "eimclf", Input, "" ); extract_value( EIMCLogForce, "eimclf", Input, "" );
extract_value( InvertersNo, "InvNo", Input, "" ); extract_value( InvertersNo, "InvNo", Input, "" );
extract_value( InverterControlCouplerFlag, "InvCtrCplFlag", Input, "" ); extract_value( InverterControlCouplerFlag, "InvCtrCplFlag", Input, "" );
extract_value(Imaxrpc, "Imaxrpc", Input, "");
extract_value( Flat, "Flat", Input, ""); extract_value( Flat, "Flat", Input, "");
if (eimc[eimc_p_Pmax] > 0 && Power > 0 && InvertersNo == 0) { if (eimc[eimc_p_Pmax] > 0 && Power > 0 && InvertersNo == 0) {