mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 05:02:45 +01:00
309926bb05
The air of physics::Vehicle becomes components of their own, with the fields
named in English (physics/components/airsupply.h):
air (AirSupply) the compressor and the main reservoir:
compressor (AirCompressor) MinCompressor, MaxCompressor and those of each
cab, CabDependentCompressor, CompressorSpeed,
CompressorPower, CompressorStartDelay,
CompressorTankValve, CompressorStart, the
CompressorList programmer and its switch, and
the state: CompressorFlag running,
CompressorAllow(Local) allow(Local),
CompressorGovernorLock, CompressorPowerTime
VeselVolume mainReservoirVolume
Compressor mainReservoirPressure
CompressedVolume compressedVolume
AirLeakRate leakRate
brakePipe, mainPipe the two pipes along the train, of one type,
(TrainPipe) TrainPipe: reservoir, pressure, couplersPending
(Pipe, PipePress, PipeCouplersPending and Pipe2,
ScndPipePress, ScndPipeCouplersPending before)
CompressorPower, a number 0 to 5, is the enum CompressorSupply (mainCircuit,
converterManual, converter, engine, frontUnitConverter, rearUnitConverter),
read from the same words of the .fiz. The CompressorList table is a
std::array of the same ints.
The exchange of air through the hoses (pneumatics.cpp) takes the pipe as one
TrainPipe of the vehicle instead of three member pointers.
No change in behaviour: 1149/1149 tests, golden traces exact against staging
62f7a29b.
85 lines
3.5 KiB
C++
85 lines
3.5 KiB
C++
/*
|
|
This Source Code Form is subject to the
|
|
terms of the Mozilla Public License, v.
|
|
2.0. If a copy of the MPL was not
|
|
distributed with this file, You can
|
|
obtain one at
|
|
http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
// the supply of compressed air of a vehicle: the compressor and the main reservoir, held by physics::Vehicle as air; and
|
|
// the pipes along the train, held by it as brakePipe and mainPipe
|
|
|
|
#pragma once
|
|
|
|
#include <array>
|
|
#include <memory>
|
|
|
|
#include "physics/vehicletypes.h"
|
|
|
|
class TReservoir;
|
|
|
|
namespace physics
|
|
{
|
|
|
|
// a pipe along the train, coupled by the hoses between the vehicles: the brake pipe, the main reservoir pipe
|
|
struct TrainPipe
|
|
{
|
|
std::shared_ptr<TReservoir> reservoir;
|
|
double pressure = 0.0;
|
|
bool couplersPending{false}; // the pipe stepped, its exchange of air through the hoses is yet to come (UpdatePipeCouplers())
|
|
};
|
|
|
|
// where the compressor gets its power from (CompressorPower of the .fiz), in the order of the numbers it had before
|
|
enum class CompressorSupply
|
|
{
|
|
mainCircuit, // Main
|
|
converterManual, // the default: from the converter, switched by hand
|
|
converter, // Converter: from the converter, always
|
|
engine, // Engine: driven by the diesel engine
|
|
frontUnitConverter, // Coupler1: from the converter of the unit in front (a motor car of an EMU)
|
|
rearUnitConverter, // Coupler2: from the converter of the unit behind
|
|
};
|
|
|
|
// the compressor of the main reservoir
|
|
struct AirCompressor
|
|
{
|
|
// the definition (the Brake section of the .fiz)
|
|
double minPressure = 0.0; // MinCP: it starts below this pressure of the main reservoir
|
|
double maxPressure = 0.0; // MaxCP: it stops above this pressure
|
|
double minPressureCabA = 0.0; // the pressures of each cab, where they differ (MinCP_B, MaxCP_B given)
|
|
double maxPressureCabA = 0.0;
|
|
double minPressureCabB = 0.0; // MinCP_B
|
|
double maxPressureCabB = 0.0; // MaxCP_B
|
|
bool cabDependent = false; // the pressures follow the occupied cab
|
|
double speed = 0.0; // CompressorSpeed: how fast it fills the main reservoir
|
|
CompressorSupply supply{CompressorSupply::converterManual}; // CompressorPower
|
|
double startDelay{0.0}; // CompressorStartDelay: how long it waits after getting its power before it can start, after the engine starts say [s]
|
|
bool tankValve{false}; // CompressorTankValve: the pressure over the top is let out of its tank at once
|
|
start_t start{start_t::manual}; // CompressorStart: whether it is started by hand, or another way
|
|
// the programmer of the compressors of a unit (the CompressorList section), indexed by the cl_* rows
|
|
std::array<std::array<int, 9>, 4> list{};
|
|
int listPositions = 0; // Size: the positions of its switch
|
|
int listDefaultPosition = 1; // Default
|
|
bool listWraps = false; // Wrap
|
|
// the state
|
|
bool running = false; // it runs
|
|
bool allow = false; // it may start
|
|
bool allowLocal{true}; // the switch of the vehicle itself; most have none, so it allows
|
|
bool governorLock{false}; // the governor switched it off at the cut-out pressure
|
|
double powerTime{0.0}; // how long it has had its power [s]
|
|
int listPosition = 0; // the position of the switch of the programmer
|
|
};
|
|
|
|
// the supply of compressed air
|
|
struct AirSupply
|
|
{
|
|
AirCompressor compressor;
|
|
double mainReservoirVolume = 0.0; // Vv: the volume of the main reservoir
|
|
double mainReservoirPressure = 0.0; // the pressure in the main reservoir
|
|
double compressedVolume = 0.0; // the compressed air in the supply
|
|
double leakRate{0.01}; // AirLeakRate: the base rate of the air leaking from the components of the brakes (0.001 = 1 l/s)
|
|
};
|
|
|
|
} // namespace physics
|