18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-02 01:32:43 +01:00
Files
maszyna/physics/components/pantographs.h
T
Hirek 5e56a91515 refactor(physics): the devices out of physics::Vehicle, the pantographs as components
The types of the devices nested in physics::Vehicle (basic_device, the pumps,
the fans, basic_valve, basic_pantograph, basic_door, door_data, water_heater,
genset_device) move out of it into physics/components/devices.h, namespace
physics, so the components of the vehicle can hold them.

The pantographs and their air become components, with English names
(physics/components/pantographs.h):

  Pantographs                 pantographs (ByEnd<basic_pantograph>)
  pantographCircuit           PantFrontVolt / PantRearVolt frontVoltage /
                              rearVoltage, PantographVoltage supplyVoltage,
                              PantAllDown allDown, PantSwitchType switchType,
                              PantsPreset presets
  pantographAir               PantVolume volume, PantPress pressure,
                              PantCompFlag compressorRunning,
                              PantographCompressorStart compressorStart,
                              SmallCompressorPower compressorPower, PantsValve
                              valve, bPantKurek3 connectedToMainReservoir,
                              PantAutoValve autoValve, PantPressSwitchActive /
                              PantPressLockActive pressureSwitchActive /
                              pressureLockActive

No string literal changed (checked over all the changed files).

No change in behaviour: 1149/1149 tests, golden traces exact against staging
62f7a29b.
2026-11-29 02:13:17 +01:00

51 lines
2.0 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 circuit and the air of the pantographs of a vehicle, held by physics::Vehicle as pantographCircuit and
// pantographAir beside its pantographs
#pragma once
#include <string>
#include <utility>
#include "physics/components/devices.h"
namespace physics
{
// the circuit of the pantographs: their voltages, the kind of their switches, the presets of the cabs
struct PantographCircuit
{
double frontVoltage = 0.0; // the voltage at the front pantograph
double rearVoltage = 0.0; // the voltage at the rear one
double supplyVoltage{0.0}; // the voltage supplied to the pantographs
bool allDown{false}; // the switch that lowers all of them
std::string switchType; // PantSwitchType: the kind of the switches of the cab
// the presets of the pantographs: the setups they can be switched to as chars, and the one selected in each cab
std::pair<std::string, ByEnd<int>> presets{"0132", {0, 0}};
};
// the air of the pantographs: their reservoir, the small compressor that fills it, the valves
struct PantographAir
{
double volume = 0.48; // so that the raised pantographs drop soon with the compressor off
double pressure = 0.0; // in the reservoirs of the pantographs
bool compressorRunning = false; // the small compressor
start_t compressorStart{start_t::manual}; // PantCompressorStart
int compressorPower = 0; // SmallCompressorPower
basic_valve valve;
bool connectedToMainReservoir = true; // the three-way cock: to the main reservoir, or to the small compressor
bool autoValve{false}; // the kind of the valve of the small compressor fitted
bool pressureSwitchActive{false}; // the pressure switch, primed at the pressure set in the air of the pantographs
bool pressureLockActive{false}; // fires when the pressure switch trips by the pressure dropping below its level
};
} // namespace physics