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

build 180508. configurable maximum oil pressure, door closing animation delay, whistle sound, indicators for water temperature and oil pressure in controlled vehicle/unit, minor bug fixes

This commit is contained in:
tmj-fstate
2018-05-08 16:18:08 +02:00
parent aa9626901f
commit b5f334a1fa
16 changed files with 192 additions and 125 deletions

View File

@@ -637,6 +637,7 @@ struct oil_pump {
start start_type { start::manual };
float resource_amount { 1.f };
float pressure_minimum { 0.f }; // lowest acceptable working pressure
float pressure_maximum { 0.f }; // oil pressure at maximum engine revolutions
float pressure_target { 0.f };
float pressure_present { 0.f };
};
@@ -943,6 +944,7 @@ public:
double DoorOpenSpeed = 1.0; double DoorCloseSpeed = 1.0; /*predkosc otwierania i zamykania w j.u. */
double DoorMaxShiftL = 0.5; double DoorMaxShiftR = 0.5; double DoorMaxPlugShift = 0.1;/*szerokosc otwarcia lub kat*/
int DoorOpenMethod = 2; /*sposob otwarcia - 1: przesuwne, 2: obrotowe, 3: trójelementowe*/
float DoorCloseDelay { 0.f }; // delay (in seconds) before the door begin closing, once conditions to close are met
double PlatformSpeed = 0.5; /*szybkosc stopnia*/
double PlatformMaxShift { 45.0 }; /*wysuniecie stopnia*/
int PlatformOpenMethod { 2 }; /*sposob animacji stopnia*/
@@ -1065,7 +1067,7 @@ public:
int DirAbsolute = 0; //zadany kierunek jazdy względem sprzęgów (1=w strone 0,-1=w stronę 1)
int ActiveCab = 0; //numer kabiny, w ktorej jest obsada (zwykle jedna na skład)
double LastSwitchingTime = 0.0; /*czas ostatniego przelaczania czegos*/
//WarningSignal: byte; {0: nie trabi, 1,2: trabi}
int WarningSignal = 0; // 0: nie trabi, 1,2,4: trabi
bool DepartureSignal = false; /*sygnal odjazdu*/
bool InsideConsist = false;
/*-zmienne dla lokomotywy elektrycznej*/
@@ -1184,7 +1186,6 @@ public:
double TotalMassxg = 0.0; /*TotalMass*g*/
Math3D::vector3 vCoulpler[2]; // powtórzenie współrzędnych sprzęgów z DynObj :/
int WarningSignal = 0; // tymczasowo 8bit, ze względu na funkcje w MTools
double fBrakeCtrlPos = -2.0; // płynna nastawa hamulca zespolonego
bool bPantKurek3 = true; // kurek trójdrogowy (pantografu): true=połączenie z ZG, false=połączenie z małą sprężarką // domyślnie zbiornik pantografu połączony jest ze zbiornikiem głównym
int iProblem = 0; // flagi problemów z taborem, aby AI nie musiało porównywać; 0=może jechać

View File

@@ -1613,10 +1613,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 );
@@ -6320,6 +6319,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 };
@@ -6709,14 +6710,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 );
@@ -7861,6 +7862,7 @@ 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, "" );
@@ -8363,7 +8365,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
@@ -8384,7 +8385,6 @@ void TMoverParameters::LoadFIZ_Engine( std::string const &Input ) {
ImaxHi = 2;
ImaxLo = 1;
}
extract_value( OilPump.pressure_minimum, "OilMinPressure", Input, "" );
break;
}
case ElectricInductionMotor: {
@@ -8424,29 +8424,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 ) {
@@ -9299,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