mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 07:22:42 +01:00
refactor(physics): the definition of the brakes apart from their state
What the .fiz gives about the brakes of a vehicle (the kinds of the brake
system, the valves and the handles, the cylinders and the rigging, the pipe
pressures, the delays and the modes it can be set to: 35 fields) moves into
physics::Braking::Config, held as brakes.config, set as the vehicle loads and
not changed after. Six fields that sat with the definition but change in the
run (the weighted pressures of the handle position, the universal buttons
pressed, the load setting, the control reservoir, the emergency valve, the
lock of the pipe) go with the state.
No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
This commit is contained in:
@@ -490,7 +490,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this]( float const /*Parameter*/ ) {
|
||||
return occupied->brakes.localKind != TLocalBrake::ManualBrake || occupied->brakes.hasHandBrake == false || occupied->brakes.handBrakePosition == ManualBrakePosNo; } );
|
||||
return occupied->brakes.config.localKind != TLocalBrake::ManualBrake || occupied->brakes.config.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->brakes.localKind != TLocalBrake::ManualBrake || occupied->brakes.hasHandBrake == false || occupied->brakes.handBrakePosition == 0; } );
|
||||
return occupied->brakes.config.localKind != TLocalBrake::ManualBrake || occupied->brakes.config.hasHandBrake == false || occupied->brakes.handBrakePosition == 0; } );
|
||||
break;
|
||||
}
|
||||
// master controller
|
||||
@@ -818,7 +818,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
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 is_equal(occupied->brakes.handlePositionSmooth, occupied->brakes.driverValve->GetPos(bh_RP), 0.2) || (occupied->brakes.driverValve->Time && occupied->brakes.driverValve->GetCP() > occupied->brakes.config.pipeHighPressure - 0.05); } );
|
||||
// return ( BrakeCtrlPosition == gbh_RP ); } );
|
||||
break;
|
||||
}
|
||||
@@ -1001,7 +1001,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return mvControlling->brakes.antiSlipType != 1 || (mvControlling->brakes.distributor->GetBrakeStatus() & b_asb) != 0 || mvControlling->SlippingWheels == false; } );
|
||||
return mvControlling->brakes.config.antiSlipType != 1 || (mvControlling->brakes.distributor->GetBrakeStatus() & b_asb) != 0 || mvControlling->SlippingWheels == false; } );
|
||||
break;
|
||||
}
|
||||
// horns
|
||||
|
||||
+36
-36
@@ -101,17 +101,17 @@ physics::Vehicle::Vehicle(double VelInitial, std::string const &TypeNameInit, st
|
||||
|
||||
for (int b = -1; b <= MainBrakeMaxPos; ++b)
|
||||
{
|
||||
brakes.pressureTable[b].PipePressureVal = 0.0;
|
||||
brakes.pressureTable[b].BrakePressureVal = 0.0;
|
||||
brakes.pressureTable[b].FlowSpeedVal = 0.0;
|
||||
brakes.config.pressureTable[b].PipePressureVal = 0.0;
|
||||
brakes.config.pressureTable[b].BrakePressureVal = 0.0;
|
||||
brakes.config.pressureTable[b].FlowSpeedVal = 0.0;
|
||||
}
|
||||
// with BrakePressureTable[-2] do {pozycja odciecia}
|
||||
{
|
||||
brakes.pressureTable[-2].PipePressureVal = -1.0;
|
||||
brakes.pressureTable[-2].BrakePressureVal = -1.0;
|
||||
brakes.pressureTable[-2].FlowSpeedVal = 0.0;
|
||||
brakes.config.pressureTable[-2].PipePressureVal = -1.0;
|
||||
brakes.config.pressureTable[-2].BrakePressureVal = -1.0;
|
||||
brakes.config.pressureTable[-2].FlowSpeedVal = 0.0;
|
||||
}
|
||||
for (auto &delay : brakes.delays)
|
||||
for (auto &delay : brakes.config.delays)
|
||||
{
|
||||
delay = 0.0;
|
||||
}
|
||||
@@ -126,7 +126,7 @@ physics::Vehicle::Vehicle(double VelInitial, std::string const &TypeNameInit, st
|
||||
Couplers[b].DmaxC = 0.1;
|
||||
Couplers[b].FmaxC = 1000.0;
|
||||
}
|
||||
for (auto &cylindermult : brakes.cylinders.leverRatio)
|
||||
for (auto &cylindermult : brakes.config.cylinders.leverRatio)
|
||||
{
|
||||
cylindermult = 0.0;
|
||||
}
|
||||
@@ -143,7 +143,7 @@ physics::Vehicle::Vehicle(double VelInitial, std::string const &TypeNameInit, st
|
||||
couplerentry.CheckCollision = false;
|
||||
}
|
||||
|
||||
for (auto &brakepress : brakes.maxCylinderPressure)
|
||||
for (auto &brakepress : brakes.config.maxCylinderPressure)
|
||||
{
|
||||
brakepress = 0.0;
|
||||
}
|
||||
@@ -504,7 +504,7 @@ void physics::Vehicle::compute_movement_(double const Deltatime)
|
||||
brakes.electrodynamic.emuWorking &= Couplers[VehicleEnd::rear].Connected->brakes.electrodynamic.emuWorking;
|
||||
}
|
||||
|
||||
if (brakes.antiSlipTimer > 0.8 && brakes.antiSlipType != 128)
|
||||
if (brakes.antiSlipTimer > 0.8 && brakes.config.antiSlipType != 128)
|
||||
{ // ASBSpeed=0.8
|
||||
// hamulec antypoślizgowy - wyłączanie
|
||||
brakes.distributor->ASB(0);
|
||||
@@ -834,11 +834,11 @@ void physics::Vehicle::ComputeTotalForce(double dt)
|
||||
double old_nrot = abs(nrot);
|
||||
nrot = v2n(); // przeliczenie prędkości liniowej na obrotową
|
||||
|
||||
if (true == TestFlag(brakes.method, bp_MHS) && brakePipe.Pressure() < 3.0 // ustawione na sztywno na 3 bar
|
||||
if (true == TestFlag(brakes.config.method, bp_MHS) && brakePipe.Pressure() < 3.0 // ustawione na sztywno na 3 bar
|
||||
&& Vel > 45 && true == TestFlag(brakes.delaySetting, bdelay_M))
|
||||
{
|
||||
// doliczenie hamowania hamulcem szynowym
|
||||
FStand += brakes.trackBrakeForce;
|
||||
FStand += brakes.config.trackBrakeForce;
|
||||
}
|
||||
// w charakterystykach jest wartość siły hamowania zamiast nacisku
|
||||
|
||||
@@ -942,22 +942,22 @@ double physics::Vehicle::BrakeForceR(double ratio, double velocity) const
|
||||
{
|
||||
double press = 0;
|
||||
ratio = brakes.distributor->GetBrakeRatio(ratio);
|
||||
if (brakes.maxPressureMass > 2)
|
||||
if (brakes.config.maxPressureMass > 2)
|
||||
{
|
||||
press = brakes.maxCylinderPressure[1] + (brakes.maxCylinderPressure[3] - brakes.maxCylinderPressure[1]) * std::min(1.0, (TotalMass - Mass) / (brakes.maxPressureMass - Mass));
|
||||
press = brakes.config.maxCylinderPressure[1] + (brakes.config.maxCylinderPressure[3] - brakes.config.maxCylinderPressure[1]) * std::min(1.0, (TotalMass - Mass) / (brakes.config.maxPressureMass - Mass));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (brakes.maxCylinderPressure[1] > 0.1)
|
||||
if (brakes.config.maxCylinderPressure[1] > 0.1)
|
||||
{
|
||||
press = brakes.maxCylinderPressure[brakes.loadSetting];
|
||||
press = brakes.config.maxCylinderPressure[brakes.loadSetting];
|
||||
}
|
||||
else
|
||||
{
|
||||
press = brakes.maxCylinderPressure[3];
|
||||
press = brakes.config.maxCylinderPressure[3];
|
||||
if (brakes.electrodynamic.type == dbrake_automatic)
|
||||
ratio = ratio + (1.5 - ratio) * std::min(1.0, Vel * 0.02);
|
||||
if (brakes.delaySetting & bdelay_R && brakes.method % 128 != bp_Cosid && brakes.method % 128 != bp_D1 && brakes.method % 128 != bp_D2 && Power < 1)
|
||||
if (brakes.delaySetting & bdelay_R && brakes.config.method % 128 != bp_Cosid && brakes.config.method % 128 != bp_D1 && brakes.config.method % 128 != bp_D2 && Power < 1)
|
||||
ratio *= brakes.distributor->GetRapidRatio(velocity);
|
||||
if (TrainType == train_type::dmu && velocity < 30.0)
|
||||
{
|
||||
@@ -971,9 +971,9 @@ double physics::Vehicle::BrakeForceR(double ratio, double velocity) const
|
||||
double physics::Vehicle::BrakeForceP(double press, double velocity) const
|
||||
{
|
||||
double BFP = 0;
|
||||
double K = ((press * brakes.pressureToForce - brakes.cylinders.springForce) * brakes.cylinders.leverRatio[0] - brakes.cylinders.slackAdjusterForce) * brakes.cylinders.riggingEfficiency;
|
||||
K *= static_cast<double>(brakes.cylinders.count) / (NAxles * std::max(1, brakes.blocksPerAxle));
|
||||
BFP = brakes.distributor->GetFC(velocity, K) * K * (NAxles * std::max(1, brakes.blocksPerAxle)) * 1000;
|
||||
double K = ((press * brakes.config.pressureToForce - brakes.config.cylinders.springForce) * brakes.config.cylinders.leverRatio[0] - brakes.config.cylinders.slackAdjusterForce) * brakes.config.cylinders.riggingEfficiency;
|
||||
K *= static_cast<double>(brakes.config.cylinders.count) / (NAxles * std::max(1, brakes.config.blocksPerAxle));
|
||||
BFP = brakes.distributor->GetFC(velocity, K) * K * (NAxles * std::max(1, brakes.config.blocksPerAxle)) * 1000;
|
||||
return BFP;
|
||||
}
|
||||
|
||||
@@ -987,16 +987,16 @@ double physics::Vehicle::BrakeForce(TTrackParam const & /*Track*/)
|
||||
double K{0};
|
||||
double brakeforce{0};
|
||||
|
||||
switch (brakes.localKind)
|
||||
switch (brakes.config.localKind)
|
||||
{
|
||||
case TLocalBrake::ManualBrake:
|
||||
{
|
||||
K = brakes.maxForce * ManualBrakeRatio();
|
||||
K = brakes.config.maxForce * ManualBrakeRatio();
|
||||
break;
|
||||
}
|
||||
case TLocalBrake::HydraulicBrake:
|
||||
{
|
||||
K = brakes.maxForce * LocalBrakeRatio();
|
||||
K = brakes.config.maxForce * LocalBrakeRatio();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -1005,34 +1005,34 @@ double physics::Vehicle::BrakeForce(TTrackParam const & /*Track*/)
|
||||
}
|
||||
}
|
||||
|
||||
if (brakes.hasHandBrake == true)
|
||||
if (brakes.config.hasHandBrake == true)
|
||||
{
|
||||
K = brakes.maxForce * ManualBrakeRatio();
|
||||
K = brakes.config.maxForce * ManualBrakeRatio();
|
||||
}
|
||||
|
||||
// the spring brake of a vehicle prepared for hauling (PulleeMode) is released by hand: no force, whatever its cylinder has
|
||||
if (brakes.spring.isReady && false == PulleeMode)
|
||||
K += std::max(0.0, brakes.spring.minForcePressure - brakes.spring.cylinder->P()) * brakes.spring.maxForce;
|
||||
|
||||
u = (brakes.cylinderPressure * brakes.pressureToForce - brakes.cylinders.springForce) * brakes.cylinders.leverRatio[0] - brakes.cylinders.slackAdjusterForce;
|
||||
if (u * brakes.cylinders.riggingEfficiency > Ntotal) // histereza na nacisku klockow
|
||||
Ntotal = u * brakes.cylinders.riggingEfficiency;
|
||||
u = (brakes.cylinderPressure * brakes.config.pressureToForce - brakes.config.cylinders.springForce) * brakes.config.cylinders.leverRatio[0] - brakes.config.cylinders.slackAdjusterForce;
|
||||
if (u * brakes.config.cylinders.riggingEfficiency > Ntotal) // histereza na nacisku klockow
|
||||
Ntotal = u * brakes.config.cylinders.riggingEfficiency;
|
||||
else
|
||||
{
|
||||
u = (brakes.cylinderPressure * brakes.pressureToForce - brakes.cylinders.springForce) * brakes.cylinders.leverRatio[0] - brakes.cylinders.slackAdjusterForce;
|
||||
if (u * (2.0 - brakes.cylinders.riggingEfficiency) < Ntotal) // histereza na nacisku klockow
|
||||
Ntotal = u * (2.0 - brakes.cylinders.riggingEfficiency);
|
||||
u = (brakes.cylinderPressure * brakes.config.pressureToForce - brakes.config.cylinders.springForce) * brakes.config.cylinders.leverRatio[0] - brakes.config.cylinders.slackAdjusterForce;
|
||||
if (u * (2.0 - brakes.config.cylinders.riggingEfficiency) < Ntotal) // histereza na nacisku klockow
|
||||
Ntotal = u * (2.0 - brakes.config.cylinders.riggingEfficiency);
|
||||
}
|
||||
|
||||
auto const NBrakeAxles{NAxles};
|
||||
|
||||
if (NBrakeAxles * brakes.blocksPerAxle > 0)
|
||||
if (NBrakeAxles * brakes.config.blocksPerAxle > 0)
|
||||
{
|
||||
if (Ntotal > 0) // nie luz
|
||||
K += Ntotal; // w kN
|
||||
K *= static_cast<double>(brakes.cylinders.count) / (NBrakeAxles * static_cast<double>(brakes.blocksPerAxle)); // w kN na os
|
||||
K *= static_cast<double>(brakes.config.cylinders.count) / (NBrakeAxles * static_cast<double>(brakes.config.blocksPerAxle)); // w kN na os
|
||||
}
|
||||
if (brakes.kind == TBrakeSystem::Pneumatic || brakes.kind == TBrakeSystem::ElectroPneumatic)
|
||||
if (brakes.config.kind == TBrakeSystem::Pneumatic || brakes.config.kind == TBrakeSystem::ElectroPneumatic)
|
||||
{
|
||||
u = brakes.distributor->GetFC(Vel, K);
|
||||
brakes.unitForce = u * K * 1000.0; // sila na jeden klocek w N
|
||||
@@ -1043,7 +1043,7 @@ double physics::Vehicle::BrakeForce(TTrackParam const & /*Track*/)
|
||||
// Fb:=UnitBrakeForce*NBpA {ham. reczny dziala na jedna os}
|
||||
// else //yB: to nie do konca ma sens, ponieważ ręczny w wagonie działa na jeden cylinder
|
||||
// hamulcowy/wózek, dlatego potrzebne są oddzielnie liczone osie
|
||||
brakeforce = brakes.unitForce * NBrakeAxles * std::max(1, brakes.blocksPerAxle);
|
||||
brakeforce = brakes.unitForce * NBrakeAxles * std::max(1, brakes.config.blocksPerAxle);
|
||||
|
||||
// u:=((BrakePress*P2FTrans)-BrakeCylSpring*BrakeCylMult[BCMFlag]/BrakeCylNo-0.83*BrakeSlckAdj/(BrakeCylNo))*BrakeCylNo;
|
||||
// { end; }
|
||||
|
||||
@@ -164,48 +164,54 @@ struct Braking
|
||||
std::shared_ptr<TDriverHandle> driverValve; // the driver's brake valve of the train brake
|
||||
std::shared_ptr<TDriverHandle> independentValve; // the driver's valve of the independent brake
|
||||
|
||||
// the definition
|
||||
TBrakeSystem kind = TBrakeSystem::Individual; // the kind of the train brake
|
||||
TBrakeSubSystem subsystem = TBrakeSubSystem::ss_None;
|
||||
TBrakeValve distributorType = TBrakeValve::NoValve;
|
||||
int distributorSize = 0;
|
||||
std::string distributorParameters;
|
||||
TBrakeHandle driverValveType = TBrakeHandle::NoHandle;
|
||||
TBrakeHandle independentValveType = TBrakeHandle::NoHandle;
|
||||
bool independentTraxx = false; // the independent brake of the Traxx kind
|
||||
DriverValveSettings driverValveSettings;
|
||||
TLocalBrake localKind = TLocalBrake::NoBrake; // the kind of the individual brake
|
||||
TBrakePressureTable pressureTable; // the pressures in the pipe of the positions of the driver's valve
|
||||
TBrakePressure actualPressure; // their values weighted for the present position of the valve
|
||||
int antiSlipType = 0; // 0: no anti-slip brake, 1: by hand, 2: automatic
|
||||
std::array<int, 3> universalButtonActions{}; // what the universal brake buttons do
|
||||
std::array<bool, 3> universalButtonPressed{}; // the universal brake buttons pressed
|
||||
double maxForce = 0.0; // the most force of the brake
|
||||
std::array<double, 5> maxCylinderPressure{}; // by the load setting: auxiliary, empty, medium, loaded, anti-slip
|
||||
int loadSetting = 0; // the index of maxCylinderPressure the brake takes
|
||||
double pressureToForce = 0.0; // P2FTrans
|
||||
double trackBrakeForce = 0.0; // the force of the track brake
|
||||
int method = 0; // the friction material and its flags (bp_*)
|
||||
int blocksPerAxle = 0; // NBpA: 0, 1, 2 or 4
|
||||
double maxPressureMass = 1.0; // MBPM: the mass of the highest pressure
|
||||
double pipeHighPressure = 0.0; // the highest working pressure of the brake pipe
|
||||
double pipeLowPressure = 0.0; // the lowest one
|
||||
double pipePressureRange = 0.0; // the difference between them
|
||||
double controlReservoirPressure = 0.0; // the pressure in the control reservoir
|
||||
double cylinderVolume = 0.0; // the volume of the brake cylinders
|
||||
double valveVolume = 0.0; // BVV
|
||||
BrakeCylinders cylinders;
|
||||
double rapidRatio = 1.0; // the ratio of the rapid brake
|
||||
double rapidSpeed = 55.0; // the speed the rapid brake switches at
|
||||
double pipeSection = 0.0; // Spg: the cross-section of the brake pipe
|
||||
EmergencyValve emergencyValve;
|
||||
PipeLock pipeLock;
|
||||
bool emergencyCutsOffDriverValve = false; // EmergencyCutsOffHandle
|
||||
TBrakeDelayTable delays; // the delays of applying and releasing
|
||||
int handlePositions = 0; // the positions of the driver's valve
|
||||
bool hasHandBrake = false;
|
||||
// the definition, what the .fiz gives: set as the vehicle loads, not changed after
|
||||
struct Config
|
||||
{
|
||||
TBrakeSystem kind = TBrakeSystem::Individual; // the kind of the train brake
|
||||
TBrakeSubSystem subsystem = TBrakeSubSystem::ss_None;
|
||||
TBrakeValve distributorType = TBrakeValve::NoValve;
|
||||
int distributorSize = 0;
|
||||
std::string distributorParameters;
|
||||
TBrakeHandle driverValveType = TBrakeHandle::NoHandle;
|
||||
TBrakeHandle independentValveType = TBrakeHandle::NoHandle;
|
||||
bool independentTraxx = false; // the independent brake of the Traxx kind
|
||||
DriverValveSettings driverValveSettings;
|
||||
TLocalBrake localKind = TLocalBrake::NoBrake; // the kind of the individual brake
|
||||
TBrakePressureTable pressureTable; // the pressures in the pipe of the positions of the driver's valve
|
||||
int antiSlipType = 0; // 0: no anti-slip brake, 1: by hand, 2: automatic
|
||||
std::array<int, 3> universalButtonActions{}; // what the universal brake buttons do
|
||||
double maxForce = 0.0; // the most force of the brake
|
||||
std::array<double, 5> maxCylinderPressure{}; // by the load setting: auxiliary, empty, medium, loaded, anti-slip
|
||||
double pressureToForce = 0.0; // P2FTrans
|
||||
double trackBrakeForce = 0.0; // the force of the track brake
|
||||
int method = 0; // the friction material and its flags (bp_*)
|
||||
int blocksPerAxle = 0; // NBpA: 0, 1, 2 or 4
|
||||
double maxPressureMass = 1.0; // MBPM: the mass of the highest pressure
|
||||
double pipeHighPressure = 0.0; // the highest working pressure of the brake pipe
|
||||
double pipeLowPressure = 0.0; // the lowest one
|
||||
double pipePressureRange = 0.0; // the difference between them
|
||||
double cylinderVolume = 0.0; // the volume of the brake cylinders
|
||||
double valveVolume = 0.0; // BVV
|
||||
BrakeCylinders cylinders;
|
||||
double rapidRatio = 1.0; // the ratio of the rapid brake
|
||||
double rapidSpeed = 55.0; // the speed the rapid brake switches at
|
||||
double pipeSection = 0.0; // Spg: the cross-section of the brake pipe
|
||||
bool emergencyCutsOffDriverValve = false; // EmergencyCutsOffHandle
|
||||
TBrakeDelayTable delays; // the delays of applying and releasing
|
||||
int handlePositions = 0; // the positions of the driver's valve
|
||||
bool hasHandBrake = false;
|
||||
int availableDelays = 0; // the delays it can be set to
|
||||
int availableOperatingModes = 0;
|
||||
};
|
||||
Config config;
|
||||
|
||||
// the state
|
||||
TBrakePressure actualPressure; // their values weighted for the present position of the valve
|
||||
std::array<bool, 3> universalButtonPressed{}; // the universal brake buttons pressed
|
||||
int loadSetting = 0; // the index of maxCylinderPressure the brake takes
|
||||
double controlReservoirPressure = 0.0; // the pressure in the control reservoir
|
||||
EmergencyValve emergencyValve;
|
||||
PipeLock pipeLock;
|
||||
double cylinderPressure = 0.0; // the pressure in the brake cylinders
|
||||
double cylinderPressureRate = 0.0; // how fast it changes, averaged over about a second [bar/s], see accelerating()
|
||||
double independentCylinderPressure = 0.0; // the pressure in the cylinders from the independent brake
|
||||
@@ -227,12 +233,10 @@ struct Braking
|
||||
int status = 0; // the bits b_* (b_off 0, b_on, b_dmg, b_rls, b_asb, b_ep ...)
|
||||
bool alarmChain = false; // the manual emergency brake
|
||||
int delaySetting = 0; // the delay set (bdelay_*)
|
||||
int availableDelays = 0; // the delays it can be set to
|
||||
// the AI wagon inspector cut the brake out (b_dmg) and puts it back when the train no longer needs it cut out
|
||||
// (brake_setting::apply). Anyone else cutting it out or putting it back takes it over
|
||||
bool cutOutByInspector = false;
|
||||
int operatingMode = 0; // the mode set (bom_*: PS/PN/EP/MED 1/2/4/8)
|
||||
int availableOperatingModes = 0;
|
||||
double unitForce = 0.0; // the braking force of one braked element
|
||||
double antiSlipTimer = 0.0; // to switch the anti-slip brake off
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ bool physics::Vehicle::ChangeCab(int direction)
|
||||
if (std::abs(CabOccupied + direction) < 2)
|
||||
{
|
||||
CabOccupied = CabOccupied + direction;
|
||||
if (brakes.handlePositions > 0 && (brakes.kind == TBrakeSystem::Pneumatic || brakes.kind == TBrakeSystem::ElectroPneumatic))
|
||||
if (brakes.config.handlePositions > 0 && (brakes.config.kind == TBrakeSystem::Pneumatic || brakes.config.kind == TBrakeSystem::ElectroPneumatic))
|
||||
{
|
||||
BrakeLevelSet(brakes.driverValve->GetPos(bh_NP));
|
||||
brakes.pipeLimiterPressure = brakePipe.Pressure();
|
||||
|
||||
@@ -285,7 +285,7 @@ bool physics::Vehicle::RunBrakeCommand(VehicleCommand const Command, double CVal
|
||||
if (CValue1 < 0.001)
|
||||
brakes.electrodynamic.emuWorking = true;
|
||||
// fBrakeCtrlPos:=BrakeCtrlPos; //to powinnno być w jednym miejscu, aktualnie w C++!!!
|
||||
brakes.actualPressure = brakes.pressureTable[brakes.handlePosition];
|
||||
brakes.actualPressure = brakes.config.pressureTable[brakes.handlePosition];
|
||||
OK = SendCtrlToNext(Command, CValue1, CValue2, Couplertype);
|
||||
} // youby - odluzniacz hamulcow, przyda sie
|
||||
else if (Command == VehicleCommand::brakeReleaser)
|
||||
|
||||
@@ -1025,7 +1025,7 @@ void physics::Vehicle::CheckEIMIC(double dt)
|
||||
EIMICFromUniversalController(dt, brakeDemand);
|
||||
break;
|
||||
}
|
||||
if (brakes.independentTraxx)
|
||||
if (brakes.config.independentTraxx)
|
||||
{
|
||||
EIMICTraxxLocalBrake(dt);
|
||||
}
|
||||
@@ -1041,7 +1041,7 @@ void physics::Vehicle::EIMICFromController(double const brakeDemand, double cons
|
||||
{
|
||||
if (eimic > 0.001)
|
||||
eimic = std::max(0.002, eimic * (double)MainCtrlPosNo / ((double)MainCtrlPosNo - offset) - offset / ((double)MainCtrlPosNo - offset));
|
||||
if (eimic < -0.001 && brakes.driverValveType != TBrakeHandle::MHZ_EN57)
|
||||
if (eimic < -0.001 && brakes.config.driverValveType != TBrakeHandle::MHZ_EN57)
|
||||
eimic = std::min(-0.002, eimic * (double)LocalBrakePosNo / ((double)LocalBrakePosNo - multiplier) + offset / ((double)LocalBrakePosNo - multiplier));
|
||||
}
|
||||
if (eimic > 0.001 && SpeedCtrlUnit.IsActive)
|
||||
@@ -1197,11 +1197,11 @@ void physics::Vehicle::EIMICTraxxLocalBrake(double dt)
|
||||
if (LocalBrakeRatio() > 0.6) // pozycja 2, zahamowywanie
|
||||
{
|
||||
eim_localbrake += dt * 0.17;
|
||||
eim_localbrake = std::max(eim_localbrake, brakes.cylinderPressure / brakes.maxCylinderPressure[0]);
|
||||
eim_localbrake = std::max(eim_localbrake, brakes.cylinderPressure / brakes.config.maxCylinderPressure[0]);
|
||||
}
|
||||
else // pozycja 1, utrzymanie cisnienia
|
||||
{
|
||||
if (eim_localbrake < brakes.distributor->GetEDBCP() / brakes.maxCylinderPressure[0])
|
||||
if (eim_localbrake < brakes.distributor->GetEDBCP() / brakes.config.maxCylinderPressure[0])
|
||||
eim_localbrake = 0;
|
||||
}
|
||||
eim_localbrake = std::clamp(eim_localbrake, 0.0, 1.0);
|
||||
@@ -1253,7 +1253,7 @@ void physics::Vehicle::CheckSpeedCtrl(double dt)
|
||||
{
|
||||
SpeedCtrlUnit.Standby = false;
|
||||
}
|
||||
if (!SpeedCtrlUnit.BrakeIntervention && (brakes.distributor->GetEDBCP() > 0.4 || brakePipe.Pressure() < brakes.pipeHighPressure - 0.2))
|
||||
if (!SpeedCtrlUnit.BrakeIntervention && (brakes.distributor->GetEDBCP() > 0.4 || brakePipe.Pressure() < brakes.config.pipeHighPressure - 0.2))
|
||||
SpeedCtrlUnit.Standby = true;
|
||||
if (EIMCtrlType >= 3 && UniCtrlList[MainCtrlPos].SpeedUp <= 0)
|
||||
{
|
||||
|
||||
@@ -231,18 +231,18 @@ bool physics::Vehicle::readBPT(std::string const &line)
|
||||
std::string braketype;
|
||||
int idx = 0;
|
||||
parser >> idx;
|
||||
parser >> brakes.pressureTable[idx].PipePressureVal >> brakes.pressureTable[idx].BrakePressureVal >> brakes.pressureTable[idx].FlowSpeedVal >> braketype;
|
||||
parser >> brakes.config.pressureTable[idx].PipePressureVal >> brakes.config.pressureTable[idx].BrakePressureVal >> brakes.config.pressureTable[idx].FlowSpeedVal >> braketype;
|
||||
if (braketype == "Pneumatic")
|
||||
{
|
||||
brakes.pressureTable[idx].BrakeType = TBrakeSystem::Pneumatic;
|
||||
brakes.config.pressureTable[idx].BrakeType = TBrakeSystem::Pneumatic;
|
||||
}
|
||||
else if (braketype == "ElectroPneumatic")
|
||||
{
|
||||
brakes.pressureTable[idx].BrakeType = TBrakeSystem::ElectroPneumatic;
|
||||
brakes.config.pressureTable[idx].BrakeType = TBrakeSystem::ElectroPneumatic;
|
||||
}
|
||||
else
|
||||
{
|
||||
brakes.pressureTable[idx].BrakeType = TBrakeSystem::Individual;
|
||||
brakes.config.pressureTable[idx].BrakeType = TBrakeSystem::Individual;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -587,12 +587,12 @@ void physics::Vehicle::BrakeValveDecode(std::string const &Valve)
|
||||
{"CV1", CV1},
|
||||
{"CV1_R", CV1_R}};
|
||||
auto lookup = valvetypes.find(Valve);
|
||||
brakes.distributorType = lookup != valvetypes.end() ? lookup->second : Other;
|
||||
brakes.config.distributorType = lookup != valvetypes.end() ? lookup->second : Other;
|
||||
|
||||
if (brakes.distributorType == Other && contains(Valve, "ESt"))
|
||||
if (brakes.config.distributorType == Other && contains(Valve, "ESt"))
|
||||
{
|
||||
|
||||
brakes.distributorType = ESt3;
|
||||
brakes.config.distributorType = ESt3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -602,33 +602,33 @@ void physics::Vehicle::BrakeValveDecode(std::string const &Valve)
|
||||
void physics::Vehicle::BrakeSubsystemDecode()
|
||||
{
|
||||
using enum TBrakeSubSystem;
|
||||
brakes.subsystem = ss_None;
|
||||
switch (brakes.distributorType)
|
||||
brakes.config.subsystem = ss_None;
|
||||
switch (brakes.config.distributorType)
|
||||
{
|
||||
using enum TBrakeValve;
|
||||
case W:
|
||||
case W_Lu_L:
|
||||
case W_Lu_VI:
|
||||
case W_Lu_XR:
|
||||
brakes.subsystem = ss_W;
|
||||
brakes.config.subsystem = ss_W;
|
||||
break;
|
||||
case ESt3:
|
||||
case ESt3AL2:
|
||||
case ESt4:
|
||||
case EP2:
|
||||
case EP1:
|
||||
brakes.subsystem = ss_ESt;
|
||||
brakes.config.subsystem = ss_ESt;
|
||||
break;
|
||||
case KE:
|
||||
brakes.subsystem = ss_KE;
|
||||
brakes.config.subsystem = ss_KE;
|
||||
break;
|
||||
case CV1:
|
||||
case CV1_L_TR:
|
||||
brakes.subsystem = ss_Dako;
|
||||
brakes.config.subsystem = ss_Dako;
|
||||
break;
|
||||
case LSt:
|
||||
case EStED:
|
||||
brakes.subsystem = ss_LSt;
|
||||
brakes.config.subsystem = ss_LSt;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -209,50 +209,50 @@ void physics::Vehicle::LoadFIZ_Wheels(std::string const &line)
|
||||
void physics::Vehicle::LoadFIZ_Brake(std::string const &line)
|
||||
{
|
||||
|
||||
extract_value(brakes.distributorParameters, "BrakeValve", line, "");
|
||||
BrakeValveDecode(brakes.distributorParameters);
|
||||
extract_value(brakes.config.distributorParameters, "BrakeValve", line, "");
|
||||
BrakeValveDecode(brakes.config.distributorParameters);
|
||||
BrakeSubsystemDecode();
|
||||
|
||||
extract_value(brakes.blocksPerAxle, "NBpA", line, "");
|
||||
extract_value(brakes.maxForce, "MBF", line, "");
|
||||
extract_value(brakes.distributorSize, "Size", line, "");
|
||||
extract_value(brakes.trackBrakeForce, "TBF", line, "");
|
||||
brakes.trackBrakeForce *= 1000.0;
|
||||
extract_value(brakes.config.blocksPerAxle, "NBpA", line, "");
|
||||
extract_value(brakes.config.maxForce, "MBF", line, "");
|
||||
extract_value(brakes.config.distributorSize, "Size", line, "");
|
||||
extract_value(brakes.config.trackBrakeForce, "TBF", line, "");
|
||||
brakes.config.trackBrakeForce *= 1000.0;
|
||||
|
||||
extract_value(brakes.maxCylinderPressure[3], "MaxBP", line, "");
|
||||
if (brakes.maxCylinderPressure[3] > 0.0)
|
||||
extract_value(brakes.config.maxCylinderPressure[3], "MaxBP", line, "");
|
||||
if (brakes.config.maxCylinderPressure[3] > 0.0)
|
||||
{
|
||||
|
||||
extract_value(brakes.cylinders.count, "BCN", line, "");
|
||||
if (brakes.cylinders.count > 0)
|
||||
extract_value(brakes.config.cylinders.count, "BCN", line, "");
|
||||
if (brakes.config.cylinders.count > 0)
|
||||
{
|
||||
|
||||
extract_value(brakes.maxCylinderPressure[0], "MaxLBP", line, "");
|
||||
if (brakes.maxCylinderPressure[0] < 0.01)
|
||||
extract_value(brakes.config.maxCylinderPressure[0], "MaxLBP", line, "");
|
||||
if (brakes.config.maxCylinderPressure[0] < 0.01)
|
||||
{
|
||||
brakes.maxCylinderPressure[0] = brakes.maxCylinderPressure[3];
|
||||
brakes.config.maxCylinderPressure[0] = brakes.config.maxCylinderPressure[3];
|
||||
}
|
||||
extract_value(brakes.maxCylinderPressure[1], "TareMaxBP", line, "");
|
||||
extract_value(brakes.maxCylinderPressure[2], "MedMaxBP", line, "");
|
||||
extract_value(brakes.maxCylinderPressure[4], "MaxASBP", line, "");
|
||||
if (brakes.maxCylinderPressure[4] < 0.01)
|
||||
extract_value(brakes.config.maxCylinderPressure[1], "TareMaxBP", line, "");
|
||||
extract_value(brakes.config.maxCylinderPressure[2], "MedMaxBP", line, "");
|
||||
extract_value(brakes.config.maxCylinderPressure[4], "MaxASBP", line, "");
|
||||
if (brakes.config.maxCylinderPressure[4] < 0.01)
|
||||
{
|
||||
brakes.maxCylinderPressure[4] = 0.0;
|
||||
brakes.config.maxCylinderPressure[4] = 0.0;
|
||||
}
|
||||
|
||||
extract_value(brakes.cylinders.radius, "BCR", line, "");
|
||||
extract_value(brakes.cylinders.stroke, "BCD", line, "");
|
||||
extract_value(brakes.cylinders.springForce, "BCS", line, "");
|
||||
extract_value(brakes.cylinders.slackAdjusterForce, "BSA", line, "");
|
||||
extract_value(brakes.cylinders.riggingEfficiency, "BRE", line, "1");
|
||||
extract_value(brakes.config.cylinders.radius, "BCR", line, "");
|
||||
extract_value(brakes.config.cylinders.stroke, "BCD", line, "");
|
||||
extract_value(brakes.config.cylinders.springForce, "BCS", line, "");
|
||||
extract_value(brakes.config.cylinders.slackAdjusterForce, "BSA", line, "");
|
||||
extract_value(brakes.config.cylinders.riggingEfficiency, "BRE", line, "1");
|
||||
|
||||
extract_value(brakes.cylinders.leverRatio[0], "BCM", line, "");
|
||||
extract_value(brakes.cylinders.leverRatio[1], "BCMlo", line, "");
|
||||
extract_value(brakes.cylinders.leverRatio[2], "BCMHi", line, "");
|
||||
extract_value(brakes.config.cylinders.leverRatio[0], "BCM", line, "");
|
||||
extract_value(brakes.config.cylinders.leverRatio[1], "BCMlo", line, "");
|
||||
extract_value(brakes.config.cylinders.leverRatio[2], "BCMHi", line, "");
|
||||
|
||||
brakes.pressureToForce = 100 * M_PI * std::pow(brakes.cylinders.radius, 2); // w kN/bar
|
||||
brakes.config.pressureToForce = 100 * M_PI * std::pow(brakes.config.cylinders.radius, 2); // w kN/bar
|
||||
|
||||
if (brakes.cylinders.leverRatio[1] > 0.0 || brakes.maxCylinderPressure[1] > 0.0)
|
||||
if (brakes.config.cylinders.leverRatio[1] > 0.0 || brakes.config.maxCylinderPressure[1] > 0.0)
|
||||
{
|
||||
brakes.loadSetting = 1;
|
||||
}
|
||||
@@ -261,24 +261,24 @@ void physics::Vehicle::LoadFIZ_Brake(std::string const &line)
|
||||
brakes.loadSetting = 0;
|
||||
}
|
||||
|
||||
brakes.cylinderVolume = M_PI * std::pow(brakes.cylinders.radius, 2) * brakes.cylinders.stroke * brakes.cylinders.count;
|
||||
extract_value(brakes.valveVolume, "BVV", line, "");
|
||||
brakes.config.cylinderVolume = M_PI * std::pow(brakes.config.cylinders.radius, 2) * brakes.config.cylinders.stroke * brakes.config.cylinders.count;
|
||||
extract_value(brakes.config.valveVolume, "BVV", line, "");
|
||||
|
||||
{
|
||||
std::map<std::string, int, std::less<>> brakemethods{{"P10-Bg", bp_P10Bg}, {"P10-Bgu", bp_P10Bgu}, {"FR513", bp_FR513}, {"FR510", bp_FR510}, {"Cosid", bp_Cosid},
|
||||
{"P10yBg", bp_P10yBg}, {"P10yBgu", bp_P10yBgu}, {"Disk1", bp_D1}, {"Disk1+Mg", bp_D1 + bp_MHS}, {"Disk2", bp_D2}};
|
||||
auto lookup = brakemethods.find(extract_value("BM", line));
|
||||
brakes.method = lookup != brakemethods.end() ? lookup->second : 0;
|
||||
brakes.config.method = lookup != brakemethods.end() ? lookup->second : 0;
|
||||
}
|
||||
|
||||
extract_value(brakes.rapidRatio, "RM", line, "1");
|
||||
extract_value(brakes.rapidSpeed, "RV", line, "55");
|
||||
extract_value(brakes.config.rapidRatio, "RM", line, "1");
|
||||
extract_value(brakes.config.rapidSpeed, "RV", line, "55");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// maxbrakepress[3] == 0 or less
|
||||
brakes.pressureToForce = 0;
|
||||
brakes.config.pressureToForce = 0;
|
||||
}
|
||||
|
||||
// Ra 2014-07: trochę niedokładności
|
||||
@@ -286,10 +286,10 @@ void physics::Vehicle::LoadFIZ_Brake(std::string const &line)
|
||||
auto const firstdraw{Random(10)};
|
||||
brakes.controlReservoirPressure = 5 + 0.001 * (Random(10) - firstdraw);
|
||||
extract_value(brakes.controlReservoirPressure, "HiPP", line, "");
|
||||
brakes.pipeHighPressure = brakes.controlReservoirPressure;
|
||||
brakes.pipeLowPressure = std::min(brakes.pipeHighPressure, 3.5);
|
||||
extract_value(brakes.pipeLowPressure, "LoPP", line, "");
|
||||
brakes.pipePressureRange = brakes.pipeHighPressure - brakes.pipeLowPressure;
|
||||
brakes.config.pipeHighPressure = brakes.controlReservoirPressure;
|
||||
brakes.config.pipeLowPressure = std::min(brakes.config.pipeHighPressure, 3.5);
|
||||
extract_value(brakes.config.pipeLowPressure, "LoPP", line, "");
|
||||
brakes.config.pipePressureRange = brakes.config.pipeHighPressure - brakes.config.pipeLowPressure;
|
||||
|
||||
extract_value(air.config.mainReservoirVolume, "Vv", line, "");
|
||||
/*
|
||||
@@ -304,13 +304,13 @@ void physics::Vehicle::LoadFIZ_Brake(std::string const &line)
|
||||
extract_value(brakes.emergencyValve.offPressure, "MinEVP", line, "");
|
||||
extract_value(brakes.emergencyValve.onPressure, "MaxEVP", line, "");
|
||||
extract_value(brakes.emergencyValve.area, "EVArea", line, "");
|
||||
extract_value(brakes.universalButtonActions[0], "UBB1", line, "");
|
||||
extract_value(brakes.universalButtonActions[1], "UBB2", line, "");
|
||||
extract_value(brakes.universalButtonActions[2], "UBB3", line, "");
|
||||
extract_value(brakes.config.universalButtonActions[0], "UBB1", line, "");
|
||||
extract_value(brakes.config.universalButtonActions[1], "UBB2", line, "");
|
||||
extract_value(brakes.config.universalButtonActions[2], "UBB3", line, "");
|
||||
extract_value(brakes.pipeLock.onPressure, "LPOn", line, "-1");
|
||||
extract_value(brakes.pipeLock.offPressure, "LPOff", line, "-1");
|
||||
extract_value(brakes.pipeLock.unlockHandlePosition, "HandlePipeUnlockPos", line, "-3");
|
||||
extract_value(brakes.emergencyCutsOffDriverValve, "EmergencyCutsOffHandle", line, "");
|
||||
extract_value(brakes.config.emergencyCutsOffDriverValve, "EmergencyCutsOffHandle", line, "");
|
||||
{
|
||||
using enum CompressorSupply;
|
||||
std::map<std::string, CompressorSupply, std::less<>> compressorpowers{
|
||||
@@ -691,9 +691,9 @@ void physics::Vehicle::LoadFIZ_CntrlBrakes(std::string const &line)
|
||||
using enum TBrakeSystem;
|
||||
std::map<std::string, TBrakeSystem, std::less<>> brakesystems{{"Pneumatic", Pneumatic}, {"ElectroPneumatic", ElectroPneumatic}};
|
||||
auto lookup = brakesystems.find(extract_value("BrakeSystem", line));
|
||||
brakes.kind = lookup != brakesystems.end() ? lookup->second : Individual;
|
||||
brakes.config.kind = lookup != brakesystems.end() ? lookup->second : Individual;
|
||||
}
|
||||
if (brakes.kind != TBrakeSystem::Individual)
|
||||
if (brakes.config.kind != TBrakeSystem::Individual)
|
||||
{
|
||||
LoadFIZ_CntrlTrainBrake(line);
|
||||
} // brakesystem != individual
|
||||
@@ -703,10 +703,10 @@ void physics::Vehicle::LoadFIZ_CntrlBrakes(std::string const &line)
|
||||
using enum TLocalBrake;
|
||||
std::map<std::string, TLocalBrake, std::less<>> localbrakes{{"ManualBrake", ManualBrake}, {"PneumaticBrake", PneumaticBrake}, {"HydraulicBrake", HydraulicBrake}};
|
||||
auto lookup = localbrakes.find(extract_value("LocalBrake", line));
|
||||
brakes.localKind = lookup != localbrakes.end() ? lookup->second : NoBrake;
|
||||
brakes.config.localKind = lookup != localbrakes.end() ? lookup->second : NoBrake;
|
||||
}
|
||||
// mbrake
|
||||
extract_value(brakes.hasHandBrake, "ManualBrake", line, "");
|
||||
extract_value(brakes.config.hasHandBrake, "ManualBrake", line, "");
|
||||
}
|
||||
|
||||
// Cntrl.: of a vehicle with a train brake, its positions, delays, modes, handles, load weighing and anti-slip brake
|
||||
@@ -714,11 +714,11 @@ void physics::Vehicle::LoadFIZ_CntrlTrainBrake(std::string const &line)
|
||||
{
|
||||
using enum TBrakeHandle;
|
||||
|
||||
extract_value(brakes.handlePositions, "BCPN", line, "");
|
||||
extract_value(brakes.config.handlePositions, "BCPN", line, "");
|
||||
for (int idx = 0; idx < 4; ++idx)
|
||||
{
|
||||
|
||||
extract_value(brakes.delays[idx], std::format("BDelay{}", idx + 1), line, "");
|
||||
extract_value(brakes.config.delays[idx], std::format("BDelay{}", idx + 1), line, "");
|
||||
}
|
||||
// brakedelays, brakedelayflag
|
||||
{
|
||||
@@ -734,7 +734,7 @@ void physics::Vehicle::LoadFIZ_CntrlTrainBrake(std::string const &line)
|
||||
std::string brakedelay;
|
||||
extract_value(brakedelay, "BrakeDelays", line, "");
|
||||
auto lookup = brakedelays.find(brakedelay);
|
||||
brakes.availableDelays = lookup != brakedelays.end() ? lookup->second : 0;
|
||||
brakes.config.availableDelays = lookup != brakedelays.end() ? lookup->second : 0;
|
||||
lookup = brakedelayflags.find(brakedelay);
|
||||
brakes.delaySetting = lookup != brakedelayflags.end() ? lookup->second : 0;
|
||||
}
|
||||
@@ -742,7 +742,7 @@ void physics::Vehicle::LoadFIZ_CntrlTrainBrake(std::string const &line)
|
||||
{
|
||||
std::map<std::string, int, std::less<>> brakeopmodes{{"PN", bom_PS + bom_PN}, {"PNEP", bom_PS + bom_PN + bom_EP}, {"PNEPMED", bom_PS + bom_PN + bom_EP + bom_MED}};
|
||||
auto lookup = brakeopmodes.find(extract_value("BrakeOpModes", line));
|
||||
brakes.availableOperatingModes = lookup != brakeopmodes.end() ? lookup->second : 0;
|
||||
brakes.config.availableOperatingModes = lookup != brakeopmodes.end() ? lookup->second : 0;
|
||||
}
|
||||
// brakehandle
|
||||
{
|
||||
@@ -751,26 +751,26 @@ void physics::Vehicle::LoadFIZ_CntrlTrainBrake(std::string const &line)
|
||||
{"MHZ_K8P", MHZ_K8P}, {"MHZ_6P", MHZ_6P}, {"M394", M394}, {"Knorr", Knorr}, {"Westinghouse", West},
|
||||
{"FVel6", FVel6}, {"FVE408", FVE408}, {"St113", St113}};
|
||||
auto lookup = brakehandles.find(extract_value("BrakeHandle", line));
|
||||
brakes.driverValveType = lookup != brakehandles.end() ? lookup->second : NoHandle;
|
||||
brakes.config.driverValveType = lookup != brakehandles.end() ? lookup->second : NoHandle;
|
||||
}
|
||||
extract_value(brakes.driverValveSettings.automaticOverload, "HAO", line, "");
|
||||
extract_value(brakes.driverValveSettings.manualOverload, "HMO", line, "");
|
||||
extract_value(brakes.driverValveSettings.genericParameter1, "HGDP1", line, "");
|
||||
extract_value(brakes.driverValveSettings.genericParameter2, "HGDP2", line, "");
|
||||
extract_value(brakes.driverValveSettings.overloadMaxPressure, "OMP", line, "");
|
||||
extract_value(brakes.driverValveSettings.overloadPressureDecrease, "OPD", line, "");
|
||||
extract_value(brakes.config.driverValveSettings.automaticOverload, "HAO", line, "");
|
||||
extract_value(brakes.config.driverValveSettings.manualOverload, "HMO", line, "");
|
||||
extract_value(brakes.config.driverValveSettings.genericParameter1, "HGDP1", line, "");
|
||||
extract_value(brakes.config.driverValveSettings.genericParameter2, "HGDP2", line, "");
|
||||
extract_value(brakes.config.driverValveSettings.overloadMaxPressure, "OMP", line, "");
|
||||
extract_value(brakes.config.driverValveSettings.overloadPressureDecrease, "OPD", line, "");
|
||||
// brakelochandle
|
||||
{
|
||||
std::map<std::string, TBrakeHandle, std::less<>> locbrakehandles{{"FD1", FD1}, {"Knorr", Knorr}, {"Westinghouse", West}};
|
||||
auto lookup = locbrakehandles.find(extract_value("LocBrakeHandle", line));
|
||||
brakes.independentValveType = lookup != locbrakehandles.end() ? lookup->second : NoHandle;
|
||||
brakes.config.independentValveType = lookup != locbrakehandles.end() ? lookup->second : NoHandle;
|
||||
}
|
||||
|
||||
// mbpm
|
||||
if (true == extract_value(brakes.maxPressureMass, "MaxBPMass", line, ""))
|
||||
if (true == extract_value(brakes.config.maxPressureMass, "MaxBPMass", line, ""))
|
||||
{
|
||||
// NOTE: only convert the value from tons to kilograms if the entry is present in the config file
|
||||
brakes.maxPressureMass *= 1000.0;
|
||||
brakes.config.maxPressureMass *= 1000.0;
|
||||
}
|
||||
|
||||
// asbtype
|
||||
@@ -782,15 +782,15 @@ void physics::Vehicle::LoadFIZ_CntrlAntiSlipBrake(std::string_view const asb)
|
||||
{
|
||||
if (asb == "yes")
|
||||
{
|
||||
brakes.antiSlipType = 128;
|
||||
brakes.config.antiSlipType = 128;
|
||||
}
|
||||
else if (brakes.handlePositions > 0 && asb == "manual")
|
||||
else if (brakes.config.handlePositions > 0 && asb == "manual")
|
||||
{
|
||||
brakes.antiSlipType = 1;
|
||||
brakes.config.antiSlipType = 1;
|
||||
}
|
||||
else if (brakes.handlePositions > 0 && asb == "automatic")
|
||||
else if (brakes.config.handlePositions > 0 && asb == "automatic")
|
||||
{
|
||||
brakes.antiSlipType = 2;
|
||||
brakes.config.antiSlipType = 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -855,7 +855,7 @@ void physics::Vehicle::LoadFIZ_CntrlControllers(std::string const &line)
|
||||
extract_value(HasCamshaft, "Camshaft", line, "");
|
||||
extract_value(EIMCtrlType, "EIMCtrlType", line, "");
|
||||
EIMCtrlType = std::clamp(EIMCtrlType, 0, 3);
|
||||
extract_value(brakes.independentTraxx, "LocalBrakeTraxx", line, "");
|
||||
extract_value(brakes.config.independentTraxx, "LocalBrakeTraxx", line, "");
|
||||
extract_value(EIMCtrlAdditionalZeros, "EIMCtrlAddZeros", line, "");
|
||||
extract_value(EIMCtrlEmergency, "EIMCtrlEmergency", line, "");
|
||||
// Elf (EIMCtrlType 2): an emergency brake position below the controller's position 0, which shifts the other positions up by one
|
||||
|
||||
@@ -46,13 +46,13 @@ void physics::Vehicle::BrakeLevelSet(double b)
|
||||
brakes.handlePositionReal = brakes.handlePositionSmooth;
|
||||
auto x = static_cast<int>(std::floor(brakes.handlePositionSmooth)); // jeśli odwołujemy się do BrakeCtrlPos w pośrednich, to musi być
|
||||
// obcięte a nie zaokrągone
|
||||
while (x > brakes.handlePosition && brakes.handlePosition < brakes.handlePositions) // jeśli zwiększyło się o 1
|
||||
while (x > brakes.handlePosition && brakes.handlePosition < brakes.config.handlePositions) // jeśli zwiększyło się o 1
|
||||
if (!IncBrakeLevelOld()) // physics::Vehicle::
|
||||
break; // wyjście awaryjne
|
||||
while (x < brakes.handlePosition && brakes.handlePosition >= -1) // jeśli zmniejszyło się o 1
|
||||
if (!DecBrakeLevelOld()) // physics::Vehicle::
|
||||
break;
|
||||
brakes.actualPressure = brakes.pressureTable[brakes.handlePosition]; // skopiowanie pozycji
|
||||
brakes.actualPressure = brakes.config.pressureTable[brakes.handlePosition]; // skopiowanie pozycji
|
||||
/*
|
||||
//youBy: obawiam sie, ze tutaj to nie dziala :P
|
||||
//Ra 2014-03: było tak zrobione, że działało - po każdej zmianie pozycji była wywoływana ta
|
||||
@@ -77,7 +77,7 @@ 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(brakes.handlePositionSmooth + b);
|
||||
return b > 0.0 ? brakes.handlePositionSmooth < brakes.handlePositions : brakes.handlePosition > -1.0; // true, jeśli można kontynuować
|
||||
return b > 0.0 ? brakes.handlePositionSmooth < brakes.config.handlePositions : brakes.handlePosition > -1.0; // true, jeśli można kontynuować
|
||||
};
|
||||
|
||||
bool physics::Vehicle::IncBrakeLevel()
|
||||
@@ -136,7 +136,7 @@ ZN //masa
|
||||
double physics::Vehicle::LocalBrakeRatio(void) const
|
||||
{
|
||||
double LBR;
|
||||
if (brakes.driverValveType == TBrakeHandle::MHZ_EN57)
|
||||
if (brakes.config.driverValveType == TBrakeHandle::MHZ_EN57)
|
||||
if (brakes.operatingMode >= bom_EP)
|
||||
LBR = brakes.driverValve->GetEP(brakes.handlePositionReal);
|
||||
else
|
||||
@@ -174,8 +174,8 @@ double physics::Vehicle::ManualBrakeRatio(void) const
|
||||
// *****************************************************************************
|
||||
double physics::Vehicle::BrakeVP(void) const
|
||||
{
|
||||
if (brakes.valveVolume > 0)
|
||||
return brakes.reservoirAir / (10.0 * brakes.valveVolume);
|
||||
if (brakes.config.valveVolume > 0)
|
||||
return brakes.reservoirAir / (10.0 * brakes.config.valveVolume);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@@ -188,8 +188,8 @@ double physics::Vehicle::RealPipeRatio(void) const
|
||||
{
|
||||
double rpp;
|
||||
|
||||
if (brakes.pipePressureRange > 0)
|
||||
rpp = (brakes.controlReservoirPressure - brakePipe.Pressure()) / brakes.pipePressureRange;
|
||||
if (brakes.config.pipePressureRange > 0)
|
||||
rpp = (brakes.controlReservoirPressure - brakePipe.Pressure()) / brakes.config.pipePressureRange;
|
||||
else
|
||||
rpp = 0;
|
||||
return rpp;
|
||||
@@ -203,13 +203,13 @@ double physics::Vehicle::PipeRatio(void) const
|
||||
{
|
||||
double pr;
|
||||
|
||||
if (brakes.pipePressureRange > 0)
|
||||
if (brakes.config.pipePressureRange > 0)
|
||||
if (false) // SPKS!! no to jak nie wchodzimy to po co branch?
|
||||
{
|
||||
if (3.0 * brakePipe.Pressure() > brakes.pipeHighPressure + brakes.pipeLowPressure + brakes.pipeLowPressure)
|
||||
pr = (brakes.pipeHighPressure - std::min(brakes.pipeHighPressure, brakePipe.Pressure())) / (brakes.pipePressureRange * 4.0 / 3.0);
|
||||
if (3.0 * brakePipe.Pressure() > brakes.config.pipeHighPressure + brakes.config.pipeLowPressure + brakes.config.pipeLowPressure)
|
||||
pr = (brakes.config.pipeHighPressure - std::min(brakes.config.pipeHighPressure, brakePipe.Pressure())) / (brakes.config.pipePressureRange * 4.0 / 3.0);
|
||||
else
|
||||
pr = (brakes.pipeHighPressure - 1.0 / 3.0 * brakes.pipePressureRange - std::max(brakes.pipeLowPressure, brakePipe.Pressure())) / (brakes.pipePressureRange * 2.0 / 3.0);
|
||||
pr = (brakes.config.pipeHighPressure - 1.0 / 3.0 * brakes.config.pipePressureRange - std::max(brakes.config.pipeLowPressure, brakePipe.Pressure())) / (brakes.config.pipePressureRange * 2.0 / 3.0);
|
||||
// if (not TestFlag(BrakeStatus, b_Ractive))
|
||||
// and(BrakeMethod and 1 = 0) and TestFlag(BrakeDelays, bdelay_R) and (Power < 1) and
|
||||
// (BrakeCtrlPos < 1) then pr : = std::min(0.5, pr);
|
||||
@@ -217,7 +217,7 @@ double physics::Vehicle::PipeRatio(void) const
|
||||
// then pr : = pr * 1.333; // dziwny rapid wywalamy
|
||||
}
|
||||
else
|
||||
pr = (brakes.pipeHighPressure - std::max(brakes.pipeLowPressure, std::min(brakes.pipeHighPressure, brakePipe.Pressure()))) / brakes.pipePressureRange;
|
||||
pr = (brakes.config.pipeHighPressure - std::max(brakes.config.pipeLowPressure, std::min(brakes.config.pipeHighPressure, brakePipe.Pressure()))) / brakes.config.pipePressureRange;
|
||||
else
|
||||
pr = 0;
|
||||
return pr;
|
||||
@@ -352,14 +352,14 @@ bool physics::Vehicle::IncBrakeLevelOld(void)
|
||||
{
|
||||
bool IBLO = false;
|
||||
|
||||
if (brakes.handlePositions > 0)
|
||||
if (brakes.config.handlePositions > 0)
|
||||
{
|
||||
if (brakes.handlePosition < brakes.handlePositions)
|
||||
if (brakes.handlePosition < brakes.config.handlePositions)
|
||||
{
|
||||
++brakes.handlePosition;
|
||||
// youBy: EP po nowemu
|
||||
IBLO = true;
|
||||
if (brakes.actualPressure.PipePressureVal < 0 && brakes.pressureTable[brakes.handlePosition - 1].PipePressureVal > 0)
|
||||
if (brakes.actualPressure.PipePressureVal < 0 && brakes.config.pressureTable[brakes.handlePosition - 1].PipePressureVal > 0)
|
||||
brakes.pipeLimiterPressure = brakePipe.Pressure();
|
||||
}
|
||||
else
|
||||
@@ -379,9 +379,9 @@ bool physics::Vehicle::DecBrakeLevelOld(void)
|
||||
{
|
||||
bool DBLO = false;
|
||||
|
||||
if (brakes.handlePositions > 0)
|
||||
if (brakes.config.handlePositions > 0)
|
||||
{
|
||||
if (brakes.handlePosition > (brakes.driverValveType == TBrakeHandle::FV4a ? -2 : -1))
|
||||
if (brakes.handlePosition > (brakes.config.driverValveType == TBrakeHandle::FV4a ? -2 : -1))
|
||||
{
|
||||
--brakes.handlePosition;
|
||||
// youBy: EP po nowemu
|
||||
@@ -499,7 +499,7 @@ bool physics::Vehicle::AlarmChainSwitch(bool const State)
|
||||
bool physics::Vehicle::AntiSlippingBrake(void)
|
||||
{
|
||||
bool ASB = false; // Ra: przeniesione z końca
|
||||
if (brakes.antiSlipType == 1)
|
||||
if (brakes.config.antiSlipType == 1)
|
||||
{
|
||||
ASB = true; // SPKS!!
|
||||
brakes.distributor->ASB(1);
|
||||
@@ -545,7 +545,7 @@ bool physics::Vehicle::UniversalBrakeButton(int button, int state)
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
flag = flag | (brakes.universalButtonPressed[i] ? brakes.universalButtonActions[i] : 0);
|
||||
flag = flag | (brakes.universalButtonPressed[i] ? brakes.config.universalButtonActions[i] : 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -555,7 +555,7 @@ bool physics::Vehicle::UniversalBrakeButton(int button, int state)
|
||||
brakes.pipeLock.unlockPressed = (flag & TUniversalBrake::ub_UnlockPipe) > 0;
|
||||
|
||||
// if the releaser can be activated by switch
|
||||
if (TestFlag(brakes.universalButtonActions[0] & brakes.universalButtonActions[1] & brakes.universalButtonActions[2], TUniversalBrake::ub_Release))
|
||||
if (TestFlag(brakes.config.universalButtonActions[0] & brakes.config.universalButtonActions[1] & brakes.config.universalButtonActions[2], TUniversalBrake::ub_Release))
|
||||
{
|
||||
BrakeReleaser(TestFlag(flag, TUniversalBrake::ub_Release) ? 1 : 0);
|
||||
}
|
||||
@@ -571,7 +571,7 @@ bool physics::Vehicle::SwitchEPBrake(int state)
|
||||
bool OK;
|
||||
|
||||
OK = false;
|
||||
if (brakes.driverValveType == TBrakeHandle::St113 && CabOccupied != 0)
|
||||
if (brakes.config.driverValveType == TBrakeHandle::St113 && CabOccupied != 0)
|
||||
{
|
||||
// the handle works the EP contactors pneumatically, their supply is cut as the Oerlikon handle's is
|
||||
if (state > 0 && EPBrakeControlPowered())
|
||||
@@ -676,15 +676,15 @@ bool physics::Vehicle::IncBrakeMult(void)
|
||||
{
|
||||
bool IBM;
|
||||
|
||||
if (brakes.loadSetting > 0 && brakes.maxPressureMass < 2 && brakes.loadSetting < 3)
|
||||
if (brakes.loadSetting > 0 && brakes.config.maxPressureMass < 2 && brakes.loadSetting < 3)
|
||||
{
|
||||
if (brakes.maxCylinderPressure[2] > 0 && brakes.loadSetting == 1)
|
||||
if (brakes.config.maxCylinderPressure[2] > 0 && brakes.loadSetting == 1)
|
||||
brakes.loadSetting = 2;
|
||||
else
|
||||
brakes.loadSetting = 3;
|
||||
IBM = true;
|
||||
if (brakes.cylinders.leverRatio[2] > 0)
|
||||
brakes.cylinders.leverRatio[0] = brakes.cylinders.leverRatio[2];
|
||||
if (brakes.config.cylinders.leverRatio[2] > 0)
|
||||
brakes.config.cylinders.leverRatio[0] = brakes.config.cylinders.leverRatio[2];
|
||||
}
|
||||
else
|
||||
IBM = false;
|
||||
@@ -699,15 +699,15 @@ bool physics::Vehicle::IncBrakeMult(void)
|
||||
bool physics::Vehicle::DecBrakeMult(void)
|
||||
{
|
||||
bool DBM;
|
||||
if (brakes.loadSetting > 1 && brakes.maxPressureMass < 2)
|
||||
if (brakes.loadSetting > 1 && brakes.config.maxPressureMass < 2)
|
||||
{
|
||||
if (brakes.maxCylinderPressure[2] > 0 && brakes.loadSetting == 3)
|
||||
if (brakes.config.maxCylinderPressure[2] > 0 && brakes.loadSetting == 3)
|
||||
brakes.loadSetting = 2;
|
||||
else
|
||||
brakes.loadSetting = 1;
|
||||
DBM = true;
|
||||
if (brakes.cylinders.leverRatio[1] > 0)
|
||||
brakes.cylinders.leverRatio[0] = brakes.cylinders.leverRatio[1];
|
||||
if (brakes.config.cylinders.leverRatio[1] > 0)
|
||||
brakes.config.cylinders.leverRatio[0] = brakes.config.cylinders.leverRatio[1];
|
||||
}
|
||||
else
|
||||
DBM = false;
|
||||
@@ -816,7 +816,7 @@ void physics::Vehicle::UpdatePipePressure(double dt)
|
||||
|
||||
brakes.driverValveFlow = 0;
|
||||
|
||||
if (brakes.handlePositions > 1)
|
||||
if (brakes.config.handlePositions > 1)
|
||||
{
|
||||
|
||||
UpdateLocalBrakeValve(dt);
|
||||
@@ -832,7 +832,7 @@ void physics::Vehicle::UpdatePipePressure(double dt)
|
||||
// Pipe.Flow(PF(PipePress, 0, d2A(7)) * dt);
|
||||
// if ConverterFlag then
|
||||
// Pipe.Flow(PF(PipePress, 0, d2A(12)) * dt);
|
||||
brakes.driverValveFlow = brakes.driverValveFlow / (Dim.L * brakes.pipeSection * 20);
|
||||
brakes.driverValveFlow = brakes.driverValveFlow / (Dim.L * brakes.config.pipeSection * 20);
|
||||
|
||||
brakes.controlReservoirPressure = brakes.distributor->GetVRP(); // ciśnienie komory wstępnej rozdzielacza
|
||||
|
||||
@@ -840,11 +840,11 @@ void physics::Vehicle::UpdatePipePressure(double dt)
|
||||
|
||||
UpdateDistributorSettings();
|
||||
|
||||
if ((brakes.driverValveType == TBrakeHandle::FVel6 || brakes.driverValveType == TBrakeHandle::FVE408) && CabOccupied != 0)
|
||||
if ((brakes.config.driverValveType == TBrakeHandle::FVel6 || brakes.config.driverValveType == TBrakeHandle::FVE408) && CabOccupied != 0)
|
||||
{
|
||||
UpdateEPBrake();
|
||||
}
|
||||
else if (brakes.driverValveType == TBrakeHandle::St113 && CabOccupied != 0 && std::abs(EpForce) > 0.001 && !EPBrakeControlPowered())
|
||||
else if (brakes.config.driverValveType == TBrakeHandle::St113 && CabOccupied != 0 && std::abs(EpForce) > 0.001 && !EPBrakeControlPowered())
|
||||
{
|
||||
// the EP brake switched on with the button drops out with the control's supply
|
||||
SwitchEPBrake(0);
|
||||
@@ -860,7 +860,7 @@ void physics::Vehicle::UpdatePipePressure(double dt)
|
||||
// the air the brake hoses carry to and from the neighbours comes once all vehicles have stepped, UpdatePipeCouplers()
|
||||
brakePipe.SetCouplersPending(true);
|
||||
|
||||
if (brakes.antiSlipType == 128)
|
||||
if (brakes.config.antiSlipType == 128)
|
||||
brakes.distributor->ASB(int(SlippingWheels && Vel > 1) * (1 + 2 * int(nrot_eps < -0.01)));
|
||||
|
||||
brakes.pipeFlow = 0;
|
||||
@@ -887,7 +887,7 @@ 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)
|
||||
{
|
||||
double lbpa = brakes.independentTraxx ? eim_localbrake : brakes.independentPosition;
|
||||
double lbpa = brakes.config.independentTraxx ? eim_localbrake : brakes.independentPosition;
|
||||
if (EIMCtrlType > 0 && UniCtrlIntegratedLocalBrakeCtrl)
|
||||
{
|
||||
lbpa = std::max(0.0, -eimic_real);
|
||||
@@ -905,7 +905,7 @@ void physics::Vehicle::UpdateLocalBrakeValve(double dt)
|
||||
// lever should apply pneumatic pressure on the locomotive directly, bypassing MED.
|
||||
// LocHandleTimeTraxx also bypasses MED, but has 3 positions (brake-hold-unbrake).
|
||||
double lbpa;
|
||||
if (brakes.independentTraxx)
|
||||
if (brakes.config.independentTraxx)
|
||||
{
|
||||
lbpa = eim_localbrake;
|
||||
}
|
||||
@@ -932,10 +932,10 @@ void physics::Vehicle::UpdateMainValve(double dt)
|
||||
// the driver's valve of a vehicle prepared for hauling is cut out, whatever its handle shows
|
||||
brakes.driverValveFlow = 0;
|
||||
}
|
||||
else if ((brakes.availableOperatingModes & bom_PS) == 0 || (CabOccupied != 0 && brakes.operatingMode != bom_PS))
|
||||
else if ((brakes.config.availableOperatingModes & bom_PS) == 0 || (CabOccupied != 0 && brakes.operatingMode != bom_PS))
|
||||
{
|
||||
|
||||
if (brakes.operatingMode < bom_EP || brakes.driverValve->GetPos(bh_EB) - 0.5 < brakes.handlePositionReal || (brakes.driverValveType != TBrakeHandle::MHZ_EN57 && brakes.driverValveType != TBrakeHandle::MHZ_K8P))
|
||||
if (brakes.operatingMode < bom_EP || brakes.driverValve->GetPos(bh_EB) - 0.5 < brakes.handlePositionReal || (brakes.config.driverValveType != TBrakeHandle::MHZ_EN57 && brakes.config.driverValveType != TBrakeHandle::MHZ_K8P))
|
||||
{
|
||||
brakes.driverValveFlow = brakes.driverValve->GetPF(MainValveHandlePosition(), brakePipe.Pressure(), temp, dt, brakes.equivalentPipePressure);
|
||||
}
|
||||
@@ -965,9 +965,9 @@ void physics::Vehicle::UpdateMainValve(double dt)
|
||||
double physics::Vehicle::MainValveSupply()
|
||||
{
|
||||
brakes.pipeLock.locked = brakePipe.Pressure() < (brakes.pipeLock.locked ? brakes.pipeLock.offPressure : brakes.pipeLock.onPressure);
|
||||
bool lock_new = (brakes.pipeLock.locked && !brakes.pipeLock.unlockPressed && brakes.handlePositionReal > brakes.pipeLock.unlockHandlePosition) || (brakes.emergencyCutsOffDriverValve && brakes.emergencyValve.flow > 0); // new simple codition based on .fiz
|
||||
bool lock_old = brakes.driverValveType == TBrakeHandle::FV4a // old complex condition based on assumptions
|
||||
&& brakePipe.Pressure() < 2.75 && (brakes.distributor->GetStatus() & b_rls) == 0 && brakes.subsystem == TBrakeSubSystem::ss_LSt && TrainType != train_type::emu && !brakes.pipeLock.unlockPressed;
|
||||
bool lock_new = (brakes.pipeLock.locked && !brakes.pipeLock.unlockPressed && brakes.handlePositionReal > brakes.pipeLock.unlockHandlePosition) || (brakes.config.emergencyCutsOffDriverValve && brakes.emergencyValve.flow > 0); // new simple codition based on .fiz
|
||||
bool lock_old = brakes.config.driverValveType == TBrakeHandle::FV4a // old complex condition based on assumptions
|
||||
&& brakePipe.Pressure() < 2.75 && (brakes.distributor->GetStatus() & b_rls) == 0 && brakes.config.subsystem == TBrakeSubSystem::ss_LSt && TrainType != train_type::emu && !brakes.pipeLock.unlockPressed;
|
||||
|
||||
if (lock_old || lock_new)
|
||||
{
|
||||
@@ -1015,23 +1015,23 @@ void physics::Vehicle::UpdateEmergencyValve(double dt)
|
||||
// what the distributor valve gets of the local brake and the load, by its kind
|
||||
void physics::Vehicle::UpdateDistributorSettings()
|
||||
{
|
||||
switch (brakes.distributorType)
|
||||
switch (brakes.config.distributorType)
|
||||
{
|
||||
|
||||
case TBrakeValve::K:
|
||||
case TBrakeValve::W:
|
||||
{
|
||||
|
||||
if (brakes.independentValveType != TBrakeHandle::NoHandle)
|
||||
if (brakes.config.independentValveType != TBrakeHandle::NoHandle)
|
||||
{
|
||||
brakes.independentCylinderPressure = brakes.independentValve->GetCP();
|
||||
|
||||
//(Hamulec as TWest).SetLBP(LocBrakePress);
|
||||
brakes.distributor->SetLBP(brakes.independentCylinderPressure);
|
||||
}
|
||||
if (brakes.maxPressureMass < 2)
|
||||
if (brakes.config.maxPressureMass < 2)
|
||||
//(Hamulec as TWest).PLC(MaxBrakePress[LoadFlag])
|
||||
brakes.distributor->PLC(brakes.maxCylinderPressure[brakes.loadSetting]);
|
||||
brakes.distributor->PLC(brakes.config.maxCylinderPressure[brakes.loadSetting]);
|
||||
else
|
||||
//(Hamulec as TWest).PLC(TotalMass);
|
||||
brakes.distributor->PLC(TotalMass - Mred);
|
||||
@@ -1060,10 +1060,10 @@ void physics::Vehicle::UpdateDistributorSettings()
|
||||
|
||||
//(Hamulec as TLSt).SetLBP(LocBrakePress);
|
||||
brakes.distributor->SetLBP(brakes.independentCylinderPressure);
|
||||
if (brakes.distributorType == TBrakeValve::EStED)
|
||||
if (brakes.config.distributorType == TBrakeValve::EStED)
|
||||
{
|
||||
if (brakes.maxPressureMass < 2)
|
||||
brakes.distributor->PLC(brakes.maxCylinderPressure[brakes.loadSetting]);
|
||||
if (brakes.config.maxPressureMass < 2)
|
||||
brakes.distributor->PLC(brakes.config.maxCylinderPressure[brakes.loadSetting]);
|
||||
else
|
||||
brakes.distributor->PLC(TotalMass - Mred);
|
||||
}
|
||||
@@ -1089,9 +1089,9 @@ void physics::Vehicle::UpdateDistributorSettings()
|
||||
case TBrakeValve::ESt4:
|
||||
case TBrakeValve::ESt3:
|
||||
{
|
||||
if (brakes.maxPressureMass < 2)
|
||||
if (brakes.config.maxPressureMass < 2)
|
||||
//(Hamulec as TNESt3).PLC(MaxBrakePress[LoadFlag])
|
||||
brakes.distributor->PLC(brakes.maxCylinderPressure[brakes.loadSetting]);
|
||||
brakes.distributor->PLC(brakes.config.maxCylinderPressure[brakes.loadSetting]);
|
||||
else
|
||||
//(Hamulec as TNESt3).PLC(TotalMass);
|
||||
brakes.distributor->PLC(TotalMass - Mred);
|
||||
@@ -1105,9 +1105,9 @@ void physics::Vehicle::UpdateDistributorSettings()
|
||||
brakes.independentCylinderPressure = brakes.independentValve->GetCP();
|
||||
//(Hamulec as TKE).SetLBP(LocBrakePress);
|
||||
brakes.distributor->SetLBP(brakes.independentCylinderPressure);
|
||||
if (brakes.maxPressureMass < 2)
|
||||
if (brakes.config.maxPressureMass < 2)
|
||||
//(Hamulec as TKE).PLC(MaxBrakePress[LoadFlag])
|
||||
brakes.distributor->PLC(brakes.maxCylinderPressure[brakes.loadSetting]);
|
||||
brakes.distributor->PLC(brakes.config.maxCylinderPressure[brakes.loadSetting]);
|
||||
else
|
||||
//(Hamulec as TKE).PLC(TotalMass);
|
||||
brakes.distributor->PLC(TotalMass - Mred);
|
||||
@@ -1258,7 +1258,7 @@ double physics::Vehicle::GetDVc(double dt)
|
||||
if (Couplers[0].Connected != nullptr && Couplers[0].CouplingFlag.HasAll(Coupling::brakeHose))
|
||||
{ //*0.85
|
||||
c = Couplers[0].Connected; // skrot //0.08 //e/D * L/D = e/D^2 * L
|
||||
dv1 = 0.5 * dt * PF(brakePipe.Pressure(), neighbour_pipe_pressure(*c, c->brakePipe.Pressure(), *c->brakePipe.reservoir), brakes.pipeSection / (1.0 + 0.015 / brakes.pipeSection * Dim.L));
|
||||
dv1 = 0.5 * dt * PF(brakePipe.Pressure(), neighbour_pipe_pressure(*c, c->brakePipe.Pressure(), *c->brakePipe.reservoir), brakes.config.pipeSection / (1.0 + 0.015 / brakes.config.pipeSection * Dim.L));
|
||||
c->brakePipe.reservoir->Flow(-dv1);
|
||||
if (pipe_wakes(dv1, brakePipe.Pressure(), *c->brakePipe.reservoir))
|
||||
c->switch_physics(true, wake_cause::mainpipe);
|
||||
@@ -1267,7 +1267,7 @@ double physics::Vehicle::GetDVc(double dt)
|
||||
if (Couplers[1].Connected != nullptr && Couplers[1].CouplingFlag.HasAll(Coupling::brakeHose))
|
||||
{
|
||||
c = Couplers[1].Connected; // skrot
|
||||
dv2 = 0.5 * dt * PF(brakePipe.Pressure(), neighbour_pipe_pressure(*c, c->brakePipe.Pressure(), *c->brakePipe.reservoir), brakes.pipeSection / (1.0 + 0.015 / brakes.pipeSection * Dim.L));
|
||||
dv2 = 0.5 * dt * PF(brakePipe.Pressure(), neighbour_pipe_pressure(*c, c->brakePipe.Pressure(), *c->brakePipe.reservoir), brakes.config.pipeSection / (1.0 + 0.015 / brakes.config.pipeSection * Dim.L));
|
||||
c->brakePipe.reservoir->Flow(-dv2);
|
||||
if (pipe_wakes(dv2, brakePipe.Pressure(), *c->brakePipe.reservoir))
|
||||
c->switch_physics(true, wake_cause::mainpipe);
|
||||
@@ -1340,7 +1340,7 @@ struct train_pipe
|
||||
train_pipe const brake_pipe{&physics::Vehicle::brakePipe,
|
||||
Coupling::brakeHose,
|
||||
&physics::Vehicle::GetDVc,
|
||||
[](physics::Vehicle const &Vehicle) { return Vehicle.brakes.pipeSection / (1.0 + 0.015 / Vehicle.brakes.pipeSection * Vehicle.Dim.L); }};
|
||||
[](physics::Vehicle const &Vehicle) { return Vehicle.brakes.config.pipeSection / (1.0 + 0.015 / Vehicle.brakes.config.pipeSection * Vehicle.Dim.L); }};
|
||||
// the main reservoir pipe, GetScndDVc()
|
||||
train_pipe const main_reservoir_pipe{&physics::Vehicle::mainPipe,
|
||||
Coupling::mainHose,
|
||||
|
||||
@@ -266,7 +266,7 @@ void physics::Vehicle::SecuritySystemCheck(double dt)
|
||||
bool physics::Vehicle::RadiostopSwitch(bool Switch)
|
||||
{
|
||||
bool EBS;
|
||||
if (brakes.kind != TBrakeSystem::Individual && brakes.handlePositions > 0)
|
||||
if (brakes.config.kind != TBrakeSystem::Individual && brakes.config.handlePositions > 0)
|
||||
{
|
||||
|
||||
if (true == Switch && false == RadioStopFlag)
|
||||
|
||||
@@ -71,16 +71,16 @@ bool physics::Vehicle::CheckLocomotiveParameters(bool ReadyFlag, int /*Dir*/)
|
||||
// WriteLogSS("aa ok", BoolToYN(OK));
|
||||
}
|
||||
|
||||
if (brakes.kind == TBrakeSystem::Individual && brakes.subsystem != TBrakeSubSystem::ss_None)
|
||||
if (brakes.config.kind == TBrakeSystem::Individual && brakes.config.subsystem != TBrakeSubSystem::ss_None)
|
||||
OK = false; //!
|
||||
|
||||
if (brakes.valveVolume == 0 && brakes.maxCylinderPressure[3] > 0 && brakes.kind != TBrakeSystem::Individual)
|
||||
if (brakes.config.valveVolume == 0 && brakes.config.maxCylinderPressure[3] > 0 && brakes.config.kind != TBrakeSystem::Individual)
|
||||
{
|
||||
brakes.valveVolume = brakes.maxCylinderPressure[3] / (5.0 - brakes.maxCylinderPressure[3]) * (brakes.cylinders.radius * brakes.cylinders.radius * brakes.cylinders.stroke * brakes.cylinders.count * M_PI) * 1000;
|
||||
brakes.config.valveVolume = brakes.config.maxCylinderPressure[3] / (5.0 - brakes.config.maxCylinderPressure[3]) * (brakes.config.cylinders.radius * brakes.config.cylinders.radius * brakes.config.cylinders.stroke * brakes.config.cylinders.count * M_PI) * 1000;
|
||||
}
|
||||
if (brakes.valveVolume == 0.0)
|
||||
if (brakes.config.valveVolume == 0.0)
|
||||
{
|
||||
brakes.valveVolume = 0.01;
|
||||
brakes.config.valveVolume = 0.01;
|
||||
}
|
||||
// WriteLog("BVV = " + FloatToStr(BrakeVVolume));
|
||||
|
||||
@@ -130,7 +130,7 @@ bool physics::Vehicle::CheckLocomotiveParameters(bool ReadyFlag, int /*Dir*/)
|
||||
ActFlowSpeed = 0.0;
|
||||
brakes.handlePositionReal = brakes.handlePosition;
|
||||
|
||||
if (brakes.independentValveType == TBrakeHandle::Knorr)
|
||||
if (brakes.config.independentValveType == TBrakeHandle::Knorr)
|
||||
brakes.independentPosition = 0.5;
|
||||
|
||||
brakePipe.reservoir->CreatePress(brakePipe.Pressure());
|
||||
@@ -165,9 +165,9 @@ bool physics::Vehicle::CheckLocomotiveParameters(bool ReadyFlag, int /*Dir*/)
|
||||
|
||||
// taki mini automat - powinno byc ladnie dobrze :)
|
||||
brakes.delaySetting = bdelay_P;
|
||||
if (TestFlag(brakes.availableDelays, bdelay_G) && !TestFlag(brakes.availableDelays, bdelay_R))
|
||||
if (TestFlag(brakes.config.availableDelays, bdelay_G) && !TestFlag(brakes.config.availableDelays, bdelay_R))
|
||||
brakes.delaySetting = bdelay_G;
|
||||
if (TestFlag(brakes.availableDelays, bdelay_R) && !TestFlag(brakes.availableDelays, bdelay_G))
|
||||
if (TestFlag(brakes.config.availableDelays, bdelay_R) && !TestFlag(brakes.config.availableDelays, bdelay_G))
|
||||
brakes.delaySetting = bdelay_R;
|
||||
/*
|
||||
// disabled, as test mode is used in specific situations and not really a default
|
||||
@@ -182,12 +182,12 @@ bool physics::Vehicle::CheckLocomotiveParameters(bool ReadyFlag, int /*Dir*/)
|
||||
|
||||
for (int b = 1; b < 4; b++)
|
||||
{
|
||||
if (brakes.delays[b] == 0)
|
||||
brakes.delays[b] = DefBrakeTable[b];
|
||||
brakes.delays[b] = brakes.delays[b] * (2.5 + Random(0.0, 0.2)) / 3.0;
|
||||
if (brakes.config.delays[b] == 0)
|
||||
brakes.config.delays[b] = DefBrakeTable[b];
|
||||
brakes.config.delays[b] = brakes.config.delays[b] * (2.5 + Random(0.0, 0.2)) / 3.0;
|
||||
}
|
||||
|
||||
brakes.distributor->Init(brakePipe.Pressure(), brakes.pipeHighPressure, brakes.pipeLowPressure, brakes.cylinderPressure, brakes.delaySetting);
|
||||
brakes.distributor->Init(brakePipe.Pressure(), brakes.config.pipeHighPressure, brakes.config.pipeLowPressure, brakes.cylinderPressure, brakes.delaySetting);
|
||||
/*
|
||||
ScndPipePress = Compressor;
|
||||
*/
|
||||
@@ -220,28 +220,28 @@ bool physics::Vehicle::CheckLocomotiveParameters(bool ReadyFlag, int /*Dir*/)
|
||||
// the distributor valve of the vehicle's kind
|
||||
void physics::Vehicle::CreateBrakeValve()
|
||||
{
|
||||
switch (brakes.distributorType)
|
||||
switch (brakes.config.distributorType)
|
||||
{
|
||||
case TBrakeValve::W:
|
||||
case TBrakeValve::K:
|
||||
{
|
||||
WriteLog("XBT W, K");
|
||||
brakes.distributor = std::make_shared<TWest>(brakes.maxCylinderPressure[3], brakes.cylinders.radius, brakes.cylinders.stroke, brakes.valveVolume, brakes.cylinders.count, brakes.availableDelays, brakes.method, NAxles, brakes.blocksPerAxle);
|
||||
if (brakes.maxPressureMass < 2) // jesli przystawka wazaca
|
||||
brakes.distributor->SetLP(0, brakes.maxCylinderPressure[3], 0);
|
||||
brakes.distributor = std::make_shared<TWest>(brakes.config.maxCylinderPressure[3], brakes.config.cylinders.radius, brakes.config.cylinders.stroke, brakes.config.valveVolume, brakes.config.cylinders.count, brakes.config.availableDelays, brakes.config.method, NAxles, brakes.config.blocksPerAxle);
|
||||
if (brakes.config.maxPressureMass < 2) // jesli przystawka wazaca
|
||||
brakes.distributor->SetLP(0, brakes.config.maxCylinderPressure[3], 0);
|
||||
else
|
||||
brakes.distributor->SetLP(Mass, brakes.maxPressureMass, brakes.maxCylinderPressure[1]);
|
||||
brakes.distributor->SetLP(Mass, brakes.config.maxPressureMass, brakes.config.maxCylinderPressure[1]);
|
||||
break;
|
||||
}
|
||||
case TBrakeValve::KE:
|
||||
{
|
||||
WriteLog("XBT WKE");
|
||||
brakes.distributor = std::make_shared<TKE>(brakes.maxCylinderPressure[3], brakes.cylinders.radius, brakes.cylinders.stroke, brakes.valveVolume, brakes.cylinders.count, brakes.availableDelays, brakes.method, NAxles, brakes.blocksPerAxle);
|
||||
brakes.distributor->SetRM(brakes.rapidRatio);
|
||||
if (brakes.maxPressureMass < 2) // jesli przystawka wazaca
|
||||
brakes.distributor->SetLP(0, brakes.maxCylinderPressure[3], 0);
|
||||
brakes.distributor = std::make_shared<TKE>(brakes.config.maxCylinderPressure[3], brakes.config.cylinders.radius, brakes.config.cylinders.stroke, brakes.config.valveVolume, brakes.config.cylinders.count, brakes.config.availableDelays, brakes.config.method, NAxles, brakes.config.blocksPerAxle);
|
||||
brakes.distributor->SetRM(brakes.config.rapidRatio);
|
||||
if (brakes.config.maxPressureMass < 2) // jesli przystawka wazaca
|
||||
brakes.distributor->SetLP(0, brakes.config.maxCylinderPressure[3], 0);
|
||||
else
|
||||
brakes.distributor->SetLP(Mass, brakes.maxPressureMass, brakes.maxCylinderPressure[1]);
|
||||
brakes.distributor->SetLP(Mass, brakes.config.maxPressureMass, brakes.config.maxCylinderPressure[1]);
|
||||
break;
|
||||
}
|
||||
case TBrakeValve::NESt3:
|
||||
@@ -250,76 +250,76 @@ void physics::Vehicle::CreateBrakeValve()
|
||||
case TBrakeValve::ESt4:
|
||||
{
|
||||
WriteLog("XBT NESt3, ESt3, ESt3AL2, ESt4");
|
||||
brakes.distributor = std::make_shared<TNESt3>(brakes.maxCylinderPressure[3], brakes.cylinders.radius, brakes.cylinders.stroke, brakes.valveVolume, brakes.cylinders.count, brakes.availableDelays, brakes.method, NAxles, brakes.blocksPerAxle);
|
||||
static_cast<TNESt3 *>(brakes.distributor.get())->SetSize(brakes.distributorSize, brakes.distributorParameters);
|
||||
if (brakes.maxPressureMass < 2) // jesli przystawka wazaca
|
||||
brakes.distributor->SetLP(0, brakes.maxCylinderPressure[3], 0);
|
||||
brakes.distributor = std::make_shared<TNESt3>(brakes.config.maxCylinderPressure[3], brakes.config.cylinders.radius, brakes.config.cylinders.stroke, brakes.config.valveVolume, brakes.config.cylinders.count, brakes.config.availableDelays, brakes.config.method, NAxles, brakes.config.blocksPerAxle);
|
||||
static_cast<TNESt3 *>(brakes.distributor.get())->SetSize(brakes.config.distributorSize, brakes.config.distributorParameters);
|
||||
if (brakes.config.maxPressureMass < 2) // jesli przystawka wazaca
|
||||
brakes.distributor->SetLP(0, brakes.config.maxCylinderPressure[3], 0);
|
||||
else
|
||||
brakes.distributor->SetLP(Mass, brakes.maxPressureMass, brakes.maxCylinderPressure[1]);
|
||||
brakes.distributor->SetLP(Mass, brakes.config.maxPressureMass, brakes.config.maxCylinderPressure[1]);
|
||||
break;
|
||||
}
|
||||
case TBrakeValve::LSt:
|
||||
{
|
||||
WriteLog("XBT LSt");
|
||||
brakes.distributor = std::make_shared<TLSt>(brakes.maxCylinderPressure[3], brakes.cylinders.radius, brakes.cylinders.stroke, brakes.valveVolume, brakes.cylinders.count, brakes.availableDelays, brakes.method, NAxles, brakes.blocksPerAxle);
|
||||
brakes.distributor->SetRM(brakes.rapidRatio);
|
||||
brakes.distributor = std::make_shared<TLSt>(brakes.config.maxCylinderPressure[3], brakes.config.cylinders.radius, brakes.config.cylinders.stroke, brakes.config.valveVolume, brakes.config.cylinders.count, brakes.config.availableDelays, brakes.config.method, NAxles, brakes.config.blocksPerAxle);
|
||||
brakes.distributor->SetRM(brakes.config.rapidRatio);
|
||||
break;
|
||||
}
|
||||
case TBrakeValve::EStED:
|
||||
{
|
||||
WriteLog("XBT EStED");
|
||||
brakes.distributor = std::make_shared<TEStED>(brakes.maxCylinderPressure[3], brakes.cylinders.radius, brakes.cylinders.stroke, brakes.valveVolume, brakes.cylinders.count, brakes.availableDelays, brakes.method, NAxles, brakes.blocksPerAxle);
|
||||
brakes.distributor->SetRM(brakes.rapidRatio);
|
||||
if (brakes.maxPressureMass < 2)
|
||||
brakes.distributor = std::make_shared<TEStED>(brakes.config.maxCylinderPressure[3], brakes.config.cylinders.radius, brakes.config.cylinders.stroke, brakes.config.valveVolume, brakes.config.cylinders.count, brakes.config.availableDelays, brakes.config.method, NAxles, brakes.config.blocksPerAxle);
|
||||
brakes.distributor->SetRM(brakes.config.rapidRatio);
|
||||
if (brakes.config.maxPressureMass < 2)
|
||||
{
|
||||
// jesli przystawka wazaca
|
||||
brakes.distributor->SetLP(0, brakes.maxCylinderPressure[3], 0);
|
||||
brakes.distributor->SetLP(0, brakes.config.maxCylinderPressure[3], 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
brakes.distributor->SetLP(Mass, brakes.maxPressureMass, brakes.maxCylinderPressure[1]);
|
||||
brakes.distributor->SetLP(Mass, brakes.config.maxPressureMass, brakes.config.maxCylinderPressure[1]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TBrakeValve::EP2:
|
||||
{
|
||||
WriteLog("XBT EP2");
|
||||
brakes.distributor = std::make_shared<TEStEP2>(brakes.maxCylinderPressure[3], brakes.cylinders.radius, brakes.cylinders.stroke, brakes.valveVolume, brakes.cylinders.count, brakes.availableDelays, brakes.method, NAxles, brakes.blocksPerAxle);
|
||||
brakes.distributor->SetLP(Mass, brakes.maxPressureMass, brakes.maxCylinderPressure[1]);
|
||||
brakes.distributor = std::make_shared<TEStEP2>(brakes.config.maxCylinderPressure[3], brakes.config.cylinders.radius, brakes.config.cylinders.stroke, brakes.config.valveVolume, brakes.config.cylinders.count, brakes.config.availableDelays, brakes.config.method, NAxles, brakes.config.blocksPerAxle);
|
||||
brakes.distributor->SetLP(Mass, brakes.config.maxPressureMass, brakes.config.maxCylinderPressure[1]);
|
||||
break;
|
||||
}
|
||||
case TBrakeValve::EP1:
|
||||
{
|
||||
WriteLog("XBT EP1");
|
||||
brakes.distributor = std::make_shared<TEStEP1>(brakes.maxCylinderPressure[3], brakes.cylinders.radius, brakes.cylinders.stroke, brakes.valveVolume, brakes.cylinders.count, brakes.availableDelays, brakes.method, NAxles, brakes.blocksPerAxle);
|
||||
brakes.distributor->SetLP(Mass, brakes.maxPressureMass, brakes.maxCylinderPressure[1]);
|
||||
brakes.distributor->SetRM(brakes.rapidRatio);
|
||||
brakes.distributor = std::make_shared<TEStEP1>(brakes.config.maxCylinderPressure[3], brakes.config.cylinders.radius, brakes.config.cylinders.stroke, brakes.config.valveVolume, brakes.config.cylinders.count, brakes.config.availableDelays, brakes.config.method, NAxles, brakes.config.blocksPerAxle);
|
||||
brakes.distributor->SetLP(Mass, brakes.config.maxPressureMass, brakes.config.maxCylinderPressure[1]);
|
||||
brakes.distributor->SetRM(brakes.config.rapidRatio);
|
||||
break;
|
||||
}
|
||||
case TBrakeValve::CV1:
|
||||
{
|
||||
WriteLog("XBT CV1");
|
||||
brakes.distributor = std::make_shared<TCV1>(brakes.maxCylinderPressure[3], brakes.cylinders.radius, brakes.cylinders.stroke, brakes.valveVolume, brakes.cylinders.count, brakes.availableDelays, brakes.method, NAxles, brakes.blocksPerAxle);
|
||||
brakes.distributor = std::make_shared<TCV1>(brakes.config.maxCylinderPressure[3], brakes.config.cylinders.radius, brakes.config.cylinders.stroke, brakes.config.valveVolume, brakes.config.cylinders.count, brakes.config.availableDelays, brakes.config.method, NAxles, brakes.config.blocksPerAxle);
|
||||
break;
|
||||
}
|
||||
case TBrakeValve::CV1_L_TR:
|
||||
{
|
||||
WriteLog("XBT CV1_L_T");
|
||||
brakes.distributor = std::make_shared<TCV1L_TR>(brakes.maxCylinderPressure[3], brakes.cylinders.radius, brakes.cylinders.stroke, brakes.valveVolume, brakes.cylinders.count, brakes.availableDelays, brakes.method, NAxles, brakes.blocksPerAxle);
|
||||
brakes.distributor = std::make_shared<TCV1L_TR>(brakes.config.maxCylinderPressure[3], brakes.config.cylinders.radius, brakes.config.cylinders.stroke, brakes.config.valveVolume, brakes.config.cylinders.count, brakes.config.availableDelays, brakes.config.method, NAxles, brakes.config.blocksPerAxle);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
brakes.distributor = std::make_shared<TBrake>(brakes.maxCylinderPressure[3], brakes.cylinders.radius, brakes.cylinders.stroke, brakes.valveVolume, brakes.cylinders.count, brakes.availableDelays, brakes.method, NAxles, brakes.blocksPerAxle);
|
||||
brakes.distributor = std::make_shared<TBrake>(brakes.config.maxCylinderPressure[3], brakes.config.cylinders.radius, brakes.config.cylinders.stroke, brakes.config.valveVolume, brakes.config.cylinders.count, brakes.config.availableDelays, brakes.config.method, NAxles, brakes.config.blocksPerAxle);
|
||||
}
|
||||
|
||||
brakes.distributor->SetASBP(brakes.maxCylinderPressure[4]);
|
||||
brakes.distributor->SetRV(brakes.rapidSpeed);
|
||||
brakes.distributor->SetASBP(brakes.config.maxCylinderPressure[4]);
|
||||
brakes.distributor->SetRV(brakes.config.rapidSpeed);
|
||||
}
|
||||
|
||||
// the driver's handle and the local brake handle of the vehicle's kinds
|
||||
void physics::Vehicle::CreateBrakeHandles()
|
||||
{
|
||||
switch (brakes.driverValveType)
|
||||
switch (brakes.config.driverValveType)
|
||||
{
|
||||
using enum TBrakeHandle;
|
||||
case FV4a:
|
||||
@@ -356,14 +356,14 @@ void physics::Vehicle::CreateBrakeHandles()
|
||||
default:
|
||||
brakes.driverValve = std::make_shared<TDriverHandle>();
|
||||
}
|
||||
brakes.driverValve->SetParams(brakes.driverValveSettings.automaticOverload, brakes.driverValveSettings.manualOverload, brakes.driverValveSettings.genericParameter1, brakes.driverValveSettings.genericParameter2, brakes.driverValveSettings.overloadMaxPressure, brakes.driverValveSettings.overloadPressureDecrease);
|
||||
brakes.driverValve->SetParams(brakes.config.driverValveSettings.automaticOverload, brakes.config.driverValveSettings.manualOverload, brakes.config.driverValveSettings.genericParameter1, brakes.config.driverValveSettings.genericParameter2, brakes.config.driverValveSettings.overloadMaxPressure, brakes.config.driverValveSettings.overloadPressureDecrease);
|
||||
|
||||
switch (brakes.independentValveType)
|
||||
switch (brakes.config.independentValveType)
|
||||
{
|
||||
case TBrakeHandle::FD1:
|
||||
{
|
||||
brakes.independentValve = std::make_shared<TFD1>();
|
||||
brakes.independentValve->Init(brakes.maxCylinderPressure[0]);
|
||||
brakes.independentValve->Init(brakes.config.maxCylinderPressure[0]);
|
||||
if (TrainType == train_type::emu)
|
||||
{
|
||||
|
||||
@@ -374,7 +374,7 @@ void physics::Vehicle::CreateBrakeHandles()
|
||||
case TBrakeHandle::Knorr:
|
||||
{
|
||||
brakes.independentValve = std::make_shared<TH1405>();
|
||||
brakes.independentValve->Init(brakes.maxCylinderPressure[0]);
|
||||
brakes.independentValve->Init(brakes.config.maxCylinderPressure[0]);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -385,16 +385,16 @@ void physics::Vehicle::CreateBrakeHandles()
|
||||
// the brake pipe, the main pipe and the spring brake's cylinder
|
||||
void physics::Vehicle::CreateBrakePipes()
|
||||
{
|
||||
if (true == TestFlag(brakes.availableDelays, bdelay_G) && (false == TestFlag(brakes.availableDelays, bdelay_R) || Power > 1.0)) // ustalanie srednicy przewodu glownego (lokomotywa lub napędowy
|
||||
brakes.pipeSection = 0.792;
|
||||
if (true == TestFlag(brakes.config.availableDelays, bdelay_G) && (false == TestFlag(brakes.config.availableDelays, bdelay_R) || Power > 1.0)) // ustalanie srednicy przewodu glownego (lokomotywa lub napędowy
|
||||
brakes.config.pipeSection = 0.792;
|
||||
else
|
||||
brakes.pipeSection = 0.507;
|
||||
brakes.config.pipeSection = 0.507;
|
||||
// WriteLog("SPG = " + FloatToStr(Spg));
|
||||
|
||||
brakePipe.reservoir = std::make_shared<TReservoir>();
|
||||
mainPipe.reservoir = std::make_shared<TReservoir>(); // zabezpieczenie, bo sie PG wywala... :(
|
||||
brakePipe.reservoir->CreateCap((std::max(Dim.L, 14.0) + 0.5) * brakes.pipeSection * 1); // dlugosc x przekroj x odejscia i takie tam
|
||||
mainPipe.reservoir->CreateCap((std::max(Dim.L, 14.0) + 0.5) * brakes.pipeSection * 1);
|
||||
brakePipe.reservoir->CreateCap((std::max(Dim.L, 14.0) + 0.5) * brakes.config.pipeSection * 1); // dlugosc x przekroj x odejscia i takie tam
|
||||
mainPipe.reservoir->CreateCap((std::max(Dim.L, 14.0) + 0.5) * brakes.config.pipeSection * 1);
|
||||
if (!brakes.spring.cylinder)
|
||||
{
|
||||
brakes.spring.cylinder = std::make_shared<TReservoir>();
|
||||
@@ -447,19 +447,19 @@ void physics::Vehicle::SetReadyToDepart()
|
||||
void physics::Vehicle::SetBraked()
|
||||
{
|
||||
WriteLog("Braked");
|
||||
brakes.reservoirAir = brakes.valveVolume * brakes.maxCylinderPressure[3];
|
||||
brakes.reservoirAir = brakes.config.valveVolume * brakes.config.maxCylinderPressure[3];
|
||||
air.Fill(air.config.mainReservoirVolume * air.compressor.config.minPressure * 0.55);
|
||||
/*
|
||||
ScndPipePress = 5.1;
|
||||
*/
|
||||
mainPipe.SetPressure(InitialScndPipePress(5.1));
|
||||
brakePipe.SetPressure(brakes.pipeLowPressure);
|
||||
brakes.pipeCylinderPressure = brakes.maxCylinderPressure[3] * 0.5;
|
||||
brakes.cylinderPressure = brakes.maxCylinderPressure[3] * 0.5;
|
||||
brakePipe.SetPressure(brakes.config.pipeLowPressure);
|
||||
brakes.pipeCylinderPressure = brakes.config.maxCylinderPressure[3] * 0.5;
|
||||
brakes.cylinderPressure = brakes.config.maxCylinderPressure[3] * 0.5;
|
||||
brakes.independentPosition = 0.0;
|
||||
brakes.handlePosition = static_cast<int>(brakes.driverValve->GetPos(bh_NP));
|
||||
brakes.pipeLimiterPressure = brakes.pipeLowPressure;
|
||||
if (brakes.localKind == TLocalBrake::ManualBrake || brakes.hasHandBrake == true)
|
||||
brakes.pipeLimiterPressure = brakes.config.pipeLowPressure;
|
||||
if (brakes.config.localKind == TLocalBrake::ManualBrake || brakes.config.hasHandBrake == true)
|
||||
{
|
||||
IncManualBrakeLevel(ManualBrakePosNo);
|
||||
}
|
||||
|
||||
@@ -1199,7 +1199,7 @@ double physics::Vehicle::InductionMotorBrakeRatio(double const ActiveInverters,
|
||||
// ustalanie współczynnika blendingu do luzowania hamulca PN
|
||||
if (inductionMotor.state.maxForce * Sign(V) * DirAbsolute < -1)
|
||||
{
|
||||
PosRatio = -Sign(V) * DirAbsolute * inductionMotor.state.force / (inductionMotor.braking.maxForce * std::max(edBCP, std::max(0.01, brakes.distributor->GetEDBCP())) / brakes.maxCylinderPressure[0]);
|
||||
PosRatio = -Sign(V) * DirAbsolute * inductionMotor.state.force / (inductionMotor.braking.maxForce * std::max(edBCP, std::max(0.01, brakes.distributor->GetEDBCP())) / brakes.config.maxCylinderPressure[0]);
|
||||
PosRatio = std::clamp(PosRatio, 0.0, 1.0);
|
||||
}
|
||||
else
|
||||
@@ -1225,13 +1225,13 @@ double physics::Vehicle::InductionMotorBrakeRatio(double const ActiveInverters,
|
||||
// w trybie split LocalBrake nie zaleca ED; uzywany jest DynamicBrakeCtrl
|
||||
// oraz zwykle zapotrzebowanie z hamulca zespolonego (edBCP)
|
||||
double const edLeverDemand = DynamicBrakeRatio();
|
||||
PosRatio = -std::max(std::max(edLeverDemand, std::min(edBCP / brakes.maxCylinderPressure[0], 1.0)), AnPos) * vhRamp;
|
||||
inductionMotor.state.forceDemand = -std::min(1.0, std::max(edLeverDemand, edBCP / brakes.maxCylinderPressure[0]));
|
||||
PosRatio = -std::max(std::max(edLeverDemand, std::min(edBCP / brakes.config.maxCylinderPressure[0], 1.0)), AnPos) * vhRamp;
|
||||
inductionMotor.state.forceDemand = -std::min(1.0, std::max(edLeverDemand, edBCP / brakes.config.maxCylinderPressure[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
PosRatio = -std::max(std::min(edBCP * 1.0 / brakes.maxCylinderPressure[0], 1.0), AnPos) * vhRamp;
|
||||
inductionMotor.state.forceDemand = -std::min(1.0, std::max(LocalBrakeRatio(), edBCP / brakes.maxCylinderPressure[0]));
|
||||
PosRatio = -std::max(std::min(edBCP * 1.0 / brakes.config.maxCylinderPressure[0], 1.0), AnPos) * vhRamp;
|
||||
inductionMotor.state.forceDemand = -std::min(1.0, std::max(LocalBrakeRatio(), edBCP / brakes.config.maxCylinderPressure[0]));
|
||||
}
|
||||
}
|
||||
return PosRatio;
|
||||
|
||||
+30
-30
@@ -77,7 +77,7 @@ void physics::ConsistBrakeBlending::SetControl(Step &state, Vehicle &Lead, Input
|
||||
state.eimic = -1.0;
|
||||
Lead.SendCtrlToNext(VehicleCommand::integratedController, std::max(0., state.eimic), Lead.CabActive);
|
||||
state.LBR = std::max(-state.eimic, 0.);
|
||||
state.eim_lb = Given.aiDriving || !Lead.brakes.independentTraxx ? 0 : Lead.eim_localbrake;
|
||||
state.eim_lb = Given.aiDriving || !Lead.brakes.config.independentTraxx ? 0 : Lead.eim_localbrake;
|
||||
}
|
||||
|
||||
// steps 1-2 of the blending: the masses and the most braking forces, pneumatic and ED, summed over the consist
|
||||
@@ -97,18 +97,18 @@ void physics::ConsistBrakeBlending::SumForces(Step &state, std::vector<Vehicle *
|
||||
{
|
||||
++state.np;
|
||||
state.masamax +=
|
||||
vehicle->brakes.maxPressureMass
|
||||
+ ( vehicle->brakes.maxPressureMass > 1.0 ?
|
||||
vehicle->brakes.config.maxPressureMass
|
||||
+ ( vehicle->brakes.config.maxPressureMass > 1.0 ?
|
||||
0.0 :
|
||||
vehicle->Mass )
|
||||
+ vehicle->Mred;
|
||||
auto const Nmax = ((vehicle->brakes.pressureToForce * vehicle->brakes.maxCylinderPressure[0] -
|
||||
vehicle->brakes.cylinders.springForce) *
|
||||
vehicle->brakes.cylinders.leverRatio[0] -
|
||||
vehicle->brakes.cylinders.slackAdjusterForce) *
|
||||
vehicle->brakes.cylinders.count * vehicle->brakes.cylinders.riggingEfficiency;
|
||||
auto const Nmax = ((vehicle->brakes.config.pressureToForce * vehicle->brakes.config.maxCylinderPressure[0] -
|
||||
vehicle->brakes.config.cylinders.springForce) *
|
||||
vehicle->brakes.config.cylinders.leverRatio[0] -
|
||||
vehicle->brakes.config.cylinders.slackAdjusterForce) *
|
||||
vehicle->brakes.config.cylinders.count * vehicle->brakes.config.cylinders.riggingEfficiency;
|
||||
state.FmaxPN += Nmax * vehicle->brakes.distributor->GetFC(
|
||||
Nmax / (vehicle->NAxles * vehicle->brakes.blocksPerAxle),
|
||||
Nmax / (vehicle->NAxles * vehicle->brakes.config.blocksPerAxle),
|
||||
vehicle->brakes.blending.referenceSpeed) *
|
||||
1000; // sila hamowania pn
|
||||
state.FmaxED += vehicle->lineBreaker.IsClosed() && vehicle->DirActive != 0 && vehicle->inductionMotor.inverterRatio == 1.0 &&
|
||||
@@ -132,9 +132,9 @@ void physics::ConsistBrakeBlending::SumForces(Step &state, std::vector<Vehicle *
|
||||
void physics::ConsistBrakeBlending::ComputeDeceleration(Step &state, Vehicle const &Lead)
|
||||
{
|
||||
double RapidMult = 1.0;
|
||||
if ((Lead.brakes.availableDelays & bdelay_P + bdelay_R) == bdelay_P + bdelay_R
|
||||
if ((Lead.brakes.config.availableDelays & bdelay_P + bdelay_R) == bdelay_P + bdelay_R
|
||||
&& Lead.brakes.delaySetting & bdelay_P)
|
||||
RapidMult = Lead.brakes.rapidRatio;
|
||||
RapidMult = Lead.brakes.config.rapidRatio;
|
||||
|
||||
state.amax = RapidMult * std::min(state.FmaxPN / state.masamax, Lead.brakes.blending.maxDeceleration);
|
||||
|
||||
@@ -215,7 +215,7 @@ void physics::ConsistBrakeBlending::ComputeElectrodynamicDemand(Step &state, Veh
|
||||
{
|
||||
state.FzadED = 0.0;
|
||||
if( state.LBR > Lead.brakes.blending.minEdDemand
|
||||
&& ( Lead.brakes.driverValveType == TBrakeHandle::MHZ_EN57 ?
|
||||
&& ( Lead.brakes.config.driverValveType == TBrakeHandle::MHZ_EN57 ?
|
||||
(Lead.brakes.operatingMode & bom_MED) != 0 :
|
||||
Lead.EpFuse ) ) {
|
||||
state.FzadED = std::min( state.Fzad, state.FmaxED );
|
||||
@@ -273,14 +273,14 @@ void physics::ConsistBrakeBlending::DistributeForces(Step &state, Vehicle const
|
||||
int i = 0;
|
||||
for (auto *vehicle : Consist)
|
||||
{
|
||||
auto const Nmax = ((vehicle->brakes.pressureToForce * vehicle->brakes.maxCylinderPressure[0] -
|
||||
vehicle->brakes.cylinders.springForce) *
|
||||
vehicle->brakes.cylinders.leverRatio[0] -
|
||||
vehicle->brakes.cylinders.slackAdjusterForce) *
|
||||
vehicle->brakes.cylinders.count * vehicle->brakes.cylinders.riggingEfficiency;
|
||||
auto const Nmax = ((vehicle->brakes.config.pressureToForce * vehicle->brakes.config.maxCylinderPressure[0] -
|
||||
vehicle->brakes.config.cylinders.springForce) *
|
||||
vehicle->brakes.config.cylinders.leverRatio[0] -
|
||||
vehicle->brakes.config.cylinders.slackAdjusterForce) *
|
||||
vehicle->brakes.config.cylinders.count * vehicle->brakes.config.cylinders.riggingEfficiency;
|
||||
FmaxEP[i] = Nmax *
|
||||
vehicle->brakes.distributor->GetFC(
|
||||
Nmax / (vehicle->NAxles * vehicle->brakes.blocksPerAxle),
|
||||
Nmax / (vehicle->NAxles * vehicle->brakes.config.blocksPerAxle),
|
||||
vehicle->brakes.blending.referenceSpeed) *
|
||||
1000; // sila hamowania pn
|
||||
|
||||
@@ -333,11 +333,11 @@ void physics::ConsistBrakeBlending::DistributeForces(Step &state, Vehicle const
|
||||
i = 0;
|
||||
for (auto *vehicle : Consist)
|
||||
{
|
||||
float Nmax = ((vehicle->brakes.pressureToForce * vehicle->brakes.maxCylinderPressure[0] -
|
||||
vehicle->brakes.cylinders.springForce) *
|
||||
vehicle->brakes.cylinders.leverRatio[0] -
|
||||
vehicle->brakes.cylinders.slackAdjusterForce) *
|
||||
vehicle->brakes.cylinders.count * vehicle->brakes.cylinders.riggingEfficiency;
|
||||
float Nmax = ((vehicle->brakes.config.pressureToForce * vehicle->brakes.config.maxCylinderPressure[0] -
|
||||
vehicle->brakes.config.cylinders.springForce) *
|
||||
vehicle->brakes.config.cylinders.leverRatio[0] -
|
||||
vehicle->brakes.config.cylinders.slackAdjusterForce) *
|
||||
vehicle->brakes.config.cylinders.count * vehicle->brakes.config.cylinders.riggingEfficiency;
|
||||
if (state.FrED > 0.1)
|
||||
vehicle->brakes.blending.epCorrectionTimer = 0;
|
||||
else
|
||||
@@ -346,23 +346,23 @@ void physics::ConsistBrakeBlending::DistributeForces(Step &state, Vehicle const
|
||||
float VelC = EPVC ? safe_clamp(vehicle->Vel, vehicle->brakes.blending.minSpeed, vehicle->brakes.blending.maxSpeed) : vehicle->brakes.blending.referenceSpeed;//korekcja EP po prędkości
|
||||
float FmaxPoj = Nmax *
|
||||
vehicle->brakes.distributor->GetFC(
|
||||
Nmax / (vehicle->NAxles * vehicle->brakes.blocksPerAxle), VelC) *
|
||||
Nmax / (vehicle->NAxles * vehicle->brakes.config.blocksPerAxle), VelC) *
|
||||
1000; // sila hamowania pn
|
||||
vehicle->brakes.independentPositionEim = FzEP[i] / FmaxPoj;
|
||||
if (vehicle->brakes.independentPositionEim>0.009)
|
||||
if (vehicle->brakes.pressureToForce * vehicle->brakes.cylinders.leverRatio[0] *
|
||||
vehicle->brakes.maxCylinderPressure[0] != 0)
|
||||
if (vehicle->brakes.config.pressureToForce * vehicle->brakes.config.cylinders.leverRatio[0] *
|
||||
vehicle->brakes.config.maxCylinderPressure[0] != 0)
|
||||
{
|
||||
float x = (vehicle->brakes.cylinders.slackAdjusterForce / vehicle->brakes.cylinders.leverRatio[0] +
|
||||
vehicle->brakes.cylinders.springForce) / (vehicle->brakes.pressureToForce *
|
||||
vehicle->brakes.maxCylinderPressure[0]);
|
||||
float x = (vehicle->brakes.config.cylinders.slackAdjusterForce / vehicle->brakes.config.cylinders.leverRatio[0] +
|
||||
vehicle->brakes.config.cylinders.springForce) / (vehicle->brakes.config.pressureToForce *
|
||||
vehicle->brakes.config.maxCylinderPressure[0]);
|
||||
vehicle->brakes.independentPositionEim = x + (1 - x) * vehicle->brakes.independentPositionEim;
|
||||
}
|
||||
else
|
||||
vehicle->brakes.independentPositionEim = vehicle->brakes.independentPositionEim;
|
||||
else
|
||||
vehicle->brakes.independentPositionEim = 0;
|
||||
if (vehicle->brakes.independentTraxx)
|
||||
if (vehicle->brakes.config.independentTraxx)
|
||||
{
|
||||
vehicle->eim_localbrake = state.eim_lb;
|
||||
vehicle->brakes.independentPositionEim = std::max(vehicle->brakes.independentPositionEim, state.eim_lb);
|
||||
|
||||
+1
-1
@@ -1561,7 +1561,7 @@ class Vehicle
|
||||
// car, as the EN57 s car does). it's the vehicle type's, unlike the cab the scenario puts a driver in
|
||||
bool HasDriverCab() const
|
||||
{
|
||||
return brakes.driverValveType != TBrakeHandle::NoHandle;
|
||||
return brakes.config.driverValveType != TBrakeHandle::NoHandle;
|
||||
}
|
||||
// whether the cab command opening the main circuit opens it where the only cab switch of the circuit is the button
|
||||
// closing it: on a diesel that's the starter button, and the command is the one way to stop an engine whose fuel pump
|
||||
|
||||
+30
-30
@@ -145,46 +145,46 @@ std::vector<channel> parameters() {
|
||||
{"BearingType", [](auto const &M) { return M.BearingType; }},
|
||||
{"ADist", [](auto const &M) { return M.ADist; }},
|
||||
{"BDist", [](auto const &M) { return M.BDist; }},
|
||||
{"NBpA", [](auto const &M) { return M.brakes.blocksPerAxle; }},
|
||||
{"NBpA", [](auto const &M) { return M.brakes.config.blocksPerAxle; }},
|
||||
{"SandCapacity", [](auto const &M) { return M.SandCapacity; }},
|
||||
{"BrakeSystem", [](auto const &M) { return static_cast<int>(M.brakes.kind); }},
|
||||
{"BrakeValve", [](auto const &M) { return static_cast<int>(M.brakes.distributorType); }},
|
||||
{"BrakeHandle", [](auto const &M) { return static_cast<int>(M.brakes.driverValveType); }},
|
||||
{"BrakeLocHandle", [](auto const &M) { return static_cast<int>(M.brakes.independentValveType); }},
|
||||
{"LocalBrake", [](auto const &M) { return static_cast<int>(M.brakes.localKind); }},
|
||||
{"ASBType", [](auto const &M) { return M.brakes.antiSlipType; }},
|
||||
{"MaxBrakeForce", [](auto const &M) { return M.brakes.maxForce; }},
|
||||
{"P2FTrans", [](auto const &M) { return M.brakes.pressureToForce; }},
|
||||
{"BrakeMethod", [](auto const &M) { return M.brakes.method; }},
|
||||
{"HighPipePress", [](auto const &M) { return M.brakes.pipeHighPressure; }},
|
||||
{"LowPipePress", [](auto const &M) { return M.brakes.pipeLowPressure; }},
|
||||
{"DeltaPipePress", [](auto const &M) { return M.brakes.pipePressureRange; }},
|
||||
{"BrakeSystem", [](auto const &M) { return static_cast<int>(M.brakes.config.kind); }},
|
||||
{"BrakeValve", [](auto const &M) { return static_cast<int>(M.brakes.config.distributorType); }},
|
||||
{"BrakeHandle", [](auto const &M) { return static_cast<int>(M.brakes.config.driverValveType); }},
|
||||
{"BrakeLocHandle", [](auto const &M) { return static_cast<int>(M.brakes.config.independentValveType); }},
|
||||
{"LocalBrake", [](auto const &M) { return static_cast<int>(M.brakes.config.localKind); }},
|
||||
{"ASBType", [](auto const &M) { return M.brakes.config.antiSlipType; }},
|
||||
{"MaxBrakeForce", [](auto const &M) { return M.brakes.config.maxForce; }},
|
||||
{"P2FTrans", [](auto const &M) { return M.brakes.config.pressureToForce; }},
|
||||
{"BrakeMethod", [](auto const &M) { return M.brakes.config.method; }},
|
||||
{"HighPipePress", [](auto const &M) { return M.brakes.config.pipeHighPressure; }},
|
||||
{"LowPipePress", [](auto const &M) { return M.brakes.config.pipeLowPressure; }},
|
||||
{"DeltaPipePress", [](auto const &M) { return M.brakes.config.pipePressureRange; }},
|
||||
{"CntrlPipePress", [](auto const &M) { return M.brakes.controlReservoirPressure; }},
|
||||
{"BrakeVolume", [](auto const &M) { return M.brakes.cylinderVolume; }},
|
||||
{"BrakeVVolume", [](auto const &M) { return M.brakes.valveVolume; }},
|
||||
{"BrakeVolume", [](auto const &M) { return M.brakes.config.cylinderVolume; }},
|
||||
{"BrakeVVolume", [](auto const &M) { return M.brakes.config.valveVolume; }},
|
||||
{"VeselVolume", [](auto const &M) { return M.air.config.mainReservoirVolume; }},
|
||||
{"BrakeCylNo", [](auto const &M) { return M.brakes.cylinders.count; }},
|
||||
{"BrakeCylRadius", [](auto const &M) { return M.brakes.cylinders.radius; }},
|
||||
{"BrakeCylDist", [](auto const &M) { return M.brakes.cylinders.stroke; }},
|
||||
{"BrakeCylSpring", [](auto const &M) { return M.brakes.cylinders.springForce; }},
|
||||
{"BrakeSlckAdj", [](auto const &M) { return M.brakes.cylinders.slackAdjusterForce; }},
|
||||
{"BrakeRigEff", [](auto const &M) { return M.brakes.cylinders.riggingEfficiency; }},
|
||||
{"RapidMult", [](auto const &M) { return M.brakes.rapidRatio; }},
|
||||
{"RapidVel", [](auto const &M) { return M.brakes.rapidSpeed; }},
|
||||
{"BrakeValveSize", [](auto const &M) { return M.brakes.distributorSize; }},
|
||||
{"BrakeCylNo", [](auto const &M) { return M.brakes.config.cylinders.count; }},
|
||||
{"BrakeCylRadius", [](auto const &M) { return M.brakes.config.cylinders.radius; }},
|
||||
{"BrakeCylDist", [](auto const &M) { return M.brakes.config.cylinders.stroke; }},
|
||||
{"BrakeCylSpring", [](auto const &M) { return M.brakes.config.cylinders.springForce; }},
|
||||
{"BrakeSlckAdj", [](auto const &M) { return M.brakes.config.cylinders.slackAdjusterForce; }},
|
||||
{"BrakeRigEff", [](auto const &M) { return M.brakes.config.cylinders.riggingEfficiency; }},
|
||||
{"RapidMult", [](auto const &M) { return M.brakes.config.rapidRatio; }},
|
||||
{"RapidVel", [](auto const &M) { return M.brakes.config.rapidSpeed; }},
|
||||
{"BrakeValveSize", [](auto const &M) { return M.brakes.config.distributorSize; }},
|
||||
{"MinCompressor", [](auto const &M) { return M.air.compressor.config.minPressure; }},
|
||||
{"MaxCompressor", [](auto const &M) { return M.air.compressor.config.maxPressure; }},
|
||||
{"CompressorSpeed", [](auto const &M) { return M.air.compressor.config.speed; }},
|
||||
{"EmergencyValveOn", [](auto const &M) { return M.brakes.emergencyValve.onPressure; }},
|
||||
{"AirLeakRate", [](auto const &M) { return M.air.config.leakRate; }},
|
||||
{"BrakeCtrlPosNo", [](auto const &M) { return M.brakes.handlePositions; }},
|
||||
{"BrakeCtrlPosNo", [](auto const &M) { return M.brakes.config.handlePositions; }},
|
||||
{"MainCtrlPosNo", [](auto const &M) { return M.MainCtrlPosNo; }},
|
||||
{"ScndCtrlPosNo", [](auto const &M) { return M.ScndCtrlPosNo; }},
|
||||
{"LightsPosNo", [](auto const &M) { return M.LightsPosNo; }},
|
||||
{"MBrake", [](auto const &M) { return M.brakes.hasHandBrake ? 1.0 : 0.0; }},
|
||||
{"MBrake", [](auto const &M) { return M.brakes.config.hasHandBrake ? 1.0 : 0.0; }},
|
||||
{"StopBrakeDecc", [](auto const &M) { return M.brakes.holding.deceleration; }},
|
||||
{"BrakeDelays", [](auto const &M) { return M.brakes.availableDelays; }},
|
||||
{"BrakeOpModes", [](auto const &M) { return M.brakes.availableOperatingModes; }},
|
||||
{"BrakeDelays", [](auto const &M) { return M.brakes.config.availableDelays; }},
|
||||
{"BrakeOpModes", [](auto const &M) { return M.brakes.config.availableOperatingModes; }},
|
||||
{"Imin", [](auto const &M) { return M.Imin; }},
|
||||
{"Imax", [](auto const &M) { return M.Imax; }},
|
||||
{"EIMCtrlType", [](auto const &M) { return M.EIMCtrlType; }},
|
||||
@@ -192,10 +192,10 @@ std::vector<channel> parameters() {
|
||||
{"PantVolume", [](auto const &M) { return M.pantographAir.Volume(); }},
|
||||
};
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
result.emplace_back(std::format("MaxBrakePress{}", i), [i](auto const &M) { return M.brakes.maxCylinderPressure[i]; });
|
||||
result.emplace_back(std::format("MaxBrakePress{}", i), [i](auto const &M) { return M.brakes.config.maxCylinderPressure[i]; });
|
||||
}
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
result.emplace_back(std::format("BrakeCylMult{}", i), [i](auto const &M) { return M.brakes.cylinders.leverRatio[i]; });
|
||||
result.emplace_back(std::format("BrakeCylMult{}", i), [i](auto const &M) { return M.brakes.config.cylinders.leverRatio[i]; });
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ bool electric(physics::Vehicle const &M) {
|
||||
|
||||
double max_brake_press(physics::Vehicle const &M) {
|
||||
auto result{0.0};
|
||||
for (auto const press : M.brakes.maxCylinderPressure) {
|
||||
for (auto const press : M.brakes.config.maxCylinderPressure) {
|
||||
result = std::max(result, press);
|
||||
}
|
||||
return result;
|
||||
@@ -115,7 +115,7 @@ std::vector<invariant> const &invariants() {
|
||||
},
|
||||
[](auto const &M) { return values({{"V", M.V}, {"AccS", M.AccS}}); }},
|
||||
{"hand brake applied, the wheels braked on the move",
|
||||
[](auto const &M, double, auto const *) { return false == M.brakes.hasHandBrake || M.brakes.handBrakePosition == 0 || std::abs(M.V) < 0.5 || std::abs(M.Fb) > 0.0; },
|
||||
[](auto const &M, double, auto const *) { return false == M.brakes.config.hasHandBrake || M.brakes.handBrakePosition == 0 || std::abs(M.V) < 0.5 || std::abs(M.Fb) > 0.0; },
|
||||
[](auto const &M) { return values({{"ManualBrakePos", M.brakes.handBrakePosition}, {"V", M.V}, {"Fb", M.Fb}}); }},
|
||||
};
|
||||
return rules;
|
||||
|
||||
@@ -79,7 +79,7 @@ TEST_CASE("brake cycle: every brake delay setting of the real vehicles") {
|
||||
test::reseed_random();
|
||||
vehicle probe{definition::fiz(path)};
|
||||
for (auto const delay : {bdelay_G, bdelay_P, bdelay_R, bdelay_R + bdelay_M, bdelay_G + bdelay_M}) {
|
||||
if ((probe->brakes.availableDelays & delay) != delay || delay == probe->brakes.delaySetting) {
|
||||
if ((probe->brakes.config.availableDelays & delay) != delay || delay == probe->brakes.delaySetting) {
|
||||
continue;
|
||||
}
|
||||
CAPTURE(delay);
|
||||
|
||||
@@ -24,7 +24,7 @@ std::vector<test::channel> handle_channels() {
|
||||
|
||||
// the vehicles with a driver's brake handle
|
||||
bool has_handle(vehicle &Vehicle) {
|
||||
return Vehicle->brakes.handlePositions > 1;
|
||||
return Vehicle->brakes.config.handlePositions > 1;
|
||||
}
|
||||
|
||||
void hold(vehicle &Vehicle, test::trace &Trace, std::string const &Event, double Position, double Seconds) {
|
||||
@@ -171,7 +171,7 @@ void ready_knorr_ep(test::consist &Unit) {
|
||||
Unit.add(definition::fiz("en57_v1/6bai"), 1);
|
||||
Unit.add(definition::fiz("en57_v1/5bgb"));
|
||||
auto &cab{Unit[0]};
|
||||
REQUIRE(cab->brakes.driverValveType == TBrakeHandle::St113);
|
||||
REQUIRE(cab->brakes.config.driverValveType == TBrakeHandle::St113);
|
||||
REQUIRE(cab->brakes.driverValve != nullptr);
|
||||
cab->BatterySwitch(true);
|
||||
cab->CabActivisation();
|
||||
@@ -210,7 +210,7 @@ TEST_CASE("brake handles: the positions of the Knorr St113 EP brake") {
|
||||
CHECK(handle.GetPos(bh_RP) == doctest::Approx(0.0));
|
||||
CHECK(ep_at(unit, 0.0) == doctest::Approx(-1.0)); // EP release
|
||||
CHECK(ep_at(unit, 1.0) == doctest::Approx(1.0)); // EP brake
|
||||
CHECK(ep_at(unit, cab->brakes.handlePositions / 2) == doctest::Approx(0.0)); // lap, Num 5
|
||||
CHECK(ep_at(unit, cab->brakes.config.handlePositions / 2) == doctest::Approx(0.0)); // lap, Num 5
|
||||
CHECK(ep_at(unit, handle.GetPos(bh_FB)) == doctest::Approx(0.0));
|
||||
CHECK(ep_at(unit, handle.GetPos(bh_EPR)) == doctest::Approx(-1.0));
|
||||
CHECK(ep_at(unit, handle.GetPos(bh_EPB)) == doctest::Approx(1.0));
|
||||
@@ -281,7 +281,7 @@ struct st113_sample {
|
||||
std::vector<st113_sample> st113_run() {
|
||||
test::reseed_random();
|
||||
vehicle real{definition::fiz("en57_v1/6bai")};
|
||||
REQUIRE(real->brakes.driverValveType == TBrakeHandle::St113);
|
||||
REQUIRE(real->brakes.config.driverValveType == TBrakeHandle::St113);
|
||||
REQUIRE(real->brakes.driverValve != nullptr);
|
||||
real.hold_main_reservoir(std::max(real->air.compressor.config.maxPressure, 8.0));
|
||||
auto &handle{*real->brakes.driverValve};
|
||||
|
||||
@@ -22,8 +22,8 @@ void freight_train(test::consist &Train, int const Wagons) {
|
||||
for (int i = 0; i < Wagons; ++i) {
|
||||
auto &wagon{Train.add(definition::fiz("3wl_v2/3wl"))};
|
||||
wagon->BrakeDelaySwitch(bdelay_G);
|
||||
REQUIRE(wagon->brakes.distributorType == TBrakeValve::ESt3);
|
||||
REQUIRE(wagon->brakes.pipeSection == doctest::Approx(0.792)); // the pipe of a freight wagon
|
||||
REQUIRE(wagon->brakes.config.distributorType == TBrakeValve::ESt3);
|
||||
REQUIRE(wagon->brakes.config.pipeSection == doctest::Approx(0.792)); // the pipe of a freight wagon
|
||||
}
|
||||
Train[0].hold_brake_pipe(5.0); // the locomotive's driver's valve in the running position
|
||||
}
|
||||
@@ -33,7 +33,7 @@ void passenger_train(test::consist &Train, int const Cars) {
|
||||
Train.add(definition::fiz("st44_v2/m62-1151"));
|
||||
for (int i = 0; i < Cars; ++i) {
|
||||
auto &car{Train.add(definition::fiz("11xa_v2/93a"))};
|
||||
REQUIRE(car->brakes.pipeSection == doctest::Approx(0.507)); // the pipe of a passenger car
|
||||
REQUIRE(car->brakes.config.pipeSection == doctest::Approx(0.507)); // the pipe of a passenger car
|
||||
}
|
||||
Train[0].hold_brake_pipe(5.0);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ TEST_CASE("brakes: a dead EN57 hauled with the brake hose alone charges from the
|
||||
// a unit standing dead: no air anywhere, nothing in its main reservoir pipe
|
||||
for (std::size_t i = 1; i < train.size(); ++i) {
|
||||
auto &car{train[i].physics()};
|
||||
REQUIRE(car.brakes.distributorType == TBrakeValve::EP2);
|
||||
REQUIRE(car.brakes.config.distributorType == TBrakeValve::EP2);
|
||||
car.brakes.distributor->ForceEmptiness();
|
||||
car.brakePipe.reservoir->CreatePress(0.0);
|
||||
car.brakePipe.reservoir->Act();
|
||||
|
||||
@@ -9,13 +9,13 @@ using test::vehicle;
|
||||
|
||||
TEST_CASE("cntrl: the brake delays of the settings come from BDelay1 to BDelay4") {
|
||||
vehicle wagon{definition::load("wagon").set("Cntrl", "BDelay1", 10.0).set("Cntrl", "BDelay2", 20.0).set("Cntrl", "BDelay3", 30.0).set("Cntrl", "BDelay4", 40.0)};
|
||||
CHECK(wagon->brakes.delays[0] == doctest::Approx(10.0));
|
||||
CHECK(wagon->brakes.config.delays[0] == doctest::Approx(10.0));
|
||||
// the vehicle varies the others a little, by 0.83 to 0.9 (CheckLocomotiveParameters())
|
||||
for (auto setting{1}; setting < 4; ++setting) {
|
||||
CAPTURE(setting);
|
||||
auto const given{10.0 * (setting + 1)};
|
||||
CHECK(wagon->brakes.delays[setting] >= 0.83 * given);
|
||||
CHECK(wagon->brakes.delays[setting] <= 0.9 * given);
|
||||
CHECK(wagon->brakes.config.delays[setting] >= 0.83 * given);
|
||||
CHECK(wagon->brakes.config.delays[setting] <= 0.9 * given);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -300,7 +300,7 @@ TEST_CASE("crew: the power an integrated handle asked for goes when the driver l
|
||||
TEST_CASE("crew: a road vehicle left by its driver gets the brake the driver stops it with") {
|
||||
test::reseed_random();
|
||||
vehicle bus{definition::fiz("road/man/nl293"), 40.0, "bus", 1};
|
||||
REQUIRE(bus->brakes.kind == TBrakeSystem::Individual);
|
||||
REQUIRE(bus->brakes.config.kind == TBrakeSystem::Individual);
|
||||
REQUIRE(bus->brakes.independentPosition == 0.0);
|
||||
bus->CabActivisation();
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ TEST_CASE("definition: the wagon from data/wagon.json loads with its values") {
|
||||
CHECK(wagon->Dim.L == doctest::Approx(26.8));
|
||||
CHECK(wagon->WheelDiameter == doctest::Approx(0.96));
|
||||
CHECK(wagon->NAxles == 4);
|
||||
CHECK(wagon->brakes.maxCylinderPressure[3] == doctest::Approx(3.8));
|
||||
CHECK(wagon->brakes.kind == TBrakeSystem::Pneumatic);
|
||||
CHECK(wagon->brakes.config.maxCylinderPressure[3] == doctest::Approx(3.8));
|
||||
CHECK(wagon->brakes.config.kind == TBrakeSystem::Pneumatic);
|
||||
}
|
||||
|
||||
TEST_CASE("definition: keys set by the test reach the vehicle") {
|
||||
@@ -63,7 +63,7 @@ TEST_CASE("definition: lines the loader skips or trims: comments, a hash anywher
|
||||
REQUIRE(wagon.LoadFIZ_Text(crlf));
|
||||
CHECK(wagon.Mass == doctest::Approx(42200.0));
|
||||
CHECK(wagon.Vmax == doctest::Approx(120.0));
|
||||
CHECK(wagon.brakes.maxCylinderPressure[3] == doctest::Approx(3.8));
|
||||
CHECK(wagon.brakes.config.maxCylinderPressure[3] == doctest::Approx(3.8));
|
||||
}
|
||||
|
||||
TEST_CASE("definition: a compressor list, whose positions allow the compressor and scale its speed and limits") {
|
||||
|
||||
@@ -99,7 +99,7 @@ TEST_CASE("driving aid: the Elf leaves out the local brake it has no control of,
|
||||
vehicle elf{definition::fiz("elf_v1/21we-a"), 60.0 /* km/h */, "elf", 1};
|
||||
REQUIRE(elf->EIMCtrlType == 2);
|
||||
// the definition has a local brake (LocalBrake=PneumaticBrake, LocBrakeHandle=FD1), the cab no control of it
|
||||
REQUIRE(elf->brakes.localKind == TLocalBrake::PneumaticBrake);
|
||||
REQUIRE(elf->brakes.config.localKind == TLocalBrake::PneumaticBrake);
|
||||
|
||||
auto const idle{read(elf, elf_cab)};
|
||||
CHECK_FALSE(idle.show_local_brake);
|
||||
|
||||
@@ -301,11 +301,11 @@ void hold(elf &Unit, bool Hold) {
|
||||
auto const force{Unit.cab().brakes.holding.deceleration * mass};
|
||||
for (std::size_t i = 0; i < Unit.unit.size(); ++i) {
|
||||
auto &car{Unit.car(i)};
|
||||
auto const nmax{((car.brakes.pressureToForce * car.brakes.maxCylinderPressure[0] - car.brakes.cylinders.springForce) * car.brakes.cylinders.leverRatio[0] - car.brakes.cylinders.slackAdjusterForce) * car.brakes.cylinders.count * car.brakes.cylinders.riggingEfficiency};
|
||||
auto const fmax{nmax * car.brakes.distributor->GetFC(nmax / (car.NAxles * car.brakes.blocksPerAxle), car.brakes.blending.referenceSpeed) * 1000};
|
||||
auto const nmax{((car.brakes.config.pressureToForce * car.brakes.config.maxCylinderPressure[0] - car.brakes.config.cylinders.springForce) * car.brakes.config.cylinders.leverRatio[0] - car.brakes.config.cylinders.slackAdjusterForce) * car.brakes.config.cylinders.count * car.brakes.config.cylinders.riggingEfficiency};
|
||||
auto const fmax{nmax * car.brakes.distributor->GetFC(nmax / (car.NAxles * car.brakes.config.blocksPerAxle), car.brakes.blending.referenceSpeed) * 1000};
|
||||
auto position{Hold ? force * car.NAxles / axles / fmax : 0.0};
|
||||
if (position > 0.009) {
|
||||
auto const slack{(car.brakes.cylinders.slackAdjusterForce / car.brakes.cylinders.leverRatio[0] + car.brakes.cylinders.springForce) / (car.brakes.pressureToForce * car.brakes.maxCylinderPressure[0])};
|
||||
auto const slack{(car.brakes.config.cylinders.slackAdjusterForce / car.brakes.config.cylinders.leverRatio[0] + car.brakes.config.cylinders.springForce) / (car.brakes.config.pressureToForce * car.brakes.config.maxCylinderPressure[0])};
|
||||
position = slack + (1 - slack) * position;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -64,7 +64,7 @@ struct times {
|
||||
times measure(int const Delay, int const Lever) {
|
||||
test::reseed_random();
|
||||
vehicle wagon{fas_413s()};
|
||||
REQUIRE(wagon->brakes.distributorType == TBrakeValve::ESt3AL2);
|
||||
REQUIRE(wagon->brakes.config.distributorType == TBrakeValve::ESt3AL2);
|
||||
if (wagon->brakes.delaySetting != Delay) {
|
||||
REQUIRE(wagon->BrakeDelaySwitch(Delay));
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ TEST_CASE("fiz: changes made by a test reach the vehicle") {
|
||||
CHECK(vehicle{eu07}->Mass == doctest::Approx(80000.0));
|
||||
CHECK(vehicle{definition{eu07}.set("Param", "M", 90000)}->Mass == doctest::Approx(90000.0));
|
||||
// a key the file doesn't have is added to its section
|
||||
CHECK(vehicle{definition{eu07}.set("Brake", "MaxBP", 3.5)}->brakes.maxCylinderPressure[3] == doctest::Approx(3.5));
|
||||
CHECK(vehicle{definition{eu07}.set("Brake", "MaxBP", 3.5)}->brakes.config.maxCylinderPressure[3] == doctest::Approx(3.5));
|
||||
// removing a key brings its default back
|
||||
CHECK(vehicle{definition{eu07}.remove("Param", "Vmax")}->Vmax != doctest::Approx(125.0));
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ vehicle::vehicle(definition const &Definition, double Velocity, std::string cons
|
||||
if (driveractive) {
|
||||
m_physics->brakes.handlePosition = static_cast<int>(std::floor(m_physics->brakes.driverValve->GetPos(Cab == 0 ? bh_NP : bh_RP)));
|
||||
// a driver keeps a vehicle on standby on its independent brake
|
||||
if (Cab != 0 && m_physics->brakes.localKind != TLocalBrake::ManualBrake && Velocity < 1.0) {
|
||||
if (Cab != 0 && m_physics->brakes.config.localKind != TLocalBrake::ManualBrake && Velocity < 1.0) {
|
||||
m_physics->IncLocalBrakeLevel(LocalBrakePosNo);
|
||||
if (m_physics->EIMCtrlEmergency) {
|
||||
m_physics->DecLocalBrakeLevel(1);
|
||||
|
||||
@@ -104,7 +104,7 @@ void TController::Activation()
|
||||
if (pVehicle != initialvehicle)
|
||||
{ // jeśli zmieniony został pojazd prowadzony
|
||||
ControllingSet(); // utworzenie połączenia do sterowanego pojazdu (może się zmienić) - silnikowy dla EZT
|
||||
if( occupied->brakes.handlePositions > 0
|
||||
if( occupied->brakes.config.handlePositions > 0
|
||||
&& ( BrakeSystem == TBrakeSystem::Pneumatic
|
||||
|| BrakeSystem == TBrakeSystem::ElectroPneumatic ) ) {
|
||||
occupied->brakes.pipeLimiterPressure = occupied->brakePipe.Pressure();
|
||||
@@ -177,7 +177,7 @@ void TController::AutoRewident()
|
||||
if( true == AIControllFlag ) {
|
||||
// if a human is in charge leave the brake mode up to them, otherwise do as you like
|
||||
for( int i = 1; i <= 8; i *= 2 ) {
|
||||
if( ( occupied->brakes.availableOperatingModes & i ) > 0 ) {
|
||||
if( ( occupied->brakes.config.availableOperatingModes & i ) > 0 ) {
|
||||
occupied->brakes.operatingMode = i;
|
||||
}
|
||||
}
|
||||
@@ -338,8 +338,8 @@ bool TController::CheckVehicles(DriverOrders user)
|
||||
fMass += p->physics->TotalMass; // dodanie masy łącznie z ładunkiem
|
||||
fVelMax = min_speed( fVelMax, p->physics->Vmax ); // ustalenie maksymalnej prędkości dla składu
|
||||
// reset oerlikon brakes consist flag as different type was detected
|
||||
if( p->physics->brakes.subsystem != TBrakeSubSystem::ss_ESt
|
||||
&& p->physics->brakes.subsystem != TBrakeSubSystem::ss_LSt ) {
|
||||
if( p->physics->brakes.config.subsystem != TBrakeSubSystem::ss_ESt
|
||||
&& p->physics->brakes.config.subsystem != TBrakeSubSystem::ss_LSt ) {
|
||||
drivingFlags.oerlikons = false;
|
||||
}
|
||||
p = p->Neighbour(dir); // pojazd podłączony od wskazanej strony
|
||||
@@ -659,7 +659,7 @@ void TController::ControllingSet()
|
||||
return;
|
||||
}
|
||||
occupied = pVehicle->physics; // domyślny skrót do obiektu parametrów
|
||||
BrakeSystem = occupied->brakes.kind; // domyślny sposób hamowania
|
||||
BrakeSystem = occupied->brakes.config.kind; // domyślny sposób hamowania
|
||||
mvControlling = pVehicle->FindPowered()->physics; // poszukiwanie członu sterowanego
|
||||
{
|
||||
auto *lookup { pVehicle->FindPantographCarrier() };
|
||||
@@ -695,7 +695,7 @@ TController::determine_consist_state() {
|
||||
|
||||
Ready = true; // wstępnie gotowy
|
||||
fReady = 0.0; // założenie, że odhamowany
|
||||
IsConsistBraked = occupied->brakes.kind == TBrakeSystem::ElectroPneumatic && false == ForcePNBrake ? occupied->brakes.cylinderPressure > 2.0 :
|
||||
IsConsistBraked = occupied->brakes.config.kind == TBrakeSystem::ElectroPneumatic && false == ForcePNBrake ? occupied->brakes.cylinderPressure > 2.0 :
|
||||
occupied->brakePipe.Pressure() < std::max(3.9, occupied->brakes.actualPressure.PipePressureVal) + 0.1;
|
||||
fAccGravity = 0.0; // przyspieszenie wynikające z pochylenia
|
||||
IsAnyCouplerStretched = false;
|
||||
@@ -716,11 +716,11 @@ TController::determine_consist_state() {
|
||||
while (p)
|
||||
{ // sprawdzenie odhamowania wszystkich połączonych pojazdów
|
||||
auto *vehicle { p->physics };
|
||||
auto const bp { std::max( 0.0, vehicle->brakes.cylinderPressure - ( vehicle->SpeedCtrlUnit.Parking ? vehicle->brakes.maxCylinderPressure[ 0 ] * vehicle->brakes.holding.deceleration : 0.0 ) ) };
|
||||
auto const bp { std::max( 0.0, vehicle->brakes.cylinderPressure - ( vehicle->SpeedCtrlUnit.Parking ? vehicle->brakes.config.maxCylinderPressure[ 0 ] * vehicle->brakes.holding.deceleration : 0.0 ) ) };
|
||||
momentum += vehicle->TotalMass * vehicle->V * ( p->DirectionGet() == iDirection ? 1 : -1 );
|
||||
mostapplied = std::max( bp, mostapplied );
|
||||
if( ( vehicle->brakes.kind != TBrakeSystem::Individual )
|
||||
&& ( vehicle->brakes.maxCylinderPressure[ 3 ] > 0.0 )
|
||||
if( ( vehicle->brakes.config.kind != TBrakeSystem::Individual )
|
||||
&& ( vehicle->brakes.config.maxCylinderPressure[ 3 ] > 0.0 )
|
||||
&& ( false == TestFlag( vehicle->brakes.distributor->GetBrakeStatus(), b_dmg ) ) ) { // a brake cut out doesn't count
|
||||
chargelevel = std::min( { chargelevel, vehicle->brakePipe.Pressure(), vehicle->brakes.distributor->GetBRP() } );
|
||||
}
|
||||
|
||||
+14
-14
@@ -66,7 +66,7 @@ TController::increase_train_brake() {
|
||||
}
|
||||
pos_corr = pos_corr / fMass * 2.5;
|
||||
|
||||
if (occupied->brakes.driverValveType == TBrakeHandle::FV4a)
|
||||
if (occupied->brakes.config.driverValveType == TBrakeHandle::FV4a)
|
||||
{
|
||||
pos_corr += occupied->brakes.driverValve->GetCP()*0.2;
|
||||
|
||||
@@ -103,8 +103,8 @@ TController::increase_train_brake() {
|
||||
&& AccDesired < 0.0 // only while braking is asked for, not when called for a train slipping back while starting
|
||||
&& ( fBrakeHeldTime > (
|
||||
occupied->brakes.delaySetting > bdelay_G ?
|
||||
occupied->brakes.delays[ 1 ] :
|
||||
occupied->brakes.delays[ 3 ] )
|
||||
occupied->brakes.config.delays[ 1 ] :
|
||||
occupied->brakes.config.delays[ 3 ] )
|
||||
// a train falling further behind needs no full fill time to be seen not to get enough
|
||||
|| ( ( brakingShortfall.value > 0.02 )
|
||||
&& ( fBrakeHeldTime > vehicle_ai::brake_response_horizon( occupied, BrakeSystem, 1.0, fBrake_a0[ 0 ] ) ) ) ) ) {
|
||||
@@ -125,7 +125,7 @@ bool TController::IncBrake()
|
||||
BrakeSystem };
|
||||
switch( bs ) {
|
||||
case TBrakeSystem::Individual: {
|
||||
if( occupied->brakes.localKind == TLocalBrake::ManualBrake ) {
|
||||
if( occupied->brakes.config.localKind == TLocalBrake::ManualBrake ) {
|
||||
OK = occupied->IncManualBrakeLevel( 1 + static_cast<int>( std::floor( 0.5 + std::fabs( AccDesired ) ) ) );
|
||||
}
|
||||
else {
|
||||
@@ -134,7 +134,7 @@ bool TController::IncBrake()
|
||||
break;
|
||||
}
|
||||
case TBrakeSystem::Pneumatic: {
|
||||
if (bs != occupied->brakes.kind)
|
||||
if (bs != occupied->brakes.config.kind)
|
||||
{
|
||||
while (occupied->brakes.operatingMode > bom_PN)
|
||||
{
|
||||
@@ -217,11 +217,11 @@ bool TController::IncBrake()
|
||||
break;
|
||||
}
|
||||
case TBrakeSystem::ElectroPneumatic: {
|
||||
while( occupied->brakes.operatingMode << 1 <= occupied->brakes.availableOperatingModes ) {
|
||||
while( occupied->brakes.operatingMode << 1 <= occupied->brakes.config.availableOperatingModes ) {
|
||||
occupied->brakes.operatingMode <<= 1;
|
||||
}
|
||||
if( occupied->EngineType == TEngineType::ElectricInductionMotor ) {
|
||||
if (occupied->brakes.driverValveType == TBrakeHandle::MHZ_EN57) {
|
||||
if (occupied->brakes.config.driverValveType == TBrakeHandle::MHZ_EN57) {
|
||||
if (occupied->brakes.handlePosition < occupied->brakes.driverValve->GetPos(bh_FB))
|
||||
OK = occupied->BrakeLevelAdd(1.0);
|
||||
}
|
||||
@@ -324,7 +324,7 @@ bool TController::DecBrake() {
|
||||
switch( bs ) {
|
||||
case TBrakeSystem::Individual: {
|
||||
auto const positionchange { 1 + std::floor( 0.5 + std::abs( AccDesired ) ) };
|
||||
OK = occupied->brakes.localKind == TLocalBrake::ManualBrake ? occupied->DecManualBrakeLevel(positionchange) : occupied->DecLocalBrakeLevel(positionchange);
|
||||
OK = occupied->brakes.config.localKind == TLocalBrake::ManualBrake ? occupied->DecManualBrakeLevel(positionchange) : occupied->DecLocalBrakeLevel(positionchange);
|
||||
break;
|
||||
}
|
||||
case TBrakeSystem::Pneumatic: {
|
||||
@@ -382,7 +382,7 @@ bool TController::DecBrake() {
|
||||
}
|
||||
case TBrakeSystem::ElectroPneumatic: {
|
||||
if( occupied->EngineType == TEngineType::ElectricInductionMotor ) {
|
||||
if( occupied->brakes.driverValveType == TBrakeHandle::MHZ_EN57 ) {
|
||||
if( occupied->brakes.config.driverValveType == TBrakeHandle::MHZ_EN57 ) {
|
||||
if( occupied->brakes.handlePosition > occupied->brakes.driverValve->GetPos( bh_RP ) ) {
|
||||
OK = occupied->BrakeLevelAdd( -1.0 );
|
||||
}
|
||||
@@ -1122,7 +1122,7 @@ void TController::SetTimeControllers()
|
||||
{
|
||||
if (occupied->brakes.driverValve->Time)
|
||||
{
|
||||
auto const pressuredifference { occupied->brakes.driverValve->GetCP() - ( occupied->brakes.pipeHighPressure - BrakeCtrlPosition * 0.25*occupied->brakes.pipePressureRange ) };
|
||||
auto const pressuredifference { occupied->brakes.driverValve->GetCP() - ( occupied->brakes.config.pipeHighPressure - BrakeCtrlPosition * 0.25*occupied->brakes.config.pipePressureRange ) };
|
||||
if (BrakeCtrlPosition > 0 && pressuredifference > 0.05)
|
||||
occupied->BrakeLevelSet(occupied->brakes.driverValve->GetPos(bh_FB));
|
||||
else if (BrakeCtrlPosition > 0 && pressuredifference < -0.05)
|
||||
@@ -1134,11 +1134,11 @@ void TController::SetTimeControllers()
|
||||
else if (BrakeCtrlPosition == -2)
|
||||
occupied->BrakeLevelSet(occupied->brakes.driverValve->GetPos(bh_NP));
|
||||
}
|
||||
if( occupied->brakes.driverValveType == TBrakeHandle::FV4a ) {
|
||||
if( occupied->brakes.config.driverValveType == TBrakeHandle::FV4a ) {
|
||||
occupied->BrakeLevelSet( BrakeCtrlPosition );
|
||||
}
|
||||
if( occupied->brakes.driverValveType == TBrakeHandle::MHZ_K8P
|
||||
|| occupied->brakes.driverValveType == TBrakeHandle::MHZ_EN57 ) {
|
||||
if( occupied->brakes.config.driverValveType == TBrakeHandle::MHZ_K8P
|
||||
|| occupied->brakes.config.driverValveType == TBrakeHandle::MHZ_EN57 ) {
|
||||
if( BrakeCtrlPosition == 0 ) {
|
||||
occupied->BrakeLevelSet( occupied->brakes.driverValve->GetPos( bh_RP ) );
|
||||
}
|
||||
@@ -1322,7 +1322,7 @@ void TController::SetTimeControllers()
|
||||
}
|
||||
//6.2. Setting buttons
|
||||
for (int i = 0; i < 3; i++) {
|
||||
occupied->UniversalBrakeButton(i, UniversalBrakeButtons & occupied->brakes.universalButtonActions[i]);
|
||||
occupied->UniversalBrakeButton(i, UniversalBrakeButtons & occupied->brakes.config.universalButtonActions[i]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ TController::~TController()
|
||||
|
||||
TBrakeSystem TController::consist_brake_system() const {
|
||||
|
||||
if( occupied->brakes.kind != TBrakeSystem::ElectroPneumatic ) { return occupied->brakes.kind; }
|
||||
if( occupied->brakes.config.kind != TBrakeSystem::ElectroPneumatic ) { return occupied->brakes.config.kind; }
|
||||
|
||||
auto isepcapable = true;
|
||||
if( pVehicles[ VehicleEnd::front ] != pVehicles[ VehicleEnd::rear ] ) {
|
||||
|
||||
@@ -176,7 +176,7 @@ bool TController::PrepareEngine()
|
||||
}
|
||||
control_field_shunting();
|
||||
// sync virtual brake state with the 'real' one
|
||||
if( occupied->brakes.driverValveType != TBrakeHandle::NoHandle ) {
|
||||
if( occupied->brakes.config.driverValveType != TBrakeHandle::NoHandle ) {
|
||||
std::unordered_map<int, int> const brakepositions{
|
||||
{ static_cast<int>( occupied->brakes.driverValve->GetPos( bh_RP ) ), gbh_RP },
|
||||
{ static_cast<int>( occupied->brakes.driverValve->GetPos( bh_NP ) ), gbh_NP },
|
||||
@@ -193,7 +193,7 @@ bool TController::PrepareEngine()
|
||||
}
|
||||
else if( ( occupied->brakes.handlePositionSmooth != occupied->brakes.driverValve->GetPos( bh_RP ) )
|
||||
&& ( ( false == occupied->brakes.driverValve->Time )
|
||||
|| ( occupied->brakes.driverValve->GetCP() < occupied->brakes.pipeHighPressure - 0.05 ) ) ) {
|
||||
|| ( occupied->brakes.driverValve->GetCP() < occupied->brakes.config.pipeHighPressure - 0.05 ) ) ) {
|
||||
cue_action( driver_hint::trainbrakerelease );
|
||||
}
|
||||
// sync spring brake state across consist
|
||||
@@ -325,8 +325,8 @@ bool TController::ReleaseEngine() {
|
||||
// activate parking brake
|
||||
// TBD: do it earlier?
|
||||
cue_action( driver_hint::springbrakeon );
|
||||
if( occupied->brakes.localKind == TLocalBrake::ManualBrake
|
||||
|| occupied->brakes.hasHandBrake == true ) {
|
||||
if( occupied->brakes.config.localKind == TLocalBrake::ManualBrake
|
||||
|| occupied->brakes.config.hasHandBrake == true ) {
|
||||
cue_action( driver_hint::manualbrakon );
|
||||
}
|
||||
// switch off remaining power
|
||||
|
||||
+21
-21
@@ -252,7 +252,7 @@ void TController::control_uphill_start() {
|
||||
if( uphillStart.toppingUp ) {
|
||||
return;
|
||||
}
|
||||
if( ( occupied->brakes.localKind != TLocalBrake::ManualBrake )
|
||||
if( ( occupied->brakes.config.localKind != TLocalBrake::ManualBrake )
|
||||
&& ( occupied->brakes.independentPosition > 0.0 ) ) {
|
||||
cue_action( driver_hint::independentbrakerelease );
|
||||
}
|
||||
@@ -287,7 +287,7 @@ bool TController::uphill_brake_top_up() {
|
||||
}
|
||||
auto const action { uphill_start::brake_top_up(
|
||||
uphillStart.brakeTopUp, trainbrakeforce, uphillStart.holdingForce, BrakeCtrlPosition, fBrakeHeldTime,
|
||||
occupied->brakes.delays[ occupied->brakes.delaySetting > bdelay_G ? 1 : 3 ] ) };
|
||||
occupied->brakes.config.delays[ occupied->brakes.delaySetting > bdelay_G ? 1 : 3 ] ) };
|
||||
if( action == uphill_start::top_up_action::none ) {
|
||||
return false;
|
||||
}
|
||||
@@ -322,7 +322,7 @@ void TController::secure_standing_train() {
|
||||
if( false == bHasRun ) {
|
||||
bBrakeChargeStart = true;
|
||||
}
|
||||
if( occupied->brakes.localKind != TLocalBrake::ManualBrake ) {
|
||||
if( occupied->brakes.config.localKind != TLocalBrake::ManualBrake ) {
|
||||
cue_action( driver_hint::independentbrakeapply );
|
||||
}
|
||||
if( false == brake_charge::locomotive_brake_holds( locomotive_brake_force(), fMass * fAccGravity ) ) {
|
||||
@@ -344,12 +344,12 @@ void TController::secure_standing_train() {
|
||||
// no other, not on a second section or a locomotive in multiple control either, let alone one hauled dead
|
||||
double TController::locomotive_brake_force() const {
|
||||
|
||||
if( ( occupied->brakes.localKind == TLocalBrake::ManualBrake )
|
||||
|| ( occupied->brakes.maxCylinderPressure[ 0 ] <= 0.0 ) ) {
|
||||
if( ( occupied->brakes.config.localKind == TLocalBrake::ManualBrake )
|
||||
|| ( occupied->brakes.config.maxCylinderPressure[ 0 ] <= 0.0 ) ) {
|
||||
return 0.0;
|
||||
}
|
||||
return brake_charge::locomotive_brake_force(
|
||||
occupied->BrakeForceP( occupied->brakes.maxCylinderPressure[ 0 ], 0.0 ),
|
||||
occupied->BrakeForceP( occupied->brakes.config.maxCylinderPressure[ 0 ], 0.0 ),
|
||||
occupied->TotalMassxg );
|
||||
}
|
||||
|
||||
@@ -499,7 +499,7 @@ void TController::control_braking_force() {
|
||||
// TODO: check whether brake delay variable still has any purpose
|
||||
cue_action(driver_hint::brakingforceincrease,
|
||||
// Ra: ten czas należy zmniejszyć, jeśli czas dojazdu do zatrzymania jest mniejszy
|
||||
(3.0 + 0.5 * ((occupied->brakes.delaySetting > bdelay_G ? occupied->brakes.delays[1] : occupied->brakes.delays[3]) - 3.0)) * 0.5); // Ra: tymczasowo, bo przeżyna S1
|
||||
(3.0 + 0.5 * ((occupied->brakes.delaySetting > bdelay_G ? occupied->brakes.config.delays[1] : occupied->brakes.config.delays[3]) - 3.0)) * 0.5); // Ra: tymczasowo, bo przeżyna S1
|
||||
}
|
||||
else if( ( BrakeSystem == TBrakeSystem::Pneumatic )
|
||||
&& ( AccDesired < 0.0 )
|
||||
@@ -529,11 +529,11 @@ void TController::control_braking_force() {
|
||||
// sanity check to prevent unintended brake release on sharp slopes
|
||||
// TODO: check whether brake delay variable still has any purpose
|
||||
cue_action(driver_hint::brakingforcedecrease,
|
||||
(occupied->brakes.delaySetting > bdelay_G ? occupied->brakes.delays[0] : occupied->brakes.delays[2]) / 3.0 * 0.5); // Ra: tymczasowo, bo przeżyna S1
|
||||
(occupied->brakes.delaySetting > bdelay_G ? occupied->brakes.config.delays[0] : occupied->brakes.config.delays[2]) / 3.0 * 0.5); // Ra: tymczasowo, bo przeżyna S1
|
||||
}
|
||||
// uphill, the locomotive brake acts at once while the train brake of a long train takes many seconds to apply:
|
||||
// put it on as the train comes to a stand, and at once if the train has started to roll back
|
||||
if( ( occupied->brakes.localKind != TLocalBrake::ManualBrake )
|
||||
if( ( occupied->brakes.config.localKind != TLocalBrake::ManualBrake )
|
||||
&& ( occupied->brakes.independentPosition < 1.0 )
|
||||
&& ( ( uphill_stop_hold() && ( std::abs( velocity ) < 3.0 )
|
||||
// a train that has slowed down short of where it is to stop and is to pull up further does not get it
|
||||
@@ -567,7 +567,7 @@ void TController::control_braking_force() {
|
||||
|
||||
void TController::apply_independent_brake_only() {
|
||||
|
||||
if( occupied->brakes.localKind != TLocalBrake::ManualBrake ) {
|
||||
if( occupied->brakes.config.localKind != TLocalBrake::ManualBrake ) {
|
||||
if( false == occupied->ShuntMode // no need for independent brake if autobrake is active
|
||||
&& is_equal(occupied->brakes.handlePositionSmooth, occupied->brakes.driverValve->GetPos(bh_RP), 0.2) ) {
|
||||
cue_action( driver_hint::independentbrakeapply );
|
||||
@@ -587,11 +587,11 @@ void TController::control_releaser() {
|
||||
|
||||
auto const hasreleaser {
|
||||
false == (is_dmu() || is_emu()) // TODO: a more refined test than rejecting these types wholesale
|
||||
&& ( occupied->brakes.driverValveType == TBrakeHandle::FV4a
|
||||
|| occupied->brakes.driverValveType == TBrakeHandle::MHZ_6P
|
||||
|| occupied->brakes.driverValveType == TBrakeHandle::MHZ_K5P
|
||||
|| occupied->brakes.driverValveType == TBrakeHandle::MHZ_K8P
|
||||
|| occupied->brakes.driverValveType == TBrakeHandle::M394 ) };
|
||||
&& ( occupied->brakes.config.driverValveType == TBrakeHandle::FV4a
|
||||
|| occupied->brakes.config.driverValveType == TBrakeHandle::MHZ_6P
|
||||
|| occupied->brakes.config.driverValveType == TBrakeHandle::MHZ_K5P
|
||||
|| occupied->brakes.config.driverValveType == TBrakeHandle::MHZ_K8P
|
||||
|| occupied->brakes.config.driverValveType == TBrakeHandle::M394 ) };
|
||||
|
||||
if( false == hasreleaser ) { return; }
|
||||
|
||||
@@ -656,11 +656,11 @@ void TController::control_main_pipe() {
|
||||
// napełnianie uderzeniowe
|
||||
if( BrakeSystem != TBrakeSystem::Pneumatic ) { return; }
|
||||
|
||||
if( occupied->brakes.driverValveType == TBrakeHandle::FV4a
|
||||
|| occupied->brakes.driverValveType == TBrakeHandle::MHZ_6P
|
||||
|| occupied->brakes.driverValveType == TBrakeHandle::MHZ_K5P
|
||||
|| occupied->brakes.driverValveType == TBrakeHandle::MHZ_K8P
|
||||
|| occupied->brakes.driverValveType == TBrakeHandle::M394 ) {
|
||||
if( occupied->brakes.config.driverValveType == TBrakeHandle::FV4a
|
||||
|| occupied->brakes.config.driverValveType == TBrakeHandle::MHZ_6P
|
||||
|| occupied->brakes.config.driverValveType == TBrakeHandle::MHZ_K5P
|
||||
|| occupied->brakes.config.driverValveType == TBrakeHandle::MHZ_K8P
|
||||
|| occupied->brakes.config.driverValveType == TBrakeHandle::M394 ) {
|
||||
|
||||
auto const departblocked { is_departure_blocked( DepartBlockedFSDelay ) };
|
||||
if( (drivingFlags.oerlikons || true == IsCargoTrain || departblocked) && BrakeCtrlPosition == gbh_RP && AbsAccS < 0.03 && AccDesired > -0.03 && VelDesired - occupied->Vel > 2.0 && fReady > 0.35 &&
|
||||
@@ -732,7 +732,7 @@ bool TController::is_brake_charging_done() const {
|
||||
return false;
|
||||
}
|
||||
return ElapsedTime - BrakeChargingStart > FSMaxTime
|
||||
|| consist_max_crp() > occupied->brakes.pipeHighPressure + FSOverchargeCRP
|
||||
|| consist_max_crp() > occupied->brakes.config.pipeHighPressure + FSOverchargeCRP
|
||||
|| std::ranges::any_of(
|
||||
BrakeChargingPipeOverchargeStart,
|
||||
[this]( auto const &Vehicle ) { return ElapsedTime - Vehicle.second > FSOverchargeTime; } );
|
||||
|
||||
@@ -448,7 +448,7 @@ vehicle_ai::brake_response_horizon( physics::Vehicle const *Vehicle, TBrakeSyste
|
||||
// BrakeDelay holds the release and the application time in G, then the same two in P
|
||||
auto const delays { Vehicle->brakes.delaySetting > bdelay_G ? 0 : 2 };
|
||||
auto const isrelease { Acceleration < 0.0 };
|
||||
horizon = std::max( horizon, 0.5 * Vehicle->brakes.delays[ delays + ( isrelease ? 0 : 1 ) ] );
|
||||
horizon = std::max( horizon, 0.5 * Vehicle->brakes.config.delays[ delays + ( isrelease ? 0 : 1 ) ] );
|
||||
}
|
||||
return horizon;
|
||||
}
|
||||
@@ -506,7 +506,7 @@ TController::adjust_desired_speed_for_braking_curve( double const Vel ) {
|
||||
braking_curve::brake_acting(
|
||||
BrakeCtrlPosition,
|
||||
// IncLocalBrakeLevel() moves the independent brake handle on a vehicle without one too
|
||||
( occupied->brakes.localKind == TLocalBrake::PneumaticBrake || occupied->brakes.localKind == TLocalBrake::HydraulicBrake ) ?
|
||||
( occupied->brakes.config.localKind == TLocalBrake::PneumaticBrake || occupied->brakes.config.localKind == TLocalBrake::HydraulicBrake ) ?
|
||||
occupied->brakes.independentPosition :
|
||||
0.0 ),
|
||||
vehicle_ai::brake_response_horizon( occupied, BrakeSystem, AbsAccS, fBrake_a0[ 0 ] ),
|
||||
@@ -821,7 +821,7 @@ TController::adjust_desired_speed_for_braking_test() {
|
||||
if( ( brakeTest.stage == RunningBrakeTest::Stage::waiting )
|
||||
&& ( false == timetable::makes_brake_test( TrainParams.run_flags() ) ) ) { return; } // the timetable says there's none (eu07/maszyna#95)
|
||||
if( false == is_train() ) { return; } // not applicable
|
||||
if( occupied->brakes.driverValveType == TBrakeHandle::FVel6 ) { return; } // leads to bugs in DecBrake, disable for now
|
||||
if( occupied->brakes.config.driverValveType == TBrakeHandle::FVel6 ) { return; } // leads to bugs in DecBrake, disable for now
|
||||
if( false == OrderCurrentGet().HasAll(DriverOrder::obeyTrain) ) { return; } // not applicable
|
||||
if( false == AIControllFlag ) { return; } // TBD: add notification about braking test and enable it for human driver as well?
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ bool is_cut_out(physics::Vehicle const &Vehicle) {
|
||||
|
||||
vehicle describe(physics::Vehicle const &Vehicle, bool const Driven) {
|
||||
vehicle described;
|
||||
described.delays = Vehicle.brakes.availableDelays;
|
||||
described.delays = Vehicle.brakes.config.availableDelays;
|
||||
// a locomotive has Power > 1, though it may be a dead one at the end of the train
|
||||
described.powered = Vehicle.Power >= 1.0;
|
||||
described.length = Vehicle.Dim.L;
|
||||
|
||||
@@ -57,7 +57,7 @@ void TTrain::OnCommand_independentbrakeincrease(TTrain *Train, command_data cons
|
||||
// the pneumatic local brake directly, never piggy-backing on the joint controller
|
||||
auto const splitMode{Train->controlled->brakes.electrodynamic.splitFromPneumatic};
|
||||
auto const useStepped{Train->ggJointCtrl.SubModel != nullptr && !splitMode};
|
||||
if (Train->occupied->brakes.localKind != TLocalBrake::ManualBrake)
|
||||
if (Train->occupied->brakes.config.localKind != TLocalBrake::ManualBrake)
|
||||
{
|
||||
if (false == splitMode && Train->ggJointCtrl.SubModel != nullptr && Train->occupied->MainCtrlPos > 0)
|
||||
{
|
||||
@@ -83,7 +83,7 @@ void TTrain::OnCommand_independentbrakeincreasefast(TTrain *Train, command_data
|
||||
|
||||
auto const splitMode{Train->controlled->brakes.electrodynamic.splitFromPneumatic};
|
||||
auto const useJointAnim{Train->ggJointCtrl.SubModel != nullptr && !splitMode};
|
||||
if (Train->occupied->brakes.localKind != TLocalBrake::ManualBrake)
|
||||
if (Train->occupied->brakes.config.localKind != TLocalBrake::ManualBrake)
|
||||
{
|
||||
if (false == splitMode && Train->ggJointCtrl.SubModel != nullptr && Train->occupied->MainCtrlPos > 0)
|
||||
{
|
||||
@@ -109,7 +109,7 @@ void TTrain::OnCommand_independentbrakedecrease(TTrain *Train, command_data cons
|
||||
|
||||
auto const splitMode{Train->controlled->brakes.electrodynamic.splitFromPneumatic};
|
||||
auto const useStepped{Train->ggJointCtrl.SubModel != nullptr && !splitMode};
|
||||
if (Train->occupied->brakes.localKind != TLocalBrake::ManualBrake
|
||||
if (Train->occupied->brakes.config.localKind != TLocalBrake::ManualBrake
|
||||
// Ra 1014-06: AI potrafi zahamować pomocniczym mimo jego braku - odhamować jakoś trzeba
|
||||
// TODO: sort AI out so it doesn't do things it doesn't have equipment for
|
||||
|| Train->occupied->brakes.independentPosition > 0)
|
||||
@@ -138,7 +138,7 @@ void TTrain::OnCommand_independentbrakedecreasefast(TTrain *Train, command_data
|
||||
|
||||
auto const splitMode{Train->controlled->brakes.electrodynamic.splitFromPneumatic};
|
||||
auto const useJointAnim{Train->ggJointCtrl.SubModel != nullptr && !splitMode};
|
||||
if (Train->occupied->brakes.localKind != TLocalBrake::ManualBrake
|
||||
if (Train->occupied->brakes.config.localKind != TLocalBrake::ManualBrake
|
||||
// Ra 1014-06: AI potrafi zahamować pomocniczym mimo jego braku - odhamować jakoś trzeba
|
||||
// TODO: sort AI out so it doesn't do things it doesn't have equipment for
|
||||
|| Train->occupied->brakes.independentPosition > 0)
|
||||
@@ -189,7 +189,7 @@ void TTrain::OnCommand_independentbrakebailoff(TTrain *Train, command_data const
|
||||
if (Train->controlled->TrainType != train_type::emu &&
|
||||
(Train->controlled->EngineType == TEngineType::ElectricSeriesMotor || Train->controlled->EngineType == TEngineType::DieselElectric ||
|
||||
Train->controlled->EngineType == TEngineType::ElectricInductionMotor) &&
|
||||
Train->occupied->brakes.handlePositions > 0)
|
||||
Train->occupied->brakes.config.handlePositions > 0)
|
||||
{
|
||||
|
||||
if (Command.action == GLFW_PRESS)
|
||||
@@ -295,17 +295,17 @@ void TTrain::OnCommand_universalbrakebutton3(TTrain *Train, command_data const &
|
||||
|
||||
void TTrain::OnCommand_trainbrakeincrease(TTrain *Train, command_data const &Command)
|
||||
{
|
||||
if (Command.action == GLFW_REPEAT && Train->occupied->brakes.driverValveType == TBrakeHandle::FV4a)
|
||||
Train->occupied->BrakeLevelAdd(Global.brake_speed * Command.time_delta * Train->occupied->brakes.handlePositions);
|
||||
else if (Command.action == GLFW_PRESS && Train->occupied->brakes.driverValveType != TBrakeHandle::FV4a)
|
||||
if (Command.action == GLFW_REPEAT && Train->occupied->brakes.config.driverValveType == TBrakeHandle::FV4a)
|
||||
Train->occupied->BrakeLevelAdd(Global.brake_speed * Command.time_delta * Train->occupied->brakes.config.handlePositions);
|
||||
else if (Command.action == GLFW_PRESS && Train->occupied->brakes.config.driverValveType != TBrakeHandle::FV4a)
|
||||
Train->set_train_brake(Train->occupied->brakes.handlePositionSmooth + Global.fBrakeStep);
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_trainbrakedecrease(TTrain *Train, command_data const &Command)
|
||||
{
|
||||
if (Command.action == GLFW_REPEAT && Train->occupied->brakes.driverValveType == TBrakeHandle::FV4a)
|
||||
Train->occupied->BrakeLevelAdd(-Global.brake_speed * Command.time_delta * Train->occupied->brakes.handlePositions);
|
||||
else if (Command.action == GLFW_PRESS && Train->occupied->brakes.driverValveType != TBrakeHandle::FV4a)
|
||||
if (Command.action == GLFW_REPEAT && Train->occupied->brakes.config.driverValveType == TBrakeHandle::FV4a)
|
||||
Train->occupied->BrakeLevelAdd(-Global.brake_speed * Command.time_delta * Train->occupied->brakes.config.handlePositions);
|
||||
else if (Command.action == GLFW_PRESS && Train->occupied->brakes.config.driverValveType != TBrakeHandle::FV4a)
|
||||
Train->set_train_brake(Train->occupied->brakes.handlePositionSmooth - Global.fBrakeStep);
|
||||
else if (Command.action == GLFW_RELEASE)
|
||||
{
|
||||
@@ -370,7 +370,7 @@ void TTrain::OnCommand_trainbrakeservice(TTrain *Train, command_data const &Comm
|
||||
if (Command.action == GLFW_PRESS)
|
||||
{
|
||||
|
||||
Train->set_train_brake(Train->occupied->brakes.handlePositions / 2 + (Train->occupied->brakes.driverValveType == TBrakeHandle::FV4a ? 1 : 0));
|
||||
Train->set_train_brake(Train->occupied->brakes.config.handlePositions / 2 + (Train->occupied->brakes.config.driverValveType == TBrakeHandle::FV4a ? 1 : 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ void TTrain::OnCommand_trainbrakefullservice(TTrain *Train, command_data const &
|
||||
if (Command.action == GLFW_PRESS)
|
||||
{
|
||||
|
||||
Train->set_train_brake(Train->occupied->brakes.handlePositions - 1);
|
||||
Train->set_train_brake(Train->occupied->brakes.config.handlePositions - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,7 +416,7 @@ void TTrain::OnCommand_trainbrakebasepressureincrease(TTrain *Train, command_dat
|
||||
if (Command.action != GLFW_RELEASE)
|
||||
{
|
||||
|
||||
if (Train->occupied->brakes.driverValveType == TBrakeHandle::FV4a)
|
||||
if (Train->occupied->brakes.config.driverValveType == TBrakeHandle::FV4a)
|
||||
{
|
||||
Train->occupied->brakes.handleCapPosition = std::clamp(Train->occupied->brakes.handleCapPosition - 0.01, -1.5, 2.0);
|
||||
}
|
||||
@@ -433,7 +433,7 @@ void TTrain::OnCommand_trainbrakebasepressuredecrease(TTrain *Train, command_dat
|
||||
if (Command.action != GLFW_RELEASE)
|
||||
{
|
||||
|
||||
if (Train->occupied->brakes.driverValveType == TBrakeHandle::FV4a)
|
||||
if (Train->occupied->brakes.config.driverValveType == TBrakeHandle::FV4a)
|
||||
{
|
||||
Train->occupied->brakes.handleCapPosition = std::clamp(Train->occupied->brakes.handleCapPosition + 0.01, -1.5, 2.0);
|
||||
}
|
||||
@@ -484,7 +484,7 @@ void TTrain::OnCommand_manualbrakeincrease(TTrain *Train, command_data const &Co
|
||||
return;
|
||||
}
|
||||
|
||||
if (vehicle->physics->brakes.localKind == TLocalBrake::ManualBrake || vehicle->physics->brakes.hasHandBrake == true)
|
||||
if (vehicle->physics->brakes.config.localKind == TLocalBrake::ManualBrake || vehicle->physics->brakes.config.hasHandBrake == true)
|
||||
{
|
||||
|
||||
vehicle->physics->IncManualBrakeLevel(1);
|
||||
@@ -504,7 +504,7 @@ void TTrain::OnCommand_manualbrakedecrease(TTrain *Train, command_data const &Co
|
||||
return;
|
||||
}
|
||||
|
||||
if (vehicle->physics->brakes.localKind == TLocalBrake::ManualBrake || vehicle->physics->brakes.hasHandBrake == true)
|
||||
if (vehicle->physics->brakes.config.localKind == TLocalBrake::ManualBrake || vehicle->physics->brakes.config.hasHandBrake == true)
|
||||
{
|
||||
|
||||
vehicle->physics->DecManualBrakeLevel(1);
|
||||
@@ -566,7 +566,7 @@ void TTrain::OnCommand_wheelspinbrakeactivate(TTrain *Train, command_data const
|
||||
return;
|
||||
}
|
||||
|
||||
if (Train->occupied->brakes.kind != TBrakeSystem::ElectroPneumatic)
|
||||
if (Train->occupied->brakes.config.kind != TBrakeSystem::ElectroPneumatic)
|
||||
{
|
||||
// standard behaviour
|
||||
if (Command.action == GLFW_PRESS)
|
||||
@@ -592,7 +592,7 @@ void TTrain::OnCommand_wheelspinbrakeactivate(TTrain *Train, command_data const
|
||||
|
||||
// the EP fuse is the cab car's (Ctrl+Z switches occupied's), checked by SwitchEPBrake with the rest of
|
||||
// the control's supply
|
||||
if (Train->occupied->brakes.driverValveType == TBrakeHandle::St113)
|
||||
if (Train->occupied->brakes.config.driverValveType == TBrakeHandle::St113)
|
||||
{
|
||||
Train->occupied->SwitchEPBrake(1);
|
||||
}
|
||||
@@ -763,7 +763,7 @@ void TTrain::OnCommand_trainbrakeoperationmodeincrease(TTrain *Train, command_da
|
||||
{
|
||||
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
if (Command.action == GLFW_PRESS && (Train->occupied->brakes.operatingMode << 1 & Train->occupied->brakes.availableOperatingModes) != 0)
|
||||
if (Command.action == GLFW_PRESS && (Train->occupied->brakes.operatingMode << 1 & Train->occupied->brakes.config.availableOperatingModes) != 0)
|
||||
{
|
||||
// next mode
|
||||
Train->occupied->brakes.operatingMode <<= 1;
|
||||
@@ -776,7 +776,7 @@ void TTrain::OnCommand_trainbrakeoperationmodedecrease(TTrain *Train, command_da
|
||||
{
|
||||
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
if (Command.action == GLFW_PRESS && (Train->occupied->brakes.operatingMode >> 1 & Train->occupied->brakes.availableOperatingModes) != 0)
|
||||
if (Command.action == GLFW_PRESS && (Train->occupied->brakes.operatingMode >> 1 & Train->occupied->brakes.config.availableOperatingModes) != 0)
|
||||
{
|
||||
// previous mode
|
||||
Train->occupied->brakes.operatingMode >>= 1;
|
||||
|
||||
@@ -102,7 +102,7 @@ void TTrain::update_sounds(double const Deltatime)
|
||||
|
||||
// McZapkie-280302 - syczenie
|
||||
// TODO: softer volume reduction than plain abrupt stop, perhaps as reusable wrapper?
|
||||
if (occupied->brakes.driverValveType == TBrakeHandle::FV4a || occupied->brakes.driverValveType == TBrakeHandle::FVel6)
|
||||
if (occupied->brakes.config.driverValveType == TBrakeHandle::FV4a || occupied->brakes.config.driverValveType == TBrakeHandle::FVel6)
|
||||
{
|
||||
// upuszczanie z PG
|
||||
if (rsHiss)
|
||||
@@ -219,7 +219,7 @@ void TTrain::update_sounds(double const Deltatime)
|
||||
{
|
||||
|
||||
auto const brakeforceratio{
|
||||
std::clamp(occupied->brakes.unitForce / std::max(1.0, occupied->BrakeForceR(1.0, occupied->Vel) / (occupied->NAxles * std::max(1, occupied->brakes.blocksPerAxle))), 0.0, 1.0)};
|
||||
std::clamp(occupied->brakes.unitForce / std::max(1.0, occupied->BrakeForceR(1.0, occupied->Vel) / (occupied->NAxles * std::max(1, occupied->brakes.config.blocksPerAxle))), 0.0, 1.0)};
|
||||
// HACK: in external view mute the sound rather than stop it, in case there's an opening bookend it'd (re)play on sound restart after returning inside
|
||||
volume = FreeFlyModeFlag ? 0.0 : rsBrake->m_amplitudeoffset + std::sqrt(brakeforceratio * std::lerp(0.4, 1.0, occupied->Vel / (1 + occupied->Vmax))) * rsBrake->m_amplitudefactor;
|
||||
rsBrake->pitch(static_cast<float>(rsBrake->m_frequencyoffset + occupied->Vel * rsBrake->m_frequencyfactor));
|
||||
@@ -457,7 +457,7 @@ void TTrain::update_sounds_runningnoise(sound_source &Sound)
|
||||
if (std::abs(occupied->nrot) > 0.01)
|
||||
{
|
||||
// hamulce wzmagaja halas
|
||||
auto const brakeforceratio{(std::clamp(occupied->brakes.unitForce / std::max(1.0, occupied->BrakeForceR(1.0, occupied->Vel) / (occupied->NAxles * std::max(1, occupied->brakes.blocksPerAxle))), 0.0, 1.0))};
|
||||
auto const brakeforceratio{(std::clamp(occupied->brakes.unitForce / std::max(1.0, occupied->BrakeForceR(1.0, occupied->Vel) / (occupied->NAxles * std::max(1, occupied->brakes.config.blocksPerAxle))), 0.0, 1.0))};
|
||||
|
||||
volume *= 1 + 0.125 * brakeforceratio;
|
||||
}
|
||||
|
||||
@@ -439,7 +439,7 @@ TTrain::state_t TTrain::get_state() const
|
||||
bool TTrain::is_eztoer() const
|
||||
{
|
||||
|
||||
return controlled->TrainType == train_type::emu && occupied->brakes.subsystem == TBrakeSubSystem::ss_ESt && controlled->lowVoltage.Is24vAvailable() == true && controlled->EpFuse == true &&
|
||||
return controlled->TrainType == train_type::emu && occupied->brakes.config.subsystem == TBrakeSubSystem::ss_ESt && controlled->lowVoltage.Is24vAvailable() == true && controlled->EpFuse == true &&
|
||||
controlled->DirActive != 0; // od yB
|
||||
}
|
||||
|
||||
@@ -483,7 +483,7 @@ void TTrain::zero_charging_train_brake()
|
||||
using enum TBrakeHandle;
|
||||
|
||||
if (occupied->brakes.handlePosition == -1 && DynamicObject->Controller != AIdriver && Global.iFeedbackMode < 3 &&
|
||||
(occupied->brakes.driverValveType == FVel6 || occupied->brakes.driverValveType == MHZ_EN57 || occupied->brakes.driverValveType == MHZ_K8P))
|
||||
(occupied->brakes.config.driverValveType == FVel6 || occupied->brakes.config.driverValveType == MHZ_EN57 || occupied->brakes.config.driverValveType == MHZ_K8P))
|
||||
{
|
||||
// Odskakiwanie hamulce EP
|
||||
set_train_brake(0);
|
||||
|
||||
@@ -109,7 +109,7 @@ bool TTrain::Update(double const Deltatime)
|
||||
updateCabLightLevels();
|
||||
|
||||
// anti slip system activation, maintained while the control button is down
|
||||
if (occupied->brakes.kind != TBrakeSystem::ElectroPneumatic && ggAntiSlipButton.GetDesiredValue() > 0.95)
|
||||
if (occupied->brakes.config.kind != TBrakeSystem::ElectroPneumatic && ggAntiSlipButton.GetDesiredValue() > 0.95)
|
||||
{
|
||||
controlled->AntiSlippingBrake();
|
||||
}
|
||||
@@ -1276,19 +1276,19 @@ void TTrain::updateBrakeControllers()
|
||||
false && Global.fCalibrateIn[0][1] != 0.0) // nie blokujemy AI
|
||||
{ // Ra: nie najlepsze miejsce, ale na początek gdzieś to dać trzeba
|
||||
// Firleju: dlatego kasujemy i zastepujemy funkcją w Console
|
||||
if (occupied->brakes.driverValveType == TBrakeHandle::FV4a)
|
||||
if (occupied->brakes.config.driverValveType == TBrakeHandle::FV4a)
|
||||
{
|
||||
double b = Console::AnalogCalibrateGet(0);
|
||||
b = b * 8.0 - 2.0;
|
||||
b = safe_clamp(b, -2.0, (double)occupied->brakes.handlePositions); // przycięcie zmiennej do granic
|
||||
b = safe_clamp(b, -2.0, (double)occupied->brakes.config.handlePositions); // przycięcie zmiennej do granic
|
||||
ggBrakeCtrl.UpdateValue(b); // przesów bez zaokrąglenia
|
||||
occupied->BrakeLevelSet(b);
|
||||
}
|
||||
else if (occupied->brakes.driverValveType == TBrakeHandle::FVel6) // może można usunąć ograniczenie do FV4a i FVel6?
|
||||
else if (occupied->brakes.config.driverValveType == TBrakeHandle::FVel6) // może można usunąć ograniczenie do FV4a i FVel6?
|
||||
{
|
||||
double b = Console::AnalogCalibrateGet(0);
|
||||
b = b * 7.0 - 1.0;
|
||||
b = safe_clamp(b, -1.0, (double)occupied->brakes.handlePositions); // przycięcie zmiennej do granic
|
||||
b = safe_clamp(b, -1.0, (double)occupied->brakes.config.handlePositions); // przycięcie zmiennej do granic
|
||||
ggBrakeCtrl.UpdateValue(b); // przesów bez zaokrąglenia
|
||||
occupied->BrakeLevelSet(b);
|
||||
}
|
||||
@@ -1315,7 +1315,7 @@ void TTrain::updateBrakeControllers()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (DynamicObject->Mechanik != nullptr && false == DynamicObject->Mechanik->AIControllFlag // nie blokujemy AI
|
||||
&& occupied->brakes.independentValveType == TBrakeHandle::FD1 && Global.iFeedbackMode == 4 && Global.fCalibrateIn[0][1] != 0.0)
|
||||
&& occupied->brakes.config.independentValveType == TBrakeHandle::FD1 && Global.iFeedbackMode == 4 && Global.fCalibrateIn[0][1] != 0.0)
|
||||
{
|
||||
// Ra: nie najlepsze miejsce, ale na początek gdzieś to dać trzeba
|
||||
// Firleju: dlatego kasujemy i zastepujemy funkcją w Console
|
||||
|
||||
+2
-2
@@ -119,8 +119,8 @@ void secure(physics::Vehicle &Occupied, physics::Vehicle &Controlling) {
|
||||
// the emergency position vents the brake pipe whatever the brake mode, and with nobody in the cab too
|
||||
Occupied.BrakeLevelSet(Occupied.brakes.driverValve->GetPos(bh_EB));
|
||||
// a vehicle with no train brake (a car, a draisine) gets the brake its driver stops it with, in full
|
||||
if (Occupied.brakes.kind == TBrakeSystem::Individual) {
|
||||
if (Occupied.brakes.localKind == TLocalBrake::ManualBrake) {
|
||||
if (Occupied.brakes.config.kind == TBrakeSystem::Individual) {
|
||||
if (Occupied.brakes.config.localKind == TLocalBrake::ManualBrake) {
|
||||
Occupied.IncManualBrakeLevel(ManualBrakePosNo);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -277,7 +277,7 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
|
||||
// NOTE: with more than one driver in the consist this is likely to go awery, since all but one will be sent to sleep
|
||||
// TBD, TODO: have the virtual helper release independent brakes during consist check?
|
||||
if( DriverType != "" ) {
|
||||
if( physics->brakes.localKind != TLocalBrake::ManualBrake ) {
|
||||
if( physics->brakes.config.localKind != TLocalBrake::ManualBrake ) {
|
||||
if( fVel < 1.0 ) {
|
||||
physics->IncLocalBrakeLevel( LocalBrakePosNo );
|
||||
if ( physics->EIMCtrlEmergency ) {
|
||||
@@ -369,28 +369,28 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
|
||||
physics->brakes.distributor->ForceEmptiness();
|
||||
physics->brakes.distributor->SetBrakeStatus( physics->brakes.distributor->GetBrakeStatus() | b_dmg ); // wylacz
|
||||
}
|
||||
if (physics->brakes.cylinders.leverRatio[2] * physics->brakes.cylinders.leverRatio[1] >
|
||||
if (physics->brakes.config.cylinders.leverRatio[2] * physics->brakes.config.cylinders.leverRatio[1] >
|
||||
0.01) // jesli jest nastawiacz mechaniczny PL
|
||||
{
|
||||
float rnd = Random(100);
|
||||
if (rnd < 20) // losowanie 20/100 usrednienie
|
||||
{
|
||||
physics->brakes.cylinders.leverRatio[2] = physics->brakes.cylinders.leverRatio[1] =
|
||||
(physics->brakes.cylinders.leverRatio[2] + physics->brakes.cylinders.leverRatio[1]) /
|
||||
physics->brakes.config.cylinders.leverRatio[2] = physics->brakes.config.cylinders.leverRatio[1] =
|
||||
(physics->brakes.config.cylinders.leverRatio[2] + physics->brakes.config.cylinders.leverRatio[1]) /
|
||||
2;
|
||||
}
|
||||
else if (rnd < 70) // losowanie 70/100-20/100 oslabienie
|
||||
{
|
||||
physics->brakes.cylinders.leverRatio[1] = physics->brakes.cylinders.leverRatio[1] * 0.50;
|
||||
physics->brakes.cylinders.leverRatio[2] = physics->brakes.cylinders.leverRatio[2] * 0.75;
|
||||
physics->brakes.config.cylinders.leverRatio[1] = physics->brakes.config.cylinders.leverRatio[1] * 0.50;
|
||||
physics->brakes.config.cylinders.leverRatio[2] = physics->brakes.config.cylinders.leverRatio[2] * 0.75;
|
||||
}
|
||||
else if (rnd < 80) // losowanie 80/100-70/100 tylko prozny
|
||||
{
|
||||
physics->brakes.cylinders.leverRatio[2] = physics->brakes.cylinders.leverRatio[1];
|
||||
physics->brakes.config.cylinders.leverRatio[2] = physics->brakes.config.cylinders.leverRatio[1];
|
||||
}
|
||||
else // tylko ladowny
|
||||
{
|
||||
physics->brakes.cylinders.leverRatio[1] = physics->brakes.cylinders.leverRatio[2];
|
||||
physics->brakes.config.cylinders.leverRatio[1] = physics->brakes.config.cylinders.leverRatio[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ void TDynamicObject::RenderSounds() {
|
||||
// brake system and braking sounds:
|
||||
|
||||
// brake cylinder piston
|
||||
auto const brakepressureratio { std::max( 0.0, physics->brakes.cylinderPressure ) / std::max( 1.0, physics->brakes.maxCylinderPressure[ 3 ] ) };
|
||||
auto const brakepressureratio { std::max( 0.0, physics->brakes.cylinderPressure ) / std::max( 1.0, physics->brakes.config.maxCylinderPressure[ 3 ] ) };
|
||||
renderBrakeCylinderSounds( brakepressureratio );
|
||||
renderEpBrakeSounds( dt );
|
||||
renderEmergencyBrakeSound();
|
||||
@@ -233,7 +233,7 @@ void TDynamicObject::renderBrakeCylinderSounds( double const brakepressureratio
|
||||
}
|
||||
// actual sound playback
|
||||
auto const quantizedratio { static_cast<int>( 15 * brakepressureratio ) };
|
||||
auto const lastbrakepressureratio { std::max( 0.f, m_lastbrakepressure ) / std::max( 1.0, physics->brakes.maxCylinderPressure[ 3 ] ) };
|
||||
auto const lastbrakepressureratio { std::max( 0.f, m_lastbrakepressure ) / std::max( 1.0, physics->brakes.config.maxCylinderPressure[ 3 ] ) };
|
||||
auto const quantizedratiochange { quantizedratio - static_cast<int>( 15 * lastbrakepressureratio ) };
|
||||
if( quantizedratiochange > 0 ) {
|
||||
m_brakecylinderpistonadvance
|
||||
@@ -257,10 +257,10 @@ void TDynamicObject::renderBrakeCylinderSounds( double const brakepressureratio
|
||||
void TDynamicObject::renderEpBrakeSounds( double const dt ) {
|
||||
|
||||
// epbrake - epcompact
|
||||
if (physics->brakes.kind == TBrakeSystem::ElectroPneumatic && physics->brakes.independentValve) {
|
||||
auto const epbrakepressureratio{ std::min( std::max( 0.0, physics->brakes.independentValve->GetCP() ) / std::max( 1.0, physics->brakes.maxCylinderPressure[0] ),
|
||||
if (physics->brakes.config.kind == TBrakeSystem::ElectroPneumatic && physics->brakes.independentValve) {
|
||||
auto const epbrakepressureratio{ std::min( std::max( 0.0, physics->brakes.independentValve->GetCP() ) / std::max( 1.0, physics->brakes.config.maxCylinderPressure[0] ),
|
||||
m_epbrakepressurechangedectimer > -1.0f ?
|
||||
std::max( physics->brakes.independentPositionEim, physics->brakes.distributor->GetEDBCP() / physics->brakes.maxCylinderPressure[3]) :
|
||||
std::max( physics->brakes.independentPositionEim, physics->brakes.distributor->GetEDBCP() / physics->brakes.config.maxCylinderPressure[3]) :
|
||||
1.0 ) };
|
||||
if ( m_lastepbrakepressure != -1.f ) {
|
||||
// HACK: potentially reset playback of opening bookend sounds
|
||||
@@ -274,7 +274,7 @@ void TDynamicObject::renderEpBrakeSounds( double const dt ) {
|
||||
m_epbrakepressurechangedectimer += dt;
|
||||
// actual sound playback
|
||||
auto const epquantizedratio{ static_cast<int>( 50 * epbrakepressureratio) };
|
||||
auto const lastepbrakepressureratio { std::max( 0.f, m_lastepbrakepressure ) / std::max( 1.0, physics->brakes.maxCylinderPressure[0] ) };
|
||||
auto const lastepbrakepressureratio { std::max( 0.f, m_lastepbrakepressure ) / std::max( 1.0, physics->brakes.config.maxCylinderPressure[0] ) };
|
||||
auto const epquantizedratiochange { epquantizedratio - static_cast<int>( 50 * lastepbrakepressureratio ) };
|
||||
if ( epquantizedratiochange > 0 && m_epbrakepressurechangeinctimer > 0.05f) {
|
||||
m_epbrakepressureincrease
|
||||
@@ -296,7 +296,7 @@ void TDynamicObject::renderEpBrakeSounds( double const dt ) {
|
||||
}
|
||||
if ( m_epbrakepressurechangeinctimer == 0 || m_epbrakepressurechangedectimer == 0 )
|
||||
m_lastepbrakepressure = std::min( physics->brakes.independentValve->GetCP(),
|
||||
physics->brakes.independentPositionEim * std::max( 1.0, physics->brakes.maxCylinderPressure[0] ) );
|
||||
physics->brakes.independentPositionEim * std::max( 1.0, physics->brakes.config.maxCylinderPressure[0] ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ double TDynamicObject::renderBrakeFrictionSounds( double const dt ) {
|
||||
|
||||
brakeforceratio =
|
||||
std::clamp(
|
||||
physics->brakes.unitForce / std::max( 1.0, physics->BrakeForceR( 1.0, physics->Vel ) / ( physics->NAxles * std::max( 1, physics->brakes.blocksPerAxle ) ) ),
|
||||
physics->brakes.unitForce / std::max( 1.0, physics->BrakeForceR( 1.0, physics->Vel ) / ( physics->NAxles * std::max( 1, physics->brakes.config.blocksPerAxle ) ) ),
|
||||
0.0, 1.0 );
|
||||
rsBrake
|
||||
.pitch( rsBrake.m_frequencyoffset + physics->Vel * rsBrake.m_frequencyfactor )
|
||||
|
||||
Reference in New Issue
Block a user