16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-23 00:29:19 +02:00

mergi with tmj

This commit is contained in:
Królik Uszasty
2020-10-09 21:11:25 +02:00
378 changed files with 53682 additions and 8658 deletions

View File

@@ -12,6 +12,7 @@ http://mozilla.org/MPL/2.0/.
//Q: 20160805 - odlaczenie pliku fizyki .pas od kompilacji
#include <map>
#include "hamulce.h"
#include "ladderlogic.h"
/*
MaSzyna EU07 locomotive simulator
Copyright (C) 2001-2004 Maciej Czapkiewicz and others
@@ -121,12 +122,12 @@ static int const dtrain_axle = 64;
static int const dtrain_out = 128; /*wykolejenie*/
/*wagi prawdopodobienstwa dla funkcji FuzzyLogic*/
#define p_elengproblem (1.000000E-02)
#define p_elengdamage (1.000000E-01)
#define p_coupldmg (2.000000E-02)
#define p_derail (1.000000E-03)
#define p_accn (1.000000E-01)
#define p_slippdmg (1.000000E-03)
#define p_elengproblem (1e-02)
#define p_elengdamage (1e-01)
#define p_coupldmg (2e-03)
#define p_derail (1e-03)
#define p_accn (1e-01)
#define p_slippdmg (1e-03)
/*typ sprzegu*/
static int const ctrain_virtual = 0; //gdy pojazdy na tym samym torze się widzą wzajemnie
@@ -160,7 +161,10 @@ enum coupling {
mainhose = 0x20,
heating = 0x40,
permanent = 0x80,
uic = 0x100
power24v = 0x100,
power110v = 0x200,
power3x400v = 0x400,
// uic = 0x1000,
};
// possible effect ranges for control commands; exclusive
enum class range_t {
@@ -168,23 +172,38 @@ enum class range_t {
unit,
consist
};
// possible settings of enable/disable input pair; exclusive
enum class operation_t {
none = 0,
enable,
disable,
enable_on,
enable_off,
disable_on,
disable_off,
};
// start method for devices; exclusive
enum class start_t {
disabled,
manual,
automatic,
manualwithautofallback,
converter,
battery
battery,
direction
};
// recognized vehicle light locations and types; can be combined
enum light {
headlight_left = 0x01,
redmarker_left = 0x02,
headlight_upper = 0x04,
headlight_right = 0x10,
redmarker_right = 0x20,
rearendsignals = 0x40
headlight_left = ( 1 << 0 ),
redmarker_left = ( 1 << 1 ),
headlight_upper = ( 1 << 2 ),
// TBD, TODO: redmarker_upper support?
headlight_right = ( 1 << 4 ),
redmarker_right = ( 1 << 5 ),
rearendsignals = ( 1 << 6 ),
auxiliary_left = ( 1 << 7 ),
auxiliary_right = ( 1 << 8 ),
};
// door operation methods; exclusive
@@ -230,7 +249,21 @@ enum sound {
attachmainhose = 1 << 10,
attachcontrol = 1 << 11,
attachgangway = 1 << 12,
attachheating = 1 << 13
attachheating = 1 << 13,
attachadapter = 1 << 14,
removeadapter = 1 << 15,
};
// customizable reset button
enum relay_t {
maincircuitground = 1 << 0,
auxiliarycircuitground = 1 << 1,
tractionnmotoroverload = 1 << 2,
primaryconverteroverload = 1 << 3,
secondaryconverteroverload = 1 << 4,
ventillatoroverload = 1 << 5,
heatingoverload = 1 << 6,
electrodynamicbrakesoverload = 1 << 7,
};
//szczególne typy pojazdów (inna obsługa) dla zmiennej TrainType
@@ -260,6 +293,7 @@ static int const eimc_f_Uzh = 8;
static int const eimc_f_DU = 9;
static int const eimc_f_I0 = 10;
static int const eimc_f_cfu = 11;
static int const eimc_f_cfuH = 12;
static int const eimc_p_F0 = 13;
static int const eimc_p_a1 = 14;
static int const eimc_p_Pmax = 15;
@@ -308,28 +342,26 @@ enum TProblem // lista problemów taboru, które uniemożliwiają jazdę
enum TCompressorList // lista parametrów w programatorze sprężarek
{ // pozycje kolejne
cl_Allow = 0, // zezwolenie na pracę sprężarek
cl_SpeedFactor = 1, // mnożnik wydajności
cl_MinFactor = 2, // mnożnik progu załącznika ciśnieniowego
cl_MaxFactor = 3 // mnożnik progu wyłącznika ciśnieniowego
cl_Allow = 0, // zezwolenie na pracę sprężarek
cl_SpeedFactor = 1, // mnożnik wydajności
cl_MinFactor = 2, // mnożnik progu załącznika ciśnieniowego
cl_MaxFactor = 3 // mnożnik progu wyłącznika ciśnieniowego
};
/*ogolne*/
/*lokacja*/
struct TLocation
{
double X;
double Y;
double Z;
};
/*rotacja*/
struct TRotation
{
double Rx;
double Ry;
double Rz;
};
/*wymiary*/
struct TDimension
{
double W = 0.0;
@@ -611,7 +643,7 @@ struct TUniversalCtrl
int NextPosFastInc = 0; /*nastepna duza pozycja przy przechodzeniu szybkim*/
int PrevPosFastDec = 0; /*poprzednia duza pozycja przy przechodzeniu szybkim*/
};
typedef TUniversalCtrl TUniversalCtrlTable[UniversalCtrlArraySize + 1]; /*tablica sterowania uniwersalnego nastawnika*/
using TUniversalCtrlTable = std::array< TUniversalCtrl, UniversalCtrlArraySize + 1>;
struct TSecuritySystem
{
@@ -630,6 +662,7 @@ struct TSecuritySystem
int VelocityAllowed;
int NextVelocityAllowed; /*predkosc pokazywana przez sygnalizacje kabinowa*/
bool RadioStop; // czy jest RadioStop
bool PoweredUp { false }; // helper, for detection of power state change
inline bool is_beeping() const {
return TestFlag( Status, s_SHPalarm );
@@ -663,8 +696,12 @@ struct TCoupling {
double FmaxC = 1000.0;
double beta = 0.0;
TCouplerType CouplerType = TCouplerType::NoCoupler; /*typ sprzegu*/
int AllowedFlag = 3; //Ra: maska dostępnych
int AutomaticCouplingFlag = coupling::coupler;
int AllowedFlag = ( coupling::coupler | coupling::brakehose ); //Ra: maska dostępnych
int PowerFlag = ( coupling::power110v | coupling::power24v );
int PowerCoupling = coupling::permanent; // type of coupling required for power transfer
/*zmienne*/
bool AutomaticCouplingAllowed { true }; // whether automatic coupling can be currently performed
int CouplingFlag = 0; /*0 - wirtualnie, 1 - sprzegi, 2 - pneumatycznie, 4 - sterowanie, 8 - kabel mocy*/
class TMoverParameters *Connected = nullptr; /*co jest podlaczone*/
int ConnectedNr = 0; //Ra: od której strony podłączony do (Connected): 0=przód, 1=tył
@@ -672,12 +709,28 @@ struct TCoupling {
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
// 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_low; // TODO: implement this
power_coupling power_110v;
power_coupling power_24v;
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 const
type() const {
return (
adapter_type == TCouplerType::NoCoupler ?
CouplerType :
adapter_type ); }
};
struct neighbour_data {
@@ -712,6 +765,8 @@ struct speed_control {
double FactorIpos = 0.0;
double FactorIneg = 0.0;
double BrakeInterventionVel = 30.0;
double PowerUpSpeed = 1000;
double PowerDownSpeed = 1000;
};
class TMoverParameters
@@ -746,6 +801,13 @@ private:
bool is_active { false }; // device is working
};
struct basic_light : public basic_device {
// config
float dimming { 1.0f }; // light strength multiplier
// ld outputs
float intensity { 0.0f }; // current light strength
};
struct cooling_fan : public basic_device {
// config
float speed { 0.f }; // cooling fan rpm; either fraction of parent rpm, or absolute value if negative
@@ -778,6 +840,23 @@ private:
bool breaker { true }; // device is allowed to operate
};
// basic approximation of a solenoid valve
struct basic_valve : basic_device {
// config
bool solenoid { true }; // requires electric power to operate
bool spring { true }; // spring return or double acting actuator
};
// basic approximation of a pantograph
struct basic_pantograph {
// ld inputs
basic_valve valve; // associated pneumatic valve
// ld outputs
bool is_active { false }; // device is working
bool sound_event { false }; // indicates last state which generated sound event
double voltage { 0.0 };
};
// basic approximation of doors
struct basic_door {
// config
@@ -822,6 +901,7 @@ private:
bool auto_include_remote { false }; // automatic door closure applies also to remote control
bool permit_needed { false };
std::vector<int> permit_presets; // permit presets selectable with preset switch
float voltage { 0.f }; // power type required for door movement
// ld inputs
bool lock_enabled { true };
bool step_enabled { true };
@@ -951,6 +1031,7 @@ public:
double LightPower = 0.0; /*moc pobierana na ogrzewanie/oswietlenie*/
double BatteryVoltage = 0.0; /*Winger - baterie w elektrykach*/
bool Battery = false; /*Czy sa zalavzone baterie*/
start_t BatteryStart = start_t::manual;
bool EpFuse = true; /*Czy sa zalavzone baterie*/
bool Signalling = false; /*Czy jest zalaczona sygnalizacja hamowania ostatniego wagonu*/
bool Radio = true; /*Czy jest zalaczony radiotelefon*/
@@ -991,16 +1072,19 @@ public:
TBrakePressure BrakePressureActual; //wartości ważone dla aktualnej pozycji kranu
int ASBType = 0; /*0: brak hamulca przeciwposlizgowego, 1: reczny, 2: automat*/
int UniversalBrakeButtonFlag[3] = { 0, 0, 0 }; /* mozliwe działania przycisków hamulcowych */
int UniversalResetButtonFlag[3] = { 0, 0, 0 }; // customizable reset buttons assignments
int TurboTest = 0;
double MaxBrakeForce = 0.0; /*maksymalna sila nacisku hamulca*/
double MaxBrakePress[5]; //pomocniczy, proz, sred, lad, pp
double P2FTrans = 0.0;
double TrackBrakeForce = 0.0; /*sila nacisku hamulca szynowego*/
int BrakeMethod = 0; /*flaga rodzaju hamulca*/
bool Handle_AutomaticOverload = false;
bool Handle_ManualOverload = false;
bool Handle_AutomaticOverload = false; //automatyczna asymilacja na pozycji napelniania
bool Handle_ManualOverload = false; //reczna asymilacja na guzik
double Handle_GenericDoubleParameter1 = 0.0;
double Handle_GenericDoubleParameter2 = 0.0;
double Handle_OverloadMaxPressure = 1.0; //maksymalne zwiekszenie cisnienia przy asymilacji
double Handle_OverloadPressureDecrease = 0.002; //predkosc spadku cisnienia przy asymilacji
/*max. cisnienie w cyl. ham., stala proporcjonalnosci p-K*/
double HighPipePress = 0.0;
double LowPipePress = 0.0;
@@ -1053,12 +1137,15 @@ public:
int ScndInMain{ 0 }; /*zaleznosc bocznika od nastawnika*/
bool MBrake = false; /*Czy jest hamulec reczny*/
double StopBrakeDecc = 0.0;
bool ReleaseParkingBySpringBrake { false };
TSecuritySystem SecuritySystem;
int EmergencyBrakeWarningSignal{ 0 }; // combined with basic WarningSignal when manual emergency brake is active
TUniversalCtrlTable UniCtrlList; /*lista pozycji uniwersalnego nastawnika*/
int UniCtrlListSize = 0; /*wielkosc listy pozycji uniwersalnego nastawnika*/
bool UniCtrlIntegratedBrakePNCtrl = false; /*zintegrowany nastawnik JH obsluguje hamulec PN*/
bool UniCtrlIntegratedBrakeCtrl = false; /*zintegrowany nastawnik JH obsluguje hamowanie*/
bool UniCtrlIntegratedLocalBrakeCtrl = false; /*zintegrowany nastawnik JH obsluguje hamowanie hamulcem pomocniczym*/
int UniCtrlNoPowerPos{ 0 }; // cached highesr position not generating traction force
/*-sekcja parametrow dla lokomotywy elektrycznej*/
TSchemeTable RList; /*lista rezystorow rozruchowych i polaczen silnikow, dla dizla: napelnienia*/
@@ -1084,8 +1171,7 @@ public:
int FastSerialCircuit = 0;/*0 - po kolei zamyka styczniki az do osiagniecia szeregowej, 1 - natychmiastowe wejscie na szeregowa*/ /*hunter-111012*/
int AutoRelayType = 0; /*0 -brak, 1 - jest, 2 - opcja*/
bool CoupledCtrl = false; /*czy mainctrl i scndctrl sa sprzezone*/
//CouplerNr: TCouplerNr; {ABu: nr sprzegu podlaczonego w drugim obiekcie}
bool IsCoupled = false; /*czy jest sprzezony ale jedzie z tylu*/
bool HasCamshaft { false };
int DynamicBrakeType = 0; /*patrz dbrake_**/
int DynamicBrakeAmpmeters = 2; /*liczba amperomierzy przy hamowaniu ED*/
double DynamicBrakeRes = 5.8; /*rezystancja oporników przy hamowaniu ED*/
@@ -1190,6 +1276,7 @@ public:
bool MED_EPVC = 0; // czy korekcja sily hamowania EP, gdy nie ma dostepnego ED
double MED_EPVC_Time = 7; // czas korekcji sily hamowania EP, gdy nie ma dostepnego ED
bool MED_Ncor = 0; // czy korekcja sily hamowania z uwzglednieniem nacisku
double MED_MinBrakeReqED = 0;
int DCEMUED_CC { 0 }; //na którym sprzęgu sprawdzać działanie ED
double DCEMUED_EP_max_Vel{ 0.0 }; //maksymalna prędkość, przy której działa EP przy włączonym ED w jednostce (dla tocznych)
@@ -1238,8 +1325,11 @@ public:
std::string Name; /*nazwa wlasna*/
TCoupling Couplers[2]; //urzadzenia zderzno-sprzegowe, polaczenia miedzy wagonami
std::array<neighbour_data, 2> Neighbours; // potential collision sources
bool EventFlag = false; /*!o true jesli cos nietypowego sie wydarzy*/
bool Power110vIsAvailable = false; // cached availability of 110v power
bool Power24vIsAvailable = false; // cached availability of 110v power
bool EventFlag = false; /*!o true jesli cos nietypowego sie wydarzy*/
int SoundFlag = 0; /*!o patrz stale sound_ */
int AIFlag{ 0 }; // HACK: events of interest for consist owner
double DistCounter = 0.0; /*! licznik kilometrow */
double V = 0.0; //predkosc w [m/s] względem sprzęgów (dodania gdy jedzie w stronę 0)
double Vel = 0.0; //moduł prędkości w [km/h], używany przez AI
@@ -1264,7 +1354,11 @@ public:
bool SandDoseAutoAllow = true; /*zezwolenie na automatyczne piaskowanie*/
double Sand = 0.0; /*ilosc piasku*/
double BrakeSlippingTimer = 0.0; /*pomocnicza zmienna do wylaczania przeciwposlizgu*/
double dpBrake = 0.0; double dpPipe = 0.0; double dpMainValve = 0.0; double dpLocalValve = 0.0;
double dpBrake = 0.0;
double dpPipe = 0.0;
double dpMainValve = 0.0;
double dpLocalValve = 0.0;
double EmergencyValveFlow = 0.0; // air flow through alerter valve during last simulation step
/*! przyrosty cisnienia w kroku czasowym*/
double ScndPipePress = 0.0; /*cisnienie w przewodzie zasilajacym*/
double BrakePress = 0.0; /*!o cisnienie w cylindrach hamulcowych*/
@@ -1281,8 +1375,14 @@ public:
bool CompressorAllow = false; /*! zezwolenie na uruchomienie sprezarki NBMX*/
bool CompressorAllowLocal{ true }; // local device state override (most units don't have this fitted so it's set to true not to intefere)
bool CompressorGovernorLock{ false }; // indicates whether compressor pressure switch was activated due to reaching cut-out pressure
bool CompressorTankValve{ false }; // indicates excessive pressure is vented from compressor tank directly and instantly
start_t CompressorStart{ start_t::manual }; // whether the compressor is started manually, or another way
start_t PantographCompressorStart{ start_t::manual };
basic_valve PantsValve;
std::array<basic_pantograph, 2> Pantographs;
bool PantAllDown { false };
double PantFrontVolt = 0.0; //pantograf pod napieciem? 'Winger 160404
double PantRearVolt = 0.0;
// TODO converter parameters, for when we start cleaning up mover parameters
start_t ConverterStart{ start_t::manual }; // whether converter is started manually, or by other means
float ConverterStartDelay{ 0.0f }; // delay (in seconds) before the converter is started, once its activation conditions are met
@@ -1290,6 +1390,8 @@ public:
bool ConverterAllow = false; /*zezwolenie na prace przetwornicy NBMX*/
bool ConverterAllowLocal{ true }; // local device state override (most units don't have this fitted so it's set to true not to intefere)
bool ConverterFlag = false; /*! czy wlaczona przetwornica NBMX*/
start_t ConverterOverloadRelayStart { start_t::manual }; // whether overload relay reset responds to dedicated button
bool ConverterOverloadRelayOffWhenMainIsOff { false };
fuel_pump FuelPump;
oil_pump OilPump;
water_pump WaterPump;
@@ -1348,13 +1450,17 @@ public:
bool Mains = false; /*polozenie glownego wylacznika*/
double MainsInitTime{ 0.0 }; // config, initialization time (in seconds) of the main circuit after it receives power, before it can be closed
double MainsInitTimeCountdown{ 0.0 }; // current state of main circuit initialization, remaining time (in seconds) until it's ready
bool LineBreakerClosesOnlyAtNoPowerPos{ false };
bool ControlPressureSwitch{ false }; // activates if the main pipe and/or brake cylinder pressure aren't within operational levels
bool HasControlPressureSwitch{ true };
bool ReleaserEnabledOnlyAtNoPowerPos{ false };
int MainCtrlPos = 0; /*polozenie glownego nastawnika*/
int ScndCtrlPos = 0; /*polozenie dodatkowego nastawnika*/
int LightsPos = 0; /*polozenie przelacznika wielopozycyjnego swiatel*/
int CompressorListPos = 0; /*polozenie przelacznika wielopozycyjnego sprezarek*/
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 MaxMainCtrlPosNoDirChange { 0 }; // can't change reverser state with master controller set above this position
int MainCtrlMaxDirChangePos { 0 }; // 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 CabOccupied = 0; //numer kabiny, w ktorej jest obsada (zwykle jedna na skład) // TODO: move to TController
double LastSwitchingTime = 0.0; /*czas ostatniego przelaczania czegos*/
@@ -1390,11 +1496,12 @@ public:
bool AutoRelayFlag = false; /*mozna zmieniac jesli AutoRelayType=2*/
bool FuseFlag = false; /*!o bezpiecznik nadmiarowy*/
bool ConvOvldFlag = false; /*! nadmiarowy przetwornicy i ogrzewania*/
bool GroundRelay { true }; // switches off to protect against damage from earths
start_t GroundRelayStart { start_t::manual }; // relay activation method
bool StLinFlag = false; /*!o styczniki liniowe*/
bool StLinSwitchOff{ false }; // state of the button forcing motor connectors open
bool ResistorsFlag = false; /*!o jazda rezystorowa*/
double RventRot = 0.0; /*!s obroty wentylatorow rozruchowych*/
bool UnBrake = false; /*w EZT - nacisniete odhamowywanie*/
double PantographVoltage{ 0.0 }; // voltage supplied to pantographs
double PantPress = 0.0; /*Cisnienie w zbiornikach pantografow*/
bool PantPressSwitchActive{ false }; // state of the pantograph pressure switch. gets primed at defined pressure level in pantograph air system
@@ -1402,6 +1509,7 @@ public:
bool NoVoltRelay{ true }; // switches off if the power level drops below threshold
bool OvervoltageRelay{ true }; // switches off if the power level goes above threshold
bool s_CAtestebrake = false; //hunter-091012: zmienna dla testu ca
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 lokomotywy spalinowej z przekladnia mechaniczna*/
double dizel_fill = 0.0; /*napelnienie*/
@@ -1445,7 +1553,7 @@ public:
double eimv[21];
static std::vector<std::string> const eimv_labels;
double SpeedCtrlTimer = 0; /*zegar dzialania tempomatu z wybieralna predkoscia*/
double eimicSpeedCtrl = 0; /*pozycja sugerowana przez tempomat*/
double eimicSpeedCtrl = 1; /*pozycja sugerowana przez tempomat*/
double eimicSpeedCtrlIntegral = 0; /*calkowany blad ustawienia predkosci*/
double NewSpeed = 0; /*nowa predkosc do zadania*/
double MED_EPVC_CurrentTime = 0; /*aktualny czas licznika czasu korekcji siły EP*/
@@ -1463,6 +1571,7 @@ public:
load_attributes LoadType;
std::string LoadQuantity; // jednostki miary
int LoadStatus = 0; //+1=trwa rozladunek,+2=trwa zaladunek,+4=zakończono,0=zaktualizowany model
bool LoadTypeChange{ false }; // indicates load type was changed
double LastLoadChangeTime = 0.0; //raz (roz)ładowania
#ifdef EU07_USEOLDDOORCODE
bool DoorBlocked = false; //Czy jest blokada drzwi
@@ -1472,12 +1581,6 @@ public:
bool DoorRightOpened = false;
double DoorRightOpenTimer{ -1.0 }; // right door closing timer for automatic door type
#endif
bool PantFrontUp = false; //stan patykow 'Winger 160204
bool PantRearUp = false;
bool PantFrontSP = true; //dzwiek patykow 'Winger 010304
bool PantRearSP = true;
double PantFrontVolt = 0.0; //pantograf pod napieciem? 'Winger 160404
double PantRearVolt = 0.0;
// TODO: move these switch types where they belong, cabin definition
std::string PantSwitchType;
std::string ConvSwitchType;
@@ -1486,6 +1589,7 @@ public:
bool Heating = false; //ogrzewanie 'Winger 020304
bool HeatingAllow { false }; // heating switch // TODO: wrap heating in a basic device
int DoubleTr = 1; //trakcja ukrotniona - przedni pojazd 'Winger 160304
basic_light CompartmentLights;
bool PhysicActivation = true;
@@ -1495,24 +1599,36 @@ public:
double FrictConst2d= 0.0;
double TotalMassxg = 0.0; /*TotalMass*g*/
double fBrakeCtrlPos = -2.0; // płynna nastawa hamulca zespolonego
double fBrakeCtrlPos = -2.0; // płynna nastawa hamulca zespolonego
bool bPantKurek3 = true; // kurek trójdrogowy (pantografu): true=połączenie z ZG, false=połączenie z małą sprężarką // domyślnie zbiornik pantografu połączony jest ze zbiornikiem głównym
bool PantAutoValve { false }; // type of installed pantograph compressor valve
int iProblem = 0; // flagi problemów z taborem, aby AI nie musiało porównywać; 0=może jechać
int iLights[2]; // bity zapalonych świateł tutaj, żeby dało się liczyć pobór prądu
plc::basic_controller m_plc;
int AIHintPantstate{ 0 }; // suggested pantograph setup
bool AIHintPantUpIfIdle{ true }; // whether raise both pantographs if idling for a while
double AIHintLocalBrakeAccFactor{ 1.05 }; // suggested acceleration weight for local brake operation
public:
TMoverParameters(double VelInitial, std::string TypeNameInit, std::string NameInit, int Cab);
// obsługa sprzęgów
static double CouplerDist( TMoverParameters const *Left, TMoverParameters const *Right );
static double Distance(const TLocation &Loc1, const TLocation &Loc2, const TDimension &Dim1, const TDimension &Dim2);
bool Attach(int ConnectNo, int ConnectToNr, TMoverParameters *ConnectTo, int CouplingType, bool Forced = false, bool Audible = true);
bool Attach(int ConnectNo, int ConnectToNr, TMoverParameters *ConnectTo, int CouplingType, bool Enforce = false, bool Audible = true);
int DettachStatus(int ConnectNo);
bool Dettach(int ConnectNo);
void damage_coupler( int const End );
void derail( int const Reason );
bool DirectionForward();
bool DirectionBackward( void );/*! kierunek ruchu*/
bool EIMDirectionChangeAllow( void ) const;
inline double IsVehicleEIMBrakingFactor() {
return (
( DynamicBrakeFlag && ResistorsFlag ) ? 0.0 :
eimv[ eimv_Ipoj ] < 0 ? -1.0 :
1.0 ); }
void BrakeLevelSet(double b);
bool BrakeLevelAdd(double b);
bool IncBrakeLevel(); // wersja na użytek AI
@@ -1527,31 +1643,35 @@ public:
// Q *******************************************************************************************
double GetTrainsetVoltage( int const Coupling = ( coupling::heating | coupling::highvoltage ) ) const;
double GetAnyTrainsetVoltage() const;
double GetTrainsetHighVoltage() const;
bool switch_physics(bool const State);
double LocalBrakeRatio(void);
double ManualBrakeRatio(void);
double PipeRatio(void);/*ile napelniac*/
double RealPipeRatio(void);/*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 SendCtrlBroadcast(std::string CtrlCommand, double ctrlvalue);
bool SendCtrlToNext(std::string const CtrlCommand, double const ctrlvalue, double const dir, int const Couplertype = ctrain_controll);
bool SetInternalCommand( std::string NewCommand, double NewValue1, double NewValue2, int const Couplertype = ctrain_controll );
bool SendCtrlToNext(std::string const CtrlCommand, double const ctrlvalue, double const dir, int const Couplertype = coupling::control );
bool SetInternalCommand( std::string NewCommand, double NewValue1, double NewValue2, int const Couplertype = coupling::control );
double GetExternalCommand(std::string &Command);
bool RunCommand( std::string Command, double CValue1, double CValue2, int const Couplertype = ctrain_controll );
bool RunCommand( std::string Command, double CValue1, double CValue2, int const Couplertype = coupling::control );
bool RunInternalCommand();
void PutCommand(std::string NewCommand, double NewValue1, double NewValue2, const TLocation &NewLocation);
bool CabActivisation( bool const Force = false );
bool CabDeactivisation( bool const Force = false );
bool CabActivisation( bool const Enforce = false );
bool CabDeactivisation( bool const Enforce = false );
/*! funkcje zwiekszajace/zmniejszajace nastawniki*/
/*! glowny nastawnik:*/
bool IncMainCtrl(int CtrlSpeed);
bool DecMainCtrl(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
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
/*! pomocniczy nastawnik:*/
bool IncScndCtrl(int CtrlSpeed);
@@ -1570,7 +1690,7 @@ public:
bool SecuritySystemReset(void);
void SecuritySystemCheck(double dt);
bool BatterySwitch(bool State);
bool BatterySwitch( bool State, range_t const Notify = range_t::consist );
bool EpFuseSwitch(bool State);
bool SpringBrakeActivate(bool State);
bool SpringBrakeShutOff(bool State);
@@ -1636,14 +1756,19 @@ public:
bool OilPumpSwitchOff( bool State, range_t const Notify = range_t::consist ); // oil pump state toggle
bool MotorBlowersSwitch( bool State, end const Side, range_t const Notify = range_t::consist ); // traction motor fan state toggle
bool MotorBlowersSwitchOff( bool State, end 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 );
/*-funkcje typowe dla lokomotywy elektrycznej*/
void LowVoltagePowerCheck( double const Deltatime );
void MainsCheck( double const Deltatime );
void PowerCouplersCheck( double const Deltatime );
void PowerCouplersCheck( double const Deltatime, coupling const Coupling );
void ConverterCheck( double const Timestep ); // przetwornica
void HeatingCheck( double const Timestep );
void WaterPumpCheck( double const Timestep );
@@ -1651,9 +1776,13 @@ public:
void FuelPumpCheck( double const Timestep );
void OilPumpCheck( double const Timestep );
void MotorBlowersCheck( double const Timestep );
bool FuseOn(void); //bezpiecznik nadamiary
void PantographsCheck( double const Timestep );
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
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
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
@@ -1672,10 +1801,11 @@ public:
bool AutoRelaySwitch(bool State); //przelacznik automatycznego rozruchu
bool AutoRelayCheck();//symulacja automatycznego rozruchu
bool MotorConnectorsCheck();
bool ResistorsFlagCheck(void) const; //sprawdzenie kontrolki oporow rozruchowych NBMX
bool PantFront( bool const State, range_t const Notify = range_t::consist ); //obsluga pantografou przedniego
bool PantRear( bool const State, range_t const Notify = range_t::consist ); //obsluga pantografu tylnego
bool OperatePantographsValve( operation_t const State, range_t const Notify = range_t::consist );
bool OperatePantographValve( end 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
void CheckSpeedCtrl(double dt);
@@ -1738,6 +1868,7 @@ private:
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_DList( std::string const &Input );
@@ -1765,7 +1896,6 @@ private:
bool readCompressorList(std::string const &Input);
void BrakeValveDecode( std::string const &s ); //Q 20160719
void BrakeSubsystemDecode(); //Q 20160719
bool EIMDirectionChangeAllow( void );
};
//double Distance(TLocation Loc1, TLocation Loc2, TDimension Dim1, TDimension Dim2);

File diff suppressed because it is too large Load Diff

View File

@@ -970,6 +970,11 @@ void TEStEP1::EPCalc(double dt)
LBP = LBP - dv;
}
void TEStEP1::SetEPS( double const nEPS )
{
EPS = nEPS;
}
//---EST3--
double TESt3::GetPF( double const PP, double const dt, double const Vel )
@@ -1680,11 +1685,6 @@ void TEStED::SetLP( double const TM, double const LM, double const TBP )
TareBP = TBP;
}
void TEStED::SetRV(double const RVR)
{
RV = RVR;
}
//---DAKO CV1---
void TCV1::CheckState( double const BCP, double &dV1 )
@@ -2132,13 +2132,13 @@ double TKE::GetPF( double const PP, double const dt, double const Vel )
if (!((typeid(*FM) == typeid(TDisk1)) ||
(typeid(*FM) == typeid(TDisk2)))) // jesli zeliwo to schodz
RapidStatus = ((BrakeDelayFlag & bdelay_R) == bdelay_R) &&
(((Vel > 50) && (RapidStatus)) || (Vel > 70));
((RV < 0) || ((Vel > RV) && (RapidStatus)) || (Vel > (RV + 20)));
else // jesli tarczowki, to zostan
RapidStatus = ((BrakeDelayFlag & bdelay_R) == bdelay_R);
// temp:=1.9-0.9*int(RapidStatus);
if ((RM * RM > 0.1)) // jesli jest rapid
if ((RM * RM > 0.001)) // jesli jest rapid
if ((RM > 0)) // jesli dodatni (naddatek);
temp = 1 - RM * int(RapidStatus);
else
@@ -2592,7 +2592,7 @@ double TMHZ_EN57::GetPF( double i_bcp, double PP, double HP, double dt, double e
if ((TP > 0)&&(CP > 4.9))
{
DP = 0.045;
DP = OverloadPressureDecrease;
if (EQ(i_bcp, 0))
TP = TP - DP * dt;
Sounds[s_fv4a_t] = DP;
@@ -2636,7 +2636,7 @@ double TMHZ_EN57::GetPF( double i_bcp, double PP, double HP, double dt, double e
{
if ((TP < 5))
TP = TP + dt; // 5/10
if ((TP < 1))
if ((TP < OverloadMaxPressure))
TP = TP - 0.5 * dt; // 5/10
}
@@ -2711,12 +2711,14 @@ double TMHZ_EN57::LPP_RP(double pos) // cisnienie z zaokraglonej pozycji;
return 5.0;
}
void TMHZ_EN57::SetParams(bool AO, bool MO, double OverP, double)
void TMHZ_EN57::SetParams(bool AO, bool MO, double OverP, double, double OMP, double OPD)
{
AutoOvrld = AO;
ManualOvrld = MO;
UnbrakeOverPressure = std::max(0.0, OverP);
Fala = (OverP > 0.01);
OverloadMaxPressure = OMP;
OverloadPressureDecrease = OPD;
}
@@ -2747,7 +2749,7 @@ double TMHZ_K5P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
if ((TP > 0)&&(CP>4.9))
{
DP = 0.004;
DP = OverloadPressureDecrease;
TP = TP - DP * dt;
Sounds[s_fv4a_t] = DP;
}
@@ -2785,7 +2787,7 @@ double TMHZ_K5P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
if ((EQ(i_bcp, -1) && (AutoOvrld)) || ((i_bcp<0.5) && (UniversalFlag & TUniversalBrake::ub_Overload)))
{
if ((TP < 1))
if ((TP < OverloadMaxPressure))
TP = TP + 0.03 * dt;
}
@@ -2839,13 +2841,15 @@ double TMHZ_K5P::GetCP()
return CP;
}
void TMHZ_K5P::SetParams(bool AO, bool MO, double OverP, double)
void TMHZ_K5P::SetParams(bool AO, bool MO, double OverP, double, double OMP, double OPD)
{
AutoOvrld = AO;
ManualOvrld = MO;
UnbrakeOverPressure = std::max(0.0, OverP);
Fala = (OverP > 0.01);
OverloadMaxPressure = OMP;
OverloadPressureDecrease = OPD;
}
bool TMHZ_K5P::EQ(double pos, double i_pos)
@@ -2875,7 +2879,7 @@ double TMHZ_6P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
if ((TP > 0)&&(CP>4.9))
{
DP = 0.004;
DP = OverloadPressureDecrease;
TP = TP - DP * dt;
Sounds[s_fv4a_t] = DP;
}
@@ -2919,7 +2923,7 @@ double TMHZ_6P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
if ((EQ(i_bcp, -1) && (AutoOvrld)) || ((i_bcp<0.5) && (UniversalFlag & TUniversalBrake::ub_Overload)))
{
if ((TP < 1))
if ((TP < OverloadMaxPressure))
TP = TP + 0.03 * dt;
}
@@ -2973,12 +2977,14 @@ double TMHZ_6P::GetCP()
return CP;
}
void TMHZ_6P::SetParams(bool AO, bool MO, double OverP, double)
void TMHZ_6P::SetParams(bool AO, bool MO, double OverP, double, double OMP, double OPD)
{
AutoOvrld = AO;
ManualOvrld = MO;
UnbrakeOverPressure = std::max(0.0, OverP);
Fala = (OverP > 0.01);
OverloadMaxPressure = OMP;
OverloadPressureDecrease = OPD;
}

View File

@@ -192,8 +192,9 @@ class TBrake {
double SizeBC = 0.0; //rozmiar^2 CH (w stosunku do 14")
bool DCV = false; //podwojny zawor zwrotny
double ASBP = 0.0; //cisnienie hamulca pp
int UniversalFlag = 0; //flaga wcisnietych przyciskow uniwersalnych
double RV = 0.0; // rapid activation vehicle velocity threshold
int UniversalFlag = 0; //flaga wcisnietych przyciskow uniwersalnych
int BrakeStatus{ b_off }; //flaga stanu
int SoundFlag = 0;
@@ -216,7 +217,7 @@ class TBrake {
bool Releaser() const;
virtual void SetEPS( double const nEPS ); //hamulec EP
virtual void SetRM( double const RMR ) {}; //ustalenie przelozenia rapida
virtual void SetRV( double const RVR) {}; //ustalenie przelozenia rapida
virtual void SetRV( double const RVR ) { RV = RVR; }; //ustalenie przelozenia rapida
virtual void SetLP(double const TM, double const LM, double const TBP) {}; //parametry przystawki wazacej
virtual void SetLBP(double const P) {}; //cisnienie z hamulca pomocniczego
virtual void PLC(double const mass) {}; //wspolczynnik cisnienia przystawki wazacej
@@ -347,7 +348,6 @@ class TLSt : public TESt4R {
protected:
double LBP = 0.0; //cisnienie hamulca pomocniczego
double RM = 0.0; //przelozenie rapida
double RV = 0.0;
double EDFlag = 0.0; //luzowanie hamulca z powodu zalaczonego ED
public:
@@ -383,7 +383,6 @@ class TEStED : public TLSt { //zawor z EP09 - Est4 z oddzielnym przekladnikiem,
double GetEDBCP()/*override*/; //cisnienie tylko z hamulca zasadniczego, uzywane do hamulca ED
void PLC(double const mass); //wspolczynnik cisnienia przystawki wazacej
void SetLP( double const TM, double const LM, double const TBP ); //parametry przystawki wazacej
void SetRV(double const RVR); //ustalenie predkosci przelaczenia rapida
inline TEStED(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) :
TLSt( i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
@@ -418,6 +417,7 @@ class TEStEP1 : public TEStEP2 {
public:
void EPCalc(double dt);
void SetEPS( double const nEPS ) override; //stan hamulca EP
inline TEStEP1(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) :
TEStEP2(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
@@ -545,7 +545,7 @@ class TDriverHandle {
virtual double GetSound(int i); //pobranie glosnosci wybranego dzwieku
virtual double GetPos(int i); //pobranie numeru pozycji o zadanym kodzie (funkcji)
virtual double GetEP(double pos); //pobranie sily hamulca ep
virtual void SetParams(bool AO, bool MO, double, double) {}; //ustawianie jakichs parametrów dla zaworu
virtual void SetParams(bool AO, bool MO, double, double, double OMP, double OPD) {}; //ustawianie jakichs parametrow dla zaworu
virtual void OvrldButton(bool Active); //przycisk recznego przeladowania/asymilacji
virtual void SetUniversalFlag(int flag); //przycisk uniwersalny
inline TDriverHandle() { memset( Sounds, 0, sizeof( Sounds ) ); }
@@ -603,6 +603,8 @@ class TMHZ_EN57 : public TDriverHandle {
double RedAdj = 0.0; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
bool Fala = false;
double UnbrakeOverPressure = 0.0;
double OverloadMaxPressure = 1.0; //maksymalne zwiekszenie cisnienia przy asymilacji
double OverloadPressureDecrease = 0.045; //predkosc spadku cisnienia przy asymilacji
static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 };
double LPP_RP(double pos);
@@ -616,7 +618,7 @@ class TMHZ_EN57 : public TDriverHandle {
double GetPos(int i)/*override*/;
double GetCP()/*override*/;
double GetEP(double pos);
void SetParams(bool AO, bool MO, double OverP, double);
void SetParams(bool AO, bool MO, double OverP, double, double OMP, double OPD);
inline TMHZ_EN57(void) :
TDriverHandle()
{}
@@ -631,6 +633,8 @@ private:
double RedAdj = 0.0; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
bool Fala = false; //czy jest napelnianie uderzeniowe
double UnbrakeOverPressure = 0.0;
double OverloadMaxPressure = 1.0; //maksymalne zwiekszenie cisnienia przy asymilacji
double OverloadPressureDecrease = 0.002; //predkosc spadku cisnienia przy asymilacji
static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 };
bool EQ(double pos, double i_pos);
@@ -642,7 +646,7 @@ public:
double GetSound(int i)/*override*/;
double GetPos(int i)/*override*/;
double GetCP()/*override*/;
void SetParams(bool AO, bool MO, double, double); /*ovveride*/
void SetParams(bool AO, bool MO, double, double, double OMP, double OPD); /*ovveride*/
inline TMHZ_K5P(void) :
TDriverHandle()
@@ -658,6 +662,8 @@ private:
double RedAdj = 0.0; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
bool Fala = false; //czy jest napelnianie uderzeniowe
double UnbrakeOverPressure = 0.0; //wartosc napelniania uderzeniowego
double OverloadMaxPressure = 1.0; //maksymalne zwiekszenie cisnienia przy asymilacji
double OverloadPressureDecrease = 0.002; //predkosc spadku cisnienia przy asymilacji
static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 };
bool EQ(double pos, double i_pos);
@@ -669,7 +675,7 @@ public:
double GetSound(int i)/*override*/;
double GetPos(int i)/*override*/;
double GetCP()/*override*/;
void SetParams(bool AO, bool MO, double, double); /*ovveride*/
void SetParams(bool AO, bool MO, double, double, double OMP, double OPD); /*ovveride*/
inline TMHZ_6P(void) :
TDriverHandle()