mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 11:56:50 +01:00
refactor(physics): TMoverParameters becomes physics::Vehicle, the mover is gone
The physics of a vehicle loses the name it had from the Pascal of 2001. Done by
tools/rename/mover_to_physics.py, committed with it:
physics/mover.h physics/vehicle.h
TMoverParameters physics::Vehicle (in namespace physics)
TDynamicObject::MoverParameters physics
mvOccupied, mvControlled occupied, controlled (TTrain, TController)
mvSecond, mvThird secondUnit, thirdUnit
mvPantographUnit pantographUnit
mover, Mover, movers physics, Physics, vehicles (locals, params)
m_mover, othermover, currentMover, from_movers, renderMoverEventSounds
m_physics, otherPhysics, currentPhysics,
from_vehicles, renderPhysicsEventSounds
The code and the comments are renamed, the string literals are not: no text
the game shows, logs or looks up has changed (none had the names). The movers
of the editor, the tracks a slide moves, keep their name.
By hand: two member functions of TDynamicObject (gather_off_track_terrain,
begin_off_track) had a local mover aliasing their own MoverParameters, which
the rename made physics { *physics }; the alias is gone, they use physics->.
No other function has a renamed local meeting a renamed member (checked over
all the functions of the code before the rename).
For the branches made before it: run the script on the branch (python
tools/rename/mover_to_physics.py, from the root of the repository) before
merging it with this one, and the names don't conflict. It can be run again;
the second time it changes nothing.
The class is the same as it was; breaking it into its parts (braking,
electrics, controls, load) and making its data private are the next stages.
No change in behaviour: 1149/1149 tests, golden traces exact against staging
62f7a29b.
This commit is contained in:
@@ -10,7 +10,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
// the brakes and the air: the brake controls, the pipes, the valves, the compressor, the spring brake
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "physics/mover.h"
|
||||
#include "physics/vehicle.h"
|
||||
#include "vehicle/DynObj.h"
|
||||
#include "physics/oerlikonest.h"
|
||||
#include "utilities/Globals.h"
|
||||
@@ -32,7 +32,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
// Nastawianie hamulców
|
||||
|
||||
void TMoverParameters::BrakeLevelSet(double b)
|
||||
void physics::Vehicle::BrakeLevelSet(double b)
|
||||
{ // ustawienie pozycji hamulca na wartość (b) w zakresie od -2 do BrakeCtrlPosNo
|
||||
// jedyny dopuszczalny sposób przestawienia hamulca zasadniczego
|
||||
if (fBrakeCtrlPos == b)
|
||||
@@ -47,10 +47,10 @@ void TMoverParameters::BrakeLevelSet(double b)
|
||||
auto x = static_cast<int>(std::floor(fBrakeCtrlPos)); // jeśli odwołujemy się do BrakeCtrlPos w pośrednich, to musi być
|
||||
// obcięte a nie zaokrągone
|
||||
while (x > BrakeCtrlPos && BrakeCtrlPos < BrakeCtrlPosNo) // jeśli zwiększyło się o 1
|
||||
if (!IncBrakeLevelOld()) // T_MoverParameters::
|
||||
if (!IncBrakeLevelOld()) // physics::Vehicle::
|
||||
break; // wyjście awaryjne
|
||||
while (x < BrakeCtrlPos && BrakeCtrlPos >= -1) // jeśli zmniejszyło się o 1
|
||||
if (!DecBrakeLevelOld()) // T_MoverParameters::
|
||||
if (!DecBrakeLevelOld()) // physics::Vehicle::
|
||||
break;
|
||||
BrakePressureActual = BrakePressureTable[BrakeCtrlPos]; // skopiowanie pozycji
|
||||
/*
|
||||
@@ -73,19 +73,19 @@ void TMoverParameters::BrakeLevelSet(double b)
|
||||
*/
|
||||
};
|
||||
|
||||
bool TMoverParameters::BrakeLevelAdd(double b)
|
||||
bool physics::Vehicle::BrakeLevelAdd(double b)
|
||||
{ // dodanie wartości (b) do pozycji hamulca (w tym ujemnej)
|
||||
// zwraca false, gdy po dodaniu było by poza zakresem
|
||||
BrakeLevelSet(fBrakeCtrlPos + b);
|
||||
return b > 0.0 ? fBrakeCtrlPos < BrakeCtrlPosNo : BrakeCtrlPos > -1.0; // true, jeśli można kontynuować
|
||||
};
|
||||
|
||||
bool TMoverParameters::IncBrakeLevel()
|
||||
bool physics::Vehicle::IncBrakeLevel()
|
||||
{ // nowa wersja na użytek AI, false gdy osiągnięto pozycję BrakeCtrlPosNo
|
||||
return BrakeLevelAdd(1.0);
|
||||
};
|
||||
|
||||
bool TMoverParameters::DecBrakeLevel()
|
||||
bool physics::Vehicle::DecBrakeLevel()
|
||||
{
|
||||
return BrakeLevelAdd(-1.0);
|
||||
}; // nowa wersja na użytek AI, false gdy osiągnięto pozycję -1
|
||||
@@ -133,7 +133,7 @@ ZN //masa
|
||||
// Q: 20160714
|
||||
// Oblicza iloraz aktualnej pozycji do maksymalnej hamulca pomocnicznego
|
||||
// *****************************************************************************
|
||||
double TMoverParameters::LocalBrakeRatio(void) const
|
||||
double physics::Vehicle::LocalBrakeRatio(void) const
|
||||
{
|
||||
double LBR;
|
||||
if (BrakeHandle == TBrakeHandle::MHZ_EN57)
|
||||
@@ -157,7 +157,7 @@ double TMoverParameters::LocalBrakeRatio(void) const
|
||||
// Q: 20160714
|
||||
// Oblicza iloraz aktualnej pozycji do maksymalnej hamulca ręcznego
|
||||
// *****************************************************************************
|
||||
double TMoverParameters::ManualBrakeRatio(void) const
|
||||
double physics::Vehicle::ManualBrakeRatio(void) const
|
||||
{
|
||||
double MBR;
|
||||
|
||||
@@ -172,7 +172,7 @@ double TMoverParameters::ManualBrakeRatio(void) const
|
||||
// Q: 20160713
|
||||
// Zwraca objętość
|
||||
// *****************************************************************************
|
||||
double TMoverParameters::BrakeVP(void) const
|
||||
double physics::Vehicle::BrakeVP(void) const
|
||||
{
|
||||
if (BrakeVVolume > 0)
|
||||
return Volume / (10.0 * BrakeVVolume);
|
||||
@@ -184,7 +184,7 @@ double TMoverParameters::BrakeVP(void) const
|
||||
// Q: 20160713
|
||||
// Zwraca iloraz różnicy między przewodem kontrolnym i głównym oraz DeltaPipePress
|
||||
// *****************************************************************************
|
||||
double TMoverParameters::RealPipeRatio(void) const
|
||||
double physics::Vehicle::RealPipeRatio(void) const
|
||||
{
|
||||
double rpp;
|
||||
|
||||
@@ -199,7 +199,7 @@ double TMoverParameters::RealPipeRatio(void) const
|
||||
// Q: 20160713
|
||||
// Zwraca iloraz ciśnienia w przewodzie do DeltaPipePress
|
||||
// *****************************************************************************
|
||||
double TMoverParameters::PipeRatio(void) const
|
||||
double physics::Vehicle::PipeRatio(void) const
|
||||
{
|
||||
double pr;
|
||||
|
||||
@@ -227,7 +227,7 @@ double TMoverParameters::PipeRatio(void) const
|
||||
// Q: 20160710
|
||||
// włączenie / wyłączenie hamulca elektro-pneumatycznego
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::EpFuseSwitch(bool State)
|
||||
bool physics::Vehicle::EpFuseSwitch(bool State)
|
||||
{
|
||||
if (EpFuse != State)
|
||||
{
|
||||
@@ -244,7 +244,7 @@ bool TMoverParameters::EpFuseSwitch(bool State)
|
||||
// yB: 20190906
|
||||
// włączenie / wyłączenie hamulca sprezynowego
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::SpringBrakeActivate(bool State)
|
||||
bool physics::Vehicle::SpringBrakeActivate(bool State)
|
||||
{
|
||||
if (Power24vIsAvailable || Power110vIsAvailable)
|
||||
{
|
||||
@@ -264,7 +264,7 @@ bool TMoverParameters::SpringBrakeActivate(bool State)
|
||||
// yB: 20190906
|
||||
// włączenie / wyłączenie odciecia hamulca sprezynowego
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::SpringBrakeShutOff(bool State)
|
||||
bool physics::Vehicle::SpringBrakeShutOff(bool State)
|
||||
{
|
||||
if (SpringBrake.ShuttOff != State)
|
||||
{
|
||||
@@ -279,7 +279,7 @@ bool TMoverParameters::SpringBrakeShutOff(bool State)
|
||||
// yB: 20190906
|
||||
// wyluzowanie hamulca sprezynowego
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::SpringBrakeRelease()
|
||||
bool physics::Vehicle::SpringBrakeRelease()
|
||||
{
|
||||
if (SpringBrake.IsReady && SpringBrake.Cylinder->P() < SpringBrake.MinForcePressure)
|
||||
{
|
||||
@@ -295,7 +295,7 @@ bool TMoverParameters::SpringBrakeRelease()
|
||||
// Q: 20160710
|
||||
// załączenie przycisku przeciwpoślizgowego
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::AntiSlippingButton(void)
|
||||
bool physics::Vehicle::AntiSlippingButton(void)
|
||||
{
|
||||
// NOTE: disabled the sandbox part, it's already controlled by another part of the AI routine
|
||||
return AntiSlippingBrake() /*|| Sandbox(true)*/;
|
||||
@@ -305,7 +305,7 @@ bool TMoverParameters::AntiSlippingButton(void)
|
||||
// Q: 20160713
|
||||
// włączenie / wyłączenie sprężarki
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::CompressorSwitch(bool State, range_t const Notify)
|
||||
bool physics::Vehicle::CompressorSwitch(bool State, range_t const Notify)
|
||||
{
|
||||
|
||||
if (CompressorStart != start_t::manual)
|
||||
@@ -329,7 +329,7 @@ bool TMoverParameters::CompressorSwitch(bool State, range_t const Notify)
|
||||
return CompressorAllow != initialstate;
|
||||
}
|
||||
|
||||
bool TMoverParameters::ChangeCompressorPreset(int const State, range_t const Notify)
|
||||
bool physics::Vehicle::ChangeCompressorPreset(int const State, range_t const Notify)
|
||||
{
|
||||
|
||||
auto const initialstate{CompressorListPos};
|
||||
@@ -348,7 +348,7 @@ bool TMoverParameters::ChangeCompressorPreset(int const State, range_t const Not
|
||||
// Q: 20160711
|
||||
// zwiększenie nastawy hamulca
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::IncBrakeLevelOld(void)
|
||||
bool physics::Vehicle::IncBrakeLevelOld(void)
|
||||
{
|
||||
bool IBLO = false;
|
||||
|
||||
@@ -375,7 +375,7 @@ bool TMoverParameters::IncBrakeLevelOld(void)
|
||||
// Q: 20160711
|
||||
// zmniejszenie nastawy hamulca
|
||||
// *****************************************************************************
|
||||
bool TMoverParameters::DecBrakeLevelOld(void)
|
||||
bool physics::Vehicle::DecBrakeLevelOld(void)
|
||||
{
|
||||
bool DBLO = false;
|
||||
|
||||
@@ -401,7 +401,7 @@ bool TMoverParameters::DecBrakeLevelOld(void)
|
||||
// Q: 20160711
|
||||
// zwiększenie nastawy hamulca pomocnicznego
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::IncLocalBrakeLevel(float const CtrlSpeed)
|
||||
bool physics::Vehicle::IncLocalBrakeLevel(float const CtrlSpeed)
|
||||
{
|
||||
bool IBL;
|
||||
if (LocalBrakePosA < 1.0 /*and (BrakeCtrlPos<1)*/)
|
||||
@@ -420,7 +420,7 @@ bool TMoverParameters::IncLocalBrakeLevel(float const CtrlSpeed)
|
||||
// Q: 20160711
|
||||
// zmniejszenie nastawy hamulca pomocniczego
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::DecLocalBrakeLevel(float const CtrlSpeed)
|
||||
bool physics::Vehicle::DecLocalBrakeLevel(float const CtrlSpeed)
|
||||
{
|
||||
bool DBL;
|
||||
if (LocalBrakePosA > 0)
|
||||
@@ -439,7 +439,7 @@ bool TMoverParameters::DecLocalBrakeLevel(float const CtrlSpeed)
|
||||
// Q: 20160711
|
||||
// zwiększenie nastawy hamulca ręcznego
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::IncManualBrakeLevel(int CtrlSpeed)
|
||||
bool physics::Vehicle::IncManualBrakeLevel(int CtrlSpeed)
|
||||
{
|
||||
bool IMBL;
|
||||
if (ManualBrakePos < ManualBrakePosNo) /*and (BrakeCtrlPos<1)*/
|
||||
@@ -462,7 +462,7 @@ bool TMoverParameters::IncManualBrakeLevel(int CtrlSpeed)
|
||||
// Q: 20160711
|
||||
// zmniejszenie nastawy hamulca ręcznego
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::DecManualBrakeLevel(int CtrlSpeed)
|
||||
bool physics::Vehicle::DecManualBrakeLevel(int CtrlSpeed)
|
||||
{
|
||||
bool DMBL;
|
||||
if (ManualBrakePos > 0)
|
||||
@@ -480,7 +480,7 @@ bool TMoverParameters::DecManualBrakeLevel(int CtrlSpeed)
|
||||
return DMBL;
|
||||
}
|
||||
|
||||
bool TMoverParameters::AlarmChainSwitch(bool const State)
|
||||
bool physics::Vehicle::AlarmChainSwitch(bool const State)
|
||||
{
|
||||
|
||||
if (AlarmChainFlag != State)
|
||||
@@ -496,7 +496,7 @@ bool TMoverParameters::AlarmChainSwitch(bool const State)
|
||||
// Q: 20160710
|
||||
// hamowanie przeciwpoślizgowe
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::AntiSlippingBrake(void)
|
||||
bool physics::Vehicle::AntiSlippingBrake(void)
|
||||
{
|
||||
bool ASB = false; // Ra: przeniesione z końca
|
||||
if (ASBType == 1)
|
||||
@@ -512,7 +512,7 @@ bool TMoverParameters::AntiSlippingBrake(void)
|
||||
// Q: 20160711
|
||||
// włączenie / wyłączenie odluźniacza
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::BrakeReleaser(int state)
|
||||
bool physics::Vehicle::BrakeReleaser(int state)
|
||||
{
|
||||
bool OK = true; // false tylko jeśli nie uda się wysłać, GF 20161124
|
||||
if (state != 0)
|
||||
@@ -536,7 +536,7 @@ bool TMoverParameters::BrakeReleaser(int state)
|
||||
// yB: 20160711
|
||||
// włączenie / wyłączenie uniwersalnego przycisku hamulcowego
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::UniversalBrakeButton(int button, int state)
|
||||
bool physics::Vehicle::UniversalBrakeButton(int button, int state)
|
||||
{
|
||||
bool OK = true; // false tylko jeśli nie uda się wysłać, GF 20161124
|
||||
UniversalBrakeButtonActive[button] = state > 0;
|
||||
@@ -566,7 +566,7 @@ bool TMoverParameters::UniversalBrakeButton(int button, int state)
|
||||
// Q: 20160711
|
||||
// włączenie / wyłączenie hamulca elektro-pneumatycznego
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::SwitchEPBrake(int state)
|
||||
bool physics::Vehicle::SwitchEPBrake(int state)
|
||||
{
|
||||
bool OK;
|
||||
|
||||
@@ -586,7 +586,7 @@ bool TMoverParameters::SwitchEPBrake(int state)
|
||||
return OK;
|
||||
}
|
||||
|
||||
bool TMoverParameters::EPBrakeControlPowered() const
|
||||
bool physics::Vehicle::EPBrakeControlPowered() const
|
||||
{
|
||||
return Power24vIsAvailable && DirActive != 0 && EpFuse;
|
||||
}
|
||||
@@ -595,7 +595,7 @@ bool TMoverParameters::EPBrakeControlPowered() const
|
||||
// Q: 20160711
|
||||
// zwiększenie ciśnienia hamowania
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::IncBrakePress(double &brake, double PressLimit, double dp)
|
||||
bool physics::Vehicle::IncBrakePress(double &brake, double PressLimit, double dp)
|
||||
{
|
||||
bool IBP;
|
||||
// if (DynamicBrakeType<>dbrake_switch) and (DynamicBrakeType<>dbrake_none) and
|
||||
@@ -624,7 +624,7 @@ bool TMoverParameters::IncBrakePress(double &brake, double PressLimit, double dp
|
||||
// Q: 20160711
|
||||
// zmniejszenie ciśnienia hamowania
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::DecBrakePress(double &brake, double PressLimit, double dp)
|
||||
bool physics::Vehicle::DecBrakePress(double &brake, double PressLimit, double dp)
|
||||
{
|
||||
bool DBP;
|
||||
|
||||
@@ -650,7 +650,7 @@ bool TMoverParameters::DecBrakePress(double &brake, double PressLimit, double dp
|
||||
// Q: 20160711
|
||||
// przełączenie nastawy hamulca O/P/T
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::BrakeDelaySwitch(int BDS)
|
||||
bool physics::Vehicle::BrakeDelaySwitch(int BDS)
|
||||
{
|
||||
bool rBDS;
|
||||
if (Hamulec->SetBDF(BDS))
|
||||
@@ -672,7 +672,7 @@ bool TMoverParameters::BrakeDelaySwitch(int BDS)
|
||||
// Q: 20160712
|
||||
// zwiększenie przełożenia hamulca
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::IncBrakeMult(void)
|
||||
bool physics::Vehicle::IncBrakeMult(void)
|
||||
{
|
||||
bool IBM;
|
||||
|
||||
@@ -696,7 +696,7 @@ bool TMoverParameters::IncBrakeMult(void)
|
||||
// Q: 20160712
|
||||
// zmniejszenie przełożenia hamulca
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::DecBrakeMult(void)
|
||||
bool physics::Vehicle::DecBrakeMult(void)
|
||||
{
|
||||
bool DBM;
|
||||
if (LoadFlag > 1 && MBPM < 2)
|
||||
@@ -719,7 +719,7 @@ bool TMoverParameters::DecBrakeMult(void)
|
||||
// Q: 20160712
|
||||
// zaktualizowanie ciśnienia w hamulcach
|
||||
// *************************************************************************************************
|
||||
void TMoverParameters::UpdateBrakePressure(double dt)
|
||||
void physics::Vehicle::UpdateBrakePressure(double dt)
|
||||
{
|
||||
// const double LBDelay = 5.0; // stala czasowa hamulca
|
||||
// double Rate, Speed, dp, sm;
|
||||
@@ -745,7 +745,7 @@ void TMoverParameters::UpdateBrakePressure(double dt)
|
||||
// Q: 20160712
|
||||
// Obliczanie pracy sprężarki
|
||||
// *************************************************************************************************
|
||||
void TMoverParameters::CompressorCheck(double dt)
|
||||
void physics::Vehicle::CompressorCheck(double dt)
|
||||
{
|
||||
|
||||
if (CompressorSpeed == 0.0)
|
||||
@@ -891,7 +891,7 @@ void TMoverParameters::CompressorCheck(double dt)
|
||||
// Q: 20160712
|
||||
// aktualizacja ciśnienia w przewodzie głównym
|
||||
// *************************************************************************************************
|
||||
void TMoverParameters::UpdatePipePressure(double dt)
|
||||
void physics::Vehicle::UpdatePipePressure(double dt)
|
||||
{
|
||||
if (PipePress > 1.0)
|
||||
{
|
||||
@@ -900,7 +900,7 @@ void TMoverParameters::UpdatePipePressure(double dt)
|
||||
}
|
||||
|
||||
// double dV;
|
||||
// TMoverParameters *c; // T_MoverParameters
|
||||
// physics::Vehicle *c; // physics::Vehicle
|
||||
double temp;
|
||||
// int b;
|
||||
|
||||
@@ -976,7 +976,7 @@ void TMoverParameters::UpdatePipePressure(double dt)
|
||||
}
|
||||
|
||||
// the flow of the local brake valve, by the handle, the TRAXX's timed one, the integrated controller or the parking
|
||||
void TMoverParameters::UpdateLocalBrakeValve(double dt)
|
||||
void physics::Vehicle::UpdateLocalBrakeValve(double dt)
|
||||
{
|
||||
// the local brake of a vehicle prepared for hauling (PulleeMode) is held released, whatever asks for it
|
||||
if (EngineType != TEngineType::ElectricInductionMotor)
|
||||
@@ -1016,7 +1016,7 @@ void TMoverParameters::UpdateLocalBrakeValve(double dt)
|
||||
}
|
||||
|
||||
// the lock of the brake pipe and the flow of the driver's handle, from the main reservoir or into the air
|
||||
void TMoverParameters::UpdateMainValve(double dt)
|
||||
void physics::Vehicle::UpdateMainValve(double dt)
|
||||
{
|
||||
auto const temp{MainValveSupply()};
|
||||
Handle->SetReductor(BrakeCtrlPos2);
|
||||
@@ -1056,7 +1056,7 @@ void TMoverParameters::UpdateMainValve(double dt)
|
||||
}
|
||||
|
||||
// the pressure the driver's handle is fed from: the main pipe's, or the brake pipe's own with the pipe locked
|
||||
double TMoverParameters::MainValveSupply()
|
||||
double physics::Vehicle::MainValveSupply()
|
||||
{
|
||||
LockPipe = PipePress < (LockPipe ? LockPipeOff : LockPipeOn);
|
||||
bool lock_new = (LockPipe && !UnlockPipe && BrakeCtrlPosR > HandleUnlock) || (EmergencyCutsOffHandle && EmergencyValveFlow > 0); // new simple codition based on .fiz
|
||||
@@ -1071,7 +1071,7 @@ double TMoverParameters::MainValveSupply()
|
||||
}
|
||||
|
||||
// the position the driver's handle works at: its own, or the one the speed control's brake intervention sets
|
||||
double TMoverParameters::MainValveHandlePosition() const
|
||||
double physics::Vehicle::MainValveHandlePosition() const
|
||||
{
|
||||
double pos = BrakeCtrlPosR;
|
||||
if (SpeedCtrlUnit.IsActive && SpeedCtrlUnit.BrakeIntervention && !SpeedCtrlUnit.Standby && BrakeCtrlPos != Handle->GetPos(bh_EB))
|
||||
@@ -1085,7 +1085,7 @@ double TMoverParameters::MainValveHandlePosition() const
|
||||
return pos;
|
||||
}
|
||||
|
||||
void TMoverParameters::UpdateEmergencyValve(double dt)
|
||||
void physics::Vehicle::UpdateEmergencyValve(double dt)
|
||||
{
|
||||
// ulepszony hamulec bezp.
|
||||
EmergencyValveFlow = 0.0;
|
||||
@@ -1107,7 +1107,7 @@ void TMoverParameters::UpdateEmergencyValve(double dt)
|
||||
}
|
||||
|
||||
// what the distributor valve gets of the local brake and the load, by its kind
|
||||
void TMoverParameters::UpdateDistributorSettings()
|
||||
void physics::Vehicle::UpdateDistributorSettings()
|
||||
{
|
||||
switch (BrakeValve)
|
||||
{
|
||||
@@ -1218,7 +1218,7 @@ void TMoverParameters::UpdateDistributorSettings()
|
||||
}
|
||||
|
||||
// the ep brake of the FVel6 and FVE408 handles, passed along the unit
|
||||
void TMoverParameters::UpdateEPBrake()
|
||||
void physics::Vehicle::UpdateEPBrake()
|
||||
{
|
||||
if (EPBrakeControlPowered()) // tu powinien byc jeszcze bezpiecznik EP i baterie -
|
||||
// temp = (Handle as TFVel6).GetCP
|
||||
@@ -1244,7 +1244,7 @@ void TMoverParameters::UpdateEPBrake()
|
||||
// Q: 20160713
|
||||
// Aktualizacja ciśnienia w przewodzie zasilającym
|
||||
// *************************************************************************************************
|
||||
void TMoverParameters::UpdateScndPipePressure(double dt)
|
||||
void physics::Vehicle::UpdateScndPipePressure(double dt)
|
||||
{
|
||||
if (ScndPipePress > 1.0)
|
||||
{
|
||||
@@ -1281,7 +1281,7 @@ void TMoverParameters::UpdateScndPipePressure(double dt)
|
||||
// yB: 20190906
|
||||
// Aktualizacja ciśnienia w hamulcu sprezynowym
|
||||
// *************************************************************************************************
|
||||
void TMoverParameters::UpdateSpringBrake(double /*dt*/)
|
||||
void physics::Vehicle::UpdateSpringBrake(double /*dt*/)
|
||||
{
|
||||
double BP = SpringBrake.PNBrakeConnection ? BrakePress : 0;
|
||||
double MSP = SpringBrake.ShuttOff ? 0 : SpringBrake.MaxSetPressure;
|
||||
@@ -1326,7 +1326,7 @@ bool pipe_wakes(double const Flow, double const Pressure, TReservoir const &Pipe
|
||||
// the pressure in the pipe of a coupled vehicle the flow to it goes by. the pressure the vehicle keeps is the one of its last step:
|
||||
// with Global.physics_pipewake one asleep can take air for a long time without waking, and the flow, going by that pressure, would
|
||||
// carry on past the pressure of the vehicle it comes from. so of one asleep, the pressure with what has flown in since
|
||||
double neighbour_pipe_pressure(TMoverParameters const &Neighbour, double const Pressure, TReservoir const &Pipe)
|
||||
double neighbour_pipe_pressure(physics::Vehicle const &Neighbour, double const Pressure, TReservoir const &Pipe)
|
||||
{
|
||||
if ((Global.physics_pipewake <= 0.f) || Neighbour.PhysicActivation)
|
||||
return Pressure;
|
||||
@@ -1339,10 +1339,10 @@ double neighbour_pipe_pressure(TMoverParameters const &Neighbour, double const P
|
||||
// Q: 20160715
|
||||
// oblicza i zwraca przepływ powietrza pomiędzy pojazdami
|
||||
// *************************************************************************************************
|
||||
double TMoverParameters::GetDVc(double dt)
|
||||
double physics::Vehicle::GetDVc(double dt)
|
||||
{
|
||||
// T_MoverParameters *c;
|
||||
TMoverParameters *c;
|
||||
// physics::Vehicle *c;
|
||||
physics::Vehicle *c;
|
||||
double dv1;
|
||||
double dv2; // , dV;
|
||||
|
||||
@@ -1384,10 +1384,10 @@ double TMoverParameters::GetDVc(double dt)
|
||||
// the air the main reservoir hoses carry between the vehicle's pipe and the neighbours' in dt: the neighbours'
|
||||
// share is sent to them, the vehicle's own returned
|
||||
// *************************************************************************************************
|
||||
double TMoverParameters::GetScndDVc(double dt)
|
||||
double physics::Vehicle::GetScndDVc(double dt)
|
||||
{
|
||||
const double Spz = 0.5067;
|
||||
TMoverParameters *c;
|
||||
physics::Vehicle *c;
|
||||
double dv1 = 0;
|
||||
double dv2 = 0;
|
||||
|
||||
@@ -1421,35 +1421,35 @@ namespace
|
||||
{
|
||||
|
||||
|
||||
// a pipe along the train, whose air the hoses between the vehicles carry (TMoverParameters::UpdatePipeCouplers())
|
||||
// a pipe along the train, whose air the hoses between the vehicles carry (physics::Vehicle::UpdatePipeCouplers())
|
||||
struct train_pipe
|
||||
{
|
||||
std::shared_ptr<TReservoir> TMoverParameters::*reservoir;
|
||||
double TMoverParameters::*pressure;
|
||||
bool TMoverParameters::*pending; // the vehicle stepped the pipe, the exchange through its hoses is yet to come
|
||||
std::shared_ptr<TReservoir> physics::Vehicle::*reservoir;
|
||||
double physics::Vehicle::*pressure;
|
||||
bool physics::Vehicle::*pending; // the vehicle stepped the pipe, the exchange through its hoses is yet to come
|
||||
CouplingSet hose; // the coupling of the pipe's hose
|
||||
double (TMoverParameters::*exchange)(double); // the air the hoses carry in a step, the neighbours' share sent to them
|
||||
double (*area)(TMoverParameters const &); // the cross-section of the hose, as the exchange takes it
|
||||
double (physics::Vehicle::*exchange)(double); // the air the hoses carry in a step, the neighbours' share sent to them
|
||||
double (*area)(physics::Vehicle const &); // the cross-section of the hose, as the exchange takes it
|
||||
};
|
||||
|
||||
// the brake pipe, GetDVc()
|
||||
train_pipe const brake_pipe{&TMoverParameters::Pipe,
|
||||
&TMoverParameters::PipePress,
|
||||
&TMoverParameters::PipeCouplersPending,
|
||||
train_pipe const brake_pipe{&physics::Vehicle::Pipe,
|
||||
&physics::Vehicle::PipePress,
|
||||
&physics::Vehicle::PipeCouplersPending,
|
||||
Coupling::brakeHose,
|
||||
&TMoverParameters::GetDVc,
|
||||
[](TMoverParameters const &Vehicle) { return Vehicle.Spg / (1.0 + 0.015 / Vehicle.Spg * Vehicle.Dim.L); }};
|
||||
&physics::Vehicle::GetDVc,
|
||||
[](physics::Vehicle const &Vehicle) { return Vehicle.Spg / (1.0 + 0.015 / Vehicle.Spg * Vehicle.Dim.L); }};
|
||||
// the main reservoir pipe, GetScndDVc()
|
||||
train_pipe const main_reservoir_pipe{&TMoverParameters::Pipe2,
|
||||
&TMoverParameters::ScndPipePress,
|
||||
&TMoverParameters::ScndPipeCouplersPending,
|
||||
train_pipe const main_reservoir_pipe{&physics::Vehicle::Pipe2,
|
||||
&physics::Vehicle::ScndPipePress,
|
||||
&physics::Vehicle::ScndPipeCouplersPending,
|
||||
Coupling::mainHose,
|
||||
&TMoverParameters::GetScndDVc,
|
||||
[](TMoverParameters const &) { return 0.5067 * 0.75; }};
|
||||
&physics::Vehicle::GetScndDVc,
|
||||
[](physics::Vehicle const &) { return 0.5067 * 0.75; }};
|
||||
|
||||
// the number of sub-steps of dt the air exchange through the hoses of the vehicle's pipe needs: in one, the air a
|
||||
// hose carries stays below what evens out the pipes on its ends
|
||||
int hose_substeps(TMoverParameters const &Vehicle, train_pipe const &Pipe, double const dt)
|
||||
int hose_substeps(physics::Vehicle const &Vehicle, train_pipe const &Pipe, double const dt)
|
||||
{
|
||||
auto substeps{1};
|
||||
auto const area{Pipe.area(Vehicle)};
|
||||
@@ -1474,12 +1474,12 @@ int hose_substeps(TMoverParameters const &Vehicle, train_pipe const &Pipe, doubl
|
||||
// the vehicles of the list which stepped the pipe, each with the number of the train it is in: the ones joined by the hoses
|
||||
// of the pipe, directly, numbered in the order of their first vehicle in the list. a vehicle which didn't step the pipe
|
||||
// (its physics sleeps) takes the air sent to it without passing it on, so it ends a train
|
||||
std::vector<std::size_t> hose_trains(std::vector<TMoverParameters *> const &Vehicles, train_pipe const &Pipe)
|
||||
std::vector<std::size_t> hose_trains(std::vector<physics::Vehicle *> const &Vehicles, train_pipe const &Pipe)
|
||||
{
|
||||
auto constexpr none{std::numeric_limits<std::size_t>::max()};
|
||||
std::vector<std::size_t> trains(Vehicles.size(), none);
|
||||
// the vehicles by their address, for finding the neighbours in the list
|
||||
std::vector<std::pair<TMoverParameters const *, std::size_t>> byaddress;
|
||||
std::vector<std::pair<physics::Vehicle const *, std::size_t>> byaddress;
|
||||
byaddress.reserve(Vehicles.size());
|
||||
for (std::size_t index = 0; index < Vehicles.size(); ++index)
|
||||
{
|
||||
@@ -1489,8 +1489,8 @@ std::vector<std::size_t> hose_trains(std::vector<TMoverParameters *> const &Vehi
|
||||
}
|
||||
}
|
||||
std::ranges::sort(byaddress);
|
||||
auto const find = [&byaddress](TMoverParameters const *Vehicle) {
|
||||
auto const found{std::ranges::lower_bound(byaddress, Vehicle, std::less<>{}, &std::pair<TMoverParameters const *, std::size_t>::first)};
|
||||
auto const find = [&byaddress](physics::Vehicle const *Vehicle) {
|
||||
auto const found{std::ranges::lower_bound(byaddress, Vehicle, std::less<>{}, &std::pair<physics::Vehicle const *, std::size_t>::first)};
|
||||
return (found != byaddress.end() && found->first == Vehicle) ? found->second : none;
|
||||
};
|
||||
std::size_t count{0};
|
||||
@@ -1530,7 +1530,7 @@ std::vector<std::size_t> hose_trains(std::vector<TMoverParameters *> const &Vehi
|
||||
// its vehicles one after another, as the step of the vehicles does. the air of a train stays in it, so a train comes out
|
||||
// the same whichever other vehicles are exchanged in the same call: all of them, or the ones of a group of
|
||||
// vehicle_table::update_steps_parallel()
|
||||
void exchange_through_hoses(std::vector<TMoverParameters *> const &Vehicles, train_pipe const &Pipe, double const dt)
|
||||
void exchange_through_hoses(std::vector<physics::Vehicle *> const &Vehicles, train_pipe const &Pipe, double const dt)
|
||||
{
|
||||
auto const trains{hose_trains(Vehicles, Pipe)};
|
||||
std::vector<int> substeps;
|
||||
@@ -1581,7 +1581,7 @@ void exchange_through_hoses(std::vector<TMoverParameters *> const &Vehicles, tra
|
||||
// pipes overshoot each other in turns and the distributors see the pressure up to 0.28 bar off what's in the pipe
|
||||
// (eu07/maszyna#368)
|
||||
// *************************************************************************************************
|
||||
int TMoverParameters::PipeCouplersSubsteps(double const dt) const
|
||||
int physics::Vehicle::PipeCouplersSubsteps(double const dt) const
|
||||
{
|
||||
return hose_substeps(*this, brake_pipe, dt);
|
||||
}
|
||||
@@ -1592,7 +1592,7 @@ int TMoverParameters::PipeCouplersSubsteps(double const dt) const
|
||||
// the vehicles' own main reservoirs feeding the pipe in the same step, the pipes of the middle vehicles of a
|
||||
// multiple unit or of locomotives in multiple traction kept jumping 0.8 bar to and fro between the steps
|
||||
// *************************************************************************************************
|
||||
int TMoverParameters::ScndPipeCouplersSubsteps(double const dt) const
|
||||
int physics::Vehicle::ScndPipeCouplersSubsteps(double const dt) const
|
||||
{
|
||||
return hose_substeps(*this, main_reservoir_pipe, dt);
|
||||
}
|
||||
@@ -1601,13 +1601,13 @@ int TMoverParameters::ScndPipeCouplersSubsteps(double const dt) const
|
||||
// the air exchange through the brake and the main reservoir hoses of the vehicles which stepped their pipes
|
||||
// (UpdatePipePressure(), UpdateScndPipePressure()) since the last call, each pipe in its own sub-steps
|
||||
// *************************************************************************************************
|
||||
void TMoverParameters::UpdatePipeCouplers(std::vector<TMoverParameters *> const &Vehicles, double const dt)
|
||||
void physics::Vehicle::UpdatePipeCouplers(std::vector<physics::Vehicle *> const &Vehicles, double const dt)
|
||||
{
|
||||
exchange_through_hoses(Vehicles, brake_pipe, dt);
|
||||
exchange_through_hoses(Vehicles, main_reservoir_pipe, dt);
|
||||
}
|
||||
|
||||
bool TMoverParameters::UpdateStopBrakeRelease(double const Demand, double const Dt)
|
||||
bool physics::Vehicle::UpdateStopBrakeRelease(double const Demand, double const Dt)
|
||||
{
|
||||
if (Demand <= 0.0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user