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

Merge branch 'tmj-dev' into milek-dev

This commit is contained in:
milek7
2018-05-19 20:26:01 +02:00
41 changed files with 6565 additions and 537 deletions

View File

@@ -1589,8 +1589,8 @@ void TMoverParameters::FuelPumpCheck( double const Timestep ) {
FuelPump.is_enabled = ( dizel_startup || Mains );
}
FuelPump.is_active = (
( true == FuelPump.is_enabled )
&& ( true == Battery ) );
( true == Battery )
&& ( true == FuelPump.is_enabled ) );
}
// oil pump status update
@@ -1611,10 +1611,9 @@ void TMoverParameters::OilPumpCheck( double const Timestep ) {
OilPump.pressure_minimum > 0.f ?
OilPump.pressure_minimum :
0.15f }; // arbitrary fallback value
auto const maxpressure { 0.65f }; // arbitrary value
OilPump.pressure_target = (
enrot > 0.1 ? interpolate( minpressure, maxpressure, static_cast<float>( clamp( enrot / maxrevolutions, 0.0, 1.0 ) ) ) * OilPump.resource_amount :
enrot > 0.1 ? interpolate( minpressure, OilPump.pressure_maximum, static_cast<float>( clamp( enrot / maxrevolutions, 0.0, 1.0 ) ) ) * OilPump.resource_amount :
true == OilPump.is_active ? minpressure :
0.f );
@@ -6318,6 +6317,8 @@ void TMoverParameters::dizel_Heat( double const dt ) {
auto const gwmin2 { 400.0 };
auto const gwmax2 { 4000.0 };
dizel_heat.Te = Global.AirTemperature;
auto const engineon { ( Mains ? 1 : 0 ) };
auto const engineoff { ( Mains ? 0 : 1 ) };
auto const rpm { enrot * 60 };
@@ -6376,7 +6377,7 @@ void TMoverParameters::dizel_Heat( double const dt ) {
// olej oddaje cieplo do wody gdy krazy przez wymiennik ciepla == wlaczona pompka lub silnik
auto const dTo { (
dizel_heat.auxiliary_water_circuit ?
( ( dizel_heat.kfo * ( dizel_heat.Ts - dizel_heat.To ) ) - ( dizel_heat.kfs * ( 0.3 ) * ( dizel_heat.To - dizel_heat.Tsr2 ) ) ) / ( gwO * Co ) :
( ( dizel_heat.kfo * ( dizel_heat.Ts - dizel_heat.To ) ) - ( dizel_heat.kfo2 * ( dizel_heat.To - dizel_heat.Tsr2 ) ) ) / ( gwO * Co ) :
( ( dizel_heat.kfo * ( dizel_heat.Ts - dizel_heat.To ) ) - ( dizel_heat.kfo2 * ( dizel_heat.To - dizel_heat.Tsr ) ) ) / ( gwO * Co ) ) };
dizel_heat.To += ( dTo * dt );
@@ -6395,12 +6396,12 @@ void TMoverParameters::dizel_Heat( double const dt ) {
dizel_heat.water_aux.is_warm = (
( true == dizel_heat.cooling )
|| ( ( true == Mains )
&& ( BatteryVoltage > 70 ) /* && !bezpompy && !awaria_chlodzenia && !WS10 */
&& ( BatteryVoltage > ( 0.75 * NominalBatteryVoltage ) ) /* && !bezpompy && !awaria_chlodzenia && !WS10 */
&& ( dizel_heat.water_aux.config.temp_cooling > 0 )
&& ( dizel_heat.temperatura2 > dizel_heat.water_aux.config.temp_cooling - ( dizel_heat.water_aux.is_warm ? 8 : 0 ) ) ) );
auto const PTC2 { ( dizel_heat.water_aux.is_warm /*or PTC2p*/ ? 1 : 0 ) };
dizel_heat.rpmwz2 = PTC2 * 80 * rpm / ( ( 0.5 * rpm ) + 500 );
dizel_heat.zaluzje2 = ( dizel_heat.water_aux.config.shutters ? PTC2 : true ); // no shutters is an equivalent to having them open
dizel_heat.zaluzje2 = ( dizel_heat.water_aux.config.shutters ? ( PTC2 == 1 ) : true ); // no shutters is an equivalent to having them open
auto const zaluzje2 { ( dizel_heat.zaluzje2 ? 1 : 0 ) };
// auxiliary water circuit heat transfer values
auto const kf2 { kurek07 * ( ( dizel_heat.kw * ( 0.3 + 0.7 * zaluzje2 ) ) * dizel_heat.rpmw2 + ( dizel_heat.kv * ( 0.3 + 0.7 * zaluzje2 ) * Vel / 3.6 ) ) + 2 };
@@ -6423,12 +6424,12 @@ void TMoverParameters::dizel_Heat( double const dt ) {
dizel_heat.water.is_warm = (
( true == dizel_heat.cooling )
|| ( ( true == Mains )
&& ( BatteryVoltage > 70 ) /* && !bezpompy && !awaria_chlodzenia && !WS10 */
&& ( BatteryVoltage > ( 0.75 * NominalBatteryVoltage ) ) /* && !bezpompy && !awaria_chlodzenia && !WS10 */
&& ( dizel_heat.water.config.temp_cooling > 0 )
&& ( dizel_heat.temperatura1 > dizel_heat.water.config.temp_cooling - ( dizel_heat.water.is_warm ? 8 : 0 ) ) ) );
auto const PTC1 { ( dizel_heat.water.is_warm /*or PTC1p*/ ? 1 : 0 ) };
dizel_heat.rpmwz = PTC1 * 80 * rpm / ( ( 0.5 * rpm ) + 500 );
dizel_heat.zaluzje1 = ( dizel_heat.water.config.shutters ? PTC1 : true ); // no shutters is an equivalent to having them open
dizel_heat.zaluzje1 = ( dizel_heat.water.config.shutters ? ( PTC1 == 1 ) : true ); // no shutters is an equivalent to having them open
auto const zaluzje1 { ( dizel_heat.zaluzje1 ? 1 : 0 ) };
// primary water circuit heat transfer values
auto const kf { obieg * kurek07 * ( ( dizel_heat.kw * ( 0.3 + 0.7 * zaluzje1 ) ) * dizel_heat.rpmw + ( dizel_heat.kv * ( 0.3 + 0.7 * zaluzje1 ) * Vel / 3.6 ) + 3 ) + 2 };
@@ -6707,14 +6708,14 @@ TMoverParameters::update_autonomous_doors( double const Deltatime ) {
// the door are closed if their timer goes below 0, or if the vehicle is moving at > 5 km/h
// NOTE: timer value of 0 is 'special' as it means the door will stay open until vehicle is moving
if( true == DoorLeftOpened ) {
if( ( DoorLeftOpenTimer < 0.0 )
if( ( ( DoorStayOpen > 0.0 ) && ( DoorLeftOpenTimer < 0.0 ) )
|| ( Vel > 5.0 ) ) {
// close the door and set the timer to expired state (closing may happen sooner if vehicle starts moving)
DoorLeft( false, range::local );
}
}
if( true == DoorRightOpened ) {
if( ( DoorRightOpenTimer < 0.0 )
if( ( ( DoorStayOpen > 0.0 ) && ( DoorRightOpenTimer < 0.0 ) )
|| ( Vel > 5.0 ) ) {
// close the door and set the timer to expired state (closing may happen sooner if vehicle starts moving)
DoorRight( false, range::local );
@@ -7786,6 +7787,7 @@ void TMoverParameters::LoadFIZ_Brake( std::string const &line ) {
}
extract_value( RapidMult, "RM", line, "1" );
extract_value( RapidVel, "RV", line, "55" );
}
}
else {
@@ -7859,10 +7861,11 @@ void TMoverParameters::LoadFIZ_Doors( std::string const &line ) {
extract_value( DoorOpenSpeed, "OpenSpeed", line, "" );
extract_value( DoorCloseSpeed, "CloseSpeed", line, "" );
extract_value( DoorCloseDelay, "DoorCloseDelay", line, "" );
extract_value( DoorMaxShiftL, "DoorMaxShiftL", line, "" );
extract_value( DoorMaxShiftR, "DoorMaxShiftR", line, "" );
extract_value( DoorMaxPlugShift, "DoorMaxShiftPlug", line, "" );
DoorOpenMethod = 2; //obrót, default
std::string openmethod; extract_value( openmethod, "DoorOpenMethod", line, "" );
if( openmethod == "Shift" ) { DoorOpenMethod = 1; } //przesuw
else if( openmethod == "Fold" ) { DoorOpenMethod = 3; } //3 submodele się obracają
@@ -7874,11 +7877,11 @@ void TMoverParameters::LoadFIZ_Doors( std::string const &line ) {
std::string doorblocked; extract_value( doorblocked, "DoorBlocked", line, "" );
DoorBlocked = ( doorblocked == "Yes" );
extract_value( DoorMaxPlugShift, "DoorMaxShiftPlug", line, "" );
extract_value( PlatformSpeed, "PlatformSpeed", line, "" );
extract_value( PlatformMaxShift, "PlatformMaxSpeed", line, "" );
extract_value( PlatformMaxShift, "PlatformMaxShift", line, "" );
extract_value( MirrorMaxShift, "MirrorMaxShift", line, "" );
PlatformOpenMethod = 2; // obrót, default
std::string platformopenmethod; extract_value( platformopenmethod, "PlatformOpenMethod", line, "" );
if( platformopenmethod == "Shift" ) { PlatformOpenMethod = 1; } // przesuw
}
@@ -8113,9 +8116,9 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) {
else if( autorelay == "Yes" ) { AutoRelayType = 1; }
else { AutoRelayType = 0; }
CoupledCtrl = ( extract_value( "CoupledCtrl", line ) == "Yes" );
extract_value( CoupledCtrl, "CoupledCtrl", line, "" );
ScndS = ( extract_value( "ScndS", line ) == "Yes" ); // brak pozycji rownoleglej przy niskiej nastawie PSR
extract_value( ScndS, "ScndS", line, "" ); // brak pozycji rownoleglej przy niskiej nastawie PSR
extract_value( InitialCtrlDelay, "IniCDelay", line, "" );
extract_value( CtrlDelay, "SCDelay", line, "" );
@@ -8207,8 +8210,8 @@ void TMoverParameters::LoadFIZ_Blending(std::string const &line) {
extract_value(MED_Vmin, "MED_Vmin", line, "0");
extract_value(MED_Vref, "MED_Vref", line, to_string(Vmax));
extract_value(MED_amax, "MED_amax", line, "9.81");
MED_EPVC = (extract_value("MED_EPVC", line).find("Yes") != std::string::npos);
MED_Ncor = (extract_value("MED_Ncor", line).find("Yes") != std::string::npos);
extract_value(MED_EPVC, "MED_EPVC", line, "");
extract_value(MED_Ncor, "MED_Ncor", line, "");
}
void TMoverParameters::LoadFIZ_Light( std::string const &line ) {
@@ -8239,7 +8242,7 @@ void TMoverParameters::LoadFIZ_Security( std::string const &line ) {
extract_value( SecuritySystem.AwareMinSpeed, "AwareMinSpeed", line, "" );
extract_value( SecuritySystem.SoundSignalDelay, "SoundSignalDelay", line, "" );
extract_value( SecuritySystem.EmergencyBrakeDelay, "EmergencyBrakeDelay", line, "" );
SecuritySystem.RadioStop = ( extract_value( "RadioStop", line ).find( "Yes" ) != std::string::npos );
extract_value( SecuritySystem.RadioStop, "RadioStop", line, "" );
}
void TMoverParameters::LoadFIZ_Clima( std::string const &line ) {
@@ -8318,7 +8321,6 @@ void TMoverParameters::LoadFIZ_Engine( std::string const &Input ) {
// TODO: unify naming scheme and sort out which diesel engine params are used where and how
extract_value( nmax, "nmax", Input, "" );
nmax /= 60.0;
// nmax = dizel_nmax; // not sure if this is needed, but just in case
extract_value( dizel_nmax_cutoff, "nmax_cutoff", Input, "0.0" );
dizel_nmax_cutoff /= 60.0;
extract_value( dizel_AIM, "AIM", Input, "1.0" );
@@ -8336,7 +8338,7 @@ void TMoverParameters::LoadFIZ_Engine( std::string const &Input ) {
}
}
hydro_TC = (extract_value("IsTC", Input) == "Yes");
extract_value(hydro_TC, "IsTC", Input, "");
if (true == hydro_TC) {
extract_value(hydro_TC_TMMax, "TC_TMMax", Input, "");
extract_value(hydro_TC_CouplingPoint, "TC_CP", Input, "");
@@ -8351,7 +8353,7 @@ void TMoverParameters::LoadFIZ_Engine( std::string const &Input ) {
extract_value(hydro_TC_LockupSpeed, "TC_LS", Input, "");
extract_value(hydro_TC_UnlockSpeed, "TC_ULS", Input, "");
hydro_R = (extract_value("IsRetarder", Input) == "Yes");
extract_value(hydro_R, "IsRetarder", Input, "");
if (true == hydro_R) {
extract_value(hydro_R_Placement, "R_Place", Input, "");
extract_value(hydro_R_TorqueInIn, "R_TII", Input, "");
@@ -8362,7 +8364,6 @@ void TMoverParameters::LoadFIZ_Engine( std::string const &Input ) {
extract_value(hydro_R_MinVel, "R_MinVel", Input, "");
}
}
extract_value( OilPump.pressure_minimum, "MinOilPressure", Input, "" );
break;
}
case DieselElectric: { //youBy
@@ -8383,7 +8384,6 @@ void TMoverParameters::LoadFIZ_Engine( std::string const &Input ) {
ImaxHi = 2;
ImaxLo = 1;
}
extract_value( OilPump.pressure_minimum, "OilMinPressure", Input, "" );
break;
}
case ElectricInductionMotor: {
@@ -8412,7 +8412,7 @@ void TMoverParameters::LoadFIZ_Engine( std::string const &Input ) {
extract_value( eimc[ eimc_p_Imax ], "Imax", Input, "" );
extract_value( eimc[ eimc_p_abed ], "abed", Input, "" );
extract_value( eimc[ eimc_p_eped ], "edep", Input, "" );
EIMCLogForce = ( extract_value( "eimclf", Input ) == "Yes" );
extract_value( EIMCLogForce, "eimclf", Input, "" );
Flat = ( extract_value( "Flat", Input ) == "1" );
@@ -8423,29 +8423,36 @@ void TMoverParameters::LoadFIZ_Engine( std::string const &Input ) {
}
} // engine type
// engine cooling factore
extract_value( dizel_heat.kw, "HeatKW", Input, "" );
extract_value( dizel_heat.kv, "HeatKV", Input, "" );
extract_value( dizel_heat.kfe, "HeatKFE", Input, "" );
extract_value( dizel_heat.kfs, "HeatKFS", Input, "" );
extract_value( dizel_heat.kfo, "HeatKFO", Input, "" );
extract_value( dizel_heat.kfo2, "HeatKFO2", Input, "" );
// engine cooling systems
extract_value( dizel_heat.water.config.temp_min, "WaterMinTemperature", Input, "" );
extract_value( dizel_heat.water.config.temp_max, "WaterMaxTemperature", Input, "" );
extract_value( dizel_heat.water.config.temp_flow, "WaterFlowTemperature", Input, "" );
extract_value( dizel_heat.water.config.temp_cooling, "WaterCoolingTemperature", Input, "" );
extract_value( dizel_heat.water.config.shutters, "WaterShutters", Input, "" );
extract_value( dizel_heat.auxiliary_water_circuit, "WaterAuxCircuit", Input, "" );
extract_value( dizel_heat.water_aux.config.temp_min, "WaterAuxMinTemperature", Input, "" );
extract_value( dizel_heat.water_aux.config.temp_max, "WaterAuxMaxTemperature", Input, "" );
extract_value( dizel_heat.water_aux.config.temp_cooling, "WaterAuxCoolingTemperature", Input, "" );
extract_value( dizel_heat.water_aux.config.shutters, "WaterAuxShutters", Input, "" );
extract_value( dizel_heat.oil.config.temp_min, "OilMinTemperature", Input, "" );
extract_value( dizel_heat.oil.config.temp_max, "OilMaxTemperature", Input, "" );
// water heater
extract_value( WaterHeater.config.temp_min, "HeaterMinTemperature", Input, "" );
extract_value( WaterHeater.config.temp_max, "HeaterMaxTemperature", Input, "" );
// NOTE: elements shared by both diesel engine variants; crude but, eh
if( ( EngineType == DieselEngine )
|| ( EngineType == DieselElectric ) ) {
// oil pump
extract_value( OilPump.pressure_minimum, "OilMinPressure", Input, "" );
extract_value( OilPump.pressure_maximum, "OilMaxPressure", Input, "" );
// engine cooling factore
extract_value( dizel_heat.kw, "HeatKW", Input, "" );
extract_value( dizel_heat.kv, "HeatKV", Input, "" );
extract_value( dizel_heat.kfe, "HeatKFE", Input, "" );
extract_value( dizel_heat.kfs, "HeatKFS", Input, "" );
extract_value( dizel_heat.kfo, "HeatKFO", Input, "" );
extract_value( dizel_heat.kfo2, "HeatKFO2", Input, "" );
// engine cooling systems
extract_value( dizel_heat.water.config.temp_min, "WaterMinTemperature", Input, "" );
extract_value( dizel_heat.water.config.temp_max, "WaterMaxTemperature", Input, "" );
extract_value( dizel_heat.water.config.temp_flow, "WaterFlowTemperature", Input, "" );
extract_value( dizel_heat.water.config.temp_cooling, "WaterCoolingTemperature", Input, "" );
extract_value( dizel_heat.water.config.shutters, "WaterShutters", Input, "" );
extract_value( dizel_heat.auxiliary_water_circuit, "WaterAuxCircuit", Input, "" );
extract_value( dizel_heat.water_aux.config.temp_min, "WaterAuxMinTemperature", Input, "" );
extract_value( dizel_heat.water_aux.config.temp_max, "WaterAuxMaxTemperature", Input, "" );
extract_value( dizel_heat.water_aux.config.temp_cooling, "WaterAuxCoolingTemperature", Input, "" );
extract_value( dizel_heat.water_aux.config.shutters, "WaterAuxShutters", Input, "" );
extract_value( dizel_heat.oil.config.temp_min, "OilMinTemperature", Input, "" );
extract_value( dizel_heat.oil.config.temp_max, "OilMaxTemperature", Input, "" );
// water heater
extract_value( WaterHeater.config.temp_min, "HeaterMinTemperature", Input, "" );
extract_value( WaterHeater.config.temp_max, "HeaterMaxTemperature", Input, "" );
}
}
void TMoverParameters::LoadFIZ_Switches( std::string const &Input ) {
@@ -8771,6 +8778,7 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int Dir)
WriteLog( "XBT EStED" );
Hamulec = std::make_shared<TEStED>( MaxBrakePress[ 3 ], BrakeCylRadius, BrakeCylDist, BrakeVVolume, BrakeCylNo, BrakeDelays, BrakeMethod, NAxles, NBpA );
Hamulec->SetRM( RapidMult );
Hamulec->SetRV( RapidVel );
if( MBPM < 2 ) {
//jesli przystawka wazaca
Hamulec->SetLP( 0, MaxBrakePress[ 3 ], 0 );
@@ -9298,9 +9306,9 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
}
else if (Command == "DoorOpen") /*NBMX*/
{ // Ra: uwzględnić trzeba jeszcze zgodność sprzęgów
if( ( DoorCloseCtrl == control::conductor )
|| ( DoorCloseCtrl == control::driver )
|| ( DoorCloseCtrl == control::mixed ) ) {
if( ( DoorOpenCtrl == control::conductor )
|| ( DoorOpenCtrl == control::driver )
|| ( DoorOpenCtrl == control::mixed ) ) {
// ignore remote command if the door is only operated locally
if( CValue2 > 0 ) {
// normalne ustawienie pojazdu