17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-06 20:58:35 +01:00

Fix/sonar maintainability rebased (#209)

* refactor(sonar): use override instead of redundant virtual (cpp:S3471)

* refactor(sonar): remove empty statements, one declaration per statement (cpp:S1116, cpp:S1659)

* refactor(sonar): drop redundant lambda return types (cpp:S3574)

* refactor(sonar): prefer using over typedef (cpp:S5416)

* refactor(sonar): use =default for trivial special members (cpp:S3490)

* refactor(sonar): use nullptr literal (cpp:S4962)

* refactor(sonar): remove redundant access specifiers (cpp:S3539)

* refactor(sonar): remove redundant casts (cpp:S1905)

* refactor(sonar): use std::scoped_lock instead of std::lock_guard (cpp:S5997)

* refactor(sonar): construct elements in place with emplace_back (cpp:S6003)

* refactor(sonar): make narrowing conversions explicit (cpp:S5276)

* refactor(sonar): mark unused parameters (cpp:S1172)

Unused names are commented out; parameters used only on some platforms
are marked [[maybe_unused]].

* refactor(sonar): declare non-mutating member functions const (cpp:S5817)

Virtual functions are left untouched so overrides keep matching.

* refactor(sonar): merge collapsible nested if statements (cpp:S1066)

Comments that preceded the inner if are kept above the merged statement.

* refactor(sonar): scope single-use variables in if init-statements (cpp:S6004)

* fix(sonar): give polymorphic base classes virtual destructors (cpp:S1235)

* refactor(sonar): use try_emplace for map insertion (cpp:S6030)

* refactor(sonar): use auto where the type is spelled out on the right (cpp:S5827)

* refactor(sonar): remove redundant parentheses (cpp:S1110)

* refactor(sonar): document intentionally empty functions (cpp:S1186)

* refactor(sonar): remove dead stores (cpp:S1854)

Side effects (e.g. LISTLINE++) are kept.

* refactor(sonar): remove unused variables, captures and private fields (cpp:S1481, cpp:S1068)

* refactor(sonar): use structured bindings for pair access (cpp:S6005)

* refactor(sonar): use range-based loops and ranges algorithms (cpp:S5566)

* refactor(sonar): split chained assignments (cpp:S1121)

* refactor(sonar): add default cases to switch statements (cpp:S3562)

* refactor(sonar): use std::size for array lengths (cpp:S7127)

* refactor(sonar): use std::ranges algorithms and std::erase(_if) (cpp:S6197)

* refactor(sonar): access static members through the class (cpp:S2209)

* refactor(sonar): add braces around nested if-else (cpp:S5261)

* refactor(sonar): avoid side effects inside typeid operands (cpp:S5279)

* refactor(sonar): drop top-level const from by-value return types (cpp:S5951)

* refactor(sonar): declare variables separately from their type definitions (cpp:S3646)

* refactor(sonar): declare loop counters in the for statement (cpp:S5955)

* refactor(sonar): rely on class template argument deduction (cpp:S6012)

* refactor(sonar): inherit base constructors instead of forwarding them (cpp:S5952)

* refactor(sonar): rename locals that shadow outer declarations (cpp:S1117)

Only local variables and definition parameters are renamed; shadowing
struct fields and enumerators in headers are left for a separate change.

* refactor(sonar): reduce enum qualification with using enum (cpp:S6177)

Applied only where no unqualified name in the block could be captured by
the introduced enumerators.

* refactor(sonar): mark converting constructors explicit (cpp:S1709)

sound_source and the gl::object conversion operators stay implicit; they
are relied upon by copy-list-initialisation and GL calls.

* refactor(sonar): initialise members in initialiser lists or declarations (cpp:S3230)

* refactor(sonar): make read-only local references and pointers const (cpp:S5350)

* refactor(sonar): take read-only pointer and reference parameters as const (cpp:S995)

TTrain command handlers keep their signature, it is fixed by the handler table.

* refactor(sonar): pass expensive-to-copy parameters by const reference (cpp:S1238)

Signatures declared in files touched by PR 206 (Driver.h, EU07.cpp) and
virtual overrides are left unchanged.

* refactor(sonar): use transparent comparators for string-keyed maps (cpp:S6045)

std::unordered_map instances and map types exposed in headers used by
other modules are left as they are.

* fix(sonar): do not use UI text as a printf format string (cpp:S5281)

Text lines containing '%' would otherwise be interpreted as format
specifiers by ImGui::TextColored.

* refactor(sonar): use std::bind_front for callbacks (cpp:S5995)

* refactor(sonar): drop const_cast on string literals passed to the Python C API (cpp:S859)

* refactor(sonar): take read-only string parameters as std::string_view (cpp:S6009)

The Windows messaging helpers keep std::string, they need c_str().

* refactor(sonar): make read-only global tables const (cpp:S5421)

Mutable global state (flags, timers, singletons) is left as is.

* refactor(sonar): replace single-case switch statements with if (cpp:S1301)

* refactor(sonar): format UUIDs and log timestamps with std::format (cpp:S6494, cpp:S5945)

* refactor(sonar): use std::array for local fixed-size arrays (cpp:S5945)

Arrays that are class members or part of headers are left unchanged.

* fix(sonar): test the bearing damage bit, not bit 0 (cpp:S872)

'DamageFlag & dtrain_bearing > 0' parsed as 'DamageFlag & (dtrain_bearing > 0)',
i.e. DamageFlag & 1, so bearing friction reacted to the wrong damage flag.

* refactor(sonar): assorted small fixes

- empty() instead of size() comparisons (cpp:S1155)
- member initialisers in declaration order (cpp:S3229)
- no redundant c_str() when a std::string is accepted (cpp:S7121)
- contains() on associative containers (cpp:S6171)
- const reference instead of a copying range-for (cpp:S6032)
- starts_with() for prefix checks (cpp:S6178)
- no std::move on temporaries (cpp:S5274)
- has_value() on std::optional (cpp:S7172)
- bool literals for bool members (cpp:S5820)
- inline only on the definition (cpp:S3548)
- explicit base access specifier (cpp:S5965)
- explicit element access instead of dereferencing an array (cpp:S7116)
- rely on the C++20 rewritten operator!= (cpp:S6186)

* refactor(sonar): more small fixes

- std::format instead of iostream manipulators in to_string/to_hex_str (cpp:S6495);
  output verified identical, negative hex values keep the unsigned form
- remove an empty compound statement (cpp:S108)
- drop an always-false unsigned < 0 branch (cpp:S1768)
- explicit lambda capture (cpp:S3608)
- std::make_unique (cpp:S5950)

* chore: strip stray carriage returns left in TTrain constructor comments

* fix: keep quantize() in its own value type

The S5276 change cast the result of the generic quantize<Type_>() to
unsigned int, which truncated float/double callers (shadow angle slider,
editor rotation snapping, AI speed control steps) and broke negative values.

* fix(sonar): use integer loop counters in segment sampling (cpp:S2193)

* refactor(sonar): clean up issues reported on PR 209

- remove locals left unused after the dead-store cleanup (cpp:S1481, cpp:S1854)
- unnamed unused parameter (cpp:S1172)
- single-use declarations moved into if init-statements (cpp:S6004)
- auto for casted initialisers (cpp:S5827)
- const references and pointers where nothing is modified (cpp:S5350)
- rename structured bindings shadowed by inner declarations (cpp:S1117)
This commit is contained in:
jerrrrycho
2026-10-11 13:22:33 +02:00
committed by GitHub
parent c26041f2e7
commit 6263fe539b
162 changed files with 4220 additions and 4598 deletions

View File

@@ -764,7 +764,7 @@ enum class TLocalBrake
HydraulicBrake
};
/// <summary>Brake delay parameter table (apply/release for passenger and freight).</summary>
typedef double TBrakeDelayTable[4];
using TBrakeDelayTable = double[4];
/// <summary>One row of the brake pressure / pipe pressure / flow-speed table for a brake handle position.</summary>
struct TBrakePressure
@@ -780,7 +780,7 @@ struct TBrakePressure
};
/// <summary>Brake pressure table indexed by handle position.</summary>
typedef std::map<int, TBrakePressure> TBrakePressureTable;
using TBrakePressureTable = std::map<int, TBrakePressure>;
/// <summary>Engine / drive type.</summary>
enum class TEngineType
@@ -989,11 +989,11 @@ struct TTransducer
struct TPowerParameters
{
/// <summary>Maximum source voltage [V].</summary>
double MaxVoltage;
double MaxVoltage{0.0};
/// <summary>Maximum source current [A].</summary>
double MaxCurrent;
double MaxCurrent{0.0};
/// <summary>Internal resistance [Ω].</summary>
double IntR;
double IntR{0.001};
/// <summary>Type of source (selects which union member is meaningful).</summary>
TPowerSource SourceType;
union
@@ -1028,10 +1028,7 @@ struct TPowerParameters
};
};
inline TPowerParameters()
{
MaxVoltage = 0.0;
MaxCurrent = 0.0;
IntR = 0.001;
{
SourceType = TPowerSource::NotDefined;
PowerType = TPowerType::NoPower;
RPowerCable.PowerTrans = TPowerType::NoPower;
@@ -1048,7 +1045,7 @@ struct TScheme
bool AutoSwitch = false; /*czy dana pozycja nastawniana jest recznie czy autom.*/
int ScndAct = 0; /*jesli ma bocznik w nastawniku, to ktory bocznik na ktorej pozycji*/
};
typedef TScheme TSchemeTable[ResArraySize + 1]; /*tablica rezystorow rozr.*/
using TSchemeTable = TScheme[ResArraySize + 1]; /*tablica rezystorow rozr.*/
struct TDEScheme
{
double RPM = 0.0; /*obroty diesla*/
@@ -1056,13 +1053,13 @@ struct TDEScheme
double Umax = 0.0; /*napiecie maksymalne*/
double Imax = 0.0; /*prad maksymalny*/
};
typedef TDEScheme TDESchemeTable[33]; /*tablica WWList dla silnikow spalinowych*/
using TDESchemeTable = TDEScheme[33]; /*tablica WWList dla silnikow spalinowych*/
struct TFFScheme
{
double v = 0.0; // parametr wejsciowy
double freq = 0.0; // wyjscie: czestotliwosc falownika
};
typedef TFFScheme TFFSchemeTable[33];
using TFFSchemeTable = TFFScheme[33];
struct TWiperScheme
{
@@ -1071,7 +1068,7 @@ struct TWiperScheme
double interval = 0.0; // interwal pracy wycieraczki
double outBackDelay = 0.0; // czas po jakim wycieraczka zacznie wracac z konca do poczatku
};
typedef TWiperScheme TWiperSchemeTable[16];
using TWiperSchemeTable = TWiperScheme[16];
struct TShuntScheme
{
@@ -1080,33 +1077,23 @@ struct TShuntScheme
double Pmin = 0.0;
double Pmax = 0.0;
};
typedef TShuntScheme TShuntSchemeTable[33];
using TShuntSchemeTable = TShuntScheme[33];
struct TMPTRelay
{ /*lista przekaznikow bocznikowania*/
double Iup = 0.0;
double Idown = 0.0;
};
typedef TMPTRelay TMPTRelayTable[MotorParametersArraySize + 1]; // indexed like MotorParam
using TMPTRelayTable = TMPTRelay[MotorParametersArraySize + 1]; // indexed like MotorParam
struct TMotorParameters
{
double mfi;
double mIsat;
double mfi0; // aproksymacja M(I) silnika} {dla dizla mIsat=przekladnia biegu
double fi;
double Isat;
double fi0; // aproksymacja E(n)=fi*n} {dla dizla fi, mfi: predkosci przelozenia biegu <->
bool AutoSwitch;
TMotorParameters()
{
mfi = 0.0;
mIsat = 0.0;
mfi0 = 0.0;
fi = 0.0;
Isat = 0.0;
fi0 = 0.0;
AutoSwitch = false;
}
double mfi{0.0};
double mIsat{0.0};
double mfi0{0.0}; // aproksymacja M(I) silnika} {dla dizla mIsat=przekladnia biegu
double fi{0.0};
double Isat{0.0};
double fi0{0.0}; // aproksymacja E(n)=fi*n} {dla dizla fi, mfi: predkosci przelozenia biegu <->
bool AutoSwitch{false};
};
struct TUniversalCtrl
@@ -1240,7 +1227,7 @@ struct TCoupling
{
return adapter_type != TCouplerType::NoCoupler;
}
inline TCouplerType const type() const
inline TCouplerType type() const
{
return adapter_type == TCouplerType::NoCoupler ? CouplerType : adapter_type;
}
@@ -1465,7 +1452,8 @@ class TMoverParameters
{
float temp_min{-1}; // lowest accepted temperature
float temp_max{-1}; // highest accepted temperature
} config;
};
heater_config_t config;
// ld inputs
bool breaker{false}; // device is allowed to operate
bool is_enabled{false}; // device is requested to operate
@@ -1500,12 +1488,17 @@ class TMoverParameters
float temp_cooling{-1}; // active cooling activation point
float temp_flow{-1}; // fluid flow activation point
bool shutters{false}; // the radiator has shutters to assist the cooling
} config;
};
circuit_config_t config;
bool is_cold{false}; // fluid is too cold
bool is_warm{false}; // fluid is too hot
bool is_hot{false}; // fluid temperature crossed cooling threshold
bool is_flowing{false}; // fluid is being pushed through the circuit
} water, water_aux, oil, engine;
};
fluid_circuit_t water;
fluid_circuit_t water_aux;
fluid_circuit_t oil;
fluid_circuit_t engine;
// output, state of affected devices
bool PA{false}; // malfunction flag
float rpmw{0.0}; // current main circuit fan revolutions
@@ -1889,9 +1882,9 @@ class TMoverParameters
double MED_Vmin = 0; // predkosc minimalna dla obliczen chwilowej sily hamowania EP w MED
double MED_Vref = 0; // predkosc referencyjna dla obliczen dostepnej sily hamowania EP w MED
double MED_amax{9.81}; // maksymalne opoznienie hamowania sluzbowego MED
bool MED_EPVC = 0; // czy korekcja sily hamowania EP, gdy nie ma dostepnego ED
bool MED_EPVC = false; // czy korekcja sily hamowania EP, gdy nie ma dostepnego ED
double MED_EPVC_Time = 7; // czas korekcji sily hamowania EP, gdy nie ma dostepnego ED
bool MED_Ncor = 0; // czy korekcja sily hamowania z uwzglednieniem nacisku
bool MED_Ncor = false; // czy korekcja sily hamowania z uwzglednieniem nacisku
double MED_MinBrakeReqED = 0; // minimalne zadanie sily hamowania uruchamiajace ED - ponizej tylko EP
double MED_FrED_factor = 1; // mnoznik sily hamowania ED do korekty blendingu
double MED_ED_Delay1 = 0; // opoznienie wdrazania hamowania ED (pierwszy raz)
@@ -2099,7 +2092,7 @@ class TMoverParameters
int CabActive = 0; // numer kabiny, z której jest sterowanie: 1 lub -1; w przeciwnym razie brak sterowania - rozrzad
int CabOccupied = 0; // numer kabiny, w ktorej jest obsada (zwykle jedna na skład) // TODO: move to TController
bool CabMaster = false; // czy pojazd jest nadrzędny w składzie
inline bool IsCabMaster()
inline bool IsCabMaster() const
{
return CabActive == CabOccupied && CabMaster;
} // czy aktualna kabina jest na pewno tą, z której można sterować
@@ -2294,8 +2287,7 @@ class TMoverParameters
bool AIHintPantUpIfIdle{true}; // whether raise both pantographs if idling for a while
double AIHintLocalBrakeAccFactor{1.05}; // suggested acceleration weight for local brake operation
public:
TMoverParameters(double VelInitial, std::string TypeNameInit, std::string NameInit, int Cab);
TMoverParameters(double VelInitial, std::string const &TypeNameInit, std::string const &NameInit, int Cab);
// obsługa sprzęgów
static double CouplerDist(TMoverParameters const *Left, TMoverParameters const *Right);
static double Distance(const TLocation &Loc1, const TLocation &Loc2, const TDimension &Dim1, const TDimension &Dim2);
@@ -2307,7 +2299,7 @@ class TMoverParameters
bool DirectionForward();
bool DirectionBackward(void); /*! kierunek ruchu*/
bool EIMDirectionChangeAllow(void) const;
inline double IsVehicleEIMBrakingFactor()
inline double IsVehicleEIMBrakingFactor() const
{
return DynamicBrakeFlag && ResistorsFlag ? 0.0 : eimv[eimv_Ipoj] < 0 ? -1.0 : 1.0;
}
@@ -2319,32 +2311,32 @@ class TMoverParameters
bool CurrentSwitch(bool const State);
bool IsMotorOverloadRelayHighThresholdOn() const;
void UpdateBatteryVoltage(double dt);
double ComputeMovement(double dt, double dt1, const TTrackShape &Shape, TTrackParam &Track, TTractionParam &ElectricTraction, TLocation const &NewLoc,
double ComputeMovement(double dt, double dt1, const TTrackShape &Shape, TTrackParam const &Track, TTractionParam const &ElectricTraction, TLocation const &NewLoc,
TRotation const &NewRot); // oblicza przesuniecie pojazdu
double FastComputeMovement(double dt, const TTrackShape &Shape, TTrackParam &Track, TLocation const &NewLoc, TRotation const &NewRot); // oblicza przesuniecie pojazdu - wersja zoptymalizowana
void compute_movement_(double const Deltatime);
double ShowEngineRotation(int VehN);
double ShowEngineRotation(int VehN) const;
// Q *******************************************************************************************
double GetTrainsetVoltage(int const Coupling = coupling::heating | coupling::highvoltage) const;
double GetTrainsetHighVoltage() const;
bool switch_physics(bool const State);
double LocalBrakeRatio(void);
double ManualBrakeRatio(void);
double PipeRatio(void); /*ile napelniac*/
double RealPipeRatio(void); /*jak szybko*/
double LocalBrakeRatio(void) const;
double ManualBrakeRatio(void) const;
double PipeRatio(void) const; /*ile napelniac*/
double RealPipeRatio(void) const; /*jak szybko*/
double BrakeVP(void) const;
double EngineRPMRatio() const; // returns current engine revolutions as percentage of max engine revolutions, in range 0-1
double EngineIdleRPM() const;
double EngineMaxRPM() const;
/*! przesylanie komend sterujacych*/
bool SendCtrlToNext(std::string const CtrlCommand, double const ctrlvalue, double const dir, int const Couplertype = coupling::control);
bool SetInternalCommand(std::string NewCommand, double NewValue1, double NewValue2, int const Couplertype = coupling::control);
double GetExternalCommand(std::string &Command);
bool RunCommand(std::string Command, double CValue1, double CValue2, int const Couplertype = coupling::control);
bool SendCtrlToNext(std::string const &CtrlCommand, double const ctrlvalue, double const dir, int const Couplertype = coupling::control);
bool SetInternalCommand(std::string const &NewCommand, double NewValue1, double NewValue2, int const Couplertype = coupling::control);
double GetExternalCommand(std::string &Command) const;
bool RunCommand(std::string const &Command, double CValue1, double CValue2, int const Couplertype = coupling::control);
bool RunInternalCommand();
void PutCommand(std::string NewCommand, double NewValue1, double NewValue2, const TLocation &NewLocation);
void PutCommand(std::string const &NewCommand, double NewValue1, double NewValue2, const TLocation &NewLocation);
bool CabActivisation(bool const Enforce = false);
bool CabDeactivisation(bool const Enforce = false);
bool CabActivisationAuto(bool const Enforce = false);
@@ -2363,7 +2355,7 @@ class TMoverParameters
/*! pomocniczy nastawnik:*/
bool IncScndCtrl(int CtrlSpeed);
bool DecScndCtrl(int CtrlSpeed);
int GetVirtualScndPos();
int GetVirtualScndPos() const;
bool IsScndCtrlNoPowerPos() const;
bool IsScndCtrlMaxPowerPos() const;
@@ -2430,7 +2422,7 @@ class TMoverParameters
double TractionForce(double dt);
double FrictionForce() const;
double BrakeForceR(double ratio, double velocity);
double BrakeForceP(double press, double velocity);
double BrakeForceP(double press, double velocity) const;
double BrakeForce(const TTrackParam &Track);
double CouplerForce(int const End, double dt);
void CollisionDetect(int const End, double const dt);
@@ -2488,8 +2480,8 @@ class TMoverParameters
/*funkcje uzalezniajace sile pociagowa od predkosci: v2n, n2r, current, momentum*/
double v2n(void);
double Current(double n, double U);
double Momentum(double I);
double MomentumF(double I, double Iw, int SCP);
double Momentum(double I) const;
double MomentumF(double I, double Iw, int SCP) const;
bool CutOffEngine(void); // odlaczenie udszkodzonych silnikow
/*funkcje automatycznego rozruchu np EN57*/
@@ -2526,7 +2518,7 @@ class TMoverParameters
/* funckje dla wagonow*/
bool AssignLoad(std::string const &Name, float const Amount = 0.f);
bool LoadingDone(double LSpeed, std::string const &Loadname);
bool LoadingDone(double LSpeed, std::string_view Loadname);
bool PermitDoors(side const Door, bool const State = true, range_t const Notify = range_t::consist);
void PermitDoors_(side const Door, bool const State = true);
bool ChangeDoorPermitPreset(int const Change, range_t const Notify = range_t::consist);
@@ -2541,7 +2533,7 @@ class TMoverParameters
bool ChangeOffsetH(double DeltaOffset);
/*funkcje ladujace pliki opisujace pojazd*/
bool LoadFIZ(std::string chkpath); // Q 20160717 bool LoadChkFile(std::string chkpath);
bool LoadFIZ(std::string const &chkpath); // Q 20160717 bool LoadChkFile(std::string chkpath);
bool CheckLocomotiveParameters(bool ReadyFlag, int Dir);
std::string EngineDescription(int what) const;
@@ -2577,10 +2569,10 @@ class TMoverParameters
void LoadFIZ_LightsList(std::string const &Input);
void LoadFIZ_DimmerList(std::string const &Input);
void LoadFIZ_CompressorList(std::string const &Input);
void LoadFIZ_PowerParamsDecode(TPowerParameters &Powerparameters, std::string const Prefix, std::string const &Input);
TPowerType LoadFIZ_PowerDecode(std::string const &Power);
TPowerSource LoadFIZ_SourceDecode(std::string const &Source);
TEngineType LoadFIZ_EngineDecode(std::string const &Engine);
void LoadFIZ_PowerParamsDecode(TPowerParameters &Powerparameters, std::string const &Prefix, std::string const &Input);
TPowerType LoadFIZ_PowerDecode(std::string const &Power) const;
TPowerSource LoadFIZ_SourceDecode(std::string const &Source) const;
TEngineType LoadFIZ_EngineDecode(std::string const &Engine) const;
bool readMPT0(std::string const &line);
bool readMPT(std::string const &line); // Q 20160717
bool readMPTElectricSeries(std::string const &line);

File diff suppressed because it is too large Load Diff

View File

@@ -211,7 +211,7 @@ double TNESt3::GetPF( double const PP, double const dt, double const Vel ) // pr
double dV{ 0.0 };
double dV1{ 0.0 };
double const nastG = static_cast<double>(BrakeDelayFlag & bdelay_G);
auto const nastG = static_cast<double>(BrakeDelayFlag & bdelay_G);
// sprawdzanie stanu
CheckState(BCP, dV1);
@@ -294,8 +294,9 @@ double TNESt3::GetPF( double const PP, double const dt, double const Vel ) // pr
return dV - dV1;
}
void TNESt3::EStParams( double const i_crc ) // parametry charakterystyczne dla ESt
void TNESt3::EStParams( double const /*i_crc*/ ) const // parametry charakterystyczne dla ESt
{
// no effect for this device type
}
void TNESt3::Init( double const PP, double const HPP, double const LPP, double const BP, int const BDF )
@@ -318,7 +319,9 @@ void TNESt3::Init( double const PP, double const HPP, double const LPP, double c
Zamykajacy = false;
if ( typeid(*FM) == typeid(TDisk1) || typeid(*FM) == typeid(TDisk2) ) // jesli zeliwo to schodz
auto const &frictionmaterial { *FM };
auto const &frictionmaterialtype { typeid( frictionmaterial ) };
if ( frictionmaterialtype == typeid(TDisk1) || frictionmaterialtype == typeid(TDisk2) ) // jesli zeliwo to schodz
RapidStaly = true;
else
RapidStaly = false;
@@ -331,9 +334,8 @@ double TNESt3::GetCRP()
// return Miedzypoj.P;
}
void TNESt3::CheckState(double const BCP, double &dV1) // glowny przyrzad rozrzadczy
void TNESt3::CheckState(double const BCP, double & /*dV1*/) // glowny przyrzad rozrzadczy
{
double const BVP{ BrakeRes->P() }; //-> tu ma byc komora rozprezna
double const VVP{ ValveRes->P() };
double const CVP{ CntrlRes->P() };
double const MPP{ Miedzypoj->P() };
@@ -355,14 +357,14 @@ void TNESt3::CheckState(double const BCP, double &dV1) // glowny przyrzad rozrza
if( ( BrakeStatus & b_hld ) == 0 )
SoundFlag |= sf_CylU;
if (VVP + 0.10 < CVP && BCP < 0.25) // poczatek hamowania
if (false == Przys_blok)
{
ValveRes->CreatePress(0.1 * VVP);
SoundFlag |= sf_Acc;
ValveRes->Act();
Przys_blok = true;
}
// poczatek hamowania
if (VVP + 0.10 < CVP && BCP < 0.25 && false == Przys_blok)
{
ValveRes->CreatePress(0.1 * VVP);
SoundFlag |= sf_Acc;
ValveRes->Act();
Przys_blok = true;
}
if (BCP > 0.5)
Zamykajacy = true;
@@ -384,7 +386,7 @@ void TNESt3::CheckReleaser(double const dt) // odluzniacz
}
}
double TNESt3::CVs(double const BP) // napelniacz sterujacego
double TNESt3::CVs(double const /*BP*/) const // napelniacz sterujacego
{
double const CVP{ CntrlRes->P() };
double const MPP{ Miedzypoj->P() };
@@ -398,7 +400,7 @@ double TNESt3::CVs(double const BP) // napelniacz sterujacego
return Nozzles[dSm];
}
double TNESt3::BVs(double const BCP) // napelniacz pomocniczego
double TNESt3::BVs(double const BCP) const // napelniacz pomocniczego
{
double const CVP{ CntrlRes->P() };
double const MPP{ Miedzypoj->P() };
@@ -637,9 +639,9 @@ void TNESt3::SetSize( int const size, std::string const &params ) // ustawianie
Nozzles[dSm] = 0.9;
// przeliczanie z mm^2 na l/m
for (int i = 0; i < dMAX; ++i)
for (auto &nozzle : Nozzles)
{
Nozzles[i] = d2A(Nozzles[i]); //(/1000^2*pi/4*1000)
nozzle = d2A(nozzle); //(/1000^2*pi/4*1000)
}
for (int i = 1; i < 4; ++i)
{

View File

@@ -70,38 +70,32 @@ static int const P_ed = 5;
class TPrzekladnik : public TReservoir // przekladnik (powtarzacz)
{
private:
public:
std::shared_ptr<TReservoir> BrakeRes;
std::shared_ptr<TReservoir> Next;
TPrzekladnik() : TReservoir() {};
using TReservoir::TReservoir;
virtual void Update(double dt);
};
class TRura : public TPrzekladnik // nieprzekladnik, rura laczaca
{
private:
public:
TRura() : TPrzekladnik() {};
virtual double P(void) /*override*/;
virtual void Update(double dt) /*override*/;
using TPrzekladnik::TPrzekladnik;
double P(void) override;
void Update(double dt) override;
};
class TPrzeciwposlizg : public TRura // przy napelnianiu - rura, przy poslizgu - upust
{
private:
bool Poslizg;
bool Poslizg{false};
public:
void SetPoslizg(bool flag);
void Update(double dt) /*override*/;
inline TPrzeciwposlizg() : TRura()
{
Poslizg = false;
}
void Update(double dt) override;
};
// przekladnik dwustopniowy
@@ -117,10 +111,8 @@ class TRapid : public TPrzekladnik {
public:
void SetRapidParams(double mult, double size);
void SetRapidStatus(bool rs);
void Update(double dt) /*override*/;
inline TRapid() :
TPrzekladnik()
{}
void Update(double dt) override;
using TPrzekladnik::TPrzekladnik;
};
// AL2
@@ -131,10 +123,8 @@ class TPrzekCiagly : public TPrzekladnik {
public:
void SetMult(double m);
void Update(double dt) /*override*/;
inline TPrzekCiagly() :
TPrzekladnik()
{}
void Update(double dt) override;
using TPrzekladnik::TPrzekladnik;
};
// podwojny zawor zwrotny
@@ -145,20 +135,15 @@ class TPrzek_PZZ : public TPrzekladnik {
public:
void SetLBP(double P);
void Update(double dt) /*override*/;
inline TPrzek_PZZ() :
TPrzekladnik()
{}
void Update(double dt) override;
using TPrzekladnik::TPrzekladnik;
};
class TPrzekZalamany : public TPrzekladnik // Knicksventil
{
private:
public:
TPrzekZalamany() :
TPrzekladnik()
{}
using TPrzekladnik::TPrzekladnik;
};
// przy napelnianiu - rura, przy hamowaniu - upust
@@ -169,10 +154,8 @@ class TPrzekED : public TRura {
public:
void SetP(double P);
void Update(double dt) /*override*/;
inline TPrzekED() :
TRura()
{}
void Update(double dt) override;
using TRura::TRura;
};
class TNESt3 : public TBrake {
@@ -206,22 +189,20 @@ class TNESt3 : public TBrake {
double LBP = 0.0; // cisnienie hamulca pomocniczego
public:
inline TNESt3(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) :
TBrake( i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
{}
void Init( double const PP, double const HPP, double const LPP, double const BP, int const BDF ) /*override*/;
virtual double GetPF( double const PP, double const dt, double const Vel ) /*override*/; // przeplyw miedzy komora wstepna i PG
void EStParams(double i_crc); // parametry charakterystyczne dla ESt
virtual double GetCRP() /*override*/;
using TBrake::TBrake;
void Init( double const PP, double const HPP, double const LPP, double const BP, int const BDF ) override;
double GetPF( double const PP, double const dt, double const Vel ) override; // przeplyw miedzy komora wstepna i PG
void EStParams(double i_crc) const; // parametry charakterystyczne dla ESt
double GetCRP() override;
void CheckState(double const BCP, double &dV1); // glowny przyrzad rozrzadczy
void CheckReleaser(double const dt); // odluzniacz
double CVs(double const BP); // napelniacz sterujacego
double BVs(double const BCP); // napelniacz pomocniczego
double CVs(double const BP) const; // napelniacz sterujacego
double BVs(double const BCP) const; // napelniacz pomocniczego
void SetSize( int const size, std::string const &params ); // ustawianie dysz (rozmiaru ZR), przekladniki
void PLC(double const mass); // wspolczynnik cisnienia przystawki wazacej
void SetLP(double const TM, double const LM, double const TBP); // parametry przystawki wazacej
virtual void ForceEmptiness() /*override*/; // wymuszenie bycia pustym
void SetLBP(double const P); // cisnienie z hamulca pomocniczego
void PLC(double const mass) override; // wspolczynnik cisnienia przystawki wazacej
void SetLP(double const TM, double const LM, double const TBP) override; // parametry przystawki wazacej
void ForceEmptiness() override; // wymuszenie bycia pustym
void SetLBP(double const P) override; // cisnienie z hamulca pomocniczego
};
extern double d2A( double const d );

View File

@@ -41,6 +41,7 @@ class TFricMat
public:
virtual double GetFC(double N, double Vel);
virtual ~TFricMat() = default;
};
@@ -49,7 +50,7 @@ class TP10Bg: public TFricMat
{
public:
double GetFC(double N, double Vel)/*override*/;
double GetFC(double N, double Vel) override;
};
@@ -59,7 +60,7 @@ class TP10Bgu: public TFricMat
{
public:
double GetFC(double N, double Vel)/*override*/;
double GetFC(double N, double Vel) override;
};
@@ -69,7 +70,7 @@ class TP10yBg: public TFricMat
{
public:
double GetFC(double N, double Vel)/*override*/;
double GetFC(double N, double Vel) override;
};
@@ -79,7 +80,7 @@ class TP10yBgu: public TFricMat
{
public:
double GetFC(double N, double Vel)/*override*/;
double GetFC(double N, double Vel) override;
};
@@ -89,7 +90,7 @@ class TP10: public TFricMat
{
public:
double GetFC(double N, double Vel)/*override*/;
double GetFC(double N, double Vel) override;
};
@@ -99,7 +100,7 @@ class TFR513: public TFricMat
{
public:
double GetFC(double N, double Vel)/*override*/;
double GetFC(double N, double Vel) override;
};
@@ -109,7 +110,7 @@ class TFR510: public TFricMat
{
public:
double GetFC(double N, double Vel)/*override*/;
double GetFC(double N, double Vel) override;
};
@@ -119,7 +120,7 @@ class TCosid: public TFricMat
{
public:
double GetFC(double N, double Vel)/*override*/;
double GetFC(double N, double Vel) override;
};
@@ -129,7 +130,7 @@ class TDisk1: public TFricMat
{
public:
double GetFC(double N, double Vel)/*override*/;
double GetFC(double N, double Vel) override;
};
@@ -139,7 +140,7 @@ class TDisk2: public TFricMat
{
public:
double GetFC(double N, double Vel)/*override*/;
double GetFC(double N, double Vel) override;
};

View File

@@ -357,21 +357,14 @@ end ; */
/// <param name="i_mat">Friction material id (bp_* constant, optionally OR'ed with bp_MHS).</param>
/// <param name="i_ba">Number of braked axles.</param>
/// <param name="i_nbpa">Number of blocks per axle.</param>
TBrake::TBrake(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa)
TBrake::TBrake(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) :
BCN(i_bcn), BCM(1), BCA(i_bcn * i_bcr * i_bcr * M_PI), BrakeDelays(i_BD), MaxBP(i_mbp), BA(i_ba), NBpA(i_nbpa), SizeBR(i_brc * 0.0128)
{
// inherited:: Create;
MaxBP = i_mbp;
BCN = i_bcn;
BCM = 1;
BCA = i_bcn * i_bcr * i_bcr * M_PI;
BA = i_ba;
NBpA = i_nbpa;
BrakeDelays = i_BD;
BrakeDelayFlag = bdelay_P;
// 210.88
// SizeBR:=i_bcn*i_bcr*i_bcr*i_bcd*40.17*MaxBP/(5-MaxBP); //objetosc ZP w stosunku do cylindra
// 14" i cisnienia 4.2 atm
SizeBR = i_brc * 0.0128;
SizeBC = i_bcn * i_bcr * i_bcr * i_bcd * 210.88 * MaxBP / 4.2; // objetosc CH w stosunku do cylindra 14" i cisnienia 4.2 atm
BrakeCyl = std::make_shared<TBrakeCyl>();
@@ -450,7 +443,7 @@ double TBrake::GetFC(double const Vel, double const N)
/// <summary>Returns the gauge pressure inside the brake cylinder.</summary>
// cisnienie cylindra hamulcowego
double TBrake::GetBCP()
double TBrake::GetBCP() const
{
return BrakeCyl->P();
}
@@ -464,14 +457,14 @@ double TBrake::GetEDBCP()
/// <summary>Returns the auxiliary reservoir (ZP) pressure.</summary>
// cisnienie zbiornika pomocniczego
double TBrake::GetBRP()
double TBrake::GetBRP() const
{
return BrakeRes->P();
}
/// <summary>Returns the valve pre-chamber pressure.</summary>
// cisnienie komory wstepnej
double TBrake::GetVRP()
double TBrake::GetVRP() const
{
return ValveRes->P();
}
@@ -516,7 +509,7 @@ double TBrake::GetHPFlow(double const HP, double const dt)
/// <summary>
/// Returns the piston force from the cylinder pressure (BCA * 100 * P).
/// </summary>
double TBrake::GetBCF()
double TBrake::GetBCF() const
{
return BCA * 100 * BrakeCyl->P();
}
@@ -558,7 +551,7 @@ bool TBrake::Releaser() const
/// support the EP brake (TWest, TEStEP1/2, ...).
/// </summary>
/// <param name="nEPS">EP intensity.</param>
void TBrake::SetEPS(double const nEPS) {}
void TBrake::SetEPS(double const nEPS) { /* no effect for this device type */ }
/// <summary>
/// Sets the anti-slip brake state flags. Bit 1 of <paramref name="state"/>
@@ -572,7 +565,7 @@ void TBrake::ASB(int const state)
}
/// <summary>Returns the raw BrakeStatus bitfield.</summary>
int TBrake::GetStatus()
int TBrake::GetStatus() const
{
return BrakeStatus;
}
@@ -674,14 +667,14 @@ double TWest::GetPF(double const PP, double const dt, double const Vel)
BCP = BrakeCyl->P();
if ((BrakeStatus & b_hld) == b_hld)
{
if (VVP + 0.03 < BVP)
BrakeStatus |= b_on;
else if (VVP > BVP + 0.1)
BrakeStatus &= ~(b_on | b_hld);
else if (VVP > BVP)
BrakeStatus &= ~b_on;
else
;
}
else if (VVP + 0.25 < BVP)
BrakeStatus |= b_on | b_hld;
@@ -707,7 +700,6 @@ double TWest::GetPF(double const PP, double const dt, double const Vel)
temp = BVP * int(EPS > 0);
dv = PF(temp, LBP, 0.0015) * dt * EPS * EPS * int(LBP * EPS < MaxBP * LoadC);
LBP = LBP - dv;
dv = 0;
// przeplyw ZP <-> silowniki
if ((BrakeStatus & b_on) == b_on && (TareBP < 0.1 || BCP < MaxBP * LoadC))
@@ -781,20 +773,15 @@ void TWest::SetLBP(double const P)
/// <param name="nEPS">New EP intensity.</param>
void TWest::SetEPS(double const nEPS)
{
double BCP;
BCP = BrakeCyl->P();
if (nEPS > 0)
DCV = true;
else if (nEPS == 0)
else if (nEPS == 0 && EPS != 0)
{
if (EPS != 0)
{
if (LBP > 0.4)
LBP = BrakeCyl->P();
if (LBP < 0.15)
LBP = 0;
}
if (LBP > 0.4)
LBP = BrakeCyl->P();
if (LBP < 0.15)
LBP = 0;
}
EPS = nEPS;
}
@@ -838,12 +825,14 @@ void TESt::CheckReleaser(double const dt)
// odluzniacz
if ((BrakeStatus & b_rls) == b_rls)
{
if (CVP - VVP < 0)
BrakeStatus &= ~b_rls;
else
{
CntrlRes->Flow(+PF(CVP, 0, 0.1) * dt);
}
}
}
/// <summary>
@@ -854,11 +843,10 @@ void TESt::CheckReleaser(double const dt)
/// </summary>
/// <param name="BCP">Brake cylinder (or impulse-chamber) pressure.</param>
/// <param name="dV1">In/out brake-pipe flow correction (unused in this base impl).</param>
void TESt::CheckState(double const BCP, double &dV1)
void TESt::CheckState(double const BCP, double & /*dV1*/)
{
double const VVP{ValveRes->P()};
double const BVP{BrakeRes->P()};
double const CVP{CntrlRes->P()};
// sprawdzanie stanu
@@ -927,7 +915,7 @@ void TESt::CheckState(double const BCP, double &dV1)
/// </summary>
/// <param name="BP">Brake cylinder (or impulse) pressure.</param>
/// <returns>Opening coefficient (0 closed, 1 fully open).</returns>
double TESt::CVs(double const BP)
double TESt::CVs(double const BP) const
{
double VVP;
double BVP;
@@ -958,7 +946,7 @@ double TESt::CVs(double const BP)
/// </summary>
/// <param name="BCP">Brake cylinder pressure.</param>
/// <returns>Opening coefficient.</returns>
double TESt::BVs(double const BCP)
double TESt::BVs(double const BCP) const
{
double VVP;
double BVP;
@@ -1000,11 +988,8 @@ double TESt::GetPF(double const PP, double const dt, double const Vel)
double CVP;
BVP = BrakeRes->P();
VVP = ValveRes->P();
BCP = BrakeCyl->P();
CVP = CntrlRes->P() - 0.0;
dv = 0;
dV1 = 0;
// sprawdzanie stanu
@@ -1086,7 +1071,7 @@ void TESt::Init(double const PP, double const HPP, double const LPP, double cons
/// derived variants and currently a no-op.
/// </summary>
/// <param name="i_crc">Characteristic value.</param>
void TESt::EStParams(double const i_crc) {}
void TESt::EStParams(double const /*i_crc*/) const { /* no effect for this device type */ }
/// <summary>Returns the control reservoir (ZS) pressure.</summary>
double TESt::GetCRP()
@@ -1160,7 +1145,6 @@ double TEStEP2::GetPF(double const PP, double const dt, double const Vel)
BCP = ImplsRes->P();
CVP = CntrlRes->P(); // 110115 - konsultacje warszawa1
dv = 0;
dV1 = 0;
// odluzniacz
@@ -1168,14 +1152,14 @@ double TEStEP2::GetPF(double const PP, double const dt, double const Vel)
// sprawdzanie stanu
if ((BrakeStatus & b_hld) == b_hld && BCP > 0.25)
{
if (VVP + 0.003 + BCP / BVM < CVP - 0.12)
BrakeStatus |= b_on; // hamowanie stopniowe;
else if (VVP - 0.003 + BCP / BVM > CVP - 0.12)
BrakeStatus &= ~(b_on | b_hld); // luzowanie;
else if (VVP + BCP / BVM > CVP - 0.12)
BrakeStatus &= ~b_on; // zatrzymanie napelaniania;
else
;
}
else if (VVP + 0.10 < CVP - 0.12 && BCP < 0.25) // poczatek hamowania
{
// if ((BrakeStatus & 1) == 0)
@@ -1343,9 +1327,9 @@ void TEStEP1::SetEPS(double const nEPS)
double TESt3::GetPF(double const PP, double const dt, double const Vel)
{
double BVP{BrakeRes->P()};
double VVP{ValveRes->P()};
double VVP;
double BCP{BrakeCyl->P()};
double CVP{CntrlRes->P() - 0.0};
double CVP;
double dv{0.0};
double dV1{0.0};
@@ -1420,11 +1404,8 @@ double TESt4R::GetPF(double const PP, double const dt, double const Vel)
double CVP;
BVP = BrakeRes->P();
VVP = ValveRes->P();
BCP = ImplsRes->P();
CVP = CntrlRes->P();
dv = 0;
dV1 = 0;
// sprawdzanie stanu
@@ -1543,11 +1524,9 @@ double TESt3AL2::GetPF(double const PP, double const dt, double const Vel)
double CVP;
BVP = BrakeRes->P();
VVP = ValveRes->P();
BCP = ImplsRes->P();
CVP = CntrlRes->P() - 0.0;
dv = 0;
dV1 = 0;
// sprawdzanie stanu
@@ -1715,8 +1694,7 @@ double TLSt::GetPF(double const PP, double const dt, double const Vel)
SoundFlag |= sf_CylU;
}
// equivalent of checkreleaser() in the base class?
bool is_releasing = BrakeStatus & b_rls || UniversalFlag & TUniversalBrake::ub_Release;
if (is_releasing)
if (bool is_releasing = BrakeStatus & b_rls || UniversalFlag & TUniversalBrake::ub_Release; is_releasing)
{
if (CVP < 0.0)
{
@@ -1934,14 +1912,14 @@ double TEStED::GetPF(double const PP, double const dt, double const Vel)
else if (VVP + (BCP - 0.1) / BVM < CVP - 0.05 && BCP > 0.25) // zatrzymanie luzowania
BrakeStatus |= b_hld;
if (VVP + 0.10 < CVP && BCP < 0.25) // poczatek hamowania
if (!Przys_blok)
{
ValveRes->CreatePress(0.75 * VVP);
SoundFlag |= sf_Acc;
ValveRes->Act();
Przys_blok = true;
}
// poczatek hamowania
if (VVP + 0.10 < CVP && BCP < 0.25 && !Przys_blok)
{
ValveRes->CreatePress(0.75 * VVP);
SoundFlag |= sf_Acc;
ValveRes->Act();
Przys_blok = true;
}
if (BCP > 0.5)
Zamykajacy = true;
@@ -2069,7 +2047,6 @@ double TEStED::GetPF(double const PP, double const dt, double const Vel)
void TEStED::Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF)
{
TLSt::Init(PP, HPP, LPP, BP, BDF);
int i;
ValveRes->CreatePress(PP);
BrakeCyl->CreatePress(BP);
@@ -2104,7 +2081,7 @@ void TEStED::Init(double const PP, double const HPP, double const LPP, double co
Nozzles[6] = 0.9;
{
for (i = 0; i < 11; ++i)
for (int i = 0; i < 11; ++i)
{
Nozzles[i] = Nozzles[i] * Nozzles[i] * 3.14159 / 4000;
}
@@ -2165,14 +2142,14 @@ void TCV1::CheckState(double const BCP, double &dV1)
// sprawdzanie stanu
if ((BrakeStatus & b_hld) == b_hld)
{
if (VVP + 0.003 + BCP / BVM < CVP)
BrakeStatus |= b_on; // hamowanie stopniowe;
else if (VVP - 0.003 + BCP * 1.0 / BVM > CVP)
BrakeStatus &= ~(b_on | b_hld); // luzowanie;
else if (VVP + BCP * 1.0 / BVM > CVP)
BrakeStatus &= ~b_on; // zatrzymanie napelaniania;
else
;
}
else if (VVP + 0.10 < CVP && BCP < 0.1) // poczatek hamowania
{
BrakeStatus |= b_on | b_hld;
@@ -2188,7 +2165,7 @@ void TCV1::CheckState(double const BCP, double &dV1)
/// </summary>
/// <param name="BP">Cylinder pressure.</param>
/// <returns>Opening coefficient.</returns>
double TCV1::CVs(double const BP)
double TCV1::CVs(double const BP) const
{
// przeplyw ZS <-> PG
if (BP > 0.05)
@@ -2204,7 +2181,7 @@ double TCV1::CVs(double const BP)
/// </summary>
/// <param name="BCP">Cylinder pressure.</param>
/// <returns>Opening coefficient.</returns>
double TCV1::BVs(double const BCP)
double TCV1::BVs(double const BCP) const
{
double VVP;
double BVP;
@@ -2243,11 +2220,9 @@ double TCV1::GetPF(double const PP, double const dt, double const Vel)
double CVP;
BVP = BrakeRes->P();
VVP = std::min(ValveRes->P(), BVP + 0.05);
BCP = BrakeCyl->P();
CVP = CntrlRes->P();
dv = 0;
dV1 = 0;
// sprawdzanie stanu
@@ -2402,11 +2377,9 @@ double TCV1L_TR::GetPF(double const PP, double const dt, double const Vel)
double CVP;
BVP = BrakeRes->P();
VVP = std::min(ValveRes->P(), BVP + 0.05);
BCP = ImplsRes->P();
CVP = CntrlRes->P();
dv = 0;
dV1 = 0;
// sprawdzanie stanu
@@ -2488,10 +2461,12 @@ void TKE::CheckReleaser(double const dt)
// odluzniacz
if (true == ((BrakeStatus & b_rls) == b_rls))
{
if (CVP - VVP < 0)
BrakeStatus &= ~b_rls;
else
CntrlRes->Flow(+PF(CVP, 0, 0.1) * dt);
}
}
/// <summary>
@@ -2502,13 +2477,11 @@ void TKE::CheckReleaser(double const dt)
/// </summary>
/// <param name="BCP">Cylinder (or impulse-chamber) pressure.</param>
/// <param name="dV1">In/out brake-pipe flow correction (unused here).</param>
void TKE::CheckState(double const BCP, double &dV1)
void TKE::CheckState(double const BCP, double & /*dV1*/)
{
double VVP;
double BVP;
double CVP;
BVP = BrakeRes->P();
VVP = ValveRes->P();
CVP = CntrlRes->P();
@@ -2578,13 +2551,11 @@ void TKE::CheckState(double const BCP, double &dV1)
/// </summary>
/// <param name="BP">Cylinder (or impulse) pressure.</param>
/// <returns>Opening coefficient.</returns>
double TKE::CVs(double const BP)
double TKE::CVs(double const BP) const
{
double VVP;
double BVP;
double CVP;
BVP = BrakeRes->P();
CVP = CntrlRes->P();
VVP = ValveRes->P();
@@ -2604,7 +2575,7 @@ double TKE::CVs(double const BP)
/// </summary>
/// <param name="BCP">Impulse-chamber pressure.</param>
/// <returns>Opening coefficient.</returns>
double TKE::BVs(double const BCP)
double TKE::BVs(double const /*BCP*/) const
{
double VVP;
double BVP;
@@ -2651,7 +2622,6 @@ double TKE::GetPF(double const PP, double const dt, double const Vel)
IMP = ImplsRes->P();
CVP = CntrlRes->P();
dv = 0;
dV1 = 0;
// sprawdzanie stanu
@@ -2694,7 +2664,8 @@ double TKE::GetPF(double const PP, double const dt, double const Vel)
ImplsRes->Flow(-dv);
// rapid
if (!(typeid(*FM) == typeid(TDisk1) || typeid(*FM) == typeid(TDisk2))) // jesli zeliwo to schodz
auto const &frictionmaterial{*FM};
if (auto const &frictionmaterialtype{typeid(frictionmaterial)}; !(frictionmaterialtype == typeid(TDisk1) || frictionmaterialtype == typeid(TDisk2))) // jesli zeliwo to schodz
RapidStatus = (BrakeDelayFlag & bdelay_R) == bdelay_R && (RV < 0 || (Vel > RV && RapidStatus) || Vel > RV + 20);
else // jesli tarczowki, to zostan
RapidStatus = (BrakeDelayFlag & bdelay_R) == bdelay_R;
@@ -2872,7 +2843,7 @@ void TDriverHandle::Init(double Press)
/// <summary>Default reductor adjustment — no-op.</summary>
/// <param name="nAdj">Pressure correction.</param>
void TDriverHandle::SetReductor(double nAdj) {}
void TDriverHandle::SetReductor(double nAdj) { /* no effect for this device type */ }
/// <summary>Default cab-gauge pressure — 0.</summary>
double TDriverHandle::GetCP()
@@ -2969,9 +2940,8 @@ double TFV4a::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
if (lround(i_bcp) == -1)
{
CP = CP + 5 * std::min(std::abs(LimPP - CP), 0.2) * PR(CP, LimPP) * dt / 2;
if (CP < RP + 0.03)
if (TP < 5)
TP = TP + dt;
if (CP < RP + 0.03 && TP < 5)
TP = TP + dt;
// if(cp+0.03<5.4)then
if (RP + 0.03 < 5.4 || CP + 0.03 < 5.4) // fala
dpMainValve = PF(std::min(HP, 17.1), PP, ActFlowSpeed / LBDelay) * dt;
@@ -3037,11 +3007,10 @@ double TFV4aM::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
int const LBDelay{100};
double const xpM{0.3}; // mnoznik membrany komory pod
ep = PP / 2.0 * 1.5 + ep / 2.0 * 0.5; // SPKS!!
for (int idx = 0; idx < 5; ++idx)
for (auto &soundvalue : Sounds)
{
Sounds[idx] = 0;
soundvalue = 0;
}
// na wszelki wypadek, zeby nie wyszlo poza zakres
@@ -3134,13 +3103,9 @@ double TFV4aM::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
}
}
if (EQ(i_bcp, 0))
if (EQ(i_bcp, 0) && TP > 2)
{
if (TP > 2)
{
dpMainValve *= 1.5;
}
dpMainValve *= 1.5;
}
ep = dpPipe;
@@ -3239,16 +3204,16 @@ double TFV4aM::GetRP()
/// </summary>
/// <param name="pos">Continuous handle position.</param>
/// <returns>Interpolated target pressure [bar].</returns>
double TFV4aM::LPP_RP(double pos) // cisnienie z zaokraglonej pozycji;
double TFV4aM::LPP_RP(double pos) const // cisnienie z zaokraglonej pozycji;
{
int const i_pos = 2 + std::floor(pos); // zaokraglone w dol
auto const i_pos = static_cast<int>(2 + std::floor(pos)); // zaokraglone w dol
return BPT[i_pos][1] + (BPT[i_pos + 1][1] - BPT[i_pos][1]) * (pos + 2 - i_pos); // interpolacja liniowa
}
/// <summary>Returns true if pos is within ±0.5 of i_pos (detent test).</summary>
/// <param name="pos">Continuous handle position.</param>
/// <param name="i_pos">Detent centre.</param>
bool TFV4aM::EQ(double pos, double i_pos)
bool TFV4aM::EQ(double pos, double i_pos) const
{
return pos <= i_pos + 0.5 && pos > i_pos - 0.5;
}
@@ -3279,12 +3244,11 @@ double TMHZ_EN57::GetPF(double i_bcp, double PP, double HP, double dt, double ep
double DP;
double pom;
for (int idx = 0; idx < 5; ++idx)
for (auto &soundvalue : Sounds)
{
Sounds[idx] = 0;
soundvalue = 0;
}
DP = 0;
i_bcp = std::clamp(i_bcp, -0.999, 9.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
@@ -3425,7 +3389,7 @@ double TMHZ_EN57::GetEP(double pos)
/// </summary>
/// <param name="pos">Continuous handle position.</param>
/// <returns>Target brake-pipe pressure [bar].</returns>
double TMHZ_EN57::LPP_RP(double pos) // cisnienie z zaokraglonej pozycji;
double TMHZ_EN57::LPP_RP(double pos) const // cisnienie z zaokraglonej pozycji;
{
if (pos > 8.5)
return 5.0 - 0.15 * pos - 0.35;
@@ -3456,7 +3420,7 @@ void TMHZ_EN57::SetParams(bool AO, bool MO, double OverP, double, double OMP, do
}
/// <summary>Returns true if pos is within ±0.5 of i_pos (detent test).</summary>
bool TMHZ_EN57::EQ(double pos, double i_pos)
bool TMHZ_EN57::EQ(double pos, double i_pos) const
{
return pos <= i_pos + 0.5 && pos > i_pos - 0.5;
}
@@ -3484,14 +3448,12 @@ double TMHZ_K5P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
double dpMainValve;
double ActFlowSpeed;
double DP;
double pom;
for (int idx = 0; idx < 5; ++idx)
for (auto &soundvalue : Sounds)
{
Sounds[idx] = 0;
soundvalue = 0;
}
DP = 0;
i_bcp = std::clamp(i_bcp, -0.999, 2.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
@@ -3512,7 +3474,6 @@ double TMHZ_K5P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
LimCP = 3.4;
else // luzowanie
LimCP = 5.0;
pom = CP;
LimCP = std::min(LimCP, HP); // pozycja + czasowy lub zasilanie
ActFlowSpeed = 4;
@@ -3636,7 +3597,7 @@ void TMHZ_K5P::SetParams(bool AO, bool MO, double OverP, double FSF, double OMP,
}
/// <summary>Returns true if pos is within ±0.5 of i_pos (detent test).</summary>
bool TMHZ_K5P::EQ(double pos, double i_pos)
bool TMHZ_K5P::EQ(double pos, double i_pos) const
{
return pos <= i_pos + 0.5 && pos > i_pos - 0.5;
}
@@ -3663,14 +3624,12 @@ double TMHZ_6P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
double dpMainValve;
double ActFlowSpeed;
double DP;
double pom;
for (int idx = 0; idx < 5; ++idx)
for (auto &soundvalue : Sounds)
{
Sounds[idx] = 0;
soundvalue = 0;
}
DP = 0;
i_bcp = std::clamp(i_bcp, -0.999, 3.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
@@ -3691,7 +3650,6 @@ double TMHZ_6P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
LimCP = 3.4;
else // luzowanie
LimCP = 5.0;
pom = CP;
LimCP = std::min(LimCP, HP); // pozycja + czasowy lub zasilanie
ActFlowSpeed = 4;
@@ -3815,7 +3773,7 @@ void TMHZ_6P::SetParams(bool AO, bool MO, double OverP, double FSF, double OMP,
}
/// <summary>Returns true if pos is within ±0.5 of i_pos (detent test).</summary>
bool TMHZ_6P::EQ(double pos, double i_pos)
bool TMHZ_6P::EQ(double pos, double i_pos) const
{
return pos <= i_pos + 0.5 && pos > i_pos - 0.5;
}
@@ -3844,7 +3802,7 @@ double TM394::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
double ActFlowSpeed;
int BCP;
BCP = lround(i_bcp);
BCP = static_cast<int>(lround(i_bcp));
if (BCP < -1)
BCP = 1;
@@ -3855,6 +3813,7 @@ double TM394::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
if (BCP == 0)
LimPP = LimPP + RedAdj;
if (BCP != 2)
{
if (CP < LimPP)
CP = CP + 4 * std::min(abs(LimPP - CP), 0.05) * PR(CP, LimPP) * dt; // zbiornik sterujacy
// cp:=cp+6*(2+int(bcp<0))*std::min(abs(Limpp-cp),0.05)*PR(cp,Limpp)*dt //zbiornik
@@ -3863,6 +3822,7 @@ double TM394::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
CP = CP - 0.2 * dt / 100;
else
CP = CP + 4 * (1 + int(BCP != 3) + int(BCP > 4)) * std::min(abs(LimPP - CP), 0.05) * PR(CP, LimPP) * dt; // zbiornik sterujacy
}
LimPP = CP;
dpPipe = std::min(HP, LimPP);
@@ -3937,7 +3897,7 @@ double TH14K1::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
//{ (10, 0), (4, 1), (0, 1), (4, 0), (4, -1), (15, -1) };
double const NomPress = 5.0;
int BCP = std::lround(i_bcp);
auto BCP = static_cast<int>(std::lround(i_bcp));
if (i_bcp < -1)
{
BCP = 1;
@@ -4034,7 +3994,7 @@ double TSt113::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
CP = PP;
BCP = lround(i_bcp);
BCP = static_cast<int>(lround(i_bcp));
EPS = BEP_K[BCP + 1];

View File

@@ -272,10 +272,11 @@ class TReservoir
/// <summary>Default constructor — creates a 1 L reservoir at zero pressure.</summary>
TReservoir() = default;
virtual ~TReservoir() = default;
};
/// <summary>Pointer typedef for a reservoir instance.</summary>
typedef TReservoir *PReservoir;
using PReservoir = TReservoir *;
/// <summary>
/// Brake cylinder reservoir — overrides pressure functions to model the
@@ -290,15 +291,15 @@ class TBrakeCyl : public TReservoir
/// Returns absolute pressure inside the brake cylinder (P() * 0.1).
/// </summary>
/// <returns>Absolute cylinder pressure.</returns>
virtual double pa() /*override*/;
double pa() override;
/// <summary>
/// Returns gauge pressure inside the brake cylinder, modelling the
/// piston-stroke pressure curve (dead volume, linear stroke, fully extended).
/// </summary>
/// <returns>Cylinder pressure in bar.</returns>
virtual double P() /*override*/;
double P() override;
/// <summary>Default constructor.</summary>
TBrakeCyl() : TReservoir() {};
using TReservoir::TReservoir;
};
/// <summary>
@@ -399,7 +400,7 @@ class TBrake
/// Returns the piston force produced by the brake cylinder pressure.
/// </summary>
/// <returns>Force in arbitrary engine units (BCA * 100 * P).</returns>
double GetBCF(); // sila tlokowa z tloka
double GetBCF() const; // sila tlokowa z tloka
/// <summary>
/// Computes the airflow drawn from the high-pressure (8 bar / main) line for one step.
/// </summary>
@@ -408,16 +409,16 @@ class TBrake
/// <returns>Net flow from the high-pressure line.</returns>
virtual double GetHPFlow(double const HP, double const dt); // przeplyw - 8 bar
/// <summary>Returns brake cylinder gauge pressure [bar].</summary>
double GetBCP(); // cisnienie cylindrow hamulcowych
double GetBCP() const; // cisnienie cylindrow hamulcowych
/// <summary>
/// Returns brake cylinder pressure originating only from the pneumatic
/// (main) brake — used to drive the ED (electrodynamic) brake e.g. in EP09.
/// </summary>
virtual double GetEDBCP(); // cisnienie tylko z hamulca zasadniczego, uzywane do hamulca ED w EP09
/// <summary>Returns auxiliary reservoir (ZP) pressure [bar].</summary>
double GetBRP(); // cisnienie zbiornika pomocniczego
double GetBRP() const; // cisnienie zbiornika pomocniczego
/// <summary>Returns valve pre-chamber pressure [bar].</summary>
double GetVRP(); // cisnienie komory wstepnej rozdzielacza
double GetVRP() const; // cisnienie komory wstepnej rozdzielacza
/// <summary>Returns control reservoir (ZS) pressure [bar]; defaults to the auxiliary reservoir for valves without a dedicated ZS.</summary>
virtual double GetCRP(); // cisnienie zbiornika sterujacego
/// <summary>
@@ -441,7 +442,7 @@ class TBrake
virtual void SetEPS(double const nEPS); // hamulec EP
/// <summary>Sets the rapid step ratio. Default no-op; overridden where supported.</summary>
/// <param name="RMR">Rapid ratio.</param>
virtual void SetRM(double const RMR) {}; // ustalenie przelozenia rapida
virtual void SetRM(double const RMR) { /* no effect for this device type */ } // ustalenie przelozenia rapida
/// <summary>Sets the velocity threshold for the rapid step.</summary>
/// <param name="RVR">Velocity threshold (same unit as Vel passed to GetPF).</param>
virtual void SetRV(double const RVR)
@@ -455,20 +456,20 @@ class TBrake
/// <param name="TM">Tare (empty) mass.</param>
/// <param name="LM">Loaded mass.</param>
/// <param name="TBP">Brake cylinder pressure for the tare mass.</param>
virtual void SetLP(double const TM, double const LM, double const TBP) {}; // parametry przystawki wazacej
virtual void SetLP(double const TM, double const LM, double const TBP) { /* no effect for this device type */ } // parametry przystawki wazacej
/// <summary>Sets the auxiliary (local) brake target pressure.</summary>
/// <param name="P">Local brake pressure [bar].</param>
virtual void SetLBP(double const P) {}; // cisnienie z hamulca pomocniczego
virtual void SetLBP(double const P) { /* no effect for this device type */ } // cisnienie z hamulca pomocniczego
/// <summary>Updates the load-weighing pressure coefficient based on current vehicle mass.</summary>
/// <param name="mass">Current vehicle mass.</param>
virtual void PLC(double const mass) {}; // wspolczynnik cisnienia przystawki wazacej
virtual void PLC(double const mass) { /* no effect for this device type */ } // wspolczynnik cisnienia przystawki wazacej
/// <summary>
/// Engages the anti-slip brake function (set hold and/or release flags).
/// </summary>
/// <param name="state">Two-bit value: bit1 = hold (b_asb), bit0 = release (b_asb_unbrake).</param>
void ASB(int state); // hamulec przeciwposlizgowy
/// <summary>Returns the raw BrakeStatus flags (for sound/visual cues).</summary>
int GetStatus(); // flaga statusu, moze sie przydac do odglosow
int GetStatus() const; // flaga statusu, moze sie przydac do odglosow
/// <summary>Sets the anti-slip target pressure.</summary>
/// <param name="Press">Pressure [bar].</param>
void SetASBP(double const Press); // ustalenie cisnienia pp
@@ -497,13 +498,14 @@ class TBrake
/// brake when ED braking is sufficient. Default no-op; overridden where supported.
/// </summary>
/// <param name="EDstate">ED brake intensity (0..1).</param>
virtual void SetED(double const EDstate) {}; // stan hamulca ED do luzowania
virtual void SetED(double const EDstate) { /* no effect for this device type */ } // stan hamulca ED do luzowania
/// <summary>Sets the universal-button flags (see TUniversalBrake).</summary>
/// <param name="flag">Combined ub_* flags.</param>
virtual void SetUniversalFlag(int flag)
{
UniversalFlag = flag;
} // przycisk uniwersalny
virtual ~TBrake() = default;
};
/// <summary>
@@ -537,26 +539,26 @@ class TWest : public TBrake
/// <param name="LPP">Low pressure.</param>
/// <param name="BP">Initial cylinder pressure.</param>
/// <param name="BDF">Initial brake delay flag.</param>
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) /*override*/;
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) override;
/// <summary>Sets the auxiliary brake target pressure and engages the DCV when above cylinder.</summary>
/// <param name="P">Pressure [bar].</param>
void SetLBP(double const P); // cisnienie z hamulca pomocniczego
void SetLBP(double const P) override; // cisnienie z hamulca pomocniczego
/// <summary>One-step distributor advance (Westinghouse logic).</summary>
/// <returns>Net flow exchanged with the brake pipe.</returns>
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
double GetPF(double const PP, double const dt, double const Vel) override; // przeplyw miedzy komora wstepna i PG
/// <summary>Returns the high-pressure flow drawn during the last GetPF step.</summary>
double GetHPFlow(double const HP, double const dt) /*override*/;
double GetHPFlow(double const HP, double const dt) override;
/// <summary>Recomputes the load-weighing pressure coefficient for the current mass.</summary>
/// <param name="mass">Vehicle mass.</param>
void PLC(double const mass); // wspolczynnik cisnienia przystawki wazacej
void PLC(double const mass) override; // wspolczynnik cisnienia przystawki wazacej
/// <summary>Sets the EP brake state and toggles the DCV / latches LBP from cylinder pressure on release.</summary>
/// <param name="nEPS">New EP intensity.</param>
void SetEPS(double const nEPS) /*override*/; // stan hamulca EP
void SetEPS(double const nEPS) override; // stan hamulca EP
/// <summary>Stores the load-weighing parameters (TareM, LoadM, TareBP).</summary>
void SetLP(double const TM, double const LM, double const TBP); // parametry przystawki wazacej
void SetLP(double const TM, double const LM, double const TBP) override; // parametry przystawki wazacej
/// <summary>Constructs the distributor by forwarding all parameters to TBrake.</summary>
inline TWest(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa) {}
using TBrake::TBrake;
};
/// <summary>
@@ -567,7 +569,6 @@ class TWest : public TBrake
class TESt : public TBrake
{
private:
protected:
/// <summary>Control reservoir (ZS) — long-term reference pressure.</summary>
std::shared_ptr<TReservoir> CntrlRes; // zbiornik sterujący
@@ -576,15 +577,15 @@ class TESt : public TBrake
public:
/// <summary>Initialises the ESt distributor; sizes the control reservoir (15 l) and computes BVM.</summary>
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) /*override*/;
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) override;
/// <summary>One-step distributor advance for the ESt baseline.</summary>
/// <returns>Net flow exchanged with the brake pipe.</returns>
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
double GetPF(double const PP, double const dt, double const Vel) override; // przeplyw miedzy komora wstepna i PG
/// <summary>Sets ESt-specific characteristic parameters (placeholder; used by some variants).</summary>
/// <param name="i_crc">Characteristic value.</param>
void EStParams(double i_crc); // parametry charakterystyczne dla ESt
void EStParams(double i_crc) const; // parametry charakterystyczne dla ESt
/// <summary>Returns the control reservoir (ZS) pressure.</summary>
double GetCRP() /*override*/;
double GetCRP() override;
/// <summary>
/// Updates BrakeStatus (b_on/b_hld) according to the relations between
/// pre-chamber, cylinder and control reservoir pressures (the main slide valve).
@@ -602,16 +603,16 @@ class TESt : public TBrake
/// </summary>
/// <param name="BP">Cylinder pressure (or impulse-chamber pressure).</param>
/// <returns>Dimensionless opening coefficient.</returns>
double CVs(double BP); // napelniacz sterujacego
double CVs(double BP) const; // napelniacz sterujacego
/// <summary>
/// Returns the effective opening factor of the auxiliary-reservoir filling
/// slide valve (ZP &lt;-&gt; pre-chamber path).
/// </summary>
/// <param name="BCP">Brake cylinder pressure.</param>
/// <returns>Dimensionless opening coefficient.</returns>
double BVs(double BCP); // napelniacz pomocniczego
double BVs(double BCP) const; // napelniacz pomocniczego
/// <summary>Vents the valve, brake and control reservoirs to zero.</summary>
void ForceEmptiness() /*override*/; // wymuszenie bycia pustym
void ForceEmptiness() override; // wymuszenie bycia pustym
/// <summary>Constructs the ESt distributor and creates the control reservoir.</summary>
inline TESt(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
@@ -627,16 +628,15 @@ class TESt : public TBrake
class TESt3 : public TESt
{
private:
// double CylFlowSpeed[2][2]; //zmienna nie uzywana
public:
/// <summary>One-step distributor advance for ESt3 (G/P-dependent fill/release curves).</summary>
/// <returns>Net flow exchanged with the brake pipe.</returns>
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
double GetPF(double const PP, double const dt, double const Vel) override; // przeplyw miedzy komora wstepna i PG
/// <summary>Constructs the ESt3 distributor.</summary>
inline TESt3(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TESt(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa) {}
using TESt::TESt;
};
/// <summary>
@@ -660,13 +660,13 @@ class TESt3AL2 : public TESt3
public:
/// <summary>Initialises the impulse chamber on top of the ESt initialisation.</summary>
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) /*override*/;
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) override;
/// <summary>One-step distributor advance for ESt3/AL2 with load-weighing relay.</summary>
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
double GetPF(double const PP, double const dt, double const Vel) override; // przeplyw miedzy komora wstepna i PG
/// <summary>Recomputes LoadC for the current vehicle mass.</summary>
void PLC(double const mass); // wspolczynnik cisnienia przystawki wazacej
void PLC(double const mass) override; // wspolczynnik cisnienia przystawki wazacej
/// <summary>Stores the load-weighing parameters.</summary>
void SetLP(double const TM, double const LM, double const TBP); // parametry przystawki wazacej
void SetLP(double const TM, double const LM, double const TBP) override; // parametry przystawki wazacej
/// <summary>Constructs the distributor and creates the impulse chamber.</summary>
inline TESt3AL2(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TESt3(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
@@ -695,9 +695,9 @@ class TESt4R : public TESt
public:
/// <summary>Initialises the ESt4R; sizes the impulse chamber and selects the R delay.</summary>
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) /*override*/;
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) override;
/// <summary>One-step distributor advance for ESt4R (rapid step active above velocity threshold).</summary>
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
double GetPF(double const PP, double const dt, double const Vel) override; // przeplyw miedzy komora wstepna i PG
/// <summary>Constructs the distributor and creates the impulse chamber.</summary>
inline TESt4R(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TESt(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
@@ -713,7 +713,6 @@ class TESt4R : public TESt
class TLSt : public TESt4R
{
private:
// double CylFlowSpeed[2][2]; // zmienna nie używana
protected:
@@ -726,24 +725,24 @@ class TLSt : public TESt4R
public:
/// <summary>Initialises the LSt; resizes the valve and impulse reservoirs and presets pressures.</summary>
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) /*override*/;
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) override;
/// <summary>Sets the auxiliary brake target pressure for the DCV.</summary>
void SetLBP(double const P); // cisnienie z hamulca pomocniczego
void SetLBP(double const P) override; // cisnienie z hamulca pomocniczego
/// <summary>Sets the rapid step ratio (RM = 1 - RMR).</summary>
/// <param name="RMR">Reduction ratio (0 disables rapid, &gt; 0 enables).</param>
void SetRM(double const RMR); // ustalenie przelozenia rapida
void SetRM(double const RMR) override; // ustalenie przelozenia rapida
/// <summary>One-step distributor advance for LSt (DCV + rapid + ED release).</summary>
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
double GetPF(double const PP, double const dt, double const Vel) override; // przeplyw miedzy komora wstepna i PG
/// <summary>Computes the high-pressure inflow (replenishes the auxiliary reservoir from the main line).</summary>
double GetHPFlow(double const HP, double const dt) /*override*/; // przeplyw - 8 bar
double GetHPFlow(double const HP, double const dt) override; // przeplyw - 8 bar
/// <summary>Returns the brake-cylinder reference pressure used by the ED brake controller (CVP-BCP * BVM).</summary>
virtual double GetEDBCP(); // cisnienie tylko z hamulca zasadniczego, uzywane do hamulca ED w EP09
double GetEDBCP() override; // cisnienie tylko z hamulca zasadniczego, uzywane do hamulca ED w EP09
/// <summary>Sets the ED brake state used to relax the pneumatic brake.</summary>
/// <param name="EDstate">ED intensity (0..1).</param>
virtual void SetED(double const EDstate); // stan hamulca ED do luzowania
void SetED(double const EDstate) override; // stan hamulca ED do luzowania
/// <summary>Constructs the LSt distributor.</summary>
inline TLSt(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TESt4R(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa) {}
using TESt4R::TESt4R;
};
/// <summary>
@@ -774,15 +773,15 @@ class TEStED : public TLSt
public:
/// <summary>Initialises the EStED — sets up Miedzypoj, ImplsRes and the nozzle characteristics.</summary>
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) /*override*/;
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) override;
/// <summary>One-step distributor advance for EStED (full EP09 logic with intermediate reservoir).</summary>
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
double GetPF(double const PP, double const dt, double const Vel) override; // przeplyw miedzy komora wstepna i PG
/// <summary>Returns ED-brake reference pressure (ImplsRes pressure scaled by load coefficient).</summary>
double GetEDBCP() /*override*/; // cisnienie tylko z hamulca zasadniczego, uzywane do hamulca ED
double GetEDBCP() override; // cisnienie tylko z hamulca zasadniczego, uzywane do hamulca ED
/// <summary>Recomputes LoadC for the current vehicle mass.</summary>
void PLC(double const mass); // wspolczynnik cisnienia przystawki wazacej
void PLC(double const mass) override; // wspolczynnik cisnienia przystawki wazacej
/// <summary>Stores the load-weighing parameters.</summary>
void SetLP(double const TM, double const LM, double const TBP); // parametry przystawki wazacej
void SetLP(double const TM, double const LM, double const TBP) override; // parametry przystawki wazacej
/// <summary>Constructs the distributor and creates the intermediate reservoir.</summary>
inline TEStED(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TLSt(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
@@ -812,21 +811,21 @@ class TEStEP2 : public TLSt
public:
/// <summary>Initialises the EP2-equipped distributor (impulse chamber, P delay).</summary>
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) /*override*/; // inicjalizacja
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) override; // inicjalizacja
/// <summary>One-step distributor advance with EP2 EP brake logic.</summary>
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
double GetPF(double const PP, double const dt, double const Vel) override; // przeplyw miedzy komora wstepna i PG
/// <summary>Recomputes LoadC for the current vehicle mass.</summary>
void PLC(double const mass); // wspolczynnik cisnienia przystawki wazacej
void PLC(double const mass) override; // wspolczynnik cisnienia przystawki wazacej
/// <summary>Sets EP intensity; if EP is active and LBP &lt; cylinder pressure, latches LBP from cylinder.</summary>
void SetEPS(double const nEPS) /*override*/; // stan hamulca EP
void SetEPS(double const nEPS) override; // stan hamulca EP
/// <summary>Stores the load-weighing parameters.</summary>
void SetLP(double const TM, double const LM, double const TBP); // parametry przystawki wazacej
void SetLP(double const TM, double const LM, double const TBP) override; // parametry przystawki wazacej
/// <summary>EP brake flow integration step. Override in EP1 for proportional control.</summary>
/// <param name="dt">Time step [s].</param>
void virtual EPCalc(double dt);
/// <summary>Constructs the EP2 distributor.</summary>
inline TEStEP2(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TLSt(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa) {}
using TLSt::TLSt;
};
/// <summary>
@@ -839,15 +838,13 @@ class TEStEP1 : public TEStEP2
public:
/// <summary>Proportional EP flow integration step (uses fractional part of EPS as the EP target).</summary>
void EPCalc(double dt);
void EPCalc(double dt) override;
/// <summary>Stores the EP intensity.</summary>
/// <param name="nEPS">Target EP value (integer part = direction, fractional part = magnitude).</param>
void SetEPS(double const nEPS) override; // stan hamulca EP
/// <summary>Constructs the EP1 distributor.</summary>
inline TEStEP1(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TEStEP2(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
{
}
using TEStEP2::TEStEP2;
};
/// <summary>
@@ -867,21 +864,21 @@ class TCV1 : public TBrake
public:
/// <summary>Initialises the CV1 distributor (sizes ZS, sets pressures, computes BVM).</summary>
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) /*override*/;
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) override;
/// <summary>One-step distributor advance for the CV1 baseline.</summary>
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
double GetPF(double const PP, double const dt, double const Vel) override; // przeplyw miedzy komora wstepna i PG
/// <summary>Returns the control reservoir (ZS) pressure.</summary>
double GetCRP() /*override*/;
double GetCRP() override;
/// <summary>Updates BrakeStatus based on pre-chamber/cylinder/control reservoir relations and the releaser.</summary>
/// <param name="BCP">Cylinder (or impulse) pressure.</param>
/// <param name="dV1">In/out brake pipe flow correction.</param>
void CheckState(double const BCP, double &dV1);
/// <summary>Returns the ZS-filling slide valve opening factor for the given cylinder pressure.</summary>
double CVs(double const BP);
double CVs(double const BP) const;
/// <summary>Returns the ZP-filling slide valve opening factor for the given cylinder pressure.</summary>
double BVs(double const BCP);
double BVs(double const BCP) const;
/// <summary>Vents valve, brake and control reservoirs to zero.</summary>
void ForceEmptiness() /*override*/; // wymuszenie bycia pustym
void ForceEmptiness() override; // wymuszenie bycia pustym
/// <summary>Constructs the CV1 distributor and creates the control reservoir.</summary>
inline TCV1(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
@@ -922,13 +919,13 @@ class TCV1L_TR : public TCV1
public:
/// <summary>Initialises the CV1-L-TR (sizes the impulse chamber on top of CV1::Init).</summary>
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) /*override*/;
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) override;
/// <summary>One-step distributor advance for CV1-L-TR (impulse chamber + DCV).</summary>
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
double GetPF(double const PP, double const dt, double const Vel) override; // przeplyw miedzy komora wstepna i PG
/// <summary>Sets the auxiliary brake target pressure for the DCV.</summary>
void SetLBP(double const P); // cisnienie z hamulca pomocniczego
void SetLBP(double const P) override; // cisnienie z hamulca pomocniczego
/// <summary>Computes the high-pressure (8 bar) inflow used to replenish the auxiliary reservoir.</summary>
double GetHPFlow(double const HP, double const dt) /*override*/; // przeplyw - 8 bar
double GetHPFlow(double const HP, double const dt) override; // przeplyw - 8 bar
/// <summary>Constructs the CV1-L-TR and creates the impulse chamber.</summary>
inline TCV1L_TR(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TCV1(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
@@ -971,31 +968,31 @@ class TKE : public TBrake
public:
/// <summary>Initialises the KE distributor (control / impulse / auxiliary reservoirs and BVM).</summary>
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) /*override*/;
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) override;
/// <summary>Sets the rapid step ratio (RM = 1 - RMR).</summary>
void SetRM(double const RMR); // ustalenie przelozenia rapida
void SetRM(double const RMR) override; // ustalenie przelozenia rapida
/// <summary>One-step distributor advance for the KE distributor.</summary>
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
double GetPF(double const PP, double const dt, double const Vel) override; // przeplyw miedzy komora wstepna i PG
/// <summary>Computes the high-pressure (8 bar) inflow used to replenish the auxiliary reservoir.</summary>
double GetHPFlow(double const HP, double const dt) /*override*/; // przeplyw - 8 bar
double GetHPFlow(double const HP, double const dt) override; // przeplyw - 8 bar
/// <summary>Returns the control reservoir (ZS) pressure.</summary>
double GetCRP() /*override*/;
double GetCRP() override;
/// <summary>Updates BrakeStatus from cylinder/pre-chamber/control reservoir pressures (KE-specific thresholds).</summary>
void CheckState(double const BCP, double &dV1);
/// <summary>Drives the releaser logic for KE — bleeds the control reservoir while engaged.</summary>
void CheckReleaser(double const dt); // odluzniacz
/// <summary>ZS-filling slide valve opening factor for the given cylinder pressure.</summary>
double CVs(double const BP); // napelniacz sterujacego
double CVs(double const BP) const; // napelniacz sterujacego
/// <summary>ZP-filling slide valve opening factor for the given cylinder pressure.</summary>
double BVs(double const BCP); // napelniacz pomocniczego
double BVs(double const BCP) const; // napelniacz pomocniczego
/// <summary>Recomputes LoadC for the current vehicle mass.</summary>
void PLC(double const mass); // wspolczynnik cisnienia przystawki wazacej
void PLC(double const mass) override; // wspolczynnik cisnienia przystawki wazacej
/// <summary>Stores the load-weighing parameters.</summary>
void SetLP(double const TM, double const LM, double const TBP); // parametry przystawki wazacej
void SetLP(double const TM, double const LM, double const TBP) override; // parametry przystawki wazacej
/// <summary>Sets the auxiliary brake target pressure for the DCV.</summary>
void SetLBP(double const P); // cisnienie z hamulca pomocniczego
void SetLBP(double const P) override; // cisnienie z hamulca pomocniczego
/// <summary>Vents valve, brake, control, impulse and secondary auxiliary reservoirs to zero.</summary>
void ForceEmptiness() /*override*/; // wymuszenie bycia pustym
void ForceEmptiness() override; // wymuszenie bycia pustym
/// <summary>Constructs the KE distributor and creates the control / impulse / secondary reservoirs.</summary>
inline TKE(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
@@ -1077,7 +1074,7 @@ class TDriverHandle
/// <param name="OverP">Unbrake over-pressure [bar].</param>
/// <param name="OMP">Overload (assimilation) max pressure [bar].</param>
/// <param name="OPD">Overload pressure decay rate [bar/s].</param>
virtual void SetParams(bool AO, bool MO, double, double, double OMP, double OPD) {}; // ustawianie jakichs parametrow dla zaworu
virtual void SetParams(bool AO, bool MO, double, double, double OMP, double OPD) { /* no effect for this device type */ } // ustawianie jakichs parametrow dla zaworu
/// <summary>Sets the manual overcharge button state.</summary>
/// <param name="Active">True while the button is pressed.</param>
virtual void OvrldButton(bool Active); // przycisk recznego przeladowania/asymilacji
@@ -1089,6 +1086,7 @@ class TDriverHandle
{
memset(Sounds, 0, sizeof(Sounds));
}
virtual ~TDriverHandle() = default;
};
/// <summary>
@@ -1107,12 +1105,12 @@ class TFV4a : public TDriverHandle
public:
/// <summary>Computes brake pipe flow for the FV4a handle (uses BPT[] table).</summary>
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) /*override*/;
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) override;
/// <summary>Initialises CP and RP to the supplied pressure.</summary>
void Init(double Press) /*override*/;
void Init(double Press) override;
/// <summary>Default constructor.</summary>
inline TFV4a() : TDriverHandle() {}
using TDriverHandle::TDriverHandle;
};
/// <summary>
@@ -1143,27 +1141,27 @@ class TFV4aM : public TDriverHandle
/// Returns the brake pipe pressure target interpolated from BPT[] for the given handle position.
/// </summary>
/// <param name="pos">Handle position.</param>
double LPP_RP(double pos);
double LPP_RP(double pos) const;
/// <summary>Returns true if pos is within ±0.5 of i_pos (detent comparison).</summary>
bool EQ(double pos, double i_pos);
bool EQ(double pos, double i_pos) const;
public:
/// <summary>Computes brake pipe flow for the FV4a/M handle (interpolated BPT, wave modelling, accelerator).</summary>
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) /*override*/;
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) override;
/// <summary>Initialises CP and RP.</summary>
void Init(double Press) /*override*/;
void Init(double Press) override;
/// <summary>Sets the reductor adjustment offset.</summary>
void SetReductor(double nAdj) /*override*/;
void SetReductor(double nAdj) override;
/// <summary>Returns Sounds[i] (or 0 if i &gt; 4).</summary>
double GetSound(int i) /*override*/;
double GetSound(int i) override;
/// <summary>Returns pos_table[i].</summary>
double GetPos(int i) /*override*/;
double GetPos(int i) override;
/// <summary>Returns the time chamber pressure (TP).</summary>
double GetCP();
double GetCP() override;
/// <summary>Returns the regulator pressure (5 + TP*0.08 + RedAdj).</summary>
double GetRP();
double GetRP() override;
/// <summary>Default constructor.</summary>
inline TFV4aM() : TDriverHandle() {}
using TDriverHandle::TDriverHandle;
};
/// <summary>
@@ -1193,32 +1191,31 @@ class TMHZ_EN57 : public TDriverHandle
static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 };
/// <summary>Returns the brake pipe pressure target for the given handle position (piecewise).</summary>
double LPP_RP(double pos);
double LPP_RP(double pos) const;
/// <summary>Returns true if pos is within ±0.5 of i_pos.</summary>
bool EQ(double pos, double i_pos);
bool EQ(double pos, double i_pos) const;
public:
/// <summary>Computes brake pipe flow for MHZ_EN57 (covers handle positions -1..10 with EP/pneumatic mix).</summary>
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) /*override*/;
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) override;
/// <summary>Initialises CP.</summary>
void Init(double Press) /*override*/;
void Init(double Press) override;
/// <summary>Sets the reductor adjustment offset.</summary>
void SetReductor(double nAdj) /*override*/;
void SetReductor(double nAdj) override;
/// <summary>Returns Sounds[i] (or 0 if i &gt; 4).</summary>
double GetSound(int i) /*override*/;
double GetSound(int i) override;
/// <summary>Returns pos_table[i].</summary>
double GetPos(int i) /*override*/;
double GetPos(int i) override;
/// <summary>Returns the regulator pressure (RP).</summary>
double GetCP() /*override*/;
double GetCP() override;
/// <summary>Returns the regulator target (5 + RedAdj).</summary>
double GetRP() /*override*/;
double GetRP() override;
/// <summary>Returns EP brake intensity for the given handle position.</summary>
double GetEP(double pos);
double GetEP(double pos) override;
/// <summary>Configures handle parameters (auto/manual overcharge, over-pressure, overcharge dynamics).</summary>
void SetParams(bool AO, bool MO, double OverP, double, double OMP, double OPD);
void SetParams(bool AO, bool MO, double OverP, double, double OMP, double OPD) override;
/// <summary>Default constructor.</summary>
inline TMHZ_EN57(void) : TDriverHandle() {}
};
using TDriverHandle::TDriverHandle;};
/// <summary>
/// MHZ_K5P — Knorr 5-position combined brake handle.
@@ -1232,7 +1229,6 @@ class TMHZ_K5P : public TDriverHandle
/// <summary>Time chamber pressure [bar].</summary>
double TP = 0.0; // zbiornik czasowy
/// <summary>Reductor reservoir pressure [bar].</summary>
double RP = 0.0; // zbiornik redukcyjny
/// <summary>Reductor adjustment offset.</summary>
double RedAdj = 0.0; // dostosowanie reduktora cisnienia (krecenie kapturkiem)
/// <summary>True while filling-stroke / release wave is active.</summary>
@@ -1249,29 +1245,28 @@ class TMHZ_K5P : public TDriverHandle
static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 };
/// <summary>Returns true if pos is within ±0.5 of i_pos.</summary>
bool EQ(double pos, double i_pos);
bool EQ(double pos, double i_pos) const;
public:
/// <summary>Computes brake pipe flow for the K5P 5-position handle (release / cut-off / brake / emergency).</summary>
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) /*override*/;
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) override;
/// <summary>Initialises CP and enables the time chambers.</summary>
void Init(double Press) /*override*/;
void Init(double Press) override;
/// <summary>Sets the reductor adjustment offset.</summary>
void SetReductor(double nAdj) /*override*/;
void SetReductor(double nAdj) override;
/// <summary>Returns Sounds[i] (or 0 if i &gt; 4).</summary>
double GetSound(int i) /*override*/;
double GetSound(int i) override;
/// <summary>Returns pos_table[i].</summary>
double GetPos(int i) /*override*/;
double GetPos(int i) override;
/// <summary>Returns CP.</summary>
double GetCP() /*override*/;
double GetCP() override;
/// <summary>Returns the regulator target (5 + TP + RedAdj).</summary>
double GetRP() /*override*/;
double GetRP() override;
/// <summary>Configures handle parameters (auto/manual overcharge, over-pressure, filling-stroke factor, overcharge dynamics).</summary>
void SetParams(bool AO, bool MO, double, double, double OMP, double OPD); /*ovveride*/
void SetParams(bool AO, bool MO, double, double, double OMP, double OPD) override;
/// <summary>Default constructor.</summary>
inline TMHZ_K5P(void) : TDriverHandle() {}
};
using TDriverHandle::TDriverHandle;};
/// <summary>
/// MHZ_6P — 6-position combined brake handle (similar logic to K5P with one more detent).
@@ -1285,7 +1280,6 @@ class TMHZ_6P : public TDriverHandle
/// <summary>Time chamber pressure [bar].</summary>
double TP = 0.0; // zbiornik czasowy
/// <summary>Reductor reservoir pressure [bar].</summary>
double RP = 0.0; // zbiornik redukcyjny
/// <summary>Reductor adjustment offset.</summary>
double RedAdj = 0.0; // dostosowanie reduktora cisnienia (krecenie kapturkiem)
/// <summary>True while filling-stroke / release wave is active.</summary>
@@ -1302,29 +1296,28 @@ class TMHZ_6P : public TDriverHandle
static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 };
/// <summary>Returns true if pos is within ±0.5 of i_pos.</summary>
bool EQ(double pos, double i_pos);
bool EQ(double pos, double i_pos) const;
public:
/// <summary>Computes brake pipe flow for the 6P handle.</summary>
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) /*override*/;
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) override;
/// <summary>Initialises CP and enables the time chambers.</summary>
void Init(double Press) /*override*/;
void Init(double Press) override;
/// <summary>Sets the reductor adjustment offset.</summary>
void SetReductor(double nAdj) /*override*/;
void SetReductor(double nAdj) override;
/// <summary>Returns Sounds[i] (or 0 if i &gt; 4).</summary>
double GetSound(int i) /*override*/;
double GetSound(int i) override;
/// <summary>Returns pos_table[i].</summary>
double GetPos(int i) /*override*/;
double GetPos(int i) override;
/// <summary>Returns CP.</summary>
double GetCP() /*override*/;
double GetCP() override;
/// <summary>Returns the regulator target (5 + TP + RedAdj).</summary>
double GetRP() /*override*/;
double GetRP() override;
/// <summary>Configures handle parameters (auto/manual overcharge, over-pressure, filling-stroke factor, overcharge dynamics).</summary>
void SetParams(bool AO, bool MO, double, double, double OMP, double OPD); /*ovveride*/
void SetParams(bool AO, bool MO, double, double, double OMP, double OPD) override;
/// <summary>Default constructor.</summary>
inline TMHZ_6P(void) : TDriverHandle() {}
};
using TDriverHandle::TDriverHandle;};
/* FBS2= class(TTDriverHandle)
private
@@ -1372,17 +1365,17 @@ class TM394 : public TDriverHandle
public:
/// <summary>Computes brake pipe flow for the M394 handle (uses BPT_394).</summary>
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) /*override*/;
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) override;
/// <summary>Initialises CP and enables the time chamber.</summary>
void Init(double Press) /*override*/;
void Init(double Press) override;
/// <summary>Sets the reductor adjustment offset.</summary>
void SetReductor(double nAdj) /*override*/;
void SetReductor(double nAdj) override;
/// <summary>Returns CP.</summary>
double GetCP() /*override*/;
double GetCP() override;
/// <summary>Returns max(5, CP) + RedAdj.</summary>
double GetRP() /*override*/;
double GetRP() override;
/// <summary>Returns pos_table[i].</summary>
double GetPos(int i) /*override*/;
double GetPos(int i) override;
/// <summary>Default constructor — sets the maximum handle position to 5.</summary>
inline TM394(void) : TDriverHandle()
@@ -1411,17 +1404,17 @@ class TH14K1 : public TDriverHandle
public:
/// <summary>Computes brake pipe flow for the H14K1 handle.</summary>
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) /*override*/;
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) override;
/// <summary>Initialises CP and enables the time chambers.</summary>
void Init(double Press) /*override*/;
void Init(double Press) override;
/// <summary>Sets the reductor adjustment offset.</summary>
void SetReductor(double nAdj) /*override*/;
void SetReductor(double nAdj) override;
/// <summary>Returns CP.</summary>
double GetCP() /*override*/;
double GetCP() override;
/// <summary>Returns the regulator target (5 + RedAdj).</summary>
double GetRP() /*override*/;
double GetRP() override;
/// <summary>Returns pos_table[i].</summary>
double GetPos(int i) /*override*/;
double GetPos(int i) override;
/// <summary>Default constructor — sets the maximum handle position to 4.</summary>
inline TH14K1(void) : TDriverHandle()
@@ -1450,21 +1443,20 @@ class TSt113 : public TH14K1
public:
/// <summary>Computes brake pipe flow for the St113 handle (with EP).</summary>
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) /*override*/;
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) override;
/// <summary>Returns CP.</summary>
double GetCP() /*override*/;
double GetCP() override;
/// <summary>Returns the regulator target (5 + RedAdj).</summary>
double GetRP() /*override*/;
double GetRP() override;
/// <summary>Returns the current EP intensity.</summary>
double GetEP() /*override*/;
double GetEP() override;
/// <summary>Returns pos_table[i].</summary>
double GetPos(int i) /*override*/;
double GetPos(int i) override;
/// <summary>Enables the time chambers (no pressure init).</summary>
void Init(double Press) /*override*/;
void Init(double Press) override;
/// <summary>Default constructor.</summary>
inline TSt113(void) : TH14K1() {}
};
using TH14K1::TH14K1;};
/// <summary>
/// Test handle — minimal implementation used during development for verifying
@@ -1479,13 +1471,12 @@ class Ttest : public TDriverHandle
public:
/// <summary>Computes brake pipe flow using the FV4a-style BPT table for testing.</summary>
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) /*override*/;
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) override;
/// <summary>Initialises CP.</summary>
void Init(double Press) /*override*/;
void Init(double Press) override;
/// <summary>Default constructor.</summary>
inline Ttest(void) : TDriverHandle() {}
};
using TDriverHandle::TDriverHandle;};
/// <summary>
/// FD1 auxiliary brake handle — directly drives the cylinder pressure between
@@ -1505,18 +1496,17 @@ class TFD1 : public TDriverHandle
double Speed = 0.0; // szybkosc dzialania
/// <summary>Computes the auxiliary brake outflow for this step.</summary>
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) /*override*/;
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) override;
/// <summary>Initialises MaxBP and the action speed.</summary>
void Init(double Press) /*override*/;
void Init(double Press) override;
/// <summary>Returns the currently commanded cylinder pressure (BP).</summary>
double GetCP() /*override*/;
double GetCP() override;
/// <summary>Sets the action speed multiplier.</summary>
void SetSpeed(double nSpeed);
// procedure Init(press: real; MaxBP: real); overload;
/// <summary>Default constructor.</summary>
inline TFD1(void) : TDriverHandle() {}
};
using TDriverHandle::TDriverHandle;};
/// <summary>
/// H1405 — Knorr auxiliary brake handle (continuous, independent brake).
@@ -1532,16 +1522,15 @@ class TH1405 : public TDriverHandle
public:
/// <summary>Computes the auxiliary brake outflow for this step (proportional to handle deflection).</summary>
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) /*override*/;
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) override;
/// <summary>Initialises MaxBP and enables the time chamber.</summary>
void Init(double Press) /*override*/;
void Init(double Press) override;
/// <summary>Returns the currently commanded cylinder pressure (BP).</summary>
double GetCP() /*override*/;
double GetCP() override;
// procedure Init(press: real; MaxBP: real); overload;
/// <summary>Default constructor.</summary>
inline TH1405(void) : TDriverHandle() {}
};
using TDriverHandle::TDriverHandle;};
/// <summary>
/// FVel6 — combined EP + pneumatic brake handle (Czech, 6+1 positions).
@@ -1559,23 +1548,22 @@ class TFVel6 : public TDriverHandle
public:
/// <summary>Computes brake pipe flow for FVel6 (continuous EP brake plus pneumatic emergency).</summary>
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) /*override*/;
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) override;
/// <summary>Returns CP.</summary>
double GetCP() /*override*/;
double GetCP() override;
/// <summary>Returns the regulator target (constant 5 bar).</summary>
double GetRP() /*override*/;
double GetRP() override;
/// <summary>Returns the current EP intensity.</summary>
double GetEP() /*override*/;
double GetEP() override;
/// <summary>Returns pos_table[i].</summary>
double GetPos(int i) /*override*/;
double GetPos(int i) override;
/// <summary>Returns Sounds[i] (or 0 if i &gt; 2).</summary>
double GetSound(int i) /*override*/;
double GetSound(int i) override;
/// <summary>Enables the time chambers.</summary>
void Init(double Press) /*override*/;
void Init(double Press) override;
/// <summary>Default constructor.</summary>
inline TFVel6(void) : TDriverHandle() {}
};
using TDriverHandle::TDriverHandle;};
/// <summary>
/// FVE408 — newer combined EP + pneumatic brake handle (10 positions).
@@ -1594,23 +1582,22 @@ class TFVE408 : public TDriverHandle
public:
/// <summary>Computes brake pipe flow for the FVE408 handle.</summary>
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) /*override*/;
double GetPF(double i_bcp, double PP, double HP, double dt, double ep) override;
/// <summary>Returns CP.</summary>
double GetCP() /*override*/;
double GetCP() override;
/// <summary>Returns the current EP intensity.</summary>
double GetEP() /*override*/;
double GetEP() override;
/// <summary>Returns the regulator target (constant 5 bar).</summary>
double GetRP() /*override*/;
double GetRP() override;
/// <summary>Returns pos_table[i].</summary>
double GetPos(int i) /*override*/;
double GetPos(int i) override;
/// <summary>Returns Sounds[i] (or 0 if i &gt; 2).</summary>
double GetSound(int i) /*override*/;
double GetSound(int i) override;
/// <summary>Enables the time chamber, disables the EP-time chamber.</summary>
void Init(double Press) /*override*/;
void Init(double Press) override;
/// <summary>Default constructor.</summary>
inline TFVE408(void) : TDriverHandle() {}
};
using TDriverHandle::TDriverHandle;};
/// <summary>
/// Pneumatic flow rate from one pressure to another through an orifice of area S.