mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-01 22:07:55 +01:00
16568d5695
The rest of the braking of physics::Vehicle moves into brakes, with English
names (physics/components/braking.h):
the valves Hamulec distributor, Handle driverValve,
LocHandle independentValve
the definition BrakeSystem kind, BrakeSubsystem subsystem, BrakeValve /
BrakeValveSize / BrakeValveParams distributorType / Size /
Parameters, BrakeHandle / BrakeLocHandle driverValveType /
independentValveType, the Handle_* driverValveSettings,
LocalBrake localKind, MaxBrakePress maxCylinderPressure,
LoadFlag loadSetting, P2FTrans pressureToForce, NBpA
blocksPerAxle, High/Low/DeltaPipePress pipeHigh/LowPressure
/ pipePressureRange, CntrlPipePress controlReservoirPressure,
Spg pipeSection, RapidMult / RapidVel rapidRatio / rapidSpeed,
BrakeDelay delays, BrakeCtrlPosNo handlePositions, ...
cylinders BrakeCylNo / Radius / Dist / Mult / Spring, BrakeSlckAdj,
BrakeRigEff: count, radius, stroke, leverRatio, springForce,
slackAdjusterForce, riggingEfficiency
emergencyValve EmergencyValveOn / Off / Open / Area / Flow
pipeLock LockPipeOn / Off, HandleUnlock, LockPipe, UnlockPipe
the state BrakePress cylinderPressure, LocBrakePress
independentCylinderPressure, EqvtPipePress
equivalentPipePressure, Volume reservoirAir, dpBrake / dpPipe /
dpMainValve / dpLocalValve brakeFlow / pipeFlow /
driverValveFlow / independentValveFlow, BrakeCtrlPos(R, 2)
handlePosition(Real), handleCapPosition, fBrakeCtrlPos
handlePositionSmooth, LocalBrakePosA(EIM) independentPosition
(Eim), BrakeStatus status, AlarmChainFlag alarmChain,
BrakeDelayFlag / BrakeDelays delaySetting / availableDelays,
BrakeOpModeFlag / BrakeOpModes operatingMode /
availableOperatingModes, UnitBrakeForce unitForce, ...
Renamed in the files of the vehicle itself, and elsewhere only where reached
through -> or .: the driver keeps its own BrakeSystem, the editor its Handle,
the radio its Volume, and the brake valve classes (brakes.*, oerlikonest.*)
their fields of the same names. The C arrays (MaxBrakePress, BrakeCylMult,
the universal buttons) are std::arrays of the same values; the bits of status,
delaySetting and operatingMode stay ints for now.
No change in behaviour: 1149/1149 tests, golden traces exact against staging
62f7a29b.
35 lines
1.3 KiB
C++
35 lines
1.3 KiB
C++
#include "stdafx.h"
|
|
#include "doctest.h"
|
|
#include "golden.h"
|
|
#include "vehicle.h"
|
|
|
|
// the invariants every golden trace checks (invariants.h) catch a vehicle in a state the simulation must
|
|
// never reach, once each, naming the time and the last event
|
|
|
|
using test::definition;
|
|
using test::vehicle;
|
|
|
|
TEST_CASE("invariants: a vehicle in an impossible state, reported once with its time and the last event") {
|
|
vehicle eu07{definition::fiz("4e_v1/4e")};
|
|
test::trace trace{"invariants/self test", test::channels::brakes()};
|
|
trace.sample(0.0, eu07.physics());
|
|
CHECK(trace.violations().empty());
|
|
|
|
trace.mark("overfilled");
|
|
eu07->brakes.cylinderPressure = 50.0;
|
|
trace.sample(0.01, eu07.physics());
|
|
trace.sample(0.02, eu07.physics());
|
|
REQUIRE(trace.violations().size() == 1);
|
|
auto const &violation{trace.violations().front()};
|
|
CHECK(violation.find("brake cylinders") != std::string::npos);
|
|
CHECK(violation.find("at 0.010 s") != std::string::npos);
|
|
CHECK(violation.find("after \"overfilled\"") != std::string::npos);
|
|
CHECK(violation.find("BrakePress=50") != std::string::npos);
|
|
|
|
eu07->brakes.cylinderPressure = 0.0;
|
|
eu07->V = std::nan("");
|
|
trace.sample(0.03, eu07.physics());
|
|
CHECK(trace.violations().size() > 1);
|
|
CHECK(trace.violations()[1].find("every value a number") != std::string::npos);
|
|
}
|