18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-02 14:16:48 +01:00

refactor(physics): the brake valves, cylinders, pressures and positions in physics::Braking

The rest of the braking of physics::Vehicle moves into brakes, with English
names (physics/components/braking.h):

  the valves      Hamulec distributor, Handle driverValve,
                  LocHandle independentValve
  the definition  BrakeSystem kind, BrakeSubsystem subsystem, BrakeValve /
                  BrakeValveSize / BrakeValveParams distributorType / Size /
                  Parameters, BrakeHandle / BrakeLocHandle driverValveType /
                  independentValveType, the Handle_* driverValveSettings,
                  LocalBrake localKind, MaxBrakePress maxCylinderPressure,
                  LoadFlag loadSetting, P2FTrans pressureToForce, NBpA
                  blocksPerAxle, High/Low/DeltaPipePress pipeHigh/LowPressure
                  / pipePressureRange, CntrlPipePress controlReservoirPressure,
                  Spg pipeSection, RapidMult / RapidVel rapidRatio / rapidSpeed,
                  BrakeDelay delays, BrakeCtrlPosNo handlePositions, ...
  cylinders       BrakeCylNo / Radius / Dist / Mult / Spring, BrakeSlckAdj,
                  BrakeRigEff: count, radius, stroke, leverRatio, springForce,
                  slackAdjusterForce, riggingEfficiency
  emergencyValve  EmergencyValveOn / Off / Open / Area / Flow
  pipeLock        LockPipeOn / Off, HandleUnlock, LockPipe, UnlockPipe
  the state       BrakePress cylinderPressure, LocBrakePress
                  independentCylinderPressure, EqvtPipePress
                  equivalentPipePressure, Volume reservoirAir, dpBrake / dpPipe /
                  dpMainValve / dpLocalValve brakeFlow / pipeFlow /
                  driverValveFlow / independentValveFlow, BrakeCtrlPos(R, 2)
                  handlePosition(Real), handleCapPosition, fBrakeCtrlPos
                  handlePositionSmooth, LocalBrakePosA(EIM) independentPosition
                  (Eim), BrakeStatus status, AlarmChainFlag alarmChain,
                  BrakeDelayFlag / BrakeDelays delaySetting / availableDelays,
                  BrakeOpModeFlag / BrakeOpModes operatingMode /
                  availableOperatingModes, UnitBrakeForce unitForce, ...

Renamed in the files of the vehicle itself, and elsewhere only where reached
through -> or .: the driver keeps its own BrakeSystem, the editor its Handle,
the radio its Volume, and the brake valve classes (brakes.*, oerlikonest.*)
their fields of the same names. The C arrays (MaxBrakePress, BrakeCylMult,
the universal buttons) are std::arrays of the same values; the bits of status,
delaySetting and operatingMode stay ints for now.

No change in behaviour: 1149/1149 tests, golden traces exact against staging
62f7a29b.
This commit is contained in:
2026-11-29 01:48:33 +01:00
parent 309926bb05
commit 16568d5695
82 changed files with 1363 additions and 1332 deletions
+15 -15
View File
@@ -490,7 +490,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this]( float const /*Parameter*/ ) {
return occupied->LocalBrake != TLocalBrake::ManualBrake || occupied->MBrake == false || occupied->ManualBrakePos == ManualBrakePosNo; } );
return occupied->brakes.localKind != TLocalBrake::ManualBrake || occupied->brakes.hasHandBrake == false || occupied->brakes.handBrakePosition == ManualBrakePosNo; } );
break;
}
case driver_hint::manualbrakoff: {
@@ -501,7 +501,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this]( float const /*Parameter*/ ) {
return occupied->LocalBrake != TLocalBrake::ManualBrake || occupied->MBrake == false || occupied->ManualBrakePos == 0; } );
return occupied->brakes.localKind != TLocalBrake::ManualBrake || occupied->brakes.hasHandBrake == false || occupied->brakes.handBrakePosition == 0; } );
break;
}
// master controller
@@ -796,8 +796,8 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
// driver_hint_brakingforcesetzero
// driver_hint_brakingforcelap
case driver_hint::trainbrakesetpipeunlock: {
if (AIControllFlag && occupied->HandleUnlock != -3) {
while( BrakeCtrlPosition >= occupied->HandleUnlock
if (AIControllFlag && occupied->brakes.pipeLock.unlockHandlePosition != -3) {
while( BrakeCtrlPosition >= occupied->brakes.pipeLock.unlockHandlePosition
&& BrakeLevelAdd(-1) ) {
// all work is done in the header
}
@@ -806,7 +806,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this](float const /*Parameter*/) {
return occupied->HandleUnlock == -3 || BrakeCtrlPosition == occupied->HandleUnlock; } );
return occupied->brakes.pipeLock.unlockHandlePosition == -3 || BrakeCtrlPosition == occupied->brakes.pipeLock.unlockHandlePosition; } );
break;
}
case driver_hint::trainbrakerelease: {
@@ -818,7 +818,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this](float const /*Parameter*/) {
return is_equal(occupied->fBrakeCtrlPos, occupied->Handle->GetPos(bh_RP), 0.2) || (occupied->Handle->Time && occupied->Handle->GetCP() > occupied->HighPipePress - 0.05); } );
return is_equal(occupied->brakes.handlePositionSmooth, occupied->brakes.driverValve->GetPos(bh_RP), 0.2) || (occupied->brakes.driverValve->Time && occupied->brakes.driverValve->GetCP() > occupied->brakes.pipeHighPressure - 0.05); } );
// return ( BrakeCtrlPosition == gbh_RP ); } );
break;
}
@@ -826,7 +826,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
if( AIControllFlag ) {
// za radą yB ustawiamy pozycję 3 kranu (ruszanie kranem w innych miejscach powino zostać wyłączone)
if( BrakeSystem == TBrakeSystem::ElectroPneumatic && false == ForcePNBrake ) {
occupied->BrakeLevelSet( occupied->Handle->GetPos( bh_EPB ) );
occupied->BrakeLevelSet( occupied->brakes.driverValve->GetPos( bh_EPB ) );
}
else {
BrakeCtrlPosition = 3;
@@ -867,7 +867,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this](float const Parameter) {
return std::abs(mvControlling->Fb) > Parameter || is_equal(occupied->fBrakeCtrlPos, occupied->Handle->GetPos(bh_EB), 0.2); },
return std::abs(mvControlling->Fb) > Parameter || is_equal(occupied->brakes.handlePositionSmooth, occupied->brakes.driverValve->GetPos(bh_EB), 0.2); },
static_cast<float>(std::max(
0.0,
std::max(
@@ -885,7 +885,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this](float const /*Parameter*/) {
return Ready && fReady < 0.4 && is_equal(occupied->fBrakeCtrlPos, occupied->Handle->GetPos(bh_RP), 0.2); } );
return Ready && fReady < 0.4 && is_equal(occupied->brakes.handlePositionSmooth, occupied->brakes.driverValve->GetPos(bh_RP), 0.2); } );
break;
}
case driver_hint::brakingforcelap: {
@@ -899,7 +899,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
}
// independent brake
case driver_hint::independentbrakeapply: {
if (AIControllFlag && occupied->LocalBrakePosA < 1.0) {
if (AIControllFlag && occupied->brakes.independentPosition < 1.0) {
occupied->IncLocalBrakeLevel( LocalBrakePosNo );
if (occupied->EIMCtrlEmergency) {
occupied->DecLocalBrakeLevel(1);
@@ -909,7 +909,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this](float const Parameter) {
return occupied->LocalBrakePosA >= Parameter; },
return occupied->brakes.independentPosition >= Parameter; },
( LocalBrakePosNo - ( occupied->EIMCtrlEmergency ? 1 : 0 ) ) / LocalBrakePosNo );
break;
}
@@ -921,7 +921,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this](float const /*Parameter*/) {
return occupied->LocalBrakePosA < 0.05; } );
return occupied->brakes.independentPosition < 0.05; } );
break;
}
// reverser
@@ -1001,7 +1001,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this](float const /*Parameter*/) {
return mvControlling->ASBType != 1 || (mvControlling->Hamulec->GetBrakeStatus() & b_asb) != 0 || mvControlling->SlippingWheels == false; } );
return mvControlling->brakes.antiSlipType != 1 || (mvControlling->brakes.distributor->GetBrakeStatus() & b_asb) != 0 || mvControlling->SlippingWheels == false; } );
break;
}
// horns
@@ -1358,7 +1358,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this](float const /*Parameter*/) {
return true == occupied->Hamulec->Releaser(); } );
return true == occupied->brakes.distributor->Releaser(); } );
break;
}
case driver_hint::releaseroff: {
@@ -1369,7 +1369,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
hint(
Action,
[this](float const /*Parameter*/) {
return false == occupied->Hamulec->Releaser(); } );
return false == occupied->brakes.distributor->Releaser(); } );
break;
}