mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 00:49:19 +02:00
23
DynObj.cpp
23
DynObj.cpp
@@ -6064,7 +6064,11 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
||||
|
||||
m_powertrainsounds.rsEngageSlippery.m_frequencyfactor /= ( 1 + MoverParameters->nmax );
|
||||
}
|
||||
else if( token == "linebreakerclose:" ) {
|
||||
else if (token == "retarder:") {
|
||||
m_powertrainsounds.retarder.deserialize(parser, sound_type::single, sound_parameters::amplitude | sound_parameters::frequency);
|
||||
m_powertrainsounds.retarder.owner(this);
|
||||
}
|
||||
else if( token == "linebreakerclose:" ) {
|
||||
m_powertrainsounds.linebreaker_close.deserialize( parser, sound_type::single );
|
||||
m_powertrainsounds.linebreaker_close.owner( this );
|
||||
}
|
||||
@@ -7297,7 +7301,7 @@ TDynamicObject::powertrain_sounds::position( glm::vec3 const Location ) {
|
||||
&inverter,
|
||||
&motor_relay, &dsbWejscie_na_bezoporow, &motor_parallel, &motor_shuntfield, &rsWentylator,
|
||||
&engine, &engine_ignition, &engine_shutdown, &engine_revving, &engine_turbo, &oil_pump, &fuel_pump, &water_pump, &water_heater, &radiator_fan, &radiator_fan_aux,
|
||||
&transmission, &rsEngageSlippery
|
||||
&transmission, &rsEngageSlippery, &retarder
|
||||
};
|
||||
for( auto sound : enginesounds ) {
|
||||
if( sound->offset() == nullvector ) {
|
||||
@@ -7564,6 +7568,21 @@ TDynamicObject::powertrain_sounds::render( TMoverParameters const &Vehicle, doub
|
||||
rsEngageSlippery.stop();
|
||||
}
|
||||
|
||||
if (Vehicle.hydro_R) {
|
||||
float speed = std::abs(Vehicle.hydro_R_n);
|
||||
|
||||
retarder
|
||||
.pitch(retarder.m_frequencyoffset + speed * retarder.m_frequencyfactor)
|
||||
.gain(retarder.m_amplitudeoffset + Vehicle.hydro_R_Fill * retarder.m_amplitudefactor);
|
||||
|
||||
if ((retarder.gain() > 0.01)&&(speed > 1)&&(Vehicle.hydro_R_ClutchActive)) {
|
||||
retarder.play(sound_flags::exclusive | sound_flags::looping);
|
||||
}
|
||||
else {
|
||||
retarder.stop();
|
||||
}
|
||||
}
|
||||
|
||||
// motor sounds
|
||||
volume = 0.0;
|
||||
if( false == motors.empty() ) {
|
||||
|
||||
1
DynObj.h
1
DynObj.h
@@ -404,6 +404,7 @@ private:
|
||||
sound_source radiator_fan_aux { sound_placement::engine };
|
||||
sound_source transmission { sound_placement::engine };
|
||||
sound_source rsEngageSlippery { sound_placement::engine }; // moved from cab
|
||||
sound_source retarder { sound_placement::engine };
|
||||
|
||||
void position( glm::vec3 const Location );
|
||||
void render( TMoverParameters const &Vehicle, double const Deltatime );
|
||||
|
||||
@@ -1277,6 +1277,9 @@ public:
|
||||
double hydro_R_FillRateDec = 1.0; /*szybkosc oprozniania sprzegla*/
|
||||
double hydro_R_MinVel = 1.0; /*minimalna predkosc, przy ktorej retarder dziala*/
|
||||
double hydro_R_EngageVel = 1.0; /*minimalna predkosc hamowania, przy ktorej sprzeglo jest wciaz wlaczone*/
|
||||
bool hydro_R_Clutch = false; /*czy retarder ma rozłączalne sprzęgło*/
|
||||
double hydro_R_ClutchSpeed = 10.0; /*szybkość narastania obrotów po włączeniu sprzęgła retardera*/
|
||||
bool hydro_R_WithIndividual = false; /*czy dla autobusów jest to łączone*/
|
||||
/*- dla lokomotyw spalinowo-elektrycznych -*/
|
||||
double AnPos = 0.0; // pozycja sterowania dokladnego (analogowego)
|
||||
bool AnalogCtrl = false; //
|
||||
@@ -1576,6 +1579,7 @@ public:
|
||||
double hydro_R_Torque = 0.0; /*moment*/
|
||||
double hydro_R_Request = 0.0; /*zadanie sily hamowania*/
|
||||
double hydro_R_n = 0.0; /*predkosc obrotowa retardera*/
|
||||
bool hydro_R_ClutchActive = false; /*czy retarder jest napędzany*/
|
||||
|
||||
/*- zmienne dla lokomotyw z silnikami indukcyjnymi -*/
|
||||
double eimic = 0; /*aktualna pozycja zintegrowanego sterowania jazda i hamowaniem*/
|
||||
|
||||
@@ -7822,6 +7822,7 @@ double TMoverParameters::dizel_Momentum(double dizel_fill, double n, double dt)
|
||||
double TMoverParameters::dizel_MomentumRetarder(double n, double dt)
|
||||
{
|
||||
double RetarderRequest = (Mains ? std::max(0.0, -eimic_real) : 0);
|
||||
if (hydro_R_WithIndividual) RetarderRequest = LocalBrakeRatio();
|
||||
if (Vel < hydro_R_MinVel)
|
||||
RetarderRequest = 0;
|
||||
if ((hydro_R_Placement == 2) && (enrot < dizel_nmin))
|
||||
@@ -7829,7 +7830,21 @@ double TMoverParameters::dizel_MomentumRetarder(double n, double dt)
|
||||
RetarderRequest = 0;
|
||||
}
|
||||
|
||||
hydro_R_n = n * 60;
|
||||
hydro_R_ClutchActive = (!hydro_R_Clutch) || (RetarderRequest > 0);
|
||||
if ((!hydro_R_Clutch)
|
||||
|| ((hydro_R_ClutchActive) && (hydro_R_ClutchSpeed == 0)))
|
||||
{
|
||||
hydro_R_n = n * 60;
|
||||
}
|
||||
else if (hydro_R_ClutchActive)
|
||||
{
|
||||
hydro_R_n = sign(n)*std::min(std::abs(hydro_R_n + hydro_R_ClutchSpeed * dt), std::abs(n * 60));
|
||||
}
|
||||
else
|
||||
{
|
||||
hydro_R_n = 0;
|
||||
}
|
||||
n = hydro_R_n / 60.f;
|
||||
|
||||
if (hydro_R_Fill < RetarderRequest) //gdy zadane hamowanie
|
||||
{
|
||||
@@ -7841,7 +7856,7 @@ double TMoverParameters::dizel_MomentumRetarder(double n, double dt)
|
||||
}
|
||||
|
||||
double Moment = hydro_R_MaxTorque;
|
||||
double pwr = Moment * n * M_PI * 2 * 0.001;
|
||||
double pwr = Moment * std::abs(n) * M_PI * 2 * 0.001;
|
||||
if (pwr > hydro_R_MaxPower)
|
||||
Moment = Moment * hydro_R_MaxPower / pwr;
|
||||
double moment_in = n*n*hydro_R_TorqueInIn;
|
||||
@@ -10631,6 +10646,9 @@ void TMoverParameters::LoadFIZ_Engine( std::string const &Input ) {
|
||||
extract_value(hydro_R_FillRateDec, "R_FRD", Input, "");
|
||||
extract_value(hydro_R_MinVel, "R_MinVel", Input, "");
|
||||
extract_value(hydro_R_EngageVel, "R_EngageVel", Input, "");
|
||||
extract_value(hydro_R_Clutch, "R_IsClutch", Input, "");
|
||||
extract_value(hydro_R_ClutchSpeed, "R_ClutchSpeed", Input, "");
|
||||
extract_value(hydro_R_WithIndividual, "R_WithIndividual", Input, "");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user