18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 16:27:11 +01:00
Files
maszyna/physics/components/maincircuit.h
T
Hirek 1bea280010 refactor(physics): the line breaker, the line contactors, the relays and the converter as components
The main circuit of physics::Vehicle becomes components, with English names
(physics/components/maincircuit.h):

  lineBreaker (LineBreaker)     Mains closed, MainsInitTime(Countdown)
                                initTime / initCountdown, MainsStart start,
                                JointEngineStart jointStart,
                                PantographsRequireMains pantographsRequireIt,
                                LineBreakerClosesOnlyAtNoPowerPos
                                closesOnlyAtNoPower,
                                EmergencyBrakeMainOffPressure emergencyOffPressure
  lineContactors (LineContactors) StLinFlag closed, StLinSwitchOff forcedOpen,
                                StLinSwitchType switchType,
                                LineContactorsInterlock interlock,
                                LastRelayTime lastSwitchTime
  protection (ProtectionRelays) NoVoltRelay noVoltage, OvervoltageRelay
                                overvoltage, GroundRelay(Start) ground(Start),
                                ControlPressureSwitch pressureSwitch,
                                HasControlPressureSwitch hasPressureSwitch,
                                PressureSwitchBrakeCylinder
                                pressureSwitchWatchesCylinders
  converter (PowerConverter)    the Converter* fields: start, startDelay(Timer),
                                allow(Local), running, overloadRelayStart,
                                overloadRelayOffWithLineBreaker; ConvOvldFlag
                                overloaded, ConvSwitchType switchType

The long comments of the fields went with them into the header. Where the
loading of the .fiz has using enum start_t, the member is this->converter:
the enumerator start_t::converter would hide it there.

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:50:50 +01:00

89 lines
4.4 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 main circuit of a vehicle: the line breaker, the line contactors, the protective relays, the converter. Held by
// physics::Vehicle as lineBreaker, lineContactors, protection and converter
#pragma once
#include <string>
#include "physics/vehicletypes.h"
namespace physics
{
// the line breaker (the main switch) of the vehicle
struct LineBreaker
{
bool closed = false;
double initTime{0.0}; // how long the main circuit initialises after it gets its power, before the breaker can close [s]
double initCountdown{0.0}; // how long it still initialises [s]
start_t start{start_t::manual};
// Engine:JointEngineStart: the line breaker / engine start switch of the cab works the vehicles in multiple too; when it
// doesn't, the cab has separate switches for them (mainb_*, mainc_*)
bool jointStart{true};
// Cntrl.PantRequiresMain: the line breaker closes without traction voltage and holds without it, and the pantographs
// rise and stay up only while it's closed (EU05, EP05, ČD 181 family); off, the pantographs come first and the line
// breaker needs their voltage. what the main circuit feeds still needs the voltage (MainCircuitPowered()), and without
// it the undervoltage relay opens the line contactors (protection.noVoltage)
bool pantographsRequireIt{false};
bool closesOnlyAtNoPower{false}; // it closes only with the master controller at a position of no power
// Cntrl.EmergencyBrakeMainOff: the brake pipe pressure [bar] taken for an emergency brake application: below it, with
// the master controller on a power position, the line breaker opens and doesn't close again. where the pantographs
// stay up only through the closed line breaker (pantographsRequireIt) they drop with it (EP05). 0: an emergency
// application leaves the line breaker alone
double emergencyOffPressure{0.0};
};
// the line contactors of the traction motors
struct LineContactors
{
bool closed = false;
bool forcedOpen{false}; // the button that forces them open
std::string switchType; // StLinSwitchType: the kind of the switch of the cab
line_contactors_interlock interlock{line_contactors_interlock::none}; // what else they need to close
double lastSwitchTime = 0.0; // the time since they last switched [s]
};
// the protective relays and the pressure switch of the main circuit
struct ProtectionRelays
{
// the undervoltage relay: it switches off if the voltage drops below its threshold, which opens the line breaker; with
// lineBreaker.pantographsRequireIt it opens the line contactors instead, and switches back on only with the master
// controller at zero or the first position
bool noVoltage{true};
bool overvoltage{true}; // the overvoltage relay, which opens above the voltage it's set to
bool ground{true}; // the ground relay, which opens to protect against damage from earths
start_t groundStart{start_t::manual}; // how the ground relay is reset
bool pressureSwitch{false}; // tripped while the brake pipe and/or the brake cylinders aren't at their working pressures
bool hasPressureSwitch{true};
// Engine:PressureSwitchBrakeCylinder: the pressure switch watches the brake cylinders (it cuts the start off above 2 bar
// there) as well as the brake pipe (below 3.6 bar). off, it's left with the brake pipe alone, and the vehicle takes
// current whatever the pressure in its brake cylinders (EP05)
bool pressureSwitchWatchesCylinders{true};
};
// the converter of the vehicle
struct PowerConverter
{
start_t start{start_t::manual}; // whether it is started by hand, or another way
float startDelay{0.0f}; // the delay before it starts, once its conditions are met [s]
double startDelayTimer{0.0}; // how long its conditions have been met
bool allow = false; // it may run
bool allowLocal{true}; // the switch of the vehicle itself; most have none, so it allows
bool running = false;
start_t overloadRelayStart{start_t::manual}; // whether its overload relay is reset by a button of its own
bool overloadRelayOffWithLineBreaker{false}; // ConverterOverloadRelayOffWhenMainIsOff
bool overloaded = false; // the overload relay of the converter and the heating tripped
std::string switchType; // ConvSwitchType: the kind of the switch of the cab. TODO: the kinds of the switches belong to the cab definition
};
} // namespace physics