mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 16:36:53 +01:00
2062 lines
103 KiB
C++
2062 lines
103 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/.
|
|
*/
|
|
|
|
#pragma once
|
|
//---------------------------------------------------------------------------
|
|
// Q: 20160805 - odlaczenie pliku fizyki .pas od kompilacji
|
|
#include <array>
|
|
#include <map>
|
|
#include <optional>
|
|
#include <unordered_map>
|
|
#include "physics/brakes.h"
|
|
#include "physics/couplerphysics.h"
|
|
#include "physics/derailment.h"
|
|
#include "physics/collision.h"
|
|
#include "scripting/ladderlogic.h"
|
|
#include "vehicle/derailmotion.h"
|
|
#include "vehicle/odometerreading.h"
|
|
#include "physics/vehicletypes.h"
|
|
#include "physics/components/dieselengine.h"
|
|
#include "physics/components/inductionmotor.h"
|
|
#include "physics/components/braking.h"
|
|
#include "physics/components/airsupply.h"
|
|
#include "physics/components/devices.h"
|
|
#include "physics/components/pantographs.h"
|
|
#include "physics/components/maincircuit.h"
|
|
#include "physics/components/lowvoltage.h"
|
|
|
|
class TractionDrive;
|
|
|
|
class cParser;
|
|
namespace physics
|
|
{
|
|
class Vehicle;
|
|
}
|
|
/*
|
|
MaSzyna EU07 locomotive simulator
|
|
Copyright (C) 2001-2004 Maciej Czapkiewicz and others
|
|
|
|
*/
|
|
|
|
/*
|
|
(C) McZapkie v.2004.02
|
|
Co brakuje:
|
|
6. brak pantografow itp 'Nie do konca, juz czesc zrobiona - Winger
|
|
7. brak efektu grzania oporow rozruchowych, silnika, osi
|
|
9. ulepszyc sprzeg sztywny oraz automatyczny
|
|
10. klopoty z EN57
|
|
...
|
|
n. Inne lokomotywy oprocz elektrowozu pradu stalego
|
|
*/
|
|
/*
|
|
Zrobione:
|
|
1. model szeregowego silnika elektrycznego sterowanego reostatem
|
|
2. fizyka ruchu - sily oporu, nachylenia, przyspieszenia styczne i normalne,
|
|
przyczepnosc/poslizg przy hamowaniu i rozruchu
|
|
3. docisk klockow hamulcowych -hamulec reczny oraz pomocniczy hamulec pneumatyczny
|
|
4. ubytki cisnienia wskutek hamowania, kompresor - ladowanie zbiornika
|
|
5. niektore uszkodzenia i awarie - logika rozmyta
|
|
a) silnik elektryczny - za duzy prad, napiecie, obroty
|
|
b) sprzegi - zerwanie gdy zbyt duze sily
|
|
6. flagi niektorych dzwiekow
|
|
7. hamulec zasadniczy - elektropneumatyczny (impulsowanie), pneumatyczny - zmiany cisnienia
|
|
zwiekszenie nacisku przy duzych predkosciach w hamulcach Oerlikona
|
|
8. sprzegi - sila, tlumiennosc
|
|
9. lok. el. - wylacznik glowny, odlacznik uszkodzonych silnikow
|
|
10. parametry trakcji
|
|
11. opoznienia w zalaczaniu stycznikow
|
|
12. trakcja wielokrotna
|
|
13. informacja na temat zrodla mocy dla silnikow trakcyjnych, ogrzewania, oswietlenia
|
|
14. dumb - uproszczony model lokomotywy (tylko dla AI)
|
|
15. ladunki - ilosc, typ, szybkosc na- i rozladunku, funkcje przetestowac!
|
|
16. ulepszony model fizyczny silnika elektrycznego (hamowanie silnikiem, ujemne napiecia)
|
|
17. poprawione hamulce - parametry cylindrow itp
|
|
18. ulepszone hamulce - napelnianie uderzeniowe, stopnie hamowania
|
|
19. poprawione hamulce - wyszczegolnenie cisnienia dla stopni hamowania
|
|
20. poprawione hamulce elektropneumatyczne
|
|
21. poprawione hamowanie przeciwposlizgowe i odluzniacz
|
|
22. dodany model mechanicznego napedu recznego (drezyna)
|
|
23. poprawiona szybkosc hamowania pomocniczego i przeciwposlizgowego, odlaczanie silnikow, odlaczanie bocznikow
|
|
24. wprowadzone systemy zabezpieczenia: SHP, Czuwak, sygnalizacja kabinowa (nie dzialaja w DebugMode).
|
|
25. poprawiona predkosc propagacji fali cisnienia (normalizacja przez kwadrat dlugosci) //to jest zdeka liniowe
|
|
26. uwzgledniona masa ladunku, przesuniecie w/m toru ruchu
|
|
27. lampy/sygnaly przednie/tylne
|
|
28. wprowadzona pozycja odciecia hamulca (yB: tja, ale oerlikona....)
|
|
29. rozne poprawki: slizganie, wykolejanie itp
|
|
30. model silnika spalinowego z przekladnia mechaniczna
|
|
31. otwieranie drzwi, sprezarka, przetwornica
|
|
32. wylaczanie obliczen dla nieruchomych wagonow
|
|
33. Zbudowany model rozdzielacza powietrza roznych systemow
|
|
34. Poprawiona pozycja napelniania uderzeniowego i hamulec EP
|
|
35. Dodane baterie akumulatorow (KURS90)
|
|
36. Hamowanie elektrodynamiczne w ET42 i poprawione w EP09
|
|
37. jednokierunkowosc walu kulakowego w EZT (nie do konca)
|
|
38. wal kulakowy w ET40
|
|
39. poprawiona blokada nastawnika w ET40
|
|
...
|
|
*/
|
|
|
|
/// <summary>Steam-locomotive grate parameters.</summary>
|
|
struct TGrateType
|
|
{
|
|
/// <summary>Fuel type burned on this grate.</summary>
|
|
TFuelType FuelType;
|
|
/// <summary>Grate surface area [m²].</summary>
|
|
double GrateSurface;
|
|
/// <summary>Fuel transport speed (stoker rate).</summary>
|
|
double FuelTransportSpeed;
|
|
/// <summary>Fuel ignition temperature [°C].</summary>
|
|
double IgnitionTemperature;
|
|
/// <summary>Maximum allowable grate temperature [°C].</summary>
|
|
double MaxTemperature;
|
|
// inline TGrateType() {
|
|
// FuelType = Undefined;
|
|
// GrateSurface = 0.0;
|
|
// FuelTransportSpeed = 0.0;
|
|
// IgnitionTemperature = 0.0;
|
|
// MaxTemperature = 0.0;
|
|
// }
|
|
};
|
|
/// <summary>Steam-locomotive boiler parameters.</summary>
|
|
struct TBoilerType
|
|
{
|
|
/// <summary>Boiler internal volume [m³].</summary>
|
|
double BoilerVolume;
|
|
/// <summary>Heat exchange surface of the boiler [m²].</summary>
|
|
double BoilerHeatSurface;
|
|
/// <summary>Superheater surface [m²].</summary>
|
|
double SuperHeaterSurface;
|
|
/// <summary>Maximum water volume [m³].</summary>
|
|
double MaxWaterVolume;
|
|
/// <summary>Minimum (safety) water volume [m³].</summary>
|
|
double MinWaterVolume;
|
|
/// <summary>Maximum boiler pressure [bar].</summary>
|
|
double MaxPressure;
|
|
// inline TBoilerType() {
|
|
// BoilerVolume = 0.0;
|
|
// BoilerHeatSurface = 0.0;
|
|
// SuperHeaterSurface = 0.0;
|
|
// MaxWaterVolume = 0.0;
|
|
// MinWaterVolume = 0.0;
|
|
// MaxPressure = 0.0;
|
|
// }
|
|
};
|
|
/// <summary>Pantograph (current collector) model identifier.</summary>
|
|
enum TPantType
|
|
{
|
|
/// <summary>AKP-4E pantograph (PKP single-arm).</summary>
|
|
AKP_4E,
|
|
/// <summary>DSA-series pantograph (Stemmann).</summary>
|
|
DSAx,
|
|
/// <summary>EC160/EC200 pantograph.</summary>
|
|
EC160_200,
|
|
/// <summary>WBL85 pantograph.</summary>
|
|
WBL85
|
|
};
|
|
/// <summary>Current-collector (pantograph) configuration block.</summary>
|
|
struct TCurrentCollector
|
|
{
|
|
/// <summary>Number of pantographs of this type.</summary>
|
|
long CollectorsNo; // musi być tu, bo inaczej się kopie
|
|
/// <summary>Minimum pantograph height [m] (currently unused).</summary>
|
|
double MinH;
|
|
/// <summary>Maximum pantograph height [m] (currently unused).</summary>
|
|
double MaxH;
|
|
/// <summary>Working width of the contact strip [m].</summary>
|
|
double CSW; // szerokość części roboczej (styku) ślizgacza
|
|
/// <summary>Minimum acceptable contact-line voltage [V].</summary>
|
|
double MinV;
|
|
/// <summary>Maximum acceptable contact-line voltage [V].</summary>
|
|
double MaxV;
|
|
/// <summary>True if an over-voltage protection relay is fitted.</summary>
|
|
bool OVP; // czy jest przekaznik nadnapieciowy
|
|
/// <summary>Minimum voltage required to engage the main switch [V].</summary>
|
|
double InsetV; // minimalne napięcie wymagane do załączenia
|
|
/// <summary>Minimum air pressure required to operate [bar].</summary>
|
|
double MinPress; // minimalne ciśnienie do załączenia WS
|
|
/// <summary>Maximum air pressure after the reductor [bar].</summary>
|
|
double MaxPress; // maksymalne ciśnienie za reduktorem
|
|
/// <summary>True if power output is faked (e.g. for AI vehicles without a model).</summary>
|
|
bool FakePower;
|
|
/// <summary>Physical layout id (orientation / side).</summary>
|
|
int PhysicalLayout;
|
|
/// <summary>Pantograph type (model).</summary>
|
|
TPantType PantographType;
|
|
// inline TCurrentCollector() {
|
|
// CollectorsNo = 0;
|
|
// MinH, MaxH, CSW, MinV, MaxV = 0.0;
|
|
// OVP, InsetV, MinPress, MaxPress = 0.0;
|
|
// }
|
|
};
|
|
/// <summary>Power-source kind (where the vehicle gets electrical or mechanical energy from).</summary>
|
|
enum class TPowerSource
|
|
{
|
|
NotDefined,
|
|
InternalSource,
|
|
Transducer,
|
|
Generator,
|
|
Accumulator,
|
|
CurrentCollector,
|
|
PowerCable,
|
|
Heater,
|
|
Main
|
|
};
|
|
|
|
/// <summary>Diesel engine driven generator parameters and outputs.</summary>
|
|
struct engine_generator
|
|
{
|
|
// ld inputs
|
|
/// <summary>Pointer to the prime-mover revolutions [rev/s].</summary>
|
|
double *engine_revolutions; // revs per second of the prime mover
|
|
// config
|
|
/// <summary>Minimum working rev rate [rev/s].</summary>
|
|
double revolutions_min; // min working revolutions rate, in revs per second
|
|
/// <summary>Maximum working rev rate [rev/s].</summary>
|
|
double revolutions_max; // max working revolutions rate, in revs per second
|
|
/// <summary>Voltage generated at <c>revolutions_min</c> [V].</summary>
|
|
double voltage_min; // voltage generated at min working revolutions
|
|
/// <summary>Voltage generated at <c>revolutions_max</c> [V].</summary>
|
|
double voltage_max; // voltage generated at max working revolutions
|
|
// ld outputs
|
|
/// <summary>Current rev rate [rev/s].</summary>
|
|
double revolutions;
|
|
/// <summary>Current generated voltage [V].</summary>
|
|
double voltage;
|
|
};
|
|
|
|
/// <summary>Battery / accumulator power source.</summary>
|
|
struct TAccumulator
|
|
{
|
|
/// <summary>Maximum capacity [Ah].</summary>
|
|
double MaxCapacity;
|
|
/// <summary>Source used to recharge the battery.</summary>
|
|
TPowerSource RechargeSource;
|
|
// inline _vehicle__1() {
|
|
// MaxCapacity = 0.0;
|
|
// RechargeSource = NotDefined;
|
|
// }
|
|
};
|
|
|
|
/// <summary>Permanent power cable (e.g. to a heater) carrying a specific power form.</summary>
|
|
struct TPowerCable
|
|
{
|
|
/// <summary>Type of power transmitted.</summary>
|
|
TPowerType PowerTrans;
|
|
/// <summary>Steam pressure (when SteamPower is transmitted) [bar].</summary>
|
|
double SteamPressure;
|
|
// inline _vehicle__2() {
|
|
// SteamPressure = 0.0;
|
|
// PowerTrans = NoPower;
|
|
// }
|
|
};
|
|
|
|
/// <summary>Steam locomotive boiler-and-grate combo.</summary>
|
|
struct THeater
|
|
{
|
|
/// <summary>Grate parameters.</summary>
|
|
TGrateType Grate;
|
|
/// <summary>Boiler parameters.</summary>
|
|
TBoilerType Boiler;
|
|
};
|
|
|
|
/// <summary>Transducer (DC-DC / converter) parameters.</summary>
|
|
struct TTransducer
|
|
{
|
|
// ld inputs
|
|
/// <summary>Input voltage [V].</summary>
|
|
double InputVoltage;
|
|
};
|
|
|
|
/// <summary>
|
|
/// Generic power-source parameters. The trailing union holds source-specific
|
|
/// configuration depending on <c>SourceType</c>.
|
|
/// </summary>
|
|
struct TPowerParameters
|
|
{
|
|
/// <summary>Maximum source voltage [V].</summary>
|
|
double MaxVoltage{0.0};
|
|
/// <summary>Maximum source current [A].</summary>
|
|
double MaxCurrent{0.0};
|
|
/// <summary>Internal resistance [Ω].</summary>
|
|
double IntR{0.001};
|
|
/// <summary>Type of source (selects which union member is meaningful).</summary>
|
|
TPowerSource SourceType;
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
THeater RHeater;
|
|
};
|
|
struct
|
|
{
|
|
TPowerCable RPowerCable;
|
|
};
|
|
struct
|
|
{
|
|
TCurrentCollector CollectorParameters;
|
|
};
|
|
struct
|
|
{
|
|
TAccumulator RAccumulator;
|
|
};
|
|
struct
|
|
{
|
|
engine_generator EngineGenerator;
|
|
};
|
|
struct
|
|
{
|
|
TTransducer Transducer;
|
|
};
|
|
struct
|
|
{
|
|
TPowerType PowerType;
|
|
};
|
|
};
|
|
inline TPowerParameters()
|
|
{
|
|
SourceType = TPowerSource::NotDefined;
|
|
PowerType = TPowerType::NoPower;
|
|
RPowerCable.PowerTrans = TPowerType::NoPower;
|
|
}
|
|
};
|
|
|
|
/*dla lokomotyw elektrycznych:*/
|
|
struct TScheme
|
|
{
|
|
int Relay = 0; /*numer pozycji rozruchu samoczynnego*/
|
|
double R = 0.0; /*opornik rozruchowy*/ /*dla dizla napelnienie*/
|
|
int Bn = 0;
|
|
int Mn = 0; /*ilosc galezi i silnikow w galezi*/ /*dla dizla Mn: czy luz czy nie*/
|
|
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*/
|
|
};
|
|
using TSchemeTable = TScheme[ResArraySize + 1]; /*tablica rezystorow rozr.*/
|
|
struct TDEScheme
|
|
{
|
|
double RPM = 0.0; /*obroty diesla*/
|
|
double GenPower = 0.0; /*moc maksymalna*/
|
|
double Umax = 0.0; /*napiecie maksymalne*/
|
|
double Imax = 0.0; /*prad maksymalny*/
|
|
};
|
|
using TDESchemeTable = TDEScheme[33]; /*tablica WWList dla silnikow spalinowych*/
|
|
struct TFFScheme
|
|
{
|
|
double v = 0.0; // parametr wejsciowy
|
|
double freq = 0.0; // wyjscie: czestotliwosc falownika
|
|
};
|
|
using TFFSchemeTable = TFFScheme[33];
|
|
|
|
struct TWiperScheme
|
|
{
|
|
uint8_t byteSum = 0; // suma bitowa pracujacych wycieraczek
|
|
double WiperSpeed = 0.0; // predkosc wycieraczki
|
|
double interval = 0.0; // interwal pracy wycieraczki
|
|
double outBackDelay = 0.0; // czas po jakim wycieraczka zacznie wracac z konca do poczatku
|
|
};
|
|
using TWiperSchemeTable = TWiperScheme[16];
|
|
|
|
struct TShuntScheme
|
|
{
|
|
double Umin = 0.0;
|
|
double Umax = 0.0;
|
|
double Pmin = 0.0;
|
|
double Pmax = 0.0;
|
|
};
|
|
using TShuntSchemeTable = TShuntScheme[33];
|
|
struct TMPTRelay
|
|
{ /*lista przekaznikow bocznikowania*/
|
|
double Iup = 0.0;
|
|
double Idown = 0.0;
|
|
};
|
|
using TMPTRelayTable = TMPTRelay[MotorParametersArraySize + 1]; // indexed like MotorParam
|
|
|
|
struct TMotorParameters
|
|
{
|
|
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
|
|
{
|
|
int mode = 0; /*tryb pracy zadajnika - pomocnicze*/
|
|
double MinCtrlVal = 0.0; /*minimalna wartosc nastawy*/
|
|
double MaxCtrlVal = 0.0; /*maksymalna wartosc nastawy*/
|
|
double SetCtrlVal = 0.0; /*docelowa wartosc nastawy*/
|
|
double SpeedUp = 0.0; /*szybkosc zwiekszania nastawy*/
|
|
double SpeedDown = 0.0; /*szybkosc zmniejszania nastawy*/
|
|
int ReturnPosition = 0; /*pozycja na ktora odskakuje zadajnik*/
|
|
int NextPosFastInc = 0; /*nastepna duza pozycja przy przechodzeniu szybkim*/
|
|
int PrevPosFastDec = 0; /*poprzednia duza pozycja przy przechodzeniu szybkim*/
|
|
};
|
|
using TUniversalCtrlTable = std::array<TUniversalCtrl, UniversalCtrlArraySize + 1>;
|
|
|
|
class TSecuritySystem
|
|
{
|
|
bool vigilance_enabled = false;
|
|
bool cabsignal_enabled = false;
|
|
bool radiostop_enabled = false;
|
|
|
|
bool cabsignal_active = false;
|
|
bool pressed = false;
|
|
bool enabled = false;
|
|
bool is_sifa = false; // Sifa-like pedal device, with inverted input for convenient keyboard usage
|
|
bool separate_acknowledge = false; // cabsignal reset button is separate from vigilance
|
|
bool cabsignal_lock = false;
|
|
bool vigilance_suspended = false; // the vigilance device switched off by the shunt mode of the vehicle, see AwareOffInShuntMode
|
|
|
|
double vigilance_timer = 0.0;
|
|
double alert_timer = 0.0;
|
|
double press_timer = 0.0;
|
|
|
|
double velocity = 0.0;
|
|
bool power = false;
|
|
int cabactive = 0;
|
|
|
|
double AwareDelay = 30.0;
|
|
double AwareMinSpeed = 0.0;
|
|
double SoundSignalDelay = 5.0;
|
|
double EmergencyBrakeDelay = 5.0;
|
|
double MaxHoldTime = 1.5;
|
|
bool CabDependent = false;
|
|
bool AwareOffInShuntMode = false; // the shunt mode of the vehicle switches the vigilance device off, as on the SM42
|
|
|
|
public:
|
|
void set_enabled(bool e);
|
|
void acknowledge_press();
|
|
void acknowledge_release();
|
|
void cabsignal_reset();
|
|
void update(double dt, double Vel, bool pwr, int cab);
|
|
void set_cabsignal();
|
|
void set_cabsignal_lock(bool);
|
|
void set_shunt_mode(bool State);
|
|
bool is_blinking() const;
|
|
bool is_vigilance_blinking() const;
|
|
bool is_cabsignal_blinking() const;
|
|
bool is_beeping() const;
|
|
bool is_cabsignal_beeping() const;
|
|
bool is_braking() const;
|
|
bool is_engine_blocked() const;
|
|
bool radiostop_available() const;
|
|
bool has_separate_acknowledge() const;
|
|
void load(std::string const &line, double vmax);
|
|
|
|
double MagnetLocation = 0.0;
|
|
};
|
|
|
|
struct TTransmision
|
|
{ // liczba zebow przekladni
|
|
int NToothM = 0;
|
|
int NToothW = 0;
|
|
double Ratio = 1.0;
|
|
double Efficiency = 1.0;
|
|
};
|
|
|
|
enum class TCouplerType
|
|
{
|
|
NoCoupler,
|
|
Articulated,
|
|
Bare,
|
|
Chain,
|
|
Screw,
|
|
Automatic
|
|
};
|
|
|
|
struct power_coupling
|
|
{
|
|
double current{0.0};
|
|
double voltage{0.0};
|
|
bool is_local{false}; // whether the power comes from external or onboard source
|
|
bool is_live{false}; // whether the coupling with next vehicle is live
|
|
};
|
|
|
|
struct TCoupling
|
|
{
|
|
/*parametry*/
|
|
double SpringKB = 1.0; /*stala sprezystosci zderzaka/sprzegu, %tlumiennosci */
|
|
double DmaxB = 0.1; /*tolerancja scisku/rozciagania, sila rozerwania*/
|
|
double FmaxB = 1000.0;
|
|
double SpringKC = 1.0;
|
|
double DmaxC = 0.1;
|
|
double FmaxC = 1000.0;
|
|
double beta = 0.0;
|
|
TCouplerType CouplerType = TCouplerType::NoCoupler; /*typ sprzegu*/
|
|
CouplingSet AutomaticCouplingFlag{Coupling::coupler};
|
|
CouplingSet AllowedFlag{Coupling::coupler | Coupling::brakeHose}; // Ra: maska dostępnych
|
|
CouplingSet PowerFlag{Coupling::power110v | Coupling::power24v};
|
|
CouplingSet PowerCoupling{Coupling::permanent}; // type of coupling required for power transfer
|
|
/*zmienne*/
|
|
bool AutomaticCouplingAllowed{true}; // whether automatic coupling can be currently performed
|
|
CouplingSet CouplingFlag; // what the coupling joins; none: the vehicles only see each other
|
|
class physics::Vehicle *Connected = nullptr; /*co jest podlaczone*/
|
|
int ConnectedNr = 0; // Ra: od której strony podłączony do (Connected): 0=przód, 1=tył
|
|
// the end of the vehicle connected to, while there is one
|
|
VehicleEnd ConnectedEnd() const
|
|
{
|
|
return static_cast<VehicleEnd>(ConnectedNr);
|
|
}
|
|
double CForce = 0.0; /*sila z jaka dzialal*/
|
|
double Dist = 0.0; /*strzalka ugiecia zderzaków*/
|
|
bool CheckCollision = false; /*czy sprawdzac sile czy pedy*/
|
|
float stretch_duration{0.f}; // seconds, elapsed time with excessive force applied to the coupler
|
|
bool broken{false}; // the coupler broke (damage_coupler()), until it's repaired (repair_coupler())
|
|
// optional adapter piece
|
|
double adapter_length{0.0}; // meters, value added on the given end to standard vehicle (half)length
|
|
double adapter_height{0.0}; // meters, distance from rail level
|
|
TCouplerType adapter_type = TCouplerType::NoCoupler; // CouplerType override if other than NoCoupler
|
|
|
|
power_coupling power_high;
|
|
power_coupling power_110v;
|
|
power_coupling power_24v;
|
|
// the circuit of the power coupling given, nullptr for a coupling which isn't one
|
|
power_coupling *power(Coupling const kind)
|
|
{
|
|
switch (kind)
|
|
{
|
|
case Coupling::highVoltage:
|
|
return &power_high;
|
|
case Coupling::power110v:
|
|
return &power_110v;
|
|
case Coupling::power24v:
|
|
return &power_24v;
|
|
default:
|
|
return nullptr;
|
|
}
|
|
}
|
|
power_coupling const *power(Coupling const kind) const
|
|
{
|
|
switch (kind)
|
|
{
|
|
case Coupling::highVoltage:
|
|
return &power_high;
|
|
case Coupling::power110v:
|
|
return &power_110v;
|
|
case Coupling::power24v:
|
|
return &power_24v;
|
|
default:
|
|
return nullptr;
|
|
}
|
|
}
|
|
|
|
// the physical model of the coupling (couplerphysics in eu07.ini), see couplerphysics.h: the parameters of this end,
|
|
// and the state of the coupling with the vehicle at this end, which that vehicle keeps alike on its own end
|
|
coupler_physics::end_parameters physics;
|
|
coupler_physics::pair_state physics_state;
|
|
// the collisions past the buffers (physics.collisions new), see collision.h: the optional keys of this end, the depth
|
|
// it's crushed to for good [m], and the hit of the pair in the step: whether either vehicle handled it already, its
|
|
// peak force [N] and how long that acted [s]
|
|
collision::end_definition collision;
|
|
double crush{0.0};
|
|
double closing{0.0}; // the velocity the buffers of the pair closed in at, at the start of the step [m/s]
|
|
bool hit_handled{false};
|
|
double hit_force{0.0};
|
|
double hit_duration{0.0};
|
|
// physics.collisions monitor: the log told of the crush of this hit of the pair already
|
|
bool crush_monitored{false};
|
|
// the energy the contact of the pair brought to its buffers, for the budget of the crush
|
|
collision::contact_energy contact;
|
|
// the log told of the vehicle at this end being inside this one already
|
|
bool inside_reported{false};
|
|
|
|
int sounds{0}; // sounds emitted by the coupling devices
|
|
bool Render = false; /*ABu: czy rysowac jak zaczepiony sprzeg*/
|
|
std::string control_type; // abstraction of control coupling interface and communication standard
|
|
|
|
inline bool has_adapter() const
|
|
{
|
|
return adapter_type != TCouplerType::NoCoupler;
|
|
}
|
|
inline TCouplerType type() const
|
|
{
|
|
return adapter_type == TCouplerType::NoCoupler ? CouplerType : adapter_type;
|
|
}
|
|
};
|
|
|
|
|
|
struct speed_control
|
|
{
|
|
bool IsActive = false;
|
|
bool Start = false;
|
|
bool ManualStateOverride = true;
|
|
bool BrakeIntervention = false;
|
|
bool BrakeInterventionBraking = false;
|
|
bool BrakeInterventionUnbraking = false;
|
|
bool Standby = false;
|
|
bool Parking = false;
|
|
double InitialPower = 1.0;
|
|
double FullPowerVelocity = -1;
|
|
double StartVelocity = -1;
|
|
double VelocityStep = 5;
|
|
double PowerStep = 0.1;
|
|
double MinPower = 0.0;
|
|
double MaxPower = 1.0;
|
|
double MinVelocity = 0;
|
|
double MaxVelocity = 120;
|
|
double DesiredVelocity = 0;
|
|
double DesiredPower = 1.0;
|
|
double Offset = -0.5;
|
|
double FactorPpos = 0.5;
|
|
double FactorPneg = 0.5;
|
|
double FactorIpos = 0.0;
|
|
double FactorIneg = 0.0;
|
|
double BrakeInterventionVel = 30.0;
|
|
double PowerUpSpeed = 1000;
|
|
double PowerDownSpeed = 1000;
|
|
};
|
|
|
|
namespace physics
|
|
{
|
|
|
|
class Vehicle
|
|
{ // Ra: wrapper na kod pascalowy, przejmujący jego funkcje Q: 20160824 - juz nie wrapper a klasa bazowa :)
|
|
public:
|
|
bool reload_FIZ();
|
|
double const &MoveLength() const { return moveLength; }
|
|
void SetMoveLength(double const Value) { moveLength = Value; }
|
|
/*---opis lokomotywy, wagonu itp*/
|
|
/*--opis serii--*/
|
|
int CategoryFlag = 1; /*1 - pociag, 2 - samochod, 4 - statek, 8 - samolot*/
|
|
/*--sekcja stalych typowych parametrow*/
|
|
std::string TypeName; /*nazwa serii/typu*/
|
|
train_type const &TrainType() const { return trainType; } // the vehicles of a handling of their own, from the Type of the .fiz
|
|
// an electric or a diesel multiple unit
|
|
bool is_multiple_unit() const
|
|
{
|
|
return trainType == train_type::emu || trainType == train_type::dmu;
|
|
}
|
|
TEngineType EngineType = TEngineType::None; /*typ napedu*/
|
|
TPowerParameters EnginePowerSource; /*zrodlo mocy dla silnikow*/
|
|
TPowerParameters HeatingPowerSource; /*zrodlo mocy dla ogrzewania*/
|
|
double const &Vmax() const { return vmax; }
|
|
double const &Mass() const { return emptyMass; }
|
|
double Power = 0.0; /*max. predkosc kontrukcyjna, masa wlasna, moc*/
|
|
double const &Mred() const { return mred; } /*Ra: zredukowane masy wirujące; potrzebne do obliczeń hamowania*/
|
|
double const &TotalMass() const { return totalMass; } /*wyliczane przez ComputeMass*/
|
|
double LightPower = 0.0; /*moc pobierana na ogrzewanie/oswietlenie*/
|
|
bool const &EpFuse() const { return epFuse; } /*Czy jest wlaczony hamulec EP*/
|
|
double EpForce = 0.0; /*Poziom zadanej sily EP*/
|
|
bool const &Signalling() const { return signalling; } /*Czy jest zalaczona sygnalizacja hamowania ostatniego wagonu*/
|
|
void SetSignalling(bool const Value) { signalling = Value; }
|
|
bool const &Radio() const { return radio; } /*Czy jest zalaczony radiotelefon*/
|
|
void SetRadio(bool const Value) { radio = Value; }
|
|
// the cut-off in the radio's power supply: a fuse in the cabinet, a lever on the desk or the switch on the radio's power
|
|
// supply (eu07/maszyna#438). Closed unless the driver opens it, so vehicles without such a switch work as before
|
|
bool const &RadioFuse() const { return radioFuse; }
|
|
void SetRadioFuse(bool const Value) { radioFuse = Value; }
|
|
TDimension Dim; /*wymiary*/
|
|
double Cx = 0.0; /*wsp. op. aerodyn.*/
|
|
float Floor = 0.96f; // poziom podłogi dla ładunków
|
|
float const &WheelDiameter() const { return wheelDiameter; } /*srednica kol napednych*/
|
|
float WheelDiameterL = 0.9f; // Ra: srednica kol tocznych przednich
|
|
float WheelDiameterT = 0.9f; // Ra: srednica kol tocznych tylnych
|
|
float TrackW = 1.435f; /*nominalna szerokosc toru [m]*/
|
|
double AxleInertialMoment = 0.0; /*moment bezwladnosci zestawu kolowego*/
|
|
std::string AxleArangement; /*uklad osi np. Bo'Bo' albo 1'C*/
|
|
int const &NPoweredAxles() const { return nPoweredAxles; } /*ilosc osi napednych liczona z powyzszego*/
|
|
int const &NAxles() const { return nAxles; } /*ilosc wszystkich osi j.w.*/
|
|
int BearingType = 1; /*lozyska: 0 - slizgowe, 1 - toczne*/
|
|
double const &ADist() const { return aDist; }
|
|
double const &BDist() const { return bDist; } /*odlegosc osi oraz czopow skretu*/
|
|
int SandCapacity = 0; /*zasobnik piasku [kg]*/
|
|
|
|
int const &WiperSwitchPos() const { return wiperSwitchPos; } // pozycja przelacznika wycieraczek
|
|
void SetWiperSwitchPos(int const Value) { wiperSwitchPos = Value; }
|
|
double WiperAngle = {45.0}; // kat pracy wycieraczek
|
|
|
|
LowVoltageSupply lowVoltage; // the battery and the low voltage circuits (physics/components/lowvoltage.h)
|
|
TrainHeating trainHeating;
|
|
LineBreaker lineBreaker; // the main circuit (physics/components/maincircuit.h)
|
|
LineContactors lineContactors;
|
|
ProtectionRelays protection;
|
|
PowerConverter converter;
|
|
ByEnd<basic_pantograph> pantographs;
|
|
PantographCircuit pantographCircuit; // their voltages, switches, presets (physics/components/pantographs.h)
|
|
PantographAir pantographAir; // their reservoir, the small compressor, the valves
|
|
TrainPipe brakePipe; // the brake pipe along the train
|
|
TrainPipe mainPipe; // the main reservoir pipe along the train
|
|
AirSupply air; // the compressor and the main reservoir (physics/components/airsupply.h)
|
|
Braking brakes; // the blending, the holding brake, the spring brake (physics/components/braking.h)
|
|
|
|
int TurboTest = 0;
|
|
/*nastawniki:*/
|
|
int MainCtrlPosNo = 0; /*ilosc pozycji nastawnika*/
|
|
int const &ScndCtrlPosNo() const { return scndCtrlPosNo; }
|
|
int LightsPosNo = 0;
|
|
bool LightsWrap = false;
|
|
ByEnd<std::array<int, 18>> Lights; // pozycje świateł, przód - tył, 1 .. 16 (17 do lightsset)
|
|
// the cab interior light each light preset sets, from the optional third column of LightsList (bits of
|
|
// lights_preset_cablight::flag); -1: the preset leaves the cab light as it is (eu07/maszyna#529)
|
|
std::array<int, 18> LightsCabLight{[] {
|
|
std::array<int, 18> positions;
|
|
positions.fill(-1);
|
|
return positions;
|
|
}()};
|
|
double maxTachoSpeed = {0.0}; // maksymalna predkosc na tarczce predkosciomierza analogowego
|
|
bool HideDirStatusWhenMoving{false}; // Czy gasic lampki kierunku powyzej predkosci zdefiniowanej przez HideDirStatusSpeed
|
|
int HideDirStatusSpeed{1}; // Predkosc od ktorej lampki kierunku sa wylaczane
|
|
bool isDoubleClickForMeasureNeeded = {false}; // czy rozpoczecie pomiaru odleglosci odbywa sie po podwojnym wcisnienciu przycisku?
|
|
float DistanceCounterDoublePressPeriod = {1.f}; // czas w jakim nalezy podwojnie wcisnac przycisk, aby rozpoczac pomiar odleglosci
|
|
TSecuritySystem SecuritySystem;
|
|
int EmergencyBrakeWarningSignal{0}; // combined with basic warningSignal when manual emergency brake is active
|
|
horn_supply const &HornSupply() const { return hornSupply; } // of the low and high tone horns (warningSignal 1 and 2)
|
|
horn_supply Horn3Supply{horn_supply::air}; // of the third horn (warningSignal 4)
|
|
// main reservoir pressure [bar, as MinCP and MaxCP] below which a pneumatic horn stays silent
|
|
static constexpr double HornMinPressure{2.0};
|
|
TUniversalCtrlTable UniCtrlList; /*lista pozycji uniwersalnego nastawnika*/
|
|
bool UniCtrlIntegratedBrakeCtrl = false; /*zintegrowany nastawnik JH obsluguje hamowanie*/
|
|
bool const &UniCtrlIntegratedLocalBrakeCtrl() const { return uniCtrlIntegratedLocalBrakeCtrl; } /*zintegrowany nastawnik JH obsluguje hamowanie hamulcem pomocniczym*/
|
|
// UCList CtrlValStep: the universal controller (EIMCtrlType 3) changes its setting in steps of this size (e.g. 0.05 for the
|
|
// 5% steps of the 6Dg), one at once when moved to a raising or lowering position, then one each time its SpeedUp / SpeedDown
|
|
// covers a step; 0 (the default) changes it continuously
|
|
double const &UniCtrlValStep() const { return uniCtrlValStep; }
|
|
|
|
/*-sekcja parametrow dla lokomotywy elektrycznej*/
|
|
TSchemeTable RList; /*lista rezystorow rozruchowych i polaczen silnikow, dla dizla: napelnienia*/
|
|
int RlistSize = 0;
|
|
TMotorParameters MotorParam[MotorParametersArraySize + 1];
|
|
/*rozne parametry silnika przy bocznikowaniach*/
|
|
/*dla lokomotywy spalinowej z przekladnia mechaniczna: przelozenia biegow*/
|
|
// bounds-safe read access to MotorParam
|
|
TMotorParameters const &motor_param(int const Position) const
|
|
{
|
|
if (Position < 0)
|
|
return MotorParam[0];
|
|
if (Position > MotorParametersArraySize)
|
|
return MotorParam[MotorParametersArraySize];
|
|
return MotorParam[Position];
|
|
}
|
|
TTransmision Transmision;
|
|
// record {liczba zebow przekladni}
|
|
// NToothM, NToothW : byte;
|
|
// Ratio: real; {NToothW/NToothM}
|
|
// end;
|
|
double NominalVoltage = 0.0; /*nominalne napiecie silnika*/
|
|
double const &WindingRes() const { return windingRes; }
|
|
double CircuitRes = 0.0; /*rezystancje silnika i obwodu*/
|
|
int IminLo = 0;
|
|
int IminHi = 0; /*prady przelacznika automatycznego rozruchu, uzywane tez przez ai_driver*/
|
|
int const &ImaxLo() const { return imaxLo; } // maksymalny prad niskiego rozruchu
|
|
int const &ImaxHi() const { return imaxHi; } // maksymalny prad wysokiego rozruchu
|
|
bool const &MotorOverloadRelayHighThreshold() const { return motorOverloadRelayHighThreshold; }
|
|
double nmax = 0.0; /*maksymalna dop. ilosc obrotow /s*/
|
|
double const &InitialCtrlDelay() const { return initialCtrlDelay; }
|
|
double CtrlDelay = 0.0; /* -//- -//- miedzy kolejnymi poz.*/
|
|
double CtrlDownDelay = 0.0; /* -//- -//- przy schodzeniu z poz.*/ /*hunter-101012*/
|
|
int BackwardsBranchesAllowed = 1;
|
|
int const &AutoRelayType() const { return autoRelayType; } /*0 -brak, 1 - jest, 2 - opcja*/
|
|
// FieldShuntSwitch=Yes: the switch of AutoRelay=Optional of a diesel-electric is its switch of the field shunting, as the SU45's
|
|
// and SP45's (fieldshunting.h): off, the field stays full. without it, off hands the shunting to the second controller, as before
|
|
bool const &FieldShuntSwitch() const { return fieldShuntSwitch; }
|
|
bool CoupledCtrl = false; /*czy mainctrl i scndctrl sa sprzezone*/
|
|
bool HasCamshaft{false};
|
|
// the dynamic brake of a diesel-electric vehicle (Engine: EDBrake=...): the traction motors brake into resistors while
|
|
// the engine runs, with the force of the definition rather than from a circuit, as the drive of these vehicles is
|
|
// computed from the generator's power. no definition, no dynamic brake (MaSzyna-EU07/maszyna#82)
|
|
struct diesel_electric_dynamic_brake
|
|
{
|
|
enum class control
|
|
{
|
|
none,
|
|
controller, // the negative range of the integrated controller (EIMCtrlType > 0), as the TRAXX one of the BR285
|
|
lever // a lever of its own (the SplitEDPneumaticBrake one, DBPN steps), with the master controller at zero
|
|
};
|
|
control source{control::none};
|
|
double max_force{0.0}; // [N] at the wheel rims of the whole vehicle, EDBrakeFmax [kN]
|
|
double max_power{0.0}; // [W] the resistors take, EDBrakePmax [kW]; 0: no limit
|
|
double fade_low{0.0}; // [km/h] EDBrakeV0: no force below
|
|
double fade_high{0.0}; // [km/h] EDBrakeV1: the whole force above, rising in between
|
|
double rate{0.5}; // [1/s] EDBrakeRate: how fast the effort follows the demand
|
|
bool blending{false}; // EDBrakeBlending: the locomotive's train brake lets off while the dynamic brake works (Hamulec->SetED)
|
|
// state
|
|
double level{0.0}; // the effort, 0..1
|
|
double force{0.0}; // [N] the braking force, against the motion
|
|
};
|
|
diesel_electric_dynamic_brake DEDynamicBrake;
|
|
double RVentnmax = 1.0; /*maks. obroty wentylatorow oporow rozruchowych*/
|
|
double RVentSpeed{0.5}; // rozpedzanie sie wentylatora obr/s^2}
|
|
bool const &RVentForceOn() const { return rventForceOn; } // forced activation switch
|
|
void SetRVentForceOn(bool const Value) { rventForceOn = Value; }
|
|
|
|
// the diesel engine, its torque converter and its retarder (physics/components/dieselengine.h)
|
|
DieselEngine diesel;
|
|
TorqueConverter torqueConverter;
|
|
Retarder retarder;
|
|
/*- dla lokomotyw spalinowo-elektrycznych -*/
|
|
double const &AnPos() const { return anPos; } // pozycja sterowania dokladnego (analogowego)
|
|
void SetAnPos(double const Value) { anPos = Value; }
|
|
bool ShuntModeAllow = false;
|
|
bool ShuntMode = false;
|
|
|
|
TDESchemeTable DElist;
|
|
TWiperSchemeTable WiperList;
|
|
int WiperListSize;
|
|
|
|
double Vadd = 1.0;
|
|
int RelayType = 0;
|
|
/*- dla uproszczonego modelu silnika (dumb) oraz dla drezyny*/
|
|
/*- dla lokomotyw z silnikami indukcyjnymi -*/
|
|
// the drive of induction motors (physics/components/inductionmotor.h)
|
|
InductionMotor inductionMotor;
|
|
|
|
/*-dla wagonow*/
|
|
struct load_attributes
|
|
{
|
|
std::string name; // name of the cargo
|
|
float offset_min{0.f}; // offset applied to cargo model when load amount is 0
|
|
|
|
load_attributes() = default;
|
|
load_attributes(std::string const &Name, float const Offsetmin) : name(Name), offset_min(Offsetmin) {}
|
|
};
|
|
std::vector<load_attributes> LoadAttributes;
|
|
float const &MaxLoad() const { return maxLoad; } /*masa w T lub ilosc w sztukach - ladownosc*/
|
|
void SetMaxLoad(float const Value) { maxLoad = Value; }
|
|
double OverLoadFactor = 0.0; /*ile razy moze byc przekroczona ladownosc*/
|
|
float LoadSpeed = 0.f;
|
|
float UnLoadSpeed = 0.f; /*szybkosc na- i rozladunku jednostki/s*/
|
|
#ifdef EU07_USEOLDDOORCODE
|
|
int DoorOpenCtrl = 0;
|
|
int DoorCloseCtrl = 0; /*0: przez pasazera, 1: przez maszyniste, 2: samoczynne (zamykanie)*/
|
|
double DoorStayOpen = 0.0; /*jak dlugo otwarte w przypadku DoorCloseCtrl=2*/
|
|
bool DoorClosureWarning = false; /*czy jest ostrzeganie przed zamknieciem*/
|
|
bool DoorClosureWarningAuto = false; // departure signal plays automatically while door closing button is held down
|
|
double DoorOpenSpeed = 1.0;
|
|
double DoorCloseSpeed = 1.0; /*predkosc otwierania i zamykania w j.u. */
|
|
double DoorMaxShiftL = 0.5;
|
|
double DoorMaxShiftR = 0.5;
|
|
double DoorMaxPlugShift = 0.1; /*szerokosc otwarcia lub kat*/
|
|
int DoorOpenMethod = 2; /*sposob otwarcia - 1: przesuwne, 2: obrotowe, 3: trójelementowe*/
|
|
float DoorCloseDelay{0.f}; // delay (in seconds) before the door begin closing, once conditions to close are met
|
|
double PlatformSpeed = 0.5; /*szybkosc stopnia*/
|
|
double PlatformMaxShift{0.0}; /*wysuniecie stopnia*/
|
|
int PlatformOpenMethod{2}; /*sposob animacji stopnia*/
|
|
#endif
|
|
double MirrorMaxShift{90.0};
|
|
double MirrorVelClose{5.0};
|
|
bool const &MirrorForbidden() const { return mirrorForbidden; } /*czy jest pozwolenie na otworzenie lusterek (przycisk)*/
|
|
void SetMirrorForbidden(bool const Value) { mirrorForbidden = Value; }
|
|
bool ScndS = false; /*Czy jest bocznikowanie na szeregowej*/
|
|
bool ScndCtrlResistiveLock{false}; // the shunt controller can't be moved, up or down, while the master controller is at zero or on a resistive position, and drops to 0 when the master controller gets there (ScndCtrlResistiveLock=Yes in Cntrl.)
|
|
bool const &SpeedCtrl() const { return speedCtrl; } /*czy jest tempomat*/
|
|
speed_control SpeedCtrlUnit; /*parametry tempomatu*/
|
|
double SpeedCtrlValue = 0; /*wybrana predkosc jazdy na tempomacie*/
|
|
/*--sekcja zmiennych*/
|
|
/*--opis konkretnego egzemplarza taboru*/
|
|
TLocation const &Loc() const { return location; } // pozycja pojazdów do wyznaczenia odległości pomiędzy sprzęgami
|
|
void SetLoc(TLocation const Value) { location = Value; }
|
|
std::string Name; /*nazwa wlasna*/
|
|
ByEnd<TCoupling> Couplers; // urzadzenia zderzno-sprzegowe, polaczenia miedzy wagonami
|
|
// the physical coupler model covers the vehicle: it's in the player's train or in one the player's train closes in on
|
|
// (vehicle_table::update_coupler_physics()); with couplerphysics all in eu07.ini every vehicle is covered
|
|
bool const &CouplerPhysics() const { return couplerPhysics; }
|
|
void SetCouplerPhysics(bool const Value) { couplerPhysics = Value; }
|
|
ByEnd<neighbour_data> Neighbours; // potential collision sources
|
|
// something out of the ordinary happened (the line breaker knocked out, a derailment), for the sounds to follow up
|
|
bool EventFlag() const { return eventFlag; }
|
|
void RaiseEventFlag() { eventFlag = true; }
|
|
void ClearEventFlag() { eventFlag = false; }
|
|
// the events of the step the sounds are to follow up (sound::), cleared once they did
|
|
int SoundFlag() const { return soundFlag; }
|
|
void ClearSoundFlags() { soundFlag = 0; }
|
|
int const &AIFlag() const { return aiFlag; } // HACK: events of interest for consist owner
|
|
// the flag of an event the AI has seen to
|
|
void ClearAIFlag(int Flag);
|
|
double const &DistCounter() const { return distCounter; } /*! licznik kilometrow */
|
|
void SetDistCounter(double const Value) { distCounter = Value; }
|
|
// the criteria of derailment (physics.derailment new), and the distance travelled since they were checked [m]
|
|
derailment::monitor derailment_monitor;
|
|
double const &DerailmentDistance() const { return derailmentDistance; }
|
|
void SetDerailmentDistance(double const Value) { derailmentDistance = Value; }
|
|
// physics.derailment monitor: the name of the track the criteria were last reported on (one report on a track), and
|
|
// how many reports there were
|
|
std::optional<std::string const *> derailment_reported;
|
|
int const &derailment_reports() const { return derailmentreportsValue; }
|
|
odometer::reading Odometer; // total distance run, kept between the sessions (eu07/maszyna#72)
|
|
std::pair<double, double> EnergyMeter; // energy <drawn, returned> from grid [kWh]
|
|
double const &V() const { return travelSpeed; } // predkosc w [m/s] względem sprzęgów (dodania gdy jedzie w stronę 0)
|
|
void SetV(double const Value) { travelSpeed = Value; }
|
|
double Vel = 0.0; // moduł prędkości w [km/h], używany przez AI
|
|
double const &AccS() const { return accS; } // efektywne przyspieszenie styczne w [m/s^2] (wszystkie siły)
|
|
void SetAccS(double const Value) { accS = Value; }
|
|
double const &AccSVBased() const { return accSVBased; } // tangential acceleration calculated from velocity change
|
|
double const &AccN() const { return accN; } // przyspieszenie normalne w [m/s^2]
|
|
void SetAccN(double const Value) { accN = Value; }
|
|
double const &AccVert() const { return accVert; } // vertical acceleration
|
|
void SetAccVert(double const Value) { accVert = Value; }
|
|
// a jolt of the track under the vehicle: up and down, or along and across (a switch)
|
|
void ShakeVertically(double const Acceleration) { accVert += Acceleration; }
|
|
void ShakeHorizontally(double const Acceleration)
|
|
{
|
|
accS += Acceleration;
|
|
accN += Acceleration;
|
|
}
|
|
double const &nrot() const { return nrotValue; } // predkosc obrotowa kol (obrotow na sekunde)
|
|
double const &WheelFlat() const { return wheelFlat; }
|
|
void SetWheelFlat(double const Value) { wheelFlat = Value; }
|
|
bool const &TruckHunting() const { return truckHunting; } // enable/disable truck hunting calculation
|
|
void SetTruckHunting(bool const Value) { truckHunting = Value; }
|
|
/*! rotacja kol [obr/s]*/
|
|
double EnginePower = 0.0; /*! chwilowa moc silnikow*/
|
|
double const &Fb() const { return brakingForce; }
|
|
double Ff = 0.0; /*przesuniecie, sila hamowania i tarcia*/
|
|
double FStand = 0.0; /*! sila pociagowa i oporow ruchu*/
|
|
bool const &SlippingWheels() const { return slippingWheels; }
|
|
bool const &SandDose() const { return sandDose; } /*! poslizg kol, sypanie piasku*/
|
|
bool SandDoseManual = false; /*piaskowanie reczne*/
|
|
bool SandDoseAuto = false; /*piaskowanie automatyczne*/
|
|
bool SandDoseAutoAllow = true; /*zezwolenie na automatyczne piaskowanie*/
|
|
double Sand = 0.0; /*ilosc piasku*/
|
|
/*! przyrosty cisnienia w kroku czasowym*/
|
|
fuel_pump FuelPump;
|
|
oil_pump OilPump;
|
|
genset_device Genset; // of a dual-mode vehicle, fitted() only with GensetPower
|
|
// the source the traction circuit takes its voltage from (the traction selector of a dual-mode vehicle)
|
|
enum class traction_mode { catenary, genset };
|
|
traction_mode const &TractionMode() const { return tractionModeSetting; }
|
|
bool GensetSelected() const { return tractionModeSetting == traction_mode::genset; }
|
|
water_pump WaterPump;
|
|
water_heater WaterHeater;
|
|
bool const &WaterCircuitsLink() const { return waterCircuitsLink; } // optional connection between water circuits
|
|
ByEnd<cooling_fan> MotorBlowers;
|
|
door_data Doors;
|
|
float DoorsOpenWithPermitAfter{-1.f}; // remote open if permit button is held for specified time. NOTE: separate from door data as its cab control thing
|
|
int const &DoorsPermitLightBlinking() const { return doorsPermitLightBlinking; } // when the doors permit signal light is blinking
|
|
|
|
/*
|
|
*/
|
|
bool const &RadioStopFlag() const { return radioStopFlag; } /*hamowanie nagle*/
|
|
void SetRadioStopFlag(bool const Value) { radioStopFlag = Value; }
|
|
int TUHEX_StageActual = 0; /*aktualny stopien tuhexa*/
|
|
bool TUHEX_Active = false; /*czy hamowanie ED wywołane z zewnątrz*/
|
|
// NapUdWsp: integer;
|
|
double const &ActFlowSpeed() const { return actFlowSpeed; } /*szybkosc stabilizatora*/
|
|
void SetActFlowSpeed(double const Value) { actFlowSpeed = Value; }
|
|
|
|
DamageSet DamageFlag; // the damage of the vehicle
|
|
EquipmentFaultSet equipmentFaults; // the faults of the equipment set on the vehicle (SetEquipmentFaults())
|
|
|
|
// EndSignalsFlag: byte; {ABu 060205: zmiany - koncowki: 1/16 - swiatla prz/tyl, 2/31 - blachy prz/tyl}
|
|
// HeadSignalsFlag: byte; {ABu 060205: zmiany - swiatla: 1/2/4 - przod, 16/32/63 - tyl}
|
|
TCommand CommandIn;
|
|
/*komenda przekazywana przez PutCommand*/
|
|
/*i wykonywana przez RunInternalCommand*/
|
|
|
|
TTrackShape RunningShape; /*geometria toru po ktorym jedzie pojazd*/
|
|
TTrackParam RunningTrack; /*parametry toru po ktorym jedzie pojazd*/
|
|
double const &OffsetTrackH() const { return offsetTrackH; }
|
|
void SetOffsetTrackH(double const Value) { offsetTrackH = Value; }
|
|
double const &OffsetTrackV() const { return offsetTrackV; } /*przesuniecie poz. i pion. w/m osi toru*/
|
|
void SetOffsetTrackV(double const Value) { offsetTrackV = Value; }
|
|
|
|
/*-zmienne dla lokomotyw*/
|
|
int const &MainCtrlPos() const { return mainCtrlPos; } /*polozenie glownego nastawnika*/
|
|
void SetMainCtrlPos(int const Value) { mainCtrlPos = Value; }
|
|
int const &ScndCtrlPos() const { return scndCtrlPos; } /*polozenie dodatkowego nastawnika*/
|
|
void SetScndCtrlPos(int const Value) { scndCtrlPos = Value; }
|
|
int const &LightsPos() const { return lightsPos; } /*polozenie przelacznika wielopozycyjnego swiatel*/
|
|
void SetLightsPos(int const Value) { lightsPos = Value; }
|
|
int DirActive = 0; // czy lok. jest wlaczona i w ktorym kierunku: względem wybranej kabiny: -1 - do tylu, +1 - do przodu, 0 - wylaczona
|
|
int DirAbsolute = 0; // zadany kierunek jazdy względem sprzęgów (1=w strone 0,-1=w stronę 1)
|
|
int const &MainCtrlMaxDirChangePos() const { return mainCtrlMaxDirChangePos; } // can't change reverser state with master controller set above this position
|
|
int CabActive = 0; // numer kabiny, z której jest sterowanie: 1 lub -1; w przeciwnym razie brak sterowania - rozrzad
|
|
int const &CabOccupied() const { return cabOccupied; } // numer kabiny, w ktorej jest obsada (zwykle jedna na skład) // TODO: move to TController
|
|
void SetCabOccupied(int const Value) { cabOccupied = Value; }
|
|
bool const &CabMaster() const { return cabMaster; } // czy pojazd jest nadrzędny w składzie
|
|
// pullee mode ("jazda ciągniona", MaSzyna-EU07/maszyna#64): the vehicle is prepared for being hauled dead in a
|
|
// train, see PulleeModeSwitch()
|
|
bool const &PulleeMode() const { return pulleeMode; }
|
|
inline bool IsCabMaster() const
|
|
{
|
|
return CabActive == cabOccupied && cabMaster;
|
|
} // czy aktualna kabina jest na pewno tą, z której można sterować
|
|
bool AutomaticCabActivation = true; // czy zmostkowany rozrzad przelacza sie sam przy zmianie kabiny
|
|
int InactiveCabFlag = 0; // co sie dzieje przy dezaktywacji kabiny
|
|
bool const &InactiveCabPantsCheck() const { return inactiveCabPantsCheck; } // niech DynamicObject sprawdzi pantografy
|
|
void SetInactiveCabPantsCheck(bool const Value) { inactiveCabPantsCheck = Value; }
|
|
double LastSwitchingTime = 0.0; /*czas ostatniego przelaczania czegos*/
|
|
int const &WarningSignal() const { return warningSignal; } // 0: nie trabi, 1,2,4: trabi
|
|
void SetWarningSignal(int const Value) { warningSignal = Value; }
|
|
bool const &DepartureSignal() const { return departureSignalOn; } /*sygnal odjazdu*/
|
|
bool const &InsideConsist() const { return insideConsist; }
|
|
void SetInsideConsist(bool const Value) { insideConsist = Value; }
|
|
/*-zmienne dla lokomotywy elektrycznej*/
|
|
double enrot = 0.0; // ilosc obrotow silnika
|
|
double Im = 0.0; // prad silnika
|
|
/*
|
|
// currently not used
|
|
double IHeating = 0.0;
|
|
double ITraction = 0.0;
|
|
*/
|
|
double Itot = 0.0; // prad calkowity
|
|
double TotalCurrent = 0.0;
|
|
// momenty
|
|
double const &Mm() const { return motorMoment; }
|
|
double const &Ft() const { return ft; }
|
|
// Ra: Im jest ujemny, jeśli lok jedzie w stronę sprzęgu 1
|
|
// a ujemne powinien być przy odwróconej polaryzacji sieci...
|
|
// w wielu miejscach jest używane abs(Im)
|
|
int const &Imin() const { return imin; }
|
|
int Imax = 0; /*prad przelaczania automatycznego rozruchu, prad bezpiecznika*/
|
|
double EngineVoltage = 0.0; // voltage supplied to engine
|
|
int MainCtrlActualPos = 0; /*wskaznik RList*/
|
|
int ScndCtrlActualPos = 0; /*wskaznik MotorParam*/
|
|
bool const &DelayCtrlFlag() const { return delayCtrlFlag; } // czy czekanie na 1. pozycji na załączenie?
|
|
bool const &AutoRelayFlag() const { return autoRelayFlag; } /*mozna zmieniac jesli autoRelayType=2*/
|
|
bool FuseFlag = false; /*!o bezpiecznik nadmiarowy*/
|
|
double LouvresOpenPressure{5.0}; // main reservoir pressure [bar] at which the pneumatic louvres of the motor fans open (ET22)
|
|
bool ResistorsFlag = false; /*!o jazda rezystorowa*/
|
|
double RventRot = 0.0; /*!s obroty wentylatorow rozruchowych*/
|
|
std::array<std::pair<double, double>, 4> PowerCircuits; // 24v, 110v, 3x400v and 3000v power circuits, voltage from local sources and current draw pairs
|
|
|
|
/*- zmienne dla lokomotyw z silnikami indukcyjnymi -*/
|
|
double eimic = 0; /*aktualna pozycja zintegrowanego sterowania jazda i hamowaniem*/
|
|
double const &EimicAnalog() const { return eimicAnalog; } /*pozycja zadajnika analogowa*/
|
|
void SetEimicAnalog(double const Value) { eimicAnalog = Value; }
|
|
// the demand of the integrated controller the vehicle goes by, the speed control counted /*faktycznie uzywana pozycja zintegrowanego sterowania jazda i hamowaniem*/
|
|
double const &EimicReal() const { return eimicReal; }
|
|
void SetEimicReal(double const Value) { eimicReal = Value; }
|
|
double eim_localbrake = 0; /*nastawa hamowania dodatkowego pneumatycznego lokomotywy*/
|
|
int EIMCtrlType = 0; /*rodzaj wariantu zadajnika jazdy*/
|
|
bool const &SpeedCtrlTypeTime() const { return speedCtrlTypeTime; } /*czy tempomat sterowany czasowo*/
|
|
int SpeedCtrlAutoTurnOffFlag = 0; /*czy tempomat sam się wyłącza*/
|
|
bool const &EIMCtrlEmergency() const { return eimCtrlEmergency; } /*czy ma dodatkowe zero jazdy i zero hamowania */
|
|
bool const &EIMCtrlMainEmergency() const { return eimCtrlMainEmergency; } /*czy zadajnik typu 2 (Elf) ma pozycje hamowania naglego ponizej swojej pozycji 0*/
|
|
double const &eimicSpeedCtrl() const { return eimicSpeedCtrlValue; } /*pozycja sugerowana przez tempomat*/
|
|
double const &NewSpeed() const { return newSpeed; } /*nowa predkosc do zadania*/
|
|
|
|
/*-zmienne dla drezyny*/
|
|
|
|
/*dla drezyny, silnika spalinowego i parowego*/
|
|
double const &eAngle() const { return eAngleValue; }
|
|
|
|
/*-dla wagonow*/
|
|
float const &LoadAmount() const { return loadAmount; } /*masa w T lub ilosc w sztukach - zaladowane*/
|
|
void SetLoadAmount(float const Value) { loadAmount = Value; }
|
|
load_attributes LoadType;
|
|
// the exchange of the load: +1 unloading, +2 loading, +4 finished, 0 the model of the load updated
|
|
int LoadStatus() const { return loadStatus; }
|
|
// a step of the exchange: so much taken out, or put in up to the capacity, and the mass with it
|
|
void UnloadStep(float Amount);
|
|
void LoadStep(float Amount);
|
|
void FinishLoadExchange() { loadStatus = 4; }
|
|
// the end of the exchange seen to, the model of the load updated
|
|
void AcknowledgeLoadExchange() { loadStatus &= 1 | 2; }
|
|
void SetLoadStatusForTest(int const Value) { loadStatus = Value; }
|
|
// the kind of the load changed, for the model of the load to follow; true once, until changed again
|
|
bool LoadTypeChange() const { return loadTypeChange; }
|
|
bool TakeLoadTypeChange()
|
|
{
|
|
auto const changed{loadTypeChange};
|
|
loadTypeChange = false;
|
|
return changed;
|
|
}
|
|
double LastLoadChangeTime = 0.0; // raz (roz)ładowania
|
|
#ifdef EU07_USEOLDDOORCODE
|
|
bool DoorBlocked = false; // Czy jest blokada drzwi
|
|
bool DoorLockEnabled{true};
|
|
bool DoorLeftOpened = false; // stan drzwi
|
|
double DoorLeftOpenTimer{-1.0}; // left door closing timer for automatic door type
|
|
bool DoorRightOpened = false;
|
|
double DoorRightOpenTimer{-1.0}; // right door closing timer for automatic door type
|
|
#endif
|
|
|
|
int DoubleTr = 1; // trakcja ukrotniona - przedni pojazd 'Winger 160304
|
|
basic_light CompartmentLights;
|
|
|
|
bool const &PhysicActivation() const { return physicActivation; }
|
|
// what the brake force (Fb) came from when the physics fell asleep (switch_physics()), for the test of ComputeTotalForce():
|
|
// asleep, a vehicle keeps the Fb and FStand of its last step, and a change of these wakes it
|
|
struct
|
|
{
|
|
double cylinder{0.0}; // BrakePress
|
|
double spring{0.0}; // brakes.spring.pressure
|
|
int manual{0}; // ManualBrakePos
|
|
double local{0.0}; // LocalBrakePosA
|
|
} sleep_brakes;
|
|
|
|
/*ABu: stale dla wyznaczania sil (i nie tylko) po optymalizacji*/
|
|
double TotalMassxg = 0.0; /*totalMass*g*/
|
|
|
|
// the lights switched on at each end (light::), from which the current they draw is counted
|
|
ByEnd<int> const &LitLights() const { return litLights; }
|
|
void SetLitLights(VehicleEnd const End, int const Lights) { litLights[End] = Lights; }
|
|
|
|
// Status nowszego hebelka od przyciemniania swiatel/swiatel dlugich
|
|
// 0 - swiatla wylaczone (opcja dziala tylko gdy w fiz zdefiniowano OffState w sekcji Switches; w przeciwnym wypadku pstryk startuje z wartoscia == 1
|
|
// 1 - swiatla normalne przyciemnione
|
|
// 2 - swiatla normalne
|
|
// 3 - swiatla dlugie przyciemnione
|
|
// 4 - swiatla dlugie normalne
|
|
|
|
struct dimPosition
|
|
{
|
|
bool isOff = false;
|
|
bool isDimmed = false;
|
|
bool isHighBeam = false;
|
|
};
|
|
|
|
// default positions
|
|
std::vector<dimPosition> dimPositions = {{false, false, false}, // 0 - Not dimmed
|
|
{false, true, false}}; // 1 - Dimmed
|
|
|
|
int const &DimmerPosition() const { return modernDimmerPosition; }
|
|
void SetDimmerPosition(int const Value) { modernDimmerPosition = Value; }
|
|
int modernDimmerDefaultPosition{0};
|
|
// bool modernContainOffPos{true};
|
|
bool const &enableModernDimmer() const { return enableModernDimmerValue; }
|
|
// the given dimmer position brought into the DimmerList, to its first or last entry; 0 for an empty list
|
|
int clampDimmerPosition(int Position) const;
|
|
// the entry of the current dimmer position, or a plain one (not off, not dimmed, no high beam) when the
|
|
// position is outside the DimmerList: the .fiz can give a short or an empty list, or a DefaultPos past its end
|
|
dimPosition currentDimPosition() const;
|
|
// moves the dimmer by Step positions within the DimmerList, around to its other end when it can cycle;
|
|
// a position outside the list is brought into it first. false when the dimmer doesn't move
|
|
bool stepDimmerPosition(int Step);
|
|
|
|
// Barwa reflektora
|
|
int refR{255}; // Czerwony
|
|
int refG{255}; // Zielony
|
|
int refB{255}; // Niebieski
|
|
|
|
double dimMultiplier{0.6f}; // mnoznik swiatel przyciemnionych
|
|
double normMultiplier{1.0f}; // mnoznik swiatel zwyklych
|
|
double highDimMultiplier{2.5f}; // mnoznik dlugich przyciemnionych
|
|
double highMultiplier{2.8f}; // mnoznik dlugich
|
|
|
|
|
|
int const &AIHintPantstate() const { return aiHintPantstate; } // suggested pantograph setup
|
|
// suggested pantograph setup in shunting (AI: ShuntPantstate=, eu07/maszyna#461), the bits as in Pantstate: 1 front,
|
|
// 2 rear, 3 both; 0 (the default) shunts with the pantographs handled as in train mode
|
|
int const &AIHintShuntPantstate() const { return aiHintShuntPantstate; }
|
|
bool AIHintPantUpIfIdle{true}; // whether raise both pantographs if idling for a while
|
|
double const &AIHintLocalBrakeAccFactor() const { return aiHintLocalBrakeAccFactor; } // suggested acceleration weight for local brake operation
|
|
|
|
Vehicle(double VelInitial, std::string const &TypeNameInit, std::string const &NameInit, int Cab);
|
|
// obsługa sprzęgów
|
|
static double CouplerDist(physics::Vehicle const *Left, physics::Vehicle const *Right);
|
|
static double Distance(const TLocation &Loc1, const TLocation &Loc2, const TDimension &Dim1, const TDimension &Dim2);
|
|
bool Attach(int ConnectNo, int ConnectToNr, physics::Vehicle *ConnectTo, CouplingSet CouplingType, bool Enforce = false, bool Audible = true);
|
|
int DettachStatus(int ConnectNo);
|
|
int DettachStatus(VehicleEnd const ConnectNo)
|
|
{
|
|
return DettachStatus(NumberOf(ConnectNo));
|
|
}
|
|
bool Dettach(int ConnectNo);
|
|
// the same by the ends, where they are known to be ends
|
|
bool Attach(VehicleEnd const ConnectNo, VehicleEnd const ConnectToNr, physics::Vehicle *ConnectTo, CouplingSet CouplingType, bool Enforce = false, bool Audible = true)
|
|
{
|
|
return Attach(NumberOf(ConnectNo), NumberOf(ConnectToNr), ConnectTo, CouplingType, Enforce, Audible);
|
|
}
|
|
bool Dettach(VehicleEnd const ConnectNo)
|
|
{
|
|
return Dettach(NumberOf(ConnectNo));
|
|
}
|
|
void damage_coupler(VehicleEnd const End);
|
|
// repairs the broken coupler of the end, and the one of the vehicle it was coupled with, so they can be coupled
|
|
// again; the vehicles clear their coupler damage once neither of their couplers is broken. returns: whether there
|
|
// was a broken coupler to repair
|
|
bool repair_coupler(VehicleEnd const End);
|
|
void Derail(DerailReason Reason);
|
|
// the velocity of the vehicles coupled to this one changes by the Change along the axis of this one [m/s], as the
|
|
// legacy derailment changes the velocity of this one (physics.collisions new)
|
|
void change_train_velocity(double Change);
|
|
// physics.derailment new: the criteria of derailment.h over the step, which travelled the Distance [m]; monitor: what
|
|
// they would do, to the log
|
|
void check_derailment(TTrackShape const &Shape, TTrackParam const &Track, double Distance);
|
|
// the vehicle leaves the rails, as the criteria of derailment.h found
|
|
void derail(derailment::verdict const &Verdict, derailment::vehicle_state const &Vehicle, derailment::track_state const &Track, std::string const *TrackName = nullptr);
|
|
// height of the centre of gravity above the rail with the load [m]
|
|
double centre_of_gravity() const;
|
|
// the vehicle is back on the rails (resetconsist, SetDamage taking VehicleDamage::derailed off): not derailed any more, and the
|
|
// criteria of derailment start from scratch, so a later derailment goes the way its model has it
|
|
void rerail();
|
|
// what resetconsist does to a vehicle: no damage of any kind, the alarm chain released, back on the rails
|
|
void repair_damage();
|
|
// how the vehicle left the rails by the criteria of derailment.h: upright, or on its side. none for any other
|
|
// derailment, which stops it as the legacy model does (with physics.collisions new by a friction of its weight, the
|
|
// forces of the vehicles coupled to it acting on it)
|
|
derailment::outcome const &Derailed() const { return derailOutcome; }
|
|
// physics.derailment new: how the vehicle left the rails, for the way it leaves the track (vehicle/derailmotion.h):
|
|
// what derailed it, the lateral acceleration of its body out of the curve then [m/s2] (negative into the curve, where a
|
|
// buckle bends the line the other way), and the side it was pulled off to by a coupling (1 the left of its front, -1
|
|
// the right; 0 the side the acceleration throws it to, from the track)
|
|
derail_motion::cause const &DerailCause() const { return derailCause; }
|
|
double const &DerailAcceleration() const { return derailAcceleration; }
|
|
int const &DerailSide() const { return derailSide; }
|
|
// the vehicle off the track, on the ground: begun and stepped by TDynamicObject, which knows the ground; its friction
|
|
// and the grade under it go into the forces of this one
|
|
derail_motion::body OffTrack;
|
|
// physics.derailment new: the vehicle derailed by the physical criteria, the end of the track or a collision has to
|
|
// leave the track and its motion on the ground isn't begun yet. never with physics.derailment monitor, old or off
|
|
bool leaves_track() const;
|
|
// physics.derailment new: a coupling of a vehicle off the track pulls this one off the rails sideways, to the Side
|
|
// (1 the left of its front, -1 the right), with the lateral acceleration [m/s2] of the pull on it
|
|
void pull_off(int Side, double Acceleration, std::string const &Why);
|
|
// physics.collisions new: what the vehicle is for the defaults of its crush and its buffers, the crush curve and the
|
|
// height of the buffers of an end, and how long the push of its ends held its wheels over the climbing limit
|
|
collision::vehicle_kind collision_kind() const;
|
|
collision::crush_curve crush_curve_at(VehicleEnd End) const;
|
|
double buffer_height_at(VehicleEnd End) const;
|
|
collision::pushed_monitor pushed_off_monitor;
|
|
// how the vehicle left the rails in a collision (physics.collisions new): overriding or pushed off, NONE otherwise
|
|
DerailReason const &CollisionDerail() const { return collisionDerail; }
|
|
// physics.collisions monitor: how many crushes the log told of, of the hits of this vehicle on the others
|
|
int const &crush_reports() const { return crushreportsValue; }
|
|
// physics.collisions new: the hit of the end on the stop of its buffers, harder than the steel takes, crushes the
|
|
// weaker end and may let one vehicle climb onto the other one, see collision.h. returns: whether it did, and the
|
|
// velocities took the hit; the legacy collision takes the rest. physics.collisions monitor: the log tells what the
|
|
// crush of the whole hit would be, once for a hit, nothing changes, and it returns false
|
|
bool crush_hit(VehicleEnd End, double dt);
|
|
// the force pressing the ends pushes the vehicle off the track (physics.collisions new), the step travelled the
|
|
// Distance [m]: the flange climbs while the wheels roll on
|
|
void check_pushed_off(double dt, double Distance);
|
|
// the vehicle leaves the rails in a collision, the reason told in the log, and slides on as the criteria of
|
|
// derailment.h have it
|
|
void derail_in_collision(DerailReason Reason, std::string const &Why);
|
|
bool DirectionForward();
|
|
bool DirectionBackward(void); /*! kierunek ruchu*/
|
|
bool EIMDirectionChangeAllow(void) const;
|
|
inline double IsVehicleEIMBrakingFactor() const
|
|
{
|
|
return brakes.electrodynamic.on && ResistorsFlag ? 0.0 : inductionMotor.state.lineCurrent < 0 ? -1.0 : 1.0;
|
|
}
|
|
void BrakeLevelSet(double b);
|
|
bool BrakeLevelAdd(double b);
|
|
bool IncBrakeLevel(); // wersja na użytek AI
|
|
bool DecBrakeLevel();
|
|
bool ChangeCab(int direction);
|
|
bool CurrentSwitch(bool const State);
|
|
bool IsMotorOverloadRelayHighThresholdOn() const;
|
|
void UpdateBatteryVoltage(double dt);
|
|
double BatteryDrain(double dt, bool converteractive) const;
|
|
double BatteryDrainCharged(double dt, bool converteractive) const;
|
|
double BatteryDrainLow(double dt, bool converteractive) const;
|
|
double BatteryDrainSwitchedOff(double dt) const;
|
|
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) const;
|
|
|
|
// Q *******************************************************************************************
|
|
double GetTrainsetVoltage(CouplingSet const couplings = Coupling::heating | Coupling::highVoltage) const;
|
|
double GetTrainsetHighVoltage() const;
|
|
// what turns the physics on, counted for the debug panel (Timer::switching_counter)
|
|
enum class wake_cause
|
|
{
|
|
other,
|
|
mainpipe, // air flowing in from a neighbour along the brake pipe
|
|
scndpipe, // along the main reservoir pipe
|
|
command,
|
|
speed, // the test of ComputeTotalForce(): the vehicle moves
|
|
acceleration, // accelerates
|
|
neighbour, // a neighbour moves or accelerates
|
|
rest // active cab, switching, ezt/dmu
|
|
};
|
|
bool switch_physics(bool const State, wake_cause const Cause = wake_cause::other);
|
|
// whether the vehicle accelerates, for the test which turns the physics off in vehicles standing still (ComputeTotalForce()).
|
|
// standing still, its acceleration is the pull of the slope and of the couplers, as the brakes and the resistance count only
|
|
// against a speed (FTotal); with Global.physics_sleepheld one held by them, the way ComputeMovement() keeps it standing, doesn't
|
|
bool accelerating() const;
|
|
// with Global.physics_sleepheld, wakes the physics of a vehicle a brake of which was set by hand: one held by its brakes sleeps
|
|
// with the brake force it had (accelerating())
|
|
void wake_for_brake();
|
|
// whether the brakes of a vehicle whose physics sleeps have changed since it fell asleep, see sleep_brakes
|
|
bool brakes_changed_asleep() const;
|
|
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(VehicleCommand const CtrlCommand, double const ctrlvalue, double const dir, CouplingSet const Couplertype = Coupling::control);
|
|
bool SetInternalCommand(VehicleCommand const NewCommand, double NewValue1, double NewValue2, CouplingSet const Couplertype = Coupling::control);
|
|
bool RunCommand(VehicleCommand const Command, double CValue1, double CValue2, CouplingSet const Couplertype = Coupling::control, std::string_view Argument = {});
|
|
// the parts of RunCommand(), by the area of the commands
|
|
bool RunControllerCommand(VehicleCommand const Command, double CValue1, double CValue2, CouplingSet Couplertype, bool &OK);
|
|
bool RunRelaysCommand(VehicleCommand const Command, double CValue1, double CValue2, CouplingSet Couplertype, bool &OK);
|
|
bool RunCabCommand(VehicleCommand const Command, double CValue1, double CValue2, CouplingSet Couplertype, bool &OK);
|
|
bool RunBrakeCommand(VehicleCommand const Command, double CValue1, double CValue2, CouplingSet Couplertype, bool &OK);
|
|
bool RunBrakeEquipmentCommand(VehicleCommand const Command, double CValue1, double CValue2, CouplingSet Couplertype, bool &OK);
|
|
bool RunAuxiliariesCommand(VehicleCommand const Command, double CValue1, double CValue2, CouplingSet Couplertype, bool &OK);
|
|
bool RunPumpsCommand(VehicleCommand const Command, double CValue1, double CValue2, CouplingSet Couplertype, bool &OK);
|
|
bool RunBlowersCommand(VehicleCommand const Command, double CValue1, double CValue2, CouplingSet Couplertype, bool &OK);
|
|
bool RunPowerCommand(VehicleCommand const Command, double CValue1, double CValue2, CouplingSet Couplertype, bool &OK);
|
|
bool RunDoorsCommand(VehicleCommand const Command, double CValue1, double CValue2, CouplingSet Couplertype, bool &OK);
|
|
void DoorPermitCommand(double CValue1, double CValue2);
|
|
void DoorRemoteCommand(bool Open, double CValue1, double CValue2);
|
|
bool RunLoadCommand(VehicleCommand const Command, double CValue1, double CValue2, std::string_view Argument, bool &OK);
|
|
bool RunInternalCommand();
|
|
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);
|
|
bool CabDeactivisationAuto(bool const Enforce = false);
|
|
|
|
/*! funkcje zwiekszajace/zmniejszajace nastawniki*/
|
|
/*! glowny nastawnik:*/
|
|
bool IncMainCtrl(int CtrlSpeed);
|
|
bool DecMainCtrl(int CtrlSpeed);
|
|
// the parts of IncMainCtrl() and DecMainCtrl() which depend on the kind of the engine
|
|
bool IncMainCtrlByEngine(int CtrlSpeed);
|
|
bool IncMainCtrlSeriesMotor(int CtrlSpeed);
|
|
bool DecMainCtrlByEngine(int CtrlSpeed);
|
|
bool DecMainCtrlSeriesMotor(int CtrlSpeed);
|
|
bool IsMainCtrlActualNoPowerPos() const; // whether the master controller is actually set to position which won't generate any extra power
|
|
bool IsMainCtrlNoPowerPos() const; // whether the master controller is set to position which won't generate any extra power
|
|
bool IsMainCtrlMaxPowerPos() const;
|
|
int MainCtrlNoPowerPos() const; // highest setting of master controller which won't cause engine to generate extra power
|
|
int MainCtrlActualPowerPos() const; // current actual setting of master controller, relative to the highest setting not generating extra power
|
|
int MainCtrlPowerPos() const; // current setting of master controller, relative to the highest setting not generating extra power
|
|
// positions the master controller of the EIMCtrlType 2 (Elf) has below its own position 0, the emergency brake (0 or 1)
|
|
int EIMCtrlEmergencyPositions() const;
|
|
// whether the master controller is in its emergency brake position (EIMCtrlType 2 with EIMCtrlMainEmergency)
|
|
bool IsMainCtrlEmergencyPos() const;
|
|
// the master controller position sent to the coupled vehicles ("MainCtrl"), the same with and without
|
|
// EIMCtrlMainEmergency: the Elf's positions without the emergency brake one, which goes as the full braking
|
|
int MainCtrlPosForCoupled() const;
|
|
// the master controller position of this vehicle for one received from a coupled vehicle ("MainCtrl")
|
|
int MainCtrlPosFromCoupled(int Position) const;
|
|
/*! pomocniczy nastawnik:*/
|
|
bool IncScndCtrl(int CtrlSpeed);
|
|
bool DecScndCtrl(int CtrlSpeed);
|
|
int GetVirtualScndPos() const;
|
|
// whether ScndCtrlResistiveLock keeps the shunt controller from being moved at the current master controller position
|
|
bool IsScndCtrlLockedByMainCtrl() const;
|
|
// ScndCtrlResistiveLock: the shunt controller drops to 0 once the master controller is at zero or on a resistive position, so it
|
|
// can't stay engaged there, locked in place (eu07/maszyna#402)
|
|
void ScndCtrlResistiveLockCheck();
|
|
// NOTE: with the cruise control, either end of the secondary controller, as before the split of the two (eu07/maszyna#69)
|
|
bool IsScndCtrlNoPowerPos() const;
|
|
bool IsScndCtrlMaxPowerPos() const;
|
|
|
|
bool AddPulseForce(int Multipler); /*dla drezyny*/
|
|
|
|
bool SandboxManual(bool const State, range_t const Notify = range_t::consist); /*wlacza/wylacza reczne sypanie piasku*/
|
|
bool SandboxAuto(bool const State, range_t const Notify = range_t::consist); /*wlacza/wylacza automatyczne sypanie piasku*/
|
|
bool Sandbox(bool const State, range_t const Notify = range_t::consist); /*wlacza/wylacza sypanie piasku*/
|
|
bool SandboxAutoAllow(bool const State); /*wlacza/wylacza zezwolenie na automatyczne sypanie piasku*/
|
|
|
|
/*! zbijanie czuwaka/SHP*/
|
|
void SecuritySystemReset(void);
|
|
void SecuritySystemCheck(double dt);
|
|
|
|
bool BatterySwitch(bool State, range_t const Notify = range_t::consist);
|
|
bool EpFuseSwitch(bool State);
|
|
bool SpringBrakeActivate(bool State);
|
|
bool SpringBrakeShutOff(bool State);
|
|
bool SpringBrakeRelease();
|
|
bool PulleeModeSwitch(bool const State);
|
|
|
|
/*! stopnie hamowania - hamulec zasadniczy*/
|
|
bool IncBrakeLevelOld(void);
|
|
bool DecBrakeLevelOld(void);
|
|
bool IncLocalBrakeLevel(float const CtrlSpeed);
|
|
bool DecLocalBrakeLevel(float const CtrlSpeed);
|
|
/*! ABu 010205: - skrajne polozenia ham. pomocniczego*/
|
|
bool IncManualBrakeLevel(int CtrlSpeed);
|
|
bool DecManualBrakeLevel(int CtrlSpeed);
|
|
/*! oddzielny nastawnik hamulca elektrodynamicznego (gdy SplitEDPneumaticBrake)*/
|
|
bool IncDynamicBrakeLevel(float const CtrlSpeed);
|
|
bool DecDynamicBrakeLevel(float const CtrlSpeed);
|
|
bool DynamicBrakeLevelSet(double Position);
|
|
double DynamicBrakeRatio(void) const;
|
|
bool DynamicBrakeAvailable(void) const; /*czy ED dostepny w aktualnym oknie predkosci Vh0..Vh1*/
|
|
bool DynamicBrakeSwitch(bool Switch);
|
|
bool RadiostopSwitch(bool Switch);
|
|
bool AlarmChainSwitch(bool const State);
|
|
bool AntiSlippingBrake(void);
|
|
bool BrakeReleaser(int state);
|
|
bool UniversalBrakeButton(int button, int state); /*uniwersalny przycisk hamulca*/
|
|
bool SwitchEPBrake(int state);
|
|
// whether the EP brake control of the cab has power: battery, the reverser out of neutral and the EP fuse on
|
|
bool EPBrakeControlPowered() const;
|
|
bool AntiSlippingButton(void); /*! reczny wlacznik urzadzen antyposlizgowych*/
|
|
|
|
/*funkcje dla ukladow pneumatycznych*/
|
|
bool IncBrakePress(double &brake, double PressLimit, double dp);
|
|
bool DecBrakePress(double &brake, double PressLimit, double dp);
|
|
bool BrakeDelaySwitch(int BDS); /*! przelaczanie nastawy opoznienia*/
|
|
bool IncBrakeMult(void); /*przelaczanie prozny/ladowny*/
|
|
bool DecBrakeMult(void);
|
|
/*pomocnicze funkcje dla ukladow pneumatycznych*/
|
|
void UpdateBrakePressure(double dt);
|
|
void UpdatePipePressure(double dt);
|
|
// the parts of UpdatePipePressure()
|
|
void UpdateLocalBrakeValve(double dt);
|
|
void UpdateMainValve(double dt);
|
|
double MainValveSupply();
|
|
double MainValveHandlePosition() const;
|
|
void UpdateEmergencyValve(double dt);
|
|
void UpdateDistributorSettings();
|
|
void UpdateEPBrake();
|
|
void CompressorCheck(double dt); /*wlacza, wylacza kompresor, laduje zbiornik*/
|
|
void UpdatePantVolume(double dt); // Ra
|
|
void PantPressureSwitchCheck();
|
|
void PantPressureSwitchTrip();
|
|
// what the air of the pantographs needs to know in the step
|
|
PantographAirSupply PantographAirSupplyNow() const;
|
|
void UpdateScndPipePressure(double dt);
|
|
void UpdateSpringBrake(double dt);
|
|
double GetDVc(double dt);
|
|
int PipeCouplersSubsteps(double dt) const;
|
|
double GetScndDVc(double dt);
|
|
int ScndPipeCouplersSubsteps(double dt) const;
|
|
// the air exchange through the brake and main reservoir hoses, after the vehicles stepped
|
|
static void UpdatePipeCouplers(std::vector<physics::Vehicle *> const &Vehicles, double dt);
|
|
|
|
/*funkcje obliczajace sily*/
|
|
void ComputeConstans(void); // ABu: wczesniejsze wyznaczenie stalych dla liczenia sil
|
|
void ComputeMass(void);
|
|
void ComputeTotalForce(double dt);
|
|
double Adhesive(double staticfriction) const;
|
|
double TractionForce(double dt);
|
|
// the parts of TractionForce(), in the order it makes them
|
|
double UpdateEngineRevolutions(double dt, double &dtrans, double &dmoment);
|
|
double DieselElectricTargetRevolutions();
|
|
void UpdateVentilators(double dt);
|
|
void UpdateResistorBlowers(double dt);
|
|
double UpdateEnginePower();
|
|
void VoltageRelaysCheck();
|
|
void DumbTractionForce(double PosRatio);
|
|
void WheelsDrivenTractionForce(double dt);
|
|
void SeriesMotorTractionForce(double dt);
|
|
void SeriesMotorDynamicBrake(double dt);
|
|
void DieselEngineTractionForce(double dt, double dmoment, double dtrans);
|
|
void DieselElectricTractionForce(double tmp);
|
|
void DieselElectricShuntForce(double tmpV, double &tmp);
|
|
double DieselElectricDigitalForce(double tmpV, double &tempUmax, double &tempImax);
|
|
double DieselElectricForce(double tmpV, double LinePower, double Ratio, double HyperbolaPower) const;
|
|
void DieselElectricShuntPower(double tmp);
|
|
void DieselElectricGenerator(double tmp, double tempUmax, double tempImax);
|
|
void ShuntFieldRelaysCheck(double tmpV, double PosRatio, double tmp);
|
|
void ShuntFieldRelaysType2(double tmp);
|
|
void ShuntFieldRelaysType41(double tmpV);
|
|
void ShuntFieldRelaysType45();
|
|
void ShuntFieldRelaysType46();
|
|
void ShuntFieldRelaysType46Up();
|
|
void ShuntFieldRelaysType46Down();
|
|
void InductionMotorTractionForce(double dt);
|
|
void InductionMotorSpeedControl(double dt);
|
|
void SpeedControlByTime(double dt);
|
|
void SpeedControlByPosition(double dt);
|
|
void InductionMotorBrakeBlending(double ActiveInverters, double &PosRatio, double &tmp);
|
|
void InductionMotorDynamicBrakeFlag();
|
|
double InductionMotorBrakeRatio(double ActiveInverters, double edBCP);
|
|
void InductionMotorDrive(double dt);
|
|
void InductionMotorForceLimits();
|
|
void UpdateInverterFrequency();
|
|
void InductionMotorOff();
|
|
// the dynamic brake of a diesel-electric vehicle: the effort following the demand, the force it gives at the speed
|
|
void update_dieselelectric_dynamic_brake(double dt);
|
|
double dieselelectric_dynamic_brake_demand() const; // 0..1, the effort the driver asks for
|
|
double dieselelectric_dynamic_brake_limit() const; // [N] the force at full effort at the speed
|
|
void apply_dieselelectric_dynamic_brake(double dt); // the force in place of the drive's one, over the step dt
|
|
double dieselelectric_motor_current(double Moment) const; // the current of the motors giving the moment
|
|
double FrictionForce() const;
|
|
double BrakeForceR(double ratio, double velocity) const;
|
|
double BrakeForceP(double press, double velocity) const;
|
|
double BrakeForce(const TTrackParam &Track);
|
|
double CouplerForce(VehicleEnd const End, double dt);
|
|
void CouplerStretchCheck(VehicleEnd End, double CF, double dt);
|
|
// whether the coupling at the end is computed by the physical model: couplerphysics set in eu07.ini, and this
|
|
// vehicle or the one at the end covered by it (CouplerPhysics), or every vehicle with couplerphysics all
|
|
bool coupler_physics_at(VehicleEnd const End) const;
|
|
// the force of the coupling at the end by the physical model (couplerphysics in eu07.ini), see couplerphysics.h
|
|
double coupler_force_physical(VehicleEnd const End, double const dt);
|
|
// how much the distance to the vehicle at the End grows [m, or m/s] when this vehicle moves (Own) and the other one
|
|
// moves (Other) along their axes: along a track the difference of the two moves; with either vehicle off the
|
|
// track (Neighbours[End].off_track) by the shares of them the ends have in the direction they are apart in
|
|
double coupler_gap_change(VehicleEnd const End, double const Own, double const Other) const;
|
|
// with the physical model: whether the vehicles at the end hit the stop of their springs at the last update and
|
|
// still close in on it, so that they collide; a hit hard enough breaks the coupling or crushes the buffers
|
|
bool coupler_stop_hit(VehicleEnd const End, physics::Vehicle &Other, VehicleEnd const OtherEnd);
|
|
// couples the automatic couplers of the end and of the other vehicle pressed against each other, unless the hit
|
|
// is too fast for them to catch
|
|
void automatic_coupling(VehicleEnd const End, physics::Vehicle &Other, VehicleEnd const OtherEnd);
|
|
void CollisionDetect(VehicleEnd const End, double const dt);
|
|
// closing speed of a collision [km/h] above which the vehicles involved may derail, adjusted for their mass ratio
|
|
static constexpr double SafeCollisionVelocity{15.0};
|
|
// closing speed [km/h] of the End of this vehicle and the OtherEnd of the other vehicle it touches, along the coupler
|
|
// axis: the sum of the speeds in a head-on collision, the difference in a rear-end one, negative when they part
|
|
double CollisionVelocity(VehicleEnd const End, physics::Vehicle const &Other, VehicleEnd const OtherEnd) const;
|
|
// velocity [m/s] of this vehicle relative to the other vehicle it touches with its End and the OtherEnd of the
|
|
// other one, along this vehicle's axis
|
|
double CouplerVelocityDifference(VehicleEnd const End, physics::Vehicle const &Other, VehicleEnd const OtherEnd) const;
|
|
// whether the automatic couplers at the End of this vehicle and the OtherEnd of the other one can catch each other on
|
|
// contact, rather than the vehicles colliding (with crash damage enabled, only at a closing speed which doesn't derail them)
|
|
bool AutomaticCouplingSafe(VehicleEnd const End, physics::Vehicle const &Other, VehicleEnd const OtherEnd) const;
|
|
// whether the control coupling (multiple-unit control) can join the End of this vehicle and the OtherEnd of the other
|
|
// one: not between an electric and a diesel traction vehicle, unless both couplers name the same control system
|
|
// (ControlType). Vehicles without own traction (cars, control trailers) take any. Global.control_coupling_engine_check
|
|
// off allows it always (eu07/maszyna#520)
|
|
bool ControlCouplingAllowed(VehicleEnd const End, physics::Vehicle const &Other, VehicleEnd const OtherEnd) const;
|
|
// the CouplingType to join the End of this vehicle and the OtherEnd of the other one with, without the control coupling
|
|
// when ControlCouplingAllowed() rules it out. a permanent coupling (of the vehicles of one unit) is kept whole
|
|
CouplingSet CompatibleCoupling(VehicleEnd const End, physics::Vehicle const &Other, VehicleEnd const OtherEnd, CouplingSet const CouplingType) const;
|
|
// the horns of the Signal (warningSignal bits) which have the air or the voltage they need to sound
|
|
int SoundingHorns(int const Signal) const;
|
|
// whether the signal lamps of the main circuit (line contactors, ground relay, motor overload relays) can light:
|
|
// the pressure switch, when fitted, cuts the start off and puts them out, otherwise they go out once the brakes are applied
|
|
bool MainCircuitLampsEnabled() const
|
|
{
|
|
return false == protection.PressureSwitchTripped() && (protection.config.hasPressureSwitch || brakes.cylinderPressure < 1.0);
|
|
}
|
|
// whether an emergency brake application holds the line breaker open: the brake pipe below the pressure taken for one
|
|
// (EmergencyBrakeMainOffPressure) while the master controller is on a power position
|
|
bool EmergencyBrakeHoldsMainOff() const
|
|
{
|
|
return lineBreaker.config.emergencyOffPressure > 0.0 && brakePipe.Pressure() < lineBreaker.config.emergencyOffPressure && false == IsMainCtrlNoPowerPos();
|
|
}
|
|
// whether the lamp of the open line contactors is lit. on the electric locomotives it tells the start can be made, so
|
|
// it goes out with the start cut off; on the diesel-electric ones (the SU45 and SU46 family) it just tells the
|
|
// contactors are open, whatever opened them: the master controller at 0, or the pressure switch (eu07/maszyna#263)
|
|
bool LineContactorsLampLit() const
|
|
{
|
|
if (EngineType == TEngineType::DieselElectric)
|
|
{
|
|
return false == lineContactors.IsClosed();
|
|
}
|
|
return false == lineContactors.IsClosed() && MainCircuitLampsEnabled();
|
|
}
|
|
// the vehicles the line breaker / engine start switch of this vehicle works, and its engine stopping on its own
|
|
// stops: the whole consist, or with JointEngineStart=No this vehicle alone (eu07/maszyna#80)
|
|
range_t MainSwitchRange() const
|
|
{
|
|
return lineBreaker.config.jointStart ? range_t::consist : range_t::local;
|
|
}
|
|
// whether the pneumatic louvres of the motor fans are still closed, the main reservoir short of the pressure that opens them
|
|
bool LouvresClosed() const
|
|
{
|
|
return air.MainReservoirPressure() < LouvresOpenPressure;
|
|
}
|
|
// whether the devices the line contactors are interlocked with (LineContactorsInterlock) let them close
|
|
bool LineContactorsInterlockReleased() const;
|
|
// whether the line contactors wait for the converter of the vehicle, switched off with its local switch (converterlocal_sw).
|
|
// the AI driver doesn't leave it so: the converters of the other vehicles running, it would wait for the contactors forever
|
|
bool LineContactorsHeldByLocalConverterSwitch() const
|
|
{
|
|
return lineContactors.config.interlock == line_contactors_interlock::converter && false == converter.LocalSwitchOn();
|
|
}
|
|
// whether the vehicle has a driver's cab: it has the driver's brake valve (BrakeHandle in the Cntrl. section of the
|
|
// .fiz), which the wagons and most cars of the units without a cab don't (a few copy the Cntrl. section of the cab
|
|
// car, as the EN57 s car does). it's the vehicle type's, unlike the cab the scenario puts a driver in
|
|
bool HasDriverCab() const
|
|
{
|
|
return brakes.config.driverValveType != TBrakeHandle::NoHandle;
|
|
}
|
|
// whether the cab command opening the main circuit opens it where the only cab switch of the circuit is the button
|
|
// closing it: on a diesel that's the starter button, and the command is the one way to stop an engine whose fuel pump
|
|
// starts on its own (eu07/maszyna#427). the other vehicles with such a button keep ignoring the command
|
|
bool MainCircuitOpensWithStarterOnly() const
|
|
{
|
|
return EngineType == TEngineType::DieselEngine || EngineType == TEngineType::DieselElectric;
|
|
}
|
|
// whether the pumps a joint oil and fuel pump switch works, those not started automatically, are all switched on
|
|
bool OilFuelPumpsEnabled() const
|
|
{
|
|
auto const fuelmanual{FuelPump.start_type != start_t::automatic};
|
|
auto const oilmanual{OilPump.start_type != start_t::automatic};
|
|
return (fuelmanual || oilmanual) && (false == fuelmanual || FuelPump.is_enabled) && (false == oilmanual || OilPump.is_enabled);
|
|
}
|
|
// whether the radio is switched on, its power supply isn't cut off and it has the low voltage to work
|
|
bool RadioPowered() const
|
|
{
|
|
return radio && radioFuse && (lowVoltage.Is24vAvailable() || lowVoltage.Is110vAvailable());
|
|
}
|
|
/*obrot kol uwzgledniajacy poslizg*/
|
|
double ComputeRotatingWheel(double WForce, double dt, double n) const;
|
|
|
|
/*--funkcje dla lokomotyw*/
|
|
bool WaterPumpBreakerSwitch(bool State, range_t const Notify = range_t::consist); // water pump breaker state toggle
|
|
bool WaterPumpSwitch(bool State, range_t const Notify = range_t::consist); // water pump state toggle
|
|
bool WaterPumpSwitchOff(bool State, range_t const Notify = range_t::consist); // water pump state toggle
|
|
bool WaterHeaterBreakerSwitch(bool State, range_t const Notify = range_t::consist); // water heater breaker state toggle
|
|
bool WaterHeaterSwitch(bool State, range_t const Notify = range_t::consist); // water heater state toggle
|
|
bool WaterCircuitsLinkSwitch(bool State, range_t const Notify = range_t::consist); // water circuits link state toggle
|
|
bool FuelPumpSwitch(bool State, range_t const Notify = range_t::consist); // fuel pump state toggle
|
|
bool FuelPumpSwitchOff(bool State, range_t const Notify = range_t::consist); // fuel pump state toggle
|
|
bool OilPumpSwitch(bool State, range_t const Notify = range_t::consist); // oil pump state toggle
|
|
bool OilPumpSwitchOff(bool State, range_t const Notify = range_t::consist); // oil pump state toggle
|
|
bool MotorBlowersSwitch(bool State, VehicleEnd const Side, range_t const Notify = range_t::consist); // traction motor fan state toggle
|
|
bool MotorBlowersSwitchOff(bool State, VehicleEnd const Side, range_t const Notify = range_t::consist); // traction motor fan state toggle
|
|
bool CompartmentLightsSwitch(bool State, range_t const Notify = range_t::consist); // compartment lights state toggle
|
|
bool CompartmentLightsSwitchOff(bool State, range_t const Notify = range_t::consist); // compartment lights state toggle
|
|
bool MainSwitch(bool const State, range_t const Notify = range_t::consist); /*! wylacznik glowny*/
|
|
void MainSwitch_(bool const State);
|
|
bool MainSwitchCheck() const; // checks conditions for closing the line breaker
|
|
bool ConverterSwitch(bool State, range_t const Notify = range_t::consist); /*! wl/wyl przetwornicy*/
|
|
bool CompressorSwitch(bool State, range_t const Notify = range_t::consist); /*! wl/wyl sprezarki*/
|
|
bool ChangeCompressorPreset(int const Change, range_t const Notify = range_t::consist);
|
|
bool HeatingSwitch(bool const State, range_t const Notify = range_t::consist);
|
|
void HeatingSwitch_(bool const State);
|
|
double EnginePowerSourceVoltage() const; // returns voltage of defined main engine power source
|
|
bool TractionModeSwitch(traction_mode const Mode, range_t const Notify = range_t::consist); // traction selector of a dual-mode vehicle
|
|
bool GensetSwitch(bool const State, range_t const Notify = range_t::consist); // genset start/stop request
|
|
double TractionSourceVoltage() const; // of the vehicle's own source the traction selector picks: the pantographs' or the genset's
|
|
double TractionSupplyVoltage() const; // what the traction circuit gets: the own source's, or the train's high voltage line's
|
|
double TractionSupplyMinVoltage() const; // below it the line breaker opens (undervoltage)
|
|
double GensetTractionPowerLimit() const; // [kW] at the wheels, the largest double unless running on the genset
|
|
double CatenaryCurrent() const; // [A] what the vehicle draws through its pantographs, if they touch the wire
|
|
// whether the main circuit feeds what runs on it (the converter, a compressor, the heating, the motor and resistor
|
|
// blowers, the traction motors): the line breaker closed, and where it closes ahead of the pantographs and holds
|
|
// without traction voltage (PantographsRequireMains) also the voltage there, at least the one the undervoltage
|
|
// trip takes. everywhere else it's the same as Mains
|
|
bool MainCircuitPowered() const;
|
|
|
|
/*-funkcje typowe dla lokomotywy elektrycznej*/
|
|
void LowVoltagePowerCheck(double const Deltatime);
|
|
void MainsCheck(double const Deltatime);
|
|
void PowerCouplersCheck(double const Deltatime, Coupling const kind);
|
|
// the parts of PowerCouplersCheck()
|
|
double LocalPowerVoltage(Coupling kind);
|
|
void PowerCouplersVoltage(Coupling kind, double abslocalvoltage, bool localpowersource);
|
|
void PowerCouplersCurrent(Coupling kind, bool localpowersource);
|
|
double *PowerCircuitCurrent(Coupling kind);
|
|
void ConverterCheck(double const Timestep); // przetwornica
|
|
void HeatingCheck(double const Timestep);
|
|
void WaterPumpCheck(double const Timestep);
|
|
void WaterHeaterCheck(double const Timestep);
|
|
void FuelPumpCheck(double const Timestep);
|
|
void OilPumpCheck(double const Timestep);
|
|
void MotorBlowersCheck(double const Timestep);
|
|
// whether the circuit a traction motor blower runs off has power: the battery, the converter or the main circuit, by its start type
|
|
bool MotorBlowerPowerIsAvailable(cooling_fan const &Blower) const;
|
|
void PantographsCheck(double const Timestep);
|
|
void GensetCheck(double const Deltatime);
|
|
void LightsCheck(double const Timestep);
|
|
bool FuseOn(range_t const Notify = range_t::consist); // bezpiecznik nadamiary
|
|
bool FuseFlagCheck(void) const; // sprawdzanie flagi nadmiarowego
|
|
void FuseOff(void); // wylaczenie nadmiarowego
|
|
// the faults of the equipment the scenery or the network sets: each sets its fault, or clears it where it was set
|
|
void SetEquipmentFaults(EquipmentFaultSet Faults);
|
|
// the stabiliser of the brake pipe set to the pressure the pipe has, as a driver taking over a cab finds it
|
|
void ResetPipeStabiliser()
|
|
{
|
|
brakes.pipeLimiterPressure = brakePipe.Pressure();
|
|
actFlowSpeed = 0;
|
|
}
|
|
// the spring brake released by hand, without the command to the other vehicles (SpringBrakeActivate())
|
|
void ReleaseSpringBrake() { brakes.spring.activate = false; }
|
|
// the mode of the brake (bom_*: PS/PN/EP/MED) set at the selector
|
|
void SetBrakeOperatingMode(int const Mode) { brakes.operatingMode = Mode; }
|
|
// the brake cut out or put back by the player, which the AI's wagon inspector no longer puts back on its own
|
|
void ClaimBrakeCutOut() { brakes.cutOutByInspector = false; }
|
|
// the pressure of the brake pipe of the consist, as the driver's vehicle measures it
|
|
void SetEquivalentPipePressure(double const Pressure) { brakes.equivalentPipePressure = Pressure; }
|
|
// the inverters of an induction motor drive, switched in and out from the cab
|
|
bool InverterActivated(std::size_t const Index) const { return inductionMotor.inverters[Index].Activate; }
|
|
void SwitchInverter(std::size_t const Index, bool const State) { inductionMotor.inverters[Index].Activate = State; }
|
|
// the distance run, kept between the sessions, and whether a cab shows it
|
|
void SetOdometer(odometer::reading const &Reading) { Odometer = Reading; }
|
|
void ShowOdometer() { Odometer.shown = true; }
|
|
bool UniversalResetButton(int const Button, range_t const Notify = range_t::consist);
|
|
bool RelayReset(int const Relays, range_t const Notify = range_t::consist); // resets specified relays
|
|
// the drive of the kind of engine of the vehicle (physics/components/drive.h)
|
|
TractionDrive const &Drive() const;
|
|
double ShowCurrent(int AmpN) const; // pokazuje bezwgl. wartosc pradu na wybranym amperomierzu
|
|
double ShowCurrentP(int AmpN) const; // pokazuje bezwgl. wartosc pradu w wybranym pojezdzie //Q 20160722
|
|
|
|
/*!o pokazuje bezwgl. wartosc obrotow na obrotomierzu jednego z 3 pojazdow*/
|
|
/*function ShowEngineRotation(VehN:int): integer; //Ra 2014-06: przeniesione do C++*/
|
|
/*funkcje uzalezniajace sile pociagowa od predkosci: v2n, n2r, current, momentum*/
|
|
double v2n(void);
|
|
double Current(double n, double U);
|
|
// the parts of Current()
|
|
void UpdateSeriesMotorDynamicBrakeFlag();
|
|
double SeriesMotorCurrent(double n, double U, double R, double Mn) const;
|
|
double SeriesMotorDrivingCurrent(double n, double U, double Rz, double Mn, int SP) const;
|
|
void MotorFailuresCheck(double n);
|
|
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*/
|
|
bool MaxCurrentSwitch(bool State, range_t const Notify = range_t::consist); // przelacznik pradu wysokiego rozruchu
|
|
bool MinCurrentSwitch(bool State); // przelacznik pradu automatycznego rozruchu
|
|
bool AutoRelaySwitch(bool State); // przelacznik automatycznego rozruchu
|
|
bool AutoRelayCheck(); // symulacja automatycznego rozruchu
|
|
// the parts of AutoRelayCheck()
|
|
bool AutoRelayShuntStep(bool ARFASI2);
|
|
bool AutoRelayMainStep(bool ARFASI);
|
|
bool AutoRelayMainUp(bool ARFASI);
|
|
bool AutoRelayMainNotchUp();
|
|
bool AutoRelayMainDown();
|
|
bool AutoRelayLineContactorsStep(bool motorconnectorsoff);
|
|
bool CamshaftRunDown();
|
|
bool CamshaftRunDownEMU();
|
|
bool MotorConnectorsCheck();
|
|
bool ResistorsFlagCheck(void) const; // sprawdzenie kontrolki oporow rozruchowych NBMX
|
|
|
|
bool OperatePantographsValve(operation_t const State, range_t const Notify = range_t::consist);
|
|
bool OperatePantographValve(VehicleEnd const End, operation_t const State, range_t const Notify = range_t::consist);
|
|
bool DropAllPantographs(bool const State, range_t const Notify = range_t::consist);
|
|
|
|
void CheckEIMIC(double dt); // sprawdzenie i zmiana nastawy zintegrowanego nastawnika jazdy/hamowania
|
|
// the parts of CheckEIMIC(), by the kind of the controller
|
|
void EIMICFromController(double brakeDemand, double offset, double multiplier);
|
|
void EIMICFromSteps(double dt);
|
|
void EIMICFromFourPositions(double dt);
|
|
void EIMICFromUniversalController(double dt, double brakeDemand);
|
|
void UniversalControllerTrainBrake();
|
|
void EIMICTraxxLocalBrake(double dt);
|
|
void EIMICLimit();
|
|
// whether the holding brake (brakes.holding) lets go at the power demand (eimic, above 0 when power is demanded) of this step of
|
|
// Dt seconds: once the demand has stayed above 0 for brakes.holding.releaseDelay. a demand of 0 or less starts the count again
|
|
bool UpdateStopBrakeRelease(double Demand, double Dt);
|
|
void CheckSpeedCtrl(double dt);
|
|
void SpeedCtrlRegulator(double dt, double accfactor);
|
|
// whether the cruise control has a switch of its own: the secondary controller doubles as its switch unless it
|
|
// shunts the field of the traction motors already, or there's none (the 6Dg, the ST45; eu07/maszyna#69)
|
|
bool IsSpeedCtrlSeparate() const;
|
|
// whether the cruise control is switched on: by its own switch, or by the secondary controller off its zero position
|
|
bool IsSpeedCtrlEngaged() const;
|
|
// the driver's switch of the cruise control: on, to hold the speed of the moment, or off. its own switch, or the
|
|
// secondary controller doubling as one (first position on, back to zero off); returns whether it did anything
|
|
bool SpeedCtrlSwitch(bool State);
|
|
void SpeedCtrlButton(int button);
|
|
void SpeedCtrlInc();
|
|
void SpeedCtrlDec();
|
|
bool SpeedCtrlPowerInc();
|
|
bool SpeedCtrlPowerDec();
|
|
|
|
/*-funkcje typowe dla lokomotywy spalinowej z przekladnia mechaniczna*/
|
|
bool dizel_EngageSwitch(double state);
|
|
bool dizel_EngageChange(double dt);
|
|
bool dizel_AutoGearCheck(void);
|
|
bool dizel_GearShiftCheck(double VelUp, double VelDown);
|
|
bool dizel_GearShiftRequest(double VelUp, double VelDown);
|
|
void dizel_ClutchCheck();
|
|
void dizel_ClutchByController();
|
|
void dizel_ClutchByIntegratedController();
|
|
double dizel_fillcheck(int mcp, double dt);
|
|
double dizel_DigitalFill(double dt);
|
|
double dizel_GovernorFill(int mcp, double realfill) const;
|
|
double dizel_GovernorRevolutions(int mcp, double &realfill) const;
|
|
double dizel_Momentum(double Fill, double n, double dt);
|
|
void hydro_TCFillCheck(double dt);
|
|
void hydro_TCTorque();
|
|
double dizel_MomentumRetarder(double n, double dt); // moment hamowania retardera
|
|
void dizel_HeatSet(float const Value);
|
|
void dizel_Heat(double const dt);
|
|
bool dizel_StartupCheck();
|
|
bool dizel_Update(double dt);
|
|
|
|
/* funckje dla wagonow*/
|
|
bool AssignLoad(std::string const &Name, float const Amount = 0.f);
|
|
bool LoadingDone(double LSpeed, std::string_view Loadname);
|
|
bool PermitDoors(VehicleSide const Door, bool const State = true, range_t const Notify = range_t::consist);
|
|
void PermitDoors_(VehicleSide const Door, bool const State = true);
|
|
bool ChangeDoorPermitPreset(int const Change, range_t const Notify = range_t::consist);
|
|
bool PermitDoorStep(bool const State, range_t const Notify = range_t::consist);
|
|
bool ChangeDoorControlMode(bool const State, range_t const Notify = range_t::consist);
|
|
bool OperateDoors(VehicleSide const Door, bool const State, range_t const Notify = range_t::consist);
|
|
bool LockDoors(bool const State, range_t const Notify = range_t::consist);
|
|
bool signal_departure(bool const State, range_t const Notify = range_t::consist); // toggles departure warning
|
|
void update_doors(double const Deltatime); // door controller update
|
|
door_closure_t door_closure() const; // state of the door closure signalling of this vehicle
|
|
// whether the door closure lamp in the cab of this vehicle is lit: with DoorClosureSignal, for the given state of the
|
|
// consist; without it, for the lock of the vehicle's own doors, as the lamp always worked
|
|
bool door_closure_lamp_lit(door_closure_t const Consist, bool const BlinkLit) const;
|
|
// whether the doors have the voltage they work on
|
|
bool doors_powered() const;
|
|
|
|
/* funkcje dla samochodow*/
|
|
bool ChangeOffsetH(double DeltaOffset);
|
|
|
|
/*funkcje ladujace pliki opisujace pojazd*/
|
|
bool LoadFIZ(std::string const &chkpath); // Q 20160717 bool LoadChkFile(std::string chkpath);
|
|
bool LoadFIZ_Text(std::string const &Text); // the same, from text in the .fiz format
|
|
bool CheckLocomotiveParameters(bool ReadyFlag, int Dir);
|
|
// the parts of CheckLocomotiveParameters()
|
|
void CreateBrakeValve();
|
|
void CreateBrakeHandles();
|
|
void CreateBrakePipes();
|
|
double InitialScndPipePress(double HosePressure) const;
|
|
void SetReadyToDepart();
|
|
void SetBraked();
|
|
std::string EngineDescription(int what) const;
|
|
// the cab interior light the light preset at given position (1-based, as lightsPos) sets, if it sets one
|
|
std::optional<lights_preset_cablight> LightsPresetCabLight(int Position) const;
|
|
|
|
private:
|
|
// the state and the definition no code outside the vehicle uses
|
|
double eimicReal = 0;
|
|
std::string chkPath;
|
|
TPowerParameters SystemPowerSource; /*zrodlo mocy dla systemow sterowania/przetwornic/sprezarek*/
|
|
TPowerParameters AlterHeatPowerSource; /*alternatywne zrodlo mocy dla ogrzewania*/
|
|
TPowerParameters LightPowerSource; /*zrodlo mocy dla oswietlenia*/
|
|
TPowerParameters AlterLightPowerSource; /*alternatywne mocy dla oswietlenia*/
|
|
// height of the centre of gravity of the empty vehicle above the rail [m] (CoGH in the Dimensions of the .fiz),
|
|
// negative when the definition gives none: derailment::default_centre_of_gravity() then
|
|
double CentreOfGravity = -1.0;
|
|
int UniversalResetButtonFlag[3] = {0, 0, 0}; // customizable reset buttons assignments
|
|
int LightsDefPos = 1;
|
|
int ScndInMain{0}; /*zaleznosc bocznika od nastawnika*/
|
|
int UniCtrlListSize = 0; /*wielkosc listy pozycji uniwersalnego nastawnika*/
|
|
bool UniCtrlIntegratedBrakePNCtrl = false; /*zintegrowany nastawnik JH obsluguje hamulec PN*/
|
|
int UniCtrlNoPowerPos{0}; // cached highesr position not generating traction force
|
|
double u = 0.0; // wspolczynnik tarcia yB wywalic!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
int FastSerialCircuit = 0; /*0 - po kolei zamyka styczniki az do osiagniecia szeregowej, 1 - natychmiastowe wejscie na szeregowa*/ /*hunter-111012*/
|
|
double TUHEX_Sum = 750; /*nastawa sterownika hamowania ED - aktualna*/
|
|
double TUHEX_Diff = 10; /*histereza działania sterownika hamowania ED*/
|
|
double TUHEX_MinIw = 60; /*minimalny prąd wzbudzenia przy hamowaniu ED - wynika z chk silnika*/
|
|
double TUHEX_MaxIw = 400; /*maksymalny prąd wzbudzenia przy hamowaniu ED - ograniczenie max siły*/
|
|
double TUHEX_Sum1 = 750; /*nastawa1 sterownika hamowania ED*/
|
|
double TUHEX_Sum2 = 750; /*nastawa2 sterownika hamowania ED*/
|
|
double TUHEX_Sum3 = 750; /*nastawa3 sterownika hamowania ED*/
|
|
int TUHEX_Stages = 0; /*liczba stopni hamowania ED*/
|
|
// TODO: wrap resistor fans variables and state into a device
|
|
int RVentType = 0; /*0 - brak, 1 - jest, 2 - automatycznie wlaczany*/
|
|
double RVentCutOff = 0.0; /*rezystancja wylaczania wentylatorow dla RVentType=2*/
|
|
double RVentMinI{50.0}; // przy jakim pradzie sie wylaczaja}
|
|
bool Trafo = false; /*pojazd wyposażony w transformator*/
|
|
double engagedownspeed = 0.9;
|
|
double engageupspeed = 0.5;
|
|
bool AnalogCtrl = false; //
|
|
bool AnMainCtrl = false; //
|
|
bool Flat = false;
|
|
double Vhyp = 1.0;
|
|
TFFSchemeTable FFlist;
|
|
int FFListSize = 0;
|
|
TFFSchemeTable FFEDlist;
|
|
int FFEDListSize = 0;
|
|
int WiperDefaultPos{0};
|
|
int modernWpierListSize;
|
|
TMPTRelayTable MPTRelay;
|
|
TShuntSchemeTable SST;
|
|
double PowerCorRatio = 1.0; // Wspolczynnik korekcyjny
|
|
double Ftmax = 0.0;
|
|
double SpeedCtrlButtons[10]{30, 40, 50, 60, 70, 80, 90, 100, 110, 120}; /*przyciski prędkości*/
|
|
double SpeedCtrlDelay = 2; /*opoznienie dzialania tempomatu z wybieralna predkoscia*/
|
|
TRotation Rot{0.0, 0.0, 0.0};
|
|
glm::vec3 Front{};
|
|
double nrot_eps = 0.0; // przyspieszenie kątowe kół (bez kierunku)
|
|
double dL = 0.0;
|
|
double FTrain = 0.0;
|
|
double FTotal = 0.0; /*! calkowita sila dzialajaca na pojazd*/
|
|
double Ntotal = 0.0; /*!s siła nacisku klockow*/
|
|
bool TUHEX_ResChange = false; /*czy zmiana rezystancji hamowania ED - odwzbudzanie*/
|
|
bool ReleaserEnabledOnlyAtNoPowerPos{false};
|
|
TTractionParam RunningTraction; /*parametry sieci trakcyjnej najblizej lokomotywy*/
|
|
double Mw = 0.0;
|
|
// sily napedne
|
|
double Fw = 0.0;
|
|
bool s_CAtestebrake = false; // hunter-091012: zmienna dla testu ca
|
|
double eimic_step_progress{0.0}; // the part of the next UniCtrlValStep the controller has covered so far
|
|
bool EIMCtrlAdditionalZeros = false; /*czy ma dodatkowe zero jazdy i zero hamowania */
|
|
double SpeedCtrlTimer = 0; /*zegar dzialania tempomatu z wybieralna predkoscia*/
|
|
double eimicSpeedCtrlIntegral = 0; /*calkowany blad ustawienia predkosci*/
|
|
double PulseForce = 0.0; /*przylozona sila*/
|
|
double PulseForceTimer = 0.0;
|
|
int PulseForceCount = 0;
|
|
std::string LoadQuantity; // jednostki miary
|
|
double FrictConst1 = 0.0;
|
|
double FrictConst2s = 0.0;
|
|
double FrictConst2d = 0.0;
|
|
int iProblem = 0; // flagi problemów z taborem, aby AI nie musiało porównywać; 0=może jechać
|
|
bool modernDimmerCanCycle{false};
|
|
plc::basic_controller m_plc;
|
|
// what the vehicle works out or is defined with, which the rest of the simulator only reads
|
|
double vmax = -1.0;
|
|
train_type trainType{train_type::generic};
|
|
double totalMass = 0.0;
|
|
double ft = 0.0;
|
|
int scndCtrlPosNo = 0;
|
|
bool slippingWheels = false;
|
|
int nAxles = 0;
|
|
bool speedCtrl = false;
|
|
double nrotValue = 0.0;
|
|
double aDist = 0.0;
|
|
bool sandDose = false;
|
|
float wheelDiameter = 1.f;
|
|
DerailReason collisionDerail{NONE};
|
|
bool autoRelayFlag = false;
|
|
double bDist = 0.0;
|
|
bool physicActivation = true;
|
|
bool waterCircuitsLink{false};
|
|
bool enableModernDimmerValue{false};
|
|
double mred = 0.0;
|
|
bool delayCtrlFlag = false;
|
|
int crushreportsValue{0};
|
|
bool epFuse = true;
|
|
int imaxHi = 0;
|
|
double initialCtrlDelay = 0.0;
|
|
double accSVBased{};
|
|
derail_motion::cause derailCause{derail_motion::cause::off_rails};
|
|
int nPoweredAxles = 0;
|
|
bool motorOverloadRelayHighThreshold{false};
|
|
int doorsPermitLightBlinking{0};
|
|
int mainCtrlMaxDirChangePos{0};
|
|
double derailAcceleration{0.0};
|
|
int derailmentreportsValue = 0;
|
|
bool cabMaster = false;
|
|
bool pulleeMode{false};
|
|
int imin = 0;
|
|
bool speedCtrlTypeTime = false;
|
|
bool eimCtrlEmergency = false;
|
|
double eimicSpeedCtrlValue = 1;
|
|
double newSpeed = 0;
|
|
int aiHintPantstate{0};
|
|
double uniCtrlValStep{0.0};
|
|
int imaxLo = 0;
|
|
int autoRelayType = 0;
|
|
bool fieldShuntSwitch = false;
|
|
int aiFlag{0};
|
|
bool eimCtrlMainEmergency = false;
|
|
double eAngleValue = M_PI * 0.5;
|
|
int aiHintShuntPantstate{0};
|
|
double aiHintLocalBrakeAccFactor{1.05};
|
|
int derailSide{0};
|
|
horn_supply hornSupply{horn_supply::air};
|
|
bool uniCtrlIntegratedLocalBrakeCtrl = false;
|
|
double windingRes = 0.0;
|
|
// what the vehicle works out or is defined with, which the rest of the simulator only reads
|
|
double brakingForce = 0.0;
|
|
derailment::outcome derailOutcome{derailment::outcome::none};
|
|
bool departureSignalOn = false;
|
|
double emptyMass = 0.0;
|
|
traction_mode tractionModeSetting{traction_mode::catenary};
|
|
double motorMoment = 0.0;
|
|
// the switches and the controllers the cab, the AI and the scenery change only through the operations above
|
|
double travelSpeed = 0.0;
|
|
TLocation location{0.0, 0.0, 0.0};
|
|
double offsetTrackH = 0.0;
|
|
double offsetTrackV = 0.0;
|
|
double accS = 0.0;
|
|
double accN = 0.0;
|
|
double accVert = 0.0;
|
|
double distCounter = 0.0;
|
|
double moveLength = 0.0;
|
|
double wheelFlat = 0.0;
|
|
bool truckHunting{true};
|
|
double derailmentDistance = 0.0;
|
|
bool insideConsist = false;
|
|
bool couplerPhysics{false};
|
|
bool inactiveCabPantsCheck = false;
|
|
double eimicAnalog = 0;
|
|
double actFlowSpeed = 0.0;
|
|
float maxLoad = 0.f;
|
|
bool eventFlag = false;
|
|
int soundFlag = 0;
|
|
float loadAmount = 0.f;
|
|
int loadStatus = 0;
|
|
bool loadTypeChange{false};
|
|
ByEnd<int> litLights;
|
|
bool signalling = false;
|
|
bool radio = false;
|
|
bool radioFuse = true;
|
|
int wiperSwitchPos = 0;
|
|
bool rventForceOn{false};
|
|
double anPos = 0.0;
|
|
bool mirrorForbidden{false};
|
|
bool radioStopFlag = false;
|
|
int mainCtrlPos = 0;
|
|
int scndCtrlPos = 0;
|
|
int lightsPos = 0;
|
|
int cabOccupied = 0;
|
|
int warningSignal = 0;
|
|
int modernDimmerPosition{0};
|
|
|
|
bool LoadFIZ_Parse(cParser &Parser); // reads the definition from either of the above
|
|
// the parts of LoadFIZ_Parse(), for a line of the definition
|
|
bool LoadFIZ_TableEnd(std::string const &inputline) const;
|
|
bool LoadFIZ_Section(std::string const &inputline, std::map<std::string, std::string, std::less<>> &fizlines);
|
|
bool LoadFIZ_TableSection(std::string const &inputline, std::map<std::string, std::string, std::less<>> &fizlines);
|
|
void LoadFIZ_TableRow(std::string const &inputline);
|
|
void LoadFIZ_Param(std::string const &line);
|
|
void LoadFIZ_Load(std::string const &line);
|
|
void LoadFIZ_Dimensions(std::string const &line);
|
|
void LoadFIZ_Wheels(std::string const &line);
|
|
void LoadFIZ_Brake(std::string const &line);
|
|
void LoadFIZ_Doors(std::string const &line);
|
|
void LoadFIZ_BuffCoupl(std::string const &line, int const Index);
|
|
void LoadFIZ_TurboPos(std::string const &line);
|
|
void LoadFIZ_Cntrl(std::string const &line);
|
|
void LoadFIZ_CntrlBrakes(std::string const &line);
|
|
void LoadFIZ_CntrlTrainBrake(std::string const &line);
|
|
void LoadFIZ_CntrlAntiSlipBrake(std::string_view asb);
|
|
void LoadFIZ_CntrlControllers(std::string const &line);
|
|
void LoadFIZ_CntrlStarts(std::string const &line);
|
|
void LoadFIZ_Blending(std::string const &line);
|
|
void LoadFIZ_DCEMUED(std::string const &line);
|
|
void LoadFIZ_SpringBrake(std::string const &line);
|
|
void LoadFIZ_Light(std::string const &line);
|
|
void LoadFIZ_Headlights(std::string const &Line);
|
|
void LoadFIZ_Clima(std::string const &line);
|
|
void LoadFIZ_Power(std::string const &Line);
|
|
void LoadFIZ_Genset(std::string const &Line);
|
|
void LoadFIZ_SpeedControl(std::string const &Line);
|
|
void LoadFIZ_Engine(std::string const &Input);
|
|
void LoadFIZ_EngineDiesel(std::string const &Input);
|
|
void LoadFIZ_EngineDieselElectric(std::string const &Input);
|
|
void LoadFIZ_EngineInductionMotor(std::string const &Input);
|
|
void LoadFIZ_EngineDieselShared(std::string const &Input);
|
|
void LoadFIZ_Switches(std::string const &Input);
|
|
void LoadFIZ_MotorParamTable(std::string const &Input);
|
|
void LoadFIZ_Circuit(std::string const &Input);
|
|
void LoadFIZ_AI(std::string const &Input);
|
|
void LoadFIZ_RList(std::string const &Input);
|
|
void LoadFIZ_UCList(std::string const &Input);
|
|
void LoadFIZ_DieselElectricDynamicBrake(std::string const &Input);
|
|
void LoadFIZ_DList(std::string const &Input);
|
|
void LoadFIZ_FFList(std::string const &Input);
|
|
void LoadFIZ_FFEDList(std::string const &Input);
|
|
void LoadFIZ_WiperList(std::string const &Input);
|
|
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) 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);
|
|
bool readMPTDieselElectric(std::string const &line);
|
|
bool readMPTDieselEngine(std::string const &line);
|
|
bool readBPT(/*int const ln,*/ std::string const &line); // Q 20160721
|
|
bool readRList(std::string const &Input);
|
|
bool readUCList(std::string const &Input);
|
|
bool readDList(std::string const &line);
|
|
bool readDMList(std::string const &line);
|
|
bool readV2NMAXList(std::string const &line);
|
|
bool readHTCList(std::string const &line);
|
|
bool readPmaxList(std::string const &line);
|
|
bool readFFList(std::string const &line);
|
|
bool readFFEDList(std::string const &line);
|
|
bool readWWList(std::string const &line);
|
|
bool readWiperList(std::string const &line);
|
|
bool readDimmerList(std::string const &line);
|
|
bool readLightsList(std::string const &Input);
|
|
bool readCompressorList(std::string const &Input);
|
|
void BrakeValveDecode(std::string const &s); // Q 20160719
|
|
void BrakeSubsystemDecode(); // Q 20160719
|
|
};
|
|
|
|
} // namespace physics
|
|
|
|
// double Distance(TLocation Loc1, TLocation Loc2, TDimension Dim1, TDimension Dim2);
|
|
|
|
namespace simulation
|
|
{
|
|
|
|
using weights_table = std::unordered_map<std::string, float>;
|
|
|
|
extern weights_table Weights;
|
|
|
|
} // namespace simulation
|