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

General logic fixes

This commit is contained in:
2025-01-07 04:46:09 +01:00
parent b114699ab3
commit 76185d10f2
3 changed files with 644 additions and 598 deletions

View File

@@ -814,9 +814,9 @@ struct inverter {
class TMoverParameters class TMoverParameters
{ // Ra: wrapper na kod pascalowy, przejmujący jego funkcje Q: 20160824 - juz nie wrapper a klasa bazowa :) { // Ra: wrapper na kod pascalowy, przejmujący jego funkcje Q: 20160824 - juz nie wrapper a klasa bazowa :)
private: private:
// types // types
/* TODO: implement /* TODO: implement
// communication cable, exchanging control signals with adjacent vehicle // communication cable, exchanging control signals with adjacent vehicle
struct jumper_cable { struct jumper_cable {
// types // types
@@ -830,234 +830,246 @@ private:
// integers // integers
// std::array<int, 1> values {}; // std::array<int, 1> values {};
}; };
*/ */
// basic approximation of a generic device // basic approximation of a generic device
// TBD: inheritance or composition? // TBD: inheritance or composition?
struct basic_device { struct basic_device
{
// config // config
start_t start_type { start_t::manual }; start_t start_type{start_t::manual};
// ld inputs // ld inputs
bool is_enabled { false }; // device is allowed/requested to operate bool is_enabled{false}; // device is allowed/requested to operate
bool is_disabled { false }; // device is requested to stop bool is_disabled{false}; // device is requested to stop
// TODO: add remaining inputs; start conditions and potential breakers // TODO: add remaining inputs; start conditions and potential breakers
// ld outputs // ld outputs
bool is_active { false }; // device is working bool is_active{false}; // device is working
}; };
struct basic_light : public basic_device { struct basic_light : public basic_device
{
// config // config
float dimming { 1.0f }; // light strength multiplier float dimming{1.0f}; // light strength multiplier
// ld outputs // ld outputs
float intensity { 0.0f }; // current light strength float intensity{0.0f}; // current light strength
}; };
struct cooling_fan : public basic_device { struct cooling_fan : public basic_device
{
// config // config
float speed { 0.f }; // cooling fan rpm; either fraction of parent rpm, or absolute value if negative float speed{0.f}; // cooling fan rpm; either fraction of parent rpm, or absolute value if negative
float sustain_time { 0.f }; // time of sustaining work of cooling fans after stop float sustain_time{0.f}; // time of sustaining work of cooling fans after stop
float min_start_velocity { -1.f }; // minimal velocity of vehicle, when cooling fans activate float min_start_velocity{-1.f}; // minimal velocity of vehicle, when cooling fans activate
// ld outputs // ld outputs
float revolutions { 0.f }; // current fan rpm float revolutions{0.f}; // current fan rpm
float stop_timer { 0.f }; // current time, when shut off condition is active float stop_timer{0.f}; // current time, when shut off condition is active
}; };
// basic approximation of a fuel pump // basic approximation of a fuel pump
struct fuel_pump : public basic_device { struct fuel_pump : public basic_device
{
// TODO: fuel consumption, optional automatic engine start after activation // TODO: fuel consumption, optional automatic engine start after activation
}; };
// basic approximation of an oil pump // basic approximation of an oil pump
struct oil_pump : public basic_device { struct oil_pump : public basic_device
{
// config // config
float pressure_minimum { 0.f }; // lowest acceptable working pressure float pressure_minimum{0.f}; // lowest acceptable working pressure
float pressure_maximum { 0.65f }; // oil pressure at maximum engine revolutions float pressure_maximum{0.65f}; // oil pressure at maximum engine revolutions
// ld inputs // ld inputs
float resource_amount { 1.f }; // amount of affected resource, compared to nominal value float resource_amount{1.f}; // amount of affected resource, compared to nominal value
// internal data // internal data
float pressure_target { 0.f }; float pressure_target{0.f};
// ld outputs // ld outputs
float pressure { 0.f }; // current pressure float pressure{0.f}; // current pressure
}; };
// basic approximation of a water pump // basic approximation of a water pump
struct water_pump : public basic_device { struct water_pump : public basic_device
{
// ld inputs // ld inputs
// TODO: move to breaker list in the basic device once implemented // TODO: move to breaker list in the basic device once implemented
bool breaker { false }; // device is allowed to operate bool breaker{false}; // device is allowed to operate
}; };
// basic approximation of a solenoid valve // basic approximation of a solenoid valve
struct basic_valve : basic_device { struct basic_valve : basic_device
{
// config // config
bool solenoid { true }; // requires electric power to operate bool solenoid{true}; // requires electric power to operate
bool spring { true }; // spring return or double acting actuator bool spring{true}; // spring return or double acting actuator
}; };
// basic approximation of a pantograph // basic approximation of a pantograph
struct basic_pantograph { struct basic_pantograph
{
// ld inputs // ld inputs
basic_valve valve; // associated pneumatic valve basic_valve valve; // associated pneumatic valve
// ld outputs // ld outputs
bool is_active { false }; // device is working bool is_active{false}; // device is working
bool sound_event { false }; // indicates last state which generated sound event bool sound_event{false}; // indicates last state which generated sound event
double voltage { 0.0 }; double voltage{0.0};
}; };
// basic approximation of doors // basic approximation of doors
struct basic_door { struct basic_door
{
// config // config
// ld inputs // ld inputs
bool open_permit { false }; // door can be opened bool open_permit{false}; // door can be opened
bool local_open { false }; // local attempt to open the door bool local_open{false}; // local attempt to open the door
bool local_close { false }; // local attempt to close the door bool local_close{false}; // local attempt to close the door
bool remote_open { false }; // received remote signal to open the door bool remote_open{false}; // received remote signal to open the door
bool remote_close { false }; // received remote signal to close the door bool remote_close{false}; // received remote signal to close the door
// internal data // internal data
float auto_timer { -1.f }; // delay between activation of open state and closing state for automatic doors float auto_timer{-1.f}; // delay between activation of open state and closing state for automatic doors
float close_delay { 0.f }; // delay between activation of closing state and actual closing float close_delay{0.f}; // delay between activation of closing state and actual closing
float open_delay { 0.f }; // delay between activation of opening state and actual opening float open_delay{0.f}; // delay between activation of opening state and actual opening
float position { 0.f }; // current shift of the door from the closed position float position{0.f}; // current shift of the door from the closed position
float step_position { 0.f }; // current shift of the movable step from the retracted position float step_position{0.f}; // current shift of the movable step from the retracted position
// ld outputs // ld outputs
bool is_closed { true }; // the door is fully closed bool is_closed{true}; // the door is fully closed
bool is_door_closed { true }; // the door is fully closed, step doesn't matter bool is_door_closed{true}; // the door is fully closed, step doesn't matter
bool is_closing { false }; // the door is currently closing bool is_closing{false}; // the door is currently closing
bool is_opening { false }; // the door is currently opening bool is_opening{false}; // the door is currently opening
bool is_open { false }; // the door is fully open bool is_open{false}; // the door is fully open
bool step_folding { false }; // the doorstep is currently closing bool step_folding{false}; // the doorstep is currently closing
bool step_unfolding { false }; // the doorstep is currently opening bool step_unfolding{false}; // the doorstep is currently opening
}; };
struct door_data { struct door_data
{
// config // config
control_t open_control { control_t::passenger }; control_t open_control{control_t::passenger};
float open_rate { 1.f }; float open_rate{1.f};
float open_delay { 0.f }; float open_delay{0.f};
control_t close_control { control_t::passenger }; control_t close_control{control_t::passenger};
float close_rate { 1.f }; float close_rate{1.f};
float close_delay { 0.f }; float close_delay{0.f};
int type { 2 }; int type{2};
float range { 0.f }; // extent of primary move/rotation float range{0.f}; // extent of primary move/rotation
float range_out { 0.f }; // extent of shift outward, applicable for plug doors float range_out{0.f}; // extent of shift outward, applicable for plug doors
int step_type { 2 }; int step_type{2};
float step_rate { 0.5f }; float step_rate{0.5f};
float step_range { 0.f }; float step_range{0.f};
bool has_lock { false }; bool has_lock{false};
bool has_warning { false }; bool has_warning{false};
bool has_autowarning { false }; bool has_autowarning{false};
float auto_duration { -1.f }; // automatic door closure delay period float auto_duration{-1.f}; // automatic door closure delay period
float auto_velocity { -1.f }; // automatic door closure velocity threshold float auto_velocity{-1.f}; // automatic door closure velocity threshold
bool auto_include_remote { false }; // automatic door closure applies also to remote control bool auto_include_remote{false}; // automatic door closure applies also to remote control
bool permit_needed { false }; bool permit_needed{false};
std::vector<int> permit_presets; // permit presets selectable with preset switch std::vector<int> permit_presets; // permit presets selectable with preset switch
float voltage { 0.f }; // power type required for door movement float voltage{0.f}; // power type required for door movement
// ld inputs // ld inputs
bool lock_enabled { true }; bool lock_enabled{true};
bool step_enabled { true }; bool step_enabled{true};
bool remote_only { false }; // door ignores local control signals bool remote_only{false}; // door ignores local control signals
// internal data // internal data
int permit_preset { -1 }; // curent position of preset selection switch int permit_preset{-1}; // curent position of preset selection switch
// vehicle parts // vehicle parts
std::array<basic_door, 2> instances; // door on the right and left side of the vehicle std::array<basic_door, 2> instances; // door on the right and left side of the vehicle
// ld outputs // ld outputs
bool is_locked { false }; bool is_locked{false};
double doorLockSpeed = 10.0; // predkosc przy ktorej wyzwalana jest blokada drzwi double doorLockSpeed = 10.0; // predkosc przy ktorej wyzwalana jest blokada drzwi
}; };
struct water_heater { struct water_heater
{
// config // config
struct heater_config_t { struct heater_config_t
float temp_min { -1 }; // lowest accepted temperature {
float temp_max { -1 }; // highest accepted temperature float temp_min{-1}; // lowest accepted temperature
float temp_max{-1}; // highest accepted temperature
} config; } config;
// ld inputs // ld inputs
bool breaker { false }; // device is allowed to operate bool breaker{false}; // device is allowed to operate
bool is_enabled { false }; // device is requested to operate bool is_enabled{false}; // device is requested to operate
// ld outputs // ld outputs
bool is_active { false }; // device is working bool is_active{false}; // device is working
bool is_damaged { false }; // device is damaged bool is_damaged{false}; // device is damaged
}; };
struct heat_data { struct heat_data
{
// input, state of relevant devices // input, state of relevant devices
bool cooling { false }; // TODO: user controlled device, implement bool cooling{false}; // TODO: user controlled device, implement
// bool okienko { true }; // window in the engine compartment // bool okienko { true }; // window in the engine compartment
// system configuration // system configuration
bool auxiliary_water_circuit { false }; // cooling system has an extra water circuit bool auxiliary_water_circuit{false}; // cooling system has an extra water circuit
double fan_speed { 0.075 }; // cooling fan rpm; either fraction of engine rpm, or absolute value if negative double fan_speed{0.075}; // cooling fan rpm; either fraction of engine rpm, or absolute value if negative
// heat exchange factors // heat exchange factors
double kw { 0.35 }; double kw{0.35};
double kv { 0.6 }; double kv{0.6};
double kfe { 1.0 }; double kfe{1.0};
double kfs { 80.0 }; double kfs{80.0};
double kfo { 25.0 }; double kfo{25.0};
double kfo2 { 25.0 }; double kfo2{25.0};
// system parts // system parts
struct fluid_circuit_t { struct fluid_circuit_t
{
struct circuit_config_t { struct circuit_config_t
float temp_min { -1 }; // lowest accepted temperature {
float temp_max { -1 }; // highest accepted temperature float temp_min{-1}; // lowest accepted temperature
float temp_cooling { -1 }; // active cooling activation point float temp_max{-1}; // highest accepted temperature
float temp_flow { -1 }; // fluid flow activation point float temp_cooling{-1}; // active cooling activation point
bool shutters { false }; // the radiator has shutters to assist the cooling float temp_flow{-1}; // fluid flow activation point
bool shutters{false}; // the radiator has shutters to assist the cooling
} config; } config;
bool is_cold { false }; // fluid is too cold bool is_cold{false}; // fluid is too cold
bool is_warm { false }; // fluid is too hot bool is_warm{false}; // fluid is too hot
bool is_hot { false }; // fluid temperature crossed cooling threshold bool is_hot{false}; // fluid temperature crossed cooling threshold
bool is_flowing { false }; // fluid is being pushed through the circuit bool is_flowing{false}; // fluid is being pushed through the circuit
} water, } water, water_aux, oil;
water_aux,
oil;
// output, state of affected devices // output, state of affected devices
bool PA { false }; // malfunction flag bool PA{false}; // malfunction flag
float rpmw { 0.0 }; // current main circuit fan revolutions float rpmw{0.0}; // current main circuit fan revolutions
float rpmwz { 0.0 }; // desired main circuit fan revolutions float rpmwz{0.0}; // desired main circuit fan revolutions
bool zaluzje1 { false }; bool zaluzje1{false};
float rpmw2 { 0.0 }; // current auxiliary circuit fan revolutions float rpmw2{0.0}; // current auxiliary circuit fan revolutions
float rpmwz2 { 0.0 }; // desired auxiliary circuit fan revolutions float rpmwz2{0.0}; // desired auxiliary circuit fan revolutions
bool zaluzje2 { false }; bool zaluzje2{false};
// output, temperatures // output, temperatures
float Te { 15.0 }; // ambient temperature TODO: get it from environment data float Te{15.0}; // ambient temperature TODO: get it from environment data
// NOTE: by default the engine is initialized in warm, startup-ready state // NOTE: by default the engine is initialized in warm, startup-ready state
float Ts { 50.0 }; // engine temperature float Ts{50.0}; // engine temperature
float To { 45.0 }; // oil temperature float To{45.0}; // oil temperature
float Tsr { 50.0 }; // main circuit radiator temperature (?) float Tsr{50.0}; // main circuit radiator temperature (?)
float Twy { 50.0 }; // main circuit water temperature float Twy{50.0}; // main circuit water temperature
float Tsr2 { 40.0 }; // secondary circuit radiator temperature (?) float Tsr2{40.0}; // secondary circuit radiator temperature (?)
float Twy2 { 40.0 }; // secondary circuit water temperature float Twy2{40.0}; // secondary circuit water temperature
float temperatura1 { 50.0 }; float temperatura1{50.0};
float temperatura2 { 40.0 }; float temperatura2{40.0};
float powerfactor { 1.0 }; // coefficient of heat generation for engines other than su45 float powerfactor{1.0}; // coefficient of heat generation for engines other than su45
}; };
struct spring_brake { struct spring_brake
{
std::shared_ptr<TReservoir> Cylinder; std::shared_ptr<TReservoir> Cylinder;
bool Activate { false }; //Input: switching brake on/off in exploitation - main valve/switch bool Activate{false}; // Input: switching brake on/off in exploitation - main valve/switch
bool ShuttOff { true }; //Input: shutting brake off during failure - valve in pneumatic container bool ShuttOff{true}; // Input: shutting brake off during failure - valve in pneumatic container
bool Release { false }; //Input: emergency releasing rod bool Release{false}; // Input: emergency releasing rod
bool IsReady{ false }; //Output: readyness to braking - cylinder is armed, spring is tentioned bool IsReady{false}; // Output: readyness to braking - cylinder is armed, spring is tentioned
bool IsActive{ false }; //Output: brake is working bool IsActive{false}; // Output: brake is working
double SBP{ 0.0 }; //Output: pressure in spring brake cylinder double SBP{0.0}; // Output: pressure in spring brake cylinder
bool PNBrakeConnection{ false }; //Conf: connection to pneumatic brake cylinders bool PNBrakeConnection{false}; // Conf: connection to pneumatic brake cylinders
double MaxSetPressure { 0.0 }; //Conf: Maximal pressure for switched off brake double MaxSetPressure{0.0}; // Conf: Maximal pressure for switched off brake
double ResetPressure{ 0.0 }; //Conf: Pressure for arming brake cylinder double ResetPressure{0.0}; // Conf: Pressure for arming brake cylinder
double MinForcePressure{ 0.1 }; //Conf: Minimal pressure for zero force double MinForcePressure{0.1}; // Conf: Minimal pressure for zero force
double MaxBrakeForce{ 0.0 }; //Conf: Maximal tension for brake pads/shoes double MaxBrakeForce{0.0}; // Conf: Maximal tension for brake pads/shoes
double PressureOn{ -2.0 }; //Conf: Pressure changing ActiveFlag to "On" double PressureOn{-2.0}; // Conf: Pressure changing ActiveFlag to "On"
double PressureOff{ -1.0 }; //Conf: Pressure changing ActiveFlag to "Off" double PressureOff{-1.0}; // Conf: Pressure changing ActiveFlag to "Off"
double ValveOffArea{ 0.0 }; //Conf: Area of filling valve double ValveOffArea{0.0}; // Conf: Area of filling valve
double ValveOnArea{ 0.0 }; //Conf: Area of dumping valve double ValveOnArea{0.0}; // Conf: Area of dumping valve
double ValvePNBrakeArea{ 0.0 }; //Conf: Area of bypass to brake cylinders double ValvePNBrakeArea{0.0}; // Conf: Area of bypass to brake cylinders
int MultiTractionCoupler{ 127 }; //Conf: Coupling flag necessary for transmitting the command
int MultiTractionCoupler{127}; // Conf: Coupling flag necessary for transmitting the command
}; };
public: public:
double dMoveLen = 0.0; double dMoveLen = 0.0;
/*---opis lokomotywy, wagonu itp*/ /*---opis lokomotywy, wagonu itp*/
/*--opis serii--*/ /*--opis serii--*/
@@ -1071,14 +1083,14 @@ public:
TPowerParameters HeatingPowerSource; /*zrodlo mocy dla ogrzewania*/ TPowerParameters HeatingPowerSource; /*zrodlo mocy dla ogrzewania*/
TPowerParameters AlterHeatPowerSource; /*alternatywne zrodlo mocy dla ogrzewania*/ TPowerParameters AlterHeatPowerSource; /*alternatywne zrodlo mocy dla ogrzewania*/
TPowerParameters LightPowerSource; /*zrodlo mocy dla oswietlenia*/ TPowerParameters LightPowerSource; /*zrodlo mocy dla oswietlenia*/
TPowerParameters AlterLightPowerSource;/*alternatywne mocy dla oswietlenia*/ TPowerParameters AlterLightPowerSource; /*alternatywne mocy dla oswietlenia*/
double Vmax = -1.0; double Vmax = -1.0;
double Mass = 0.0; double Mass = 0.0;
double Power = 0.0; /*max. predkosc kontrukcyjna, masa wlasna, moc*/ double Power = 0.0; /*max. predkosc kontrukcyjna, masa wlasna, moc*/
double Mred = 0.0; /*Ra: zredukowane masy wirujące; potrzebne do obliczeń hamowania*/ double Mred = 0.0; /*Ra: zredukowane masy wirujące; potrzebne do obliczeń hamowania*/
double TotalMass = 0.0; /*wyliczane przez ComputeMass*/ double TotalMass = 0.0; /*wyliczane przez ComputeMass*/
double HeatingPower = 0.0; double HeatingPower = 0.0;
double EngineHeatingRPM { 0.0 }; // guaranteed engine revolutions with heating enabled double EngineHeatingRPM{0.0}; // guaranteed engine revolutions with heating enabled
double LightPower = 0.0; /*moc pobierana na ogrzewanie/oswietlenie*/ double LightPower = 0.0; /*moc pobierana na ogrzewanie/oswietlenie*/
double BatteryVoltage = 0.0; /*Winger - baterie w elektrykach*/ double BatteryVoltage = 0.0; /*Winger - baterie w elektrykach*/
bool Battery = false; /*Czy sa zalaczone baterie*/ bool Battery = false; /*Czy sa zalaczone baterie*/
@@ -1090,22 +1102,23 @@ public:
float NominalBatteryVoltage = 0.f; /*Winger - baterie w elektrykach*/ float NominalBatteryVoltage = 0.f; /*Winger - baterie w elektrykach*/
TDimension Dim; /*wymiary*/ TDimension Dim; /*wymiary*/
double Cx = 0.0; /*wsp. op. aerodyn.*/ double Cx = 0.0; /*wsp. op. aerodyn.*/
float Floor = 0.96f; //poziom podłogi dla ładunków float Floor = 0.96f; // poziom podłogi dla ładunków
float WheelDiameter = 1.f; /*srednica kol napednych*/ float WheelDiameter = 1.f; /*srednica kol napednych*/
float WheelDiameterL = 0.9f; //Ra: srednica kol tocznych przednich float WheelDiameterL = 0.9f; // Ra: srednica kol tocznych przednich
float WheelDiameterT = 0.9f; //Ra: srednica kol tocznych tylnych float WheelDiameterT = 0.9f; // Ra: srednica kol tocznych tylnych
float TrackW = 1.435f; /*nominalna szerokosc toru [m]*/ float TrackW = 1.435f; /*nominalna szerokosc toru [m]*/
double AxleInertialMoment = 0.0; /*moment bezwladnosci zestawu kolowego*/ double AxleInertialMoment = 0.0; /*moment bezwladnosci zestawu kolowego*/
std::string AxleArangement; /*uklad osi np. Bo'Bo' albo 1'C*/ std::string AxleArangement; /*uklad osi np. Bo'Bo' albo 1'C*/
int NPoweredAxles = 0; /*ilosc osi napednych liczona z powyzszego*/ int NPoweredAxles = 0; /*ilosc osi napednych liczona z powyzszego*/
int NAxles = 0; /*ilosc wszystkich osi j.w.*/ int NAxles = 0; /*ilosc wszystkich osi j.w.*/
int BearingType = 1; /*lozyska: 0 - slizgowe, 1 - toczne*/ int BearingType = 1; /*lozyska: 0 - slizgowe, 1 - toczne*/
double ADist = 0.0; double BDist = 0.0; /*odlegosc osi oraz czopow skretu*/ double ADist = 0.0;
double BDist = 0.0; /*odlegosc osi oraz czopow skretu*/
/*hamulce:*/ /*hamulce:*/
int NBpA = 0; /*ilosc el. ciernych na os: 0 1 2 lub 4*/ int NBpA = 0; /*ilosc el. ciernych na os: 0 1 2 lub 4*/
int SandCapacity = 0; /*zasobnik piasku [kg]*/ int SandCapacity = 0; /*zasobnik piasku [kg]*/
TBrakeSystem BrakeSystem = TBrakeSystem::Individual;/*rodzaj hamulca zespolonego*/ TBrakeSystem BrakeSystem = TBrakeSystem::Individual; /*rodzaj hamulca zespolonego*/
TBrakeSubSystem BrakeSubsystem = TBrakeSubSystem::ss_None ; TBrakeSubSystem BrakeSubsystem = TBrakeSubSystem::ss_None;
TBrakeValve BrakeValve = TBrakeValve::NoValve; TBrakeValve BrakeValve = TBrakeValve::NoValve;
TBrakeHandle BrakeHandle = TBrakeHandle::NoHandle; TBrakeHandle BrakeHandle = TBrakeHandle::NoHandle;
TBrakeHandle BrakeLocHandle = TBrakeHandle::NoHandle; TBrakeHandle BrakeLocHandle = TBrakeHandle::NoHandle;
@@ -1121,28 +1134,28 @@ public:
TLocalBrake LocalBrake = TLocalBrake::NoBrake; /*rodzaj hamulca indywidualnego*/ TLocalBrake LocalBrake = TLocalBrake::NoBrake; /*rodzaj hamulca indywidualnego*/
TBrakePressureTable BrakePressureTable; /*wyszczegolnienie cisnien w rurze*/ TBrakePressureTable BrakePressureTable; /*wyszczegolnienie cisnien w rurze*/
TBrakePressure BrakePressureActual; //wartości ważone dla aktualnej pozycji kranu TBrakePressure BrakePressureActual; // wartości ważone dla aktualnej pozycji kranu
int ASBType = 0; /*0: brak hamulca przeciwposlizgowego, 1: reczny, 2: automat*/ int ASBType = 0; /*0: brak hamulca przeciwposlizgowego, 1: reczny, 2: automat*/
int UniversalBrakeButtonFlag[3] = { 0, 0, 0 }; /* mozliwe działania przycisków hamulcowych */ int UniversalBrakeButtonFlag[3] = {0, 0, 0}; /* mozliwe działania przycisków hamulcowych */
int UniversalResetButtonFlag[3] = { 0, 0, 0 }; // customizable reset buttons assignments int UniversalResetButtonFlag[3] = {0, 0, 0}; // customizable reset buttons assignments
int TurboTest = 0; int TurboTest = 0;
double MaxBrakeForce = 0.0; /*maksymalna sila nacisku hamulca*/ double MaxBrakeForce = 0.0; /*maksymalna sila nacisku hamulca*/
double MaxBrakePress[5]; //pomocniczy, proz, sred, lad, pp double MaxBrakePress[5]; // pomocniczy, proz, sred, lad, pp
double P2FTrans = 0.0; double P2FTrans = 0.0;
double TrackBrakeForce = 0.0; /*sila nacisku hamulca szynowego*/ double TrackBrakeForce = 0.0; /*sila nacisku hamulca szynowego*/
int BrakeMethod = 0; /*flaga rodzaju hamulca*/ int BrakeMethod = 0; /*flaga rodzaju hamulca*/
bool Handle_AutomaticOverload = false; //automatyczna asymilacja na pozycji napelniania bool Handle_AutomaticOverload = false; // automatyczna asymilacja na pozycji napelniania
bool Handle_ManualOverload = false; //reczna asymilacja na guzik bool Handle_ManualOverload = false; // reczna asymilacja na guzik
double Handle_GenericDoubleParameter1 = 0.0; double Handle_GenericDoubleParameter1 = 0.0;
double Handle_GenericDoubleParameter2 = 0.0; double Handle_GenericDoubleParameter2 = 0.0;
double Handle_OverloadMaxPressure = 1.0; //maksymalne zwiekszenie cisnienia przy asymilacji double Handle_OverloadMaxPressure = 1.0; // maksymalne zwiekszenie cisnienia przy asymilacji
double Handle_OverloadPressureDecrease = 0.002; //predkosc spadku cisnienia przy asymilacji double Handle_OverloadPressureDecrease = 0.002; // predkosc spadku cisnienia przy asymilacji
/*max. cisnienie w cyl. ham., stala proporcjonalnosci p-K*/ /*max. cisnienie w cyl. ham., stala proporcjonalnosci p-K*/
double HighPipePress = 0.0; double HighPipePress = 0.0;
double LowPipePress = 0.0; double LowPipePress = 0.0;
double DeltaPipePress = 0.0; double DeltaPipePress = 0.0;
/*max. i min. robocze cisnienie w przewodzie glownym oraz roznica miedzy nimi*/ /*max. i min. robocze cisnienie w przewodzie glownym oraz roznica miedzy nimi*/
double CntrlPipePress = 0.0; //ciśnienie z zbiorniku sterującym double CntrlPipePress = 0.0; // ciśnienie z zbiorniku sterującym
double BrakeVolume = 0.0; double BrakeVolume = 0.0;
double BrakeVVolume = 0.0; double BrakeVVolume = 0.0;
double VeselVolume = 0.0; double VeselVolume = 0.0;
@@ -1183,7 +1196,7 @@ public:
bool CompressorListWrap = false; bool CompressorListWrap = false;
/*cisnienie wlaczania, zalaczania sprezarki, wydajnosc sprezarki*/ /*cisnienie wlaczania, zalaczania sprezarki, wydajnosc sprezarki*/
TBrakeDelayTable BrakeDelay; /*opoznienie hamowania/odhamowania t/o*/ TBrakeDelayTable BrakeDelay; /*opoznienie hamowania/odhamowania t/o*/
double AirLeakRate{ 0.01 }; // base rate of air leak from brake system components ( 0.001 = 1 l/sec ) double AirLeakRate{0.01}; // base rate of air leak from brake system components ( 0.001 = 1 l/sec )
int BrakeCtrlPosNo = 0; /*ilosc pozycji hamulca*/ int BrakeCtrlPosNo = 0; /*ilosc pozycji hamulca*/
/*nastawniki:*/ /*nastawniki:*/
int MainCtrlPosNo = 0; /*ilosc pozycji nastawnika*/ int MainCtrlPosNo = 0; /*ilosc pozycji nastawnika*/
@@ -1203,14 +1216,14 @@ public:
bool HideDirStatusWhenMoving { false }; // Czy gasic lampki kierunku powyzej predkosci zdefiniowanej przez HideDirStatusSpeed bool HideDirStatusWhenMoving { false }; // Czy gasic lampki kierunku powyzej predkosci zdefiniowanej przez HideDirStatusSpeed
int HideDirStatusSpeed{ 1 }; // Predkosc od ktorej lampki kierunku sa wylaczane int HideDirStatusSpeed{ 1 }; // Predkosc od ktorej lampki kierunku sa wylaczane
TSecuritySystem SecuritySystem; TSecuritySystem SecuritySystem;
int EmergencyBrakeWarningSignal{ 0 }; // combined with basic WarningSignal when manual emergency brake is active int EmergencyBrakeWarningSignal{0}; // combined with basic WarningSignal when manual emergency brake is active
TUniversalCtrlTable UniCtrlList; /*lista pozycji uniwersalnego nastawnika*/ TUniversalCtrlTable UniCtrlList; /*lista pozycji uniwersalnego nastawnika*/
int UniCtrlListSize = 0; /*wielkosc listy pozycji uniwersalnego nastawnika*/ int UniCtrlListSize = 0; /*wielkosc listy pozycji uniwersalnego nastawnika*/
bool UniCtrlIntegratedBrakePNCtrl = false; /*zintegrowany nastawnik JH obsluguje hamulec PN*/ bool UniCtrlIntegratedBrakePNCtrl = false; /*zintegrowany nastawnik JH obsluguje hamulec PN*/
bool UniCtrlIntegratedBrakeCtrl = false; /*zintegrowany nastawnik JH obsluguje hamowanie*/ bool UniCtrlIntegratedBrakeCtrl = false; /*zintegrowany nastawnik JH obsluguje hamowanie*/
bool UniCtrlIntegratedLocalBrakeCtrl = false; /*zintegrowany nastawnik JH obsluguje hamowanie hamulcem pomocniczym*/ bool UniCtrlIntegratedLocalBrakeCtrl = false; /*zintegrowany nastawnik JH obsluguje hamowanie hamulcem pomocniczym*/
int UniCtrlNoPowerPos{ 0 }; // cached highesr position not generating traction force int UniCtrlNoPowerPos{0}; // cached highesr position not generating traction force
std::pair<std::string, std::array<int, 2>> PantsPreset { "0132", { 0, 0 } }; // pantograph preset switches; .first holds possible setups as chars, .second holds currently selected preset in each cab std::pair<std::string, std::array<int, 2>> PantsPreset{"0132", {0, 0}}; // pantograph preset switches; .first holds possible setups as chars, .second holds currently selected preset in each cab
/*-sekcja parametrow dla lokomotywy elektrycznej*/ /*-sekcja parametrow dla lokomotywy elektrycznej*/
TSchemeTable RList; /*lista rezystorow rozruchowych i polaczen silnikow, dla dizla: napelnienia*/ TSchemeTable RList; /*lista rezystorow rozruchowych i polaczen silnikow, dla dizla: napelnienia*/
@@ -1225,20 +1238,22 @@ public:
// end; // end;
double NominalVoltage = 0.0; /*nominalne napiecie silnika*/ double NominalVoltage = 0.0; /*nominalne napiecie silnika*/
double WindingRes = 0.0; double WindingRes = 0.0;
double u = 0.0; //wspolczynnik tarcia yB wywalic!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! double u = 0.0; // wspolczynnik tarcia yB wywalic!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
double CircuitRes = 0.0; /*rezystancje silnika i obwodu*/ double CircuitRes = 0.0; /*rezystancje silnika i obwodu*/
int IminLo = 0; int IminHi = 0; /*prady przelacznika automatycznego rozruchu, uzywane tez przez ai_driver*/ int IminLo = 0;
int IminHi = 0; /*prady przelacznika automatycznego rozruchu, uzywane tez przez ai_driver*/
int ImaxLo = 0; // maksymalny prad niskiego rozruchu int ImaxLo = 0; // maksymalny prad niskiego rozruchu
int ImaxHi = 0; // maksymalny prad wysokiego rozruchu int ImaxHi = 0; // maksymalny prad wysokiego rozruchu
bool MotorOverloadRelayHighThreshold { false }; bool MotorOverloadRelayHighThreshold{false};
double nmax = 0.0; /*maksymalna dop. ilosc obrotow /s*/ double nmax = 0.0; /*maksymalna dop. ilosc obrotow /s*/
double InitialCtrlDelay = 0.0; double CtrlDelay = 0.0; /* -//- -//- miedzy kolejnymi poz.*/ double InitialCtrlDelay = 0.0;
double CtrlDelay = 0.0; /* -//- -//- miedzy kolejnymi poz.*/
double CtrlDownDelay = 0.0; /* -//- -//- przy schodzeniu z poz.*/ /*hunter-101012*/ double CtrlDownDelay = 0.0; /* -//- -//- przy schodzeniu z poz.*/ /*hunter-101012*/
int FastSerialCircuit = 0;/*0 - po kolei zamyka styczniki az do osiagniecia szeregowej, 1 - natychmiastowe wejscie na szeregowa*/ /*hunter-111012*/ int FastSerialCircuit = 0; /*0 - po kolei zamyka styczniki az do osiagniecia szeregowej, 1 - natychmiastowe wejscie na szeregowa*/ /*hunter-111012*/
int BackwardsBranchesAllowed = 1; int BackwardsBranchesAllowed = 1;
int AutoRelayType = 0; /*0 -brak, 1 - jest, 2 - opcja*/ int AutoRelayType = 0; /*0 -brak, 1 - jest, 2 - opcja*/
bool CoupledCtrl = false; /*czy mainctrl i scndctrl sa sprzezone*/ bool CoupledCtrl = false; /*czy mainctrl i scndctrl sa sprzezone*/
bool HasCamshaft { false }; bool HasCamshaft{false};
int DynamicBrakeType = 0; /*patrz dbrake_**/ int DynamicBrakeType = 0; /*patrz dbrake_**/
int DynamicBrakeAmpmeters = 2; /*liczba amperomierzy przy hamowaniu ED*/ int DynamicBrakeAmpmeters = 2; /*liczba amperomierzy przy hamowaniu ED*/
double DynamicBrakeRes = 5.8; /*rezystancja oporników przy hamowaniu ED*/ double DynamicBrakeRes = 5.8; /*rezystancja oporników przy hamowaniu ED*/
@@ -1256,9 +1271,9 @@ public:
int RVentType = 0; /*0 - brak, 1 - jest, 2 - automatycznie wlaczany*/ int RVentType = 0; /*0 - brak, 1 - jest, 2 - automatycznie wlaczany*/
double RVentnmax = 1.0; /*maks. obroty wentylatorow oporow rozruchowych*/ double RVentnmax = 1.0; /*maks. obroty wentylatorow oporow rozruchowych*/
double RVentCutOff = 0.0; /*rezystancja wylaczania wentylatorow dla RVentType=2*/ double RVentCutOff = 0.0; /*rezystancja wylaczania wentylatorow dla RVentType=2*/
double RVentSpeed { 0.5 }; //rozpedzanie sie wentylatora obr/s^2} double RVentSpeed{0.5}; // rozpedzanie sie wentylatora obr/s^2}
double RVentMinI { 50.0 }; //przy jakim pradzie sie wylaczaja} double RVentMinI{50.0}; // przy jakim pradzie sie wylaczaja}
bool RVentForceOn { false }; // forced activation switch bool RVentForceOn{false}; // forced activation switch
int CompressorPower = 1; // 0: main circuit, 1: z przetwornicy, reczne, 2: w przetwornicy, stale, 3: diesel engine, 4: converter of unit in front, 5: converter of unit behind int CompressorPower = 1; // 0: main circuit, 1: z przetwornicy, reczne, 2: w przetwornicy, stale, 3: diesel engine, 4: converter of unit in front, 5: converter of unit behind
int SmallCompressorPower = 0; /*Winger ZROBIC*/ int SmallCompressorPower = 0; /*Winger ZROBIC*/
bool Trafo = false; /*pojazd wyposażony w transformator*/ bool Trafo = false; /*pojazd wyposażony w transformator*/
@@ -1283,12 +1298,14 @@ public:
double dizel_minVelfullengage = 0.0; /*najmniejsza predkosc przy jezdzie ze sprzeglem bez poslizgu*/ double dizel_minVelfullengage = 0.0; /*najmniejsza predkosc przy jezdzie ze sprzeglem bez poslizgu*/
double dizel_maxVelANS = 3.0; /*predkosc progowa rozlaczenia przetwornika momentu*/ double dizel_maxVelANS = 3.0; /*predkosc progowa rozlaczenia przetwornika momentu*/
double dizel_AIM = 1.0; /*moment bezwladnosci walu itp*/ double dizel_AIM = 1.0; /*moment bezwladnosci walu itp*/
double dizel_RevolutionsDecreaseRate{ 2.0 }; double dizel_RevolutionsDecreaseRate{2.0};
double dizel_NominalFuelConsumptionRate = 250.0; /*jednostkowe zużycie paliwa przy mocy nominalnej, wczytywane z fiz, g/kWh*/ double dizel_NominalFuelConsumptionRate = 250.0; /*jednostkowe zużycie paliwa przy mocy nominalnej, wczytywane z fiz, g/kWh*/
double dizel_FuelConsumption = 0.0; /*współczynnik zużycia paliwa przeliczony do jednostek maszynowych, l/obrót*/ double dizel_FuelConsumption = 0.0; /*współczynnik zużycia paliwa przeliczony do jednostek maszynowych, l/obrót*/
double dizel_FuelConsumptionActual = 0.0; /*chwilowe spalanie paliwa w l/h*/ double dizel_FuelConsumptionActual = 0.0; /*chwilowe spalanie paliwa w l/h*/
double dizel_FuelConsumptedTotal = 0.0; /*ilość paliwa zużyta od początku symulacji, l*/ double dizel_FuelConsumptedTotal = 0.0; /*ilość paliwa zużyta od początku symulacji, l*/
double dizel_engageDia = 0.5; double dizel_engageMaxForce = 6000.0; double dizel_engagefriction = 0.5; /*parametry sprzegla*/ double dizel_engageDia = 0.5;
double dizel_engageMaxForce = 6000.0;
double dizel_engagefriction = 0.5; /*parametry sprzegla*/
double engagedownspeed = 0.9; double engagedownspeed = 0.9;
double engageupspeed = 0.5; double engageupspeed = 0.5;
/*parametry przetwornika momentu*/ /*parametry przetwornika momentu*/
@@ -1333,18 +1350,18 @@ public:
TMPTRelayTable MPTRelay; TMPTRelayTable MPTRelay;
int RelayType = 0; int RelayType = 0;
TShuntSchemeTable SST; TShuntSchemeTable SST;
double PowerCorRatio = 1.0; //Wspolczynnik korekcyjny double PowerCorRatio = 1.0; // Wspolczynnik korekcyjny
/*- dla uproszczonego modelu silnika (dumb) oraz dla drezyny*/ /*- dla uproszczonego modelu silnika (dumb) oraz dla drezyny*/
double Ftmax = 0.0; double Ftmax = 0.0;
/*- dla lokomotyw z silnikami indukcyjnymi -*/ /*- dla lokomotyw z silnikami indukcyjnymi -*/
double eimc[26]; double eimc[26];
bool EIMCLogForce = false; // bool EIMCLogForce = false; //
static std::vector<std::string> const eimc_labels; static std::vector<std::string> const eimc_labels;
double InverterFrequency { 0.0 }; // current frequency of power inverters double InverterFrequency{0.0}; // current frequency of power inverters
int InvertersNo = 0; // number of inverters int InvertersNo = 0; // number of inverters
double InvertersRatio = 0.0; double InvertersRatio = 0.0;
std::vector<inverter> Inverters; //all inverters std::vector<inverter> Inverters; // all inverters
int InverterControlCouplerFlag = 4; //which coupling flag is necessary to controll inverters int InverterControlCouplerFlag = 4; // which coupling flag is necessary to controll inverters
int Imaxrpc = 0; // Maksymalny prad rezystora hamowania chlodzonego pasywnie int Imaxrpc = 0; // Maksymalny prad rezystora hamowania chlodzonego pasywnie
int BRVto = 0; // Czas jaki wentylatory jeszcze dodatkowo schladzaja rezystor int BRVto = 0; // Czas jaki wentylatory jeszcze dodatkowo schladzaja rezystor
double BRVtimer = 0; // Timer dla podtrzymania wentylatora double BRVtimer = 0; // Timer dla podtrzymania wentylatora
@@ -1353,7 +1370,7 @@ public:
double MED_Vmax = 0; // predkosc maksymalna dla obliczen chwilowej sily hamowania EP w MED double MED_Vmax = 0; // predkosc maksymalna dla obliczen chwilowej sily hamowania EP w MED
double MED_Vmin = 0; // predkosc minimalna dla obliczen chwilowej sily hamowania EP w MED double MED_Vmin = 0; // predkosc minimalna dla obliczen chwilowej sily hamowania EP w MED
double MED_Vref = 0; // predkosc referencyjna dla obliczen dostepnej sily hamowania EP w MED double MED_Vref = 0; // predkosc referencyjna dla obliczen dostepnej sily hamowania EP w MED
double MED_amax { 9.81 }; // maksymalne opoznienie hamowania sluzbowego MED double MED_amax{9.81}; // maksymalne opoznienie hamowania sluzbowego MED
bool MED_EPVC = 0; // czy korekcja sily hamowania EP, gdy nie ma dostepnego ED 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 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 bool MED_Ncor = 0; // czy korekcja sily hamowania z uwzglednieniem nacisku
@@ -1362,81 +1379,89 @@ public:
double MED_ED_Delay1 = 0; // opoznienie wdrazania hamowania ED (pierwszy raz) double MED_ED_Delay1 = 0; // opoznienie wdrazania hamowania ED (pierwszy raz)
double MED_ED_Delay2 = 0; // opoznienie zwiekszania sily hamowania ED (kolejne razy) double MED_ED_Delay2 = 0; // opoznienie zwiekszania sily hamowania ED (kolejne razy)
int DCEMUED_CC { 0 }; //na którym sprzęgu sprawdzać działanie ED 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) double DCEMUED_EP_max_Vel{0.0}; // maksymalna prędkość, przy której działa EP przy włączonym ED w jednostce (dla tocznych)
double DCEMUED_EP_min_Im{ 0.0 }; //minimalny prąd, przy którym EP nie działa przy włączonym ED w członie (dla silnikowych) double DCEMUED_EP_min_Im{0.0}; // minimalny prąd, przy którym EP nie działa przy włączonym ED w członie (dla silnikowych)
double DCEMUED_EP_delay{ 0.0 }; //opóźnienie włączenia hamulca EP przy hamowaniu ED - zwłoka wstępna double DCEMUED_EP_delay{0.0}; // opóźnienie włączenia hamulca EP przy hamowaniu ED - zwłoka wstępna
/*-dla wagonow*/ /*-dla wagonow*/
struct load_attributes { struct load_attributes
{
std::string name; // name of the cargo std::string name; // name of the cargo
float offset_min { 0.f }; // offset applied to cargo model when load amount is 0 float offset_min{0.f}; // offset applied to cargo model when load amount is 0
load_attributes() = default; load_attributes() = default;
load_attributes( std::string const &Name, float const Offsetmin ) : load_attributes(std::string const &Name, float const Offsetmin) : name(Name), offset_min(Offsetmin) {}
name( Name ), offset_min( Offsetmin )
{}
}; };
std::vector<load_attributes> LoadAttributes; std::vector<load_attributes> LoadAttributes;
float MaxLoad = 0.f; /*masa w T lub ilosc w sztukach - ladownosc*/ float MaxLoad = 0.f; /*masa w T lub ilosc w sztukach - ladownosc*/
double OverLoadFactor = 0.0; /*ile razy moze byc przekroczona ladownosc*/ double OverLoadFactor = 0.0; /*ile razy moze byc przekroczona ladownosc*/
float LoadSpeed = 0.f; float UnLoadSpeed = 0.f;/*szybkosc na- i rozladunku jednostki/s*/ float LoadSpeed = 0.f;
float UnLoadSpeed = 0.f; /*szybkosc na- i rozladunku jednostki/s*/
#ifdef EU07_USEOLDDOORCODE #ifdef EU07_USEOLDDOORCODE
int DoorOpenCtrl = 0; int DoorCloseCtrl = 0; /*0: przez pasazera, 1: przez maszyniste, 2: samoczynne (zamykanie)*/ 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*/ double DoorStayOpen = 0.0; /*jak dlugo otwarte w przypadku DoorCloseCtrl=2*/
bool DoorClosureWarning = false; /*czy jest ostrzeganie przed zamknieciem*/ bool DoorClosureWarning = false; /*czy jest ostrzeganie przed zamknieciem*/
bool DoorClosureWarningAuto = false; // departure signal plays automatically while door closing button is held down 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 DoorOpenSpeed = 1.0;
double DoorMaxShiftL = 0.5; double DoorMaxShiftR = 0.5; double DoorMaxPlugShift = 0.1;/*szerokosc otwarcia lub kat*/ 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*/ 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 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 PlatformSpeed = 0.5; /*szybkosc stopnia*/
double PlatformMaxShift { 0.0 }; /*wysuniecie stopnia*/ double PlatformMaxShift{0.0}; /*wysuniecie stopnia*/
int PlatformOpenMethod { 2 }; /*sposob animacji stopnia*/ int PlatformOpenMethod{2}; /*sposob animacji stopnia*/
#endif #endif
double MirrorMaxShift { 90.0 }; double MirrorMaxShift{90.0};
double MirrorVelClose { 5.0 }; double MirrorVelClose{5.0};
bool MirrorForbidden{ false }; /*czy jest pozwolenie na otworzenie lusterek (przycisk)*/ bool MirrorForbidden{false}; /*czy jest pozwolenie na otworzenie lusterek (przycisk)*/
bool ScndS = false; /*Czy jest bocznikowanie na szeregowej*/ bool ScndS = false; /*Czy jest bocznikowanie na szeregowej*/
bool SpeedCtrl = false; /*czy jest tempomat*/ bool SpeedCtrl = false; /*czy jest tempomat*/
speed_control SpeedCtrlUnit; /*parametry tempomatu*/ speed_control SpeedCtrlUnit; /*parametry tempomatu*/
double SpeedCtrlButtons[10] { 30, 40, 50, 60, 70, 80, 90, 100, 110, 120 }; /*przyciski prędkości*/ 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*/ double SpeedCtrlDelay = 2; /*opoznienie dzialania tempomatu z wybieralna predkoscia*/
double SpeedCtrlValue = 0; /*wybrana predkosc jazdy na tempomacie*/ double SpeedCtrlValue = 0; /*wybrana predkosc jazdy na tempomacie*/
/*--sekcja zmiennych*/ /*--sekcja zmiennych*/
/*--opis konkretnego egzemplarza taboru*/ /*--opis konkretnego egzemplarza taboru*/
TLocation Loc { 0.0, 0.0, 0.0 }; //pozycja pojazdów do wyznaczenia odległości pomiędzy sprzęgami TLocation Loc{0.0, 0.0, 0.0}; // pozycja pojazdów do wyznaczenia odległości pomiędzy sprzęgami
TRotation Rot { 0.0, 0.0, 0.0 }; TRotation Rot{0.0, 0.0, 0.0};
glm::vec3 Front{}; glm::vec3 Front{};
std::string Name; /*nazwa wlasna*/ std::string Name; /*nazwa wlasna*/
TCoupling Couplers[2]; //urzadzenia zderzno-sprzegowe, polaczenia miedzy wagonami TCoupling Couplers[2]; // urzadzenia zderzno-sprzegowe, polaczenia miedzy wagonami
std::array<neighbour_data, 2> Neighbours; // potential collision sources std::array<neighbour_data, 2> Neighbours; // potential collision sources
bool Power110vIsAvailable = false; // cached availability of 110v power bool Power110vIsAvailable = false; // cached availability of 110v power
bool Power24vIsAvailable = false; // cached availability of 110v power bool Power24vIsAvailable = false; // cached availability of 110v power
double Power24vVoltage { 0.0 }; // cached battery voltage double Power24vVoltage{0.0}; // cached battery voltage
bool EventFlag = false; /*!o true jesli cos nietypowego sie wydarzy*/ bool EventFlag = false; /*!o true jesli cos nietypowego sie wydarzy*/
int SoundFlag = 0; /*!o patrz stale sound_ */ int SoundFlag = 0; /*!o patrz stale sound_ */
int AIFlag{ 0 }; // HACK: events of interest for consist owner int AIFlag{0}; // HACK: events of interest for consist owner
double DistCounter = 0.0; /*! licznik kilometrow */ double DistCounter = 0.0; /*! licznik kilometrow */
std::pair<double, double> EnergyMeter; // energy <drawn, returned> from grid [kWh] std::pair<double, double> EnergyMeter; // energy <drawn, returned> from grid [kWh]
double V = 0.0; //predkosc w [m/s] względem sprzęgów (dodania gdy jedzie w stronę 0) 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 double Vel = 0.0; // moduł prędkości w [km/h], używany przez AI
double AccS = 0.0; //efektywne przyspieszenie styczne w [m/s^2] (wszystkie siły) double AccS = 0.0; // efektywne przyspieszenie styczne w [m/s^2] (wszystkie siły)
double AccSVBased {}; // tangential acceleration calculated from velocity change double AccSVBased{}; // tangential acceleration calculated from velocity change
double AccN = 0.0; // przyspieszenie normalne w [m/s^2] double AccN = 0.0; // przyspieszenie normalne w [m/s^2]
double AccVert = 0.0; // vertical acceleration double AccVert = 0.0; // vertical acceleration
double nrot = 0.0; // predkosc obrotowa kol (obrotow na sekunde) double nrot = 0.0; // predkosc obrotowa kol (obrotow na sekunde)
double nrot_eps = 0.0; //przyspieszenie kątowe kół (bez kierunku) double nrot_eps = 0.0; // przyspieszenie kątowe kół (bez kierunku)
double WheelFlat = 0.0; double WheelFlat = 0.0;
bool TruckHunting { true }; // enable/disable truck hunting calculation bool TruckHunting{true}; // enable/disable truck hunting calculation
/*! rotacja kol [obr/s]*/ /*! rotacja kol [obr/s]*/
double EnginePower = 0.0; /*! chwilowa moc silnikow*/ double EnginePower = 0.0; /*! chwilowa moc silnikow*/
double dL = 0.0; double Fb = 0.0; double Ff = 0.0; /*przesuniecie, sila hamowania i tarcia*/ double dL = 0.0;
double FTrain = 0.0; double FStand = 0.0; /*! sila pociagowa i oporow ruchu*/ double Fb = 0.0;
double Ff = 0.0; /*przesuniecie, sila hamowania i tarcia*/
double FTrain = 0.0;
double FStand = 0.0; /*! sila pociagowa i oporow ruchu*/
double FTotal = 0.0; /*! calkowita sila dzialajaca na pojazd*/ double FTotal = 0.0; /*! calkowita sila dzialajaca na pojazd*/
double UnitBrakeForce = 0.0; /*!s siła hamowania przypadająca na jeden element*/ double UnitBrakeForce = 0.0; /*!s siła hamowania przypadająca na jeden element*/
double Ntotal = 0.0; /*!s siła nacisku klockow*/ double Ntotal = 0.0; /*!s siła nacisku klockow*/
bool SlippingWheels = false; bool SandDose = false; /*! poslizg kol, sypanie piasku*/ bool SlippingWheels = false;
bool SandDose = false; /*! poslizg kol, sypanie piasku*/
bool SandDoseManual = false; /*piaskowanie reczne*/ bool SandDoseManual = false; /*piaskowanie reczne*/
bool SandDoseAuto = false; /*piaskowanie automatyczne*/ bool SandDoseAuto = false; /*piaskowanie automatyczne*/
bool SandDoseAutoAllow = true; /*zezwolenie na automatyczne piaskowanie*/ bool SandDoseAutoAllow = true; /*zezwolenie na automatyczne piaskowanie*/
@@ -1461,36 +1486,36 @@ public:
bool CompressorFlag = false; /*!o czy wlaczona sprezarka*/ bool CompressorFlag = false; /*!o czy wlaczona sprezarka*/
bool PantCompFlag = false; /*!o czy wlaczona sprezarka pantografow*/ bool PantCompFlag = false; /*!o czy wlaczona sprezarka pantografow*/
bool CompressorAllow = false; /*! zezwolenie na uruchomienie sprezarki NBMX*/ 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 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 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 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 CompressorStart{start_t::manual}; // whether the compressor is started manually, or another way
start_t PantographCompressorStart{ start_t::manual }; start_t PantographCompressorStart{start_t::manual};
basic_valve PantsValve; basic_valve PantsValve;
std::array<basic_pantograph, 2> Pantographs; std::array<basic_pantograph, 2> Pantographs;
bool PantAllDown { false }; bool PantAllDown{false};
double PantFrontVolt = 0.0; //pantograf pod napieciem? 'Winger 160404 double PantFrontVolt = 0.0; // pantograf pod napieciem? 'Winger 160404
double PantRearVolt = 0.0; double PantRearVolt = 0.0;
// TODO converter parameters, for when we start cleaning up mover parameters // 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 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 float ConverterStartDelay{0.0f}; // delay (in seconds) before the converter is started, once its activation conditions are met
double ConverterStartDelayTimer{ 0.0 }; // helper, for tracking whether converter start delay passed double ConverterStartDelayTimer{0.0}; // helper, for tracking whether converter start delay passed
bool ConverterAllow = false; /*zezwolenie na prace przetwornicy NBMX*/ 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 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*/ bool ConverterFlag = false; /*! czy wlaczona przetwornica NBMX*/
bool BRVentilators = false; /* Czy rezystor hamowania pracuje */ bool BRVentilators = false; /* Czy rezystor hamowania pracuje */
start_t ConverterOverloadRelayStart { start_t::manual }; // whether overload relay reset responds to dedicated button start_t ConverterOverloadRelayStart{start_t::manual}; // whether overload relay reset responds to dedicated button
bool ConverterOverloadRelayOffWhenMainIsOff { false }; bool ConverterOverloadRelayOffWhenMainIsOff{false};
fuel_pump FuelPump; fuel_pump FuelPump;
oil_pump OilPump; oil_pump OilPump;
water_pump WaterPump; water_pump WaterPump;
water_heater WaterHeater; water_heater WaterHeater;
bool WaterCircuitsLink { false }; // optional connection between water circuits bool WaterCircuitsLink{false}; // optional connection between water circuits
heat_data dizel_heat; heat_data dizel_heat;
std::array<cooling_fan, 2> MotorBlowers; std::array<cooling_fan, 2> MotorBlowers;
door_data Doors; 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 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 DoorsPermitLightBlinking { 0 }; //when the doors permit signal light is blinking int DoorsPermitLightBlinking{0}; // when the doors permit signal light is blinking
int BrakeCtrlPos = -2; /*nastawa hamulca zespolonego*/ int BrakeCtrlPos = -2; /*nastawa hamulca zespolonego*/
double BrakeCtrlPosR = 0.0; /*nastawa hamulca zespolonego - plynna dla FV4a*/ double BrakeCtrlPosR = 0.0; /*nastawa hamulca zespolonego - plynna dla FV4a*/
@@ -1498,10 +1523,10 @@ public:
int ManualBrakePos = 0; /*nastawa hamulca recznego*/ int ManualBrakePos = 0; /*nastawa hamulca recznego*/
double LocalBrakePosA = 0.0; /*nastawa hamulca pomocniczego*/ double LocalBrakePosA = 0.0; /*nastawa hamulca pomocniczego*/
double LocalBrakePosAEIM = 0.0; /*pozycja hamulca pomocniczego ep dla asynchronicznych ezt*/ double LocalBrakePosAEIM = 0.0; /*pozycja hamulca pomocniczego ep dla asynchronicznych ezt*/
bool UniversalBrakeButtonActive[3] = { false, false, false }; /* brake button pressed */ bool UniversalBrakeButtonActive[3] = {false, false, false}; /* brake button pressed */
/* /*
int BrakeStatus = b_off; //0 - odham, 1 - ham., 2 - uszk., 4 - odluzniacz, 8 - antyposlizg, 16 - uzyte EP, 32 - pozycja R, 64 - powrot z R int BrakeStatus = b_off; //0 - odham, 1 - ham., 2 - uszk., 4 - odluzniacz, 8 - antyposlizg, 16 - uzyte EP, 32 - pozycja R, 64 - powrot z R
*/ */
bool AlarmChainFlag = false; // manual emergency brake bool AlarmChainFlag = false; // manual emergency brake
bool RadioStopFlag = false; /*hamowanie nagle*/ bool RadioStopFlag = false; /*hamowanie nagle*/
bool LockPipe = false; /*locking brake pipe in emergency state*/ bool LockPipe = false; /*locking brake pipe in emergency state*/
@@ -1519,60 +1544,63 @@ public:
double LimPipePress = 0.0; /*stabilizator cisnienia*/ double LimPipePress = 0.0; /*stabilizator cisnienia*/
double ActFlowSpeed = 0.0; /*szybkosc stabilizatora*/ double ActFlowSpeed = 0.0; /*szybkosc stabilizatora*/
int DamageFlag = 0; // kombinacja bitowa stalych dtrain_* }
int EngDmgFlag = 0; // kombinacja bitowa stalych usterek}
int DerailReason = 0; // przyczyna wykolejenia
int DamageFlag = 0; //kombinacja bitowa stalych dtrain_* } // EndSignalsFlag: byte; {ABu 060205: zmiany - koncowki: 1/16 - swiatla prz/tyl, 2/31 - blachy prz/tyl}
int EngDmgFlag = 0; //kombinacja bitowa stalych usterek} // HeadSignalsFlag: byte; {ABu 060205: zmiany - swiatla: 1/2/4 - przod, 16/32/63 - tyl}
int DerailReason = 0; //przyczyna wykolejenia
//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; TCommand CommandIn;
/*komenda przekazywana przez PutCommand*/ /*komenda przekazywana przez PutCommand*/
/*i wykonywana przez RunInternalCommand*/ /*i wykonywana przez RunInternalCommand*/
std::string CommandOut; /*komenda przekazywana przez ExternalCommand*/ std::string CommandOut; /*komenda przekazywana przez ExternalCommand*/
std::string CommandLast; //Ra: ostatnio wykonana komenda do podglądu std::string CommandLast; // Ra: ostatnio wykonana komenda do podglądu
double ValueOut = 0.0; /*argument komendy która ma byc przekazana na zewnatrz*/ double ValueOut = 0.0; /*argument komendy która ma byc przekazana na zewnatrz*/
TTrackShape RunningShape;/*geometria toru po ktorym jedzie pojazd*/ TTrackShape RunningShape; /*geometria toru po ktorym jedzie pojazd*/
TTrackParam RunningTrack;/*parametry toru po ktorym jedzie pojazd*/ TTrackParam RunningTrack; /*parametry toru po ktorym jedzie pojazd*/
double OffsetTrackH = 0.0; double OffsetTrackV = 0.0; /*przesuniecie poz. i pion. w/m osi toru*/ double OffsetTrackH = 0.0;
double OffsetTrackV = 0.0; /*przesuniecie poz. i pion. w/m osi toru*/
/*-zmienne dla lokomotyw*/ /*-zmienne dla lokomotyw*/
bool Mains = false; /*polozenie glownego wylacznika*/ 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 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 double MainsInitTimeCountdown{0.0}; // current state of main circuit initialization, remaining time (in seconds) until it's ready
start_t MainsStart { start_t::manual }; start_t MainsStart{start_t::manual};
bool LineBreakerClosesOnlyAtNoPowerPos{ false }; bool LineBreakerClosesOnlyAtNoPowerPos{false};
bool ControlPressureSwitch{ false }; // activates if the main pipe and/or brake cylinder pressure aren't within operational levels bool ControlPressureSwitch{false}; // activates if the main pipe and/or brake cylinder pressure aren't within operational levels
bool HasControlPressureSwitch{ true }; bool HasControlPressureSwitch{true};
bool ReleaserEnabledOnlyAtNoPowerPos{ false }; bool ReleaserEnabledOnlyAtNoPowerPos{false};
int MainCtrlPos = 0; /*polozenie glownego nastawnika*/ int MainCtrlPos = 0; /*polozenie glownego nastawnika*/
int ScndCtrlPos = 0; /*polozenie dodatkowego nastawnika*/ int ScndCtrlPos = 0; /*polozenie dodatkowego nastawnika*/
int LightsPos = 0; /*polozenie przelacznika wielopozycyjnego swiatel*/ int LightsPos = 0; /*polozenie przelacznika wielopozycyjnego swiatel*/
int CompressorListPos = 0; /*polozenie przelacznika wielopozycyjnego sprezarek*/ 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 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 DirAbsolute = 0; // zadany kierunek jazdy względem sprzęgów (1=w strone 0,-1=w stronę 1)
int MainCtrlMaxDirChangePos { 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 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 int CabOccupied = 0; // numer kabiny, w ktorej jest obsada (zwykle jedna na skład) // TODO: move to TController
bool CabMaster = false; //czy pojazd jest nadrzędny w składzie bool CabMaster = false; // czy pojazd jest nadrzędny w składzie
inline bool IsCabMaster() { return ((CabActive == CabOccupied) && CabMaster); } //czy aktualna kabina jest na pewno tą, z której można sterować inline bool IsCabMaster()
bool AutomaticCabActivation = true; //czy zmostkowany rozrzad przelacza sie sam przy zmianie kabiny {
int InactiveCabFlag = 0; //co sie dzieje przy dezaktywacji kabiny return ((CabActive == CabOccupied) && CabMaster);
bool InactiveCabPantsCheck = false; //niech DynamicObject sprawdzi pantografy } // 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 InactiveCabPantsCheck = false; // niech DynamicObject sprawdzi pantografy
double LastSwitchingTime = 0.0; /*czas ostatniego przelaczania czegos*/ double LastSwitchingTime = 0.0; /*czas ostatniego przelaczania czegos*/
int WarningSignal = 0; // 0: nie trabi, 1,2,4: trabi int WarningSignal = 0; // 0: nie trabi, 1,2,4: trabi
bool DepartureSignal = false; /*sygnal odjazdu*/ bool DepartureSignal = false; /*sygnal odjazdu*/
bool InsideConsist = false; bool InsideConsist = false;
/*-zmienne dla lokomotywy elektrycznej*/ /*-zmienne dla lokomotywy elektrycznej*/
TTractionParam RunningTraction;/*parametry sieci trakcyjnej najblizej lokomotywy*/ TTractionParam RunningTraction; /*parametry sieci trakcyjnej najblizej lokomotywy*/
double enrot = 0.0; // ilosc obrotow silnika double enrot = 0.0; // ilosc obrotow silnika
double Im = 0.0; // prad silnika double Im = 0.0; // prad silnika
/* /*
// currently not used // currently not used
double IHeating = 0.0; double IHeating = 0.0;
double ITraction = 0.0; double ITraction = 0.0;
*/ */
double Itot = 0.0; // prad calkowity double Itot = 0.0; // prad calkowity
double TotalCurrent = 0.0; double TotalCurrent = 0.0;
// momenty // momenty
@@ -1581,41 +1609,42 @@ public:
// sily napedne // sily napedne
double Fw = 0.0; double Fw = 0.0;
double Ft = 0.0; double Ft = 0.0;
//Ra: Im jest ujemny, jeśli lok jedzie w stronę sprzęgu 1 // Ra: Im jest ujemny, jeśli lok jedzie w stronę sprzęgu 1
//a ujemne powinien być przy odwróconej polaryzacji sieci... // a ujemne powinien być przy odwróconej polaryzacji sieci...
//w wielu miejscach jest używane abs(Im) // w wielu miejscach jest używane abs(Im)
int Imin = 0; int Imax = 0; /*prad przelaczania automatycznego rozruchu, prad bezpiecznika*/ int Imin = 0;
int Imax = 0; /*prad przelaczania automatycznego rozruchu, prad bezpiecznika*/
double EngineVoltage = 0.0; // voltage supplied to engine double EngineVoltage = 0.0; // voltage supplied to engine
int MainCtrlActualPos = 0; /*wskaznik RList*/ int MainCtrlActualPos = 0; /*wskaznik RList*/
int ScndCtrlActualPos = 0; /*wskaznik MotorParam*/ int ScndCtrlActualPos = 0; /*wskaznik MotorParam*/
bool DelayCtrlFlag = false; //czy czekanie na 1. pozycji na załączenie? bool DelayCtrlFlag = false; // czy czekanie na 1. pozycji na załączenie?
double LastRelayTime = 0.0; /*czas ostatniego przelaczania stycznikow*/ double LastRelayTime = 0.0; /*czas ostatniego przelaczania stycznikow*/
bool AutoRelayFlag = false; /*mozna zmieniac jesli AutoRelayType=2*/ bool AutoRelayFlag = false; /*mozna zmieniac jesli AutoRelayType=2*/
bool FuseFlag = false; /*!o bezpiecznik nadmiarowy*/ bool FuseFlag = false; /*!o bezpiecznik nadmiarowy*/
bool ConvOvldFlag = false; /*! nadmiarowy przetwornicy i ogrzewania*/ bool ConvOvldFlag = false; /*! nadmiarowy przetwornicy i ogrzewania*/
bool GroundRelay { true }; // switches off to protect against damage from earths bool GroundRelay{true}; // switches off to protect against damage from earths
start_t GroundRelayStart { start_t::manual }; // relay activation method start_t GroundRelayStart{start_t::manual}; // relay activation method
bool StLinFlag = false; /*!o styczniki liniowe*/ bool StLinFlag = false; /*!o styczniki liniowe*/
bool StLinSwitchOff{ false }; // state of the button forcing motor connectors open bool StLinSwitchOff{false}; // state of the button forcing motor connectors open
bool ResistorsFlag = false; /*!o jazda rezystorowa*/ bool ResistorsFlag = false; /*!o jazda rezystorowa*/
double RventRot = 0.0; /*!s obroty wentylatorow rozruchowych*/ double RventRot = 0.0; /*!s obroty wentylatorow rozruchowych*/
double PantographVoltage{ 0.0 }; // voltage supplied to pantographs double PantographVoltage{0.0}; // voltage supplied to pantographs
double PantPress = 0.0; /*Cisnienie w zbiornikach pantografow*/ 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 bool PantPressSwitchActive{false}; // state of the pantograph pressure switch. gets primed at defined pressure level in pantograph air system
bool PantPressLockActive{ false }; // pwr system state flag. fires when pressure switch activates by pantograph pressure dropping below defined level bool PantPressLockActive{false}; // pwr system state flag. fires when pressure switch activates by pantograph pressure dropping below defined level
bool NoVoltRelay{ true }; // switches off if the power level drops below threshold 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 OvervoltageRelay{true}; // switches off if the power level goes above threshold
bool s_CAtestebrake = false; //hunter-091012: zmienna dla testu ca 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 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*/ /*-zmienne dla lokomotywy spalinowej z przekladnia mechaniczna*/
double dizel_fill = 0.0; /*napelnienie*/ double dizel_fill = 0.0; /*napelnienie*/
double dizel_engagestate = 0.0; /*sprzeglo skrzyni biegow: 0 - luz, 1 - wlaczone, 0.5 - wlaczone 50% (z poslizgiem)*/ double dizel_engagestate = 0.0; /*sprzeglo skrzyni biegow: 0 - luz, 1 - wlaczone, 0.5 - wlaczone 50% (z poslizgiem)*/
double dizel_engage = 0.0; /*sprzeglo skrzyni biegow: aktualny docisk*/ double dizel_engage = 0.0; /*sprzeglo skrzyni biegow: aktualny docisk*/
double dizel_automaticgearstatus = 0.0; /*0 - bez zmiany, -1 zmiana na nizszy +1 zmiana na wyzszy*/ double dizel_automaticgearstatus = 0.0; /*0 - bez zmiany, -1 zmiana na nizszy +1 zmiana na wyzszy*/
bool dizel_startup { false }; // engine startup procedure request indicator bool dizel_startup{false}; // engine startup procedure request indicator
bool dizel_ignition { false }; // engine ignition request indicator bool dizel_ignition{false}; // engine ignition request indicator
bool dizel_spinup { false }; // engine spin up to idle speed flag bool dizel_spinup{false}; // engine spin up to idle speed flag
double dizel_engagedeltaomega = 0.0; /*roznica predkosci katowych tarcz sprzegla*/ double dizel_engagedeltaomega = 0.0; /*roznica predkosci katowych tarcz sprzegla*/
double dizel_n_old = 0.0; /*poredkosc na potrzeby obliczen sprzegiel*/ double dizel_n_old = 0.0; /*poredkosc na potrzeby obliczen sprzegiel*/
double dizel_Torque = 0.0; /*aktualny moment obrotowy silnika spalinowego*/ double dizel_Torque = 0.0; /*aktualny moment obrotowy silnika spalinowego*/
@@ -1673,24 +1702,24 @@ public:
load_attributes LoadType; load_attributes LoadType;
std::string LoadQuantity; // jednostki miary std::string LoadQuantity; // jednostki miary
int LoadStatus = 0; //+1=trwa rozladunek,+2=trwa zaladunek,+4=zakończono,0=zaktualizowany model int LoadStatus = 0; //+1=trwa rozladunek,+2=trwa zaladunek,+4=zakończono,0=zaktualizowany model
bool LoadTypeChange{ false }; // indicates load type was changed bool LoadTypeChange{false}; // indicates load type was changed
double LastLoadChangeTime = 0.0; //raz (roz)ładowania double LastLoadChangeTime = 0.0; // raz (roz)ładowania
#ifdef EU07_USEOLDDOORCODE #ifdef EU07_USEOLDDOORCODE
bool DoorBlocked = false; //Czy jest blokada drzwi bool DoorBlocked = false; // Czy jest blokada drzwi
bool DoorLockEnabled { true }; bool DoorLockEnabled{true};
bool DoorLeftOpened = false; //stan drzwi bool DoorLeftOpened = false; // stan drzwi
double DoorLeftOpenTimer { -1.0 }; // left door closing timer for automatic door type double DoorLeftOpenTimer{-1.0}; // left door closing timer for automatic door type
bool DoorRightOpened = false; bool DoorRightOpened = false;
double DoorRightOpenTimer{ -1.0 }; // right door closing timer for automatic door type double DoorRightOpenTimer{-1.0}; // right door closing timer for automatic door type
#endif #endif
// TODO: move these switch types where they belong, cabin definition // TODO: move these switch types where they belong, cabin definition
std::string PantSwitchType; std::string PantSwitchType;
std::string ConvSwitchType; std::string ConvSwitchType;
std::string StLinSwitchType; std::string StLinSwitchType;
bool Heating = false; //ogrzewanie 'Winger 020304 bool Heating = false; // ogrzewanie 'Winger 020304
bool HeatingAllow { false }; // heating switch // TODO: wrap heating in a basic device bool HeatingAllow{false}; // heating switch // TODO: wrap heating in a basic device
int DoubleTr = 1; //trakcja ukrotniona - przedni pojazd 'Winger 160304 int DoubleTr = 1; // trakcja ukrotniona - przedni pojazd 'Winger 160304
basic_light CompartmentLights; basic_light CompartmentLights;
bool PhysicActivation = true; bool PhysicActivation = true;
@@ -1698,12 +1727,12 @@ public:
/*ABu: stale dla wyznaczania sil (i nie tylko) po optymalizacji*/ /*ABu: stale dla wyznaczania sil (i nie tylko) po optymalizacji*/
double FrictConst1 = 0.0; double FrictConst1 = 0.0;
double FrictConst2s = 0.0; double FrictConst2s = 0.0;
double FrictConst2d= 0.0; double FrictConst2d = 0.0;
double TotalMassxg = 0.0; /*TotalMass*g*/ 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 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 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 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 int iLights[2]; // bity zapalonych świateł tutaj, żeby dało się liczyć pobór prądu
@@ -1714,8 +1743,8 @@ public:
// 3 - swiatla dlugie przyciemnione // 3 - swiatla dlugie przyciemnione
// 4 - swiatla dlugie normalne // 4 - swiatla dlugie normalne
int modernDimmerState{0}; int modernDimmerState{0};
bool modernContainOffPos = true; bool modernContainOffPos{true};
bool enableModernDimmer = false; bool enableModernDimmer {false};
// Barwa reflektora // Barwa reflektora
int refR{255}; // Czerwony int refR{255}; // Czerwony

View File

@@ -9943,6 +9943,13 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
else else
result = false; result = false;
if (!modernContainOffPos)
modernDimmerState = 1;
if (!enableModernDimmer)
{
modernDimmerState = 2;
}
WriteLog("CERROR: " + to_string(ConversionError) + ", SUCCES: " + to_string(result)); WriteLog("CERROR: " + to_string(ConversionError) + ", SUCCES: " + to_string(result));
return result; return result;
} }
@@ -11142,10 +11149,6 @@ void TMoverParameters::LoadFIZ_Switches( std::string const &Input ) {
extract_value( UniversalResetButtonFlag[ 2 ], "RelayResetButton3", Input, "" ); extract_value( UniversalResetButtonFlag[ 2 ], "RelayResetButton3", Input, "" );
extract_value(enableModernDimmer, "ModernDimmer", Input, ""); extract_value(enableModernDimmer, "ModernDimmer", Input, "");
extract_value(modernContainOffPos, "ModernDimmerOffPosition", Input, ""); extract_value(modernContainOffPos, "ModernDimmerOffPosition", Input, "");
if (!modernContainOffPos)
modernDimmerState = 1;
if (!enableModernDimmer)
modernDimmerState = 2;
// pantograph presets // pantograph presets
{ {
auto &presets { PantsPreset.first }; auto &presets { PantsPreset.first };

View File

@@ -4888,10 +4888,12 @@ void TTrain::OnCommand_endsignalstoggle( TTrain *Train, command_data const &Comm
} }
void TTrain::OnCommand_headlightsdimtoggle( TTrain *Train, command_data const &Command ) { void TTrain::OnCommand_headlightsdimtoggle( TTrain *Train, command_data const &Command ) {
if (Train->DynamicObject->MoverParameters->enableModernDimmer)
return;
if( Command.action == GLFW_PRESS ) { if( Command.action == GLFW_PRESS ) {
// only reacting to press, so the switch doesn't flip back and forth if key is held down // only reacting to press, so the switch doesn't flip back and forth if key is held down
if( false == Train->DynamicObject->DimHeadlights ) { if (Train->DynamicObject->MoverParameters->modernDimmerState == 2)
{
// turn on // turn on
OnCommand_headlightsdimenable( Train, Command ); OnCommand_headlightsdimenable( Train, Command );
} }
@@ -4904,6 +4906,8 @@ void TTrain::OnCommand_headlightsdimtoggle( TTrain *Train, command_data const &C
void TTrain::OnCommand_headlightsdimenable( TTrain *Train, command_data const &Command ) { void TTrain::OnCommand_headlightsdimenable( TTrain *Train, command_data const &Command ) {
if (Train->DynamicObject->MoverParameters->enableModernDimmer)
return;
if( Command.action == GLFW_PRESS ) { if( Command.action == GLFW_PRESS ) {
// only reacting to press, so the switch doesn't flip back and forth if key is held down // only reacting to press, so the switch doesn't flip back and forth if key is held down
if( Train->ggDimHeadlightsButton.SubModel != nullptr ) { if( Train->ggDimHeadlightsButton.SubModel != nullptr ) {
@@ -4920,13 +4924,18 @@ void TTrain::OnCommand_headlightsdimenable( TTrain *Train, command_data const &C
Train->DynamicObject->DimHeadlights = true; Train->DynamicObject->DimHeadlights = true;
*/ */
WriteLog("Switch do 1");
Train->mvOccupied->modernDimmerState = 1; // ustawiamy modern dimmer na flage przyciemnienia Train->DynamicObject->MoverParameters->modernDimmerState = 1; // ustawiamy modern dimmer na flage przyciemnienia
Train->DynamicObject->RaLightsSet(Train->DynamicObject->MoverParameters->iLights[0],
Train->DynamicObject->MoverParameters->iLights[1]
); // aktualizacja swiatelek
} }
} }
void TTrain::OnCommand_headlightsdimdisable( TTrain *Train, command_data const &Command ) { void TTrain::OnCommand_headlightsdimdisable( TTrain *Train, command_data const &Command ) {
if (Train->DynamicObject->MoverParameters->enableModernDimmer) // nie wiem dlaczego to tak dziala ze jest odwrocona logika
return;
if( Command.action == GLFW_PRESS ) { if( Command.action == GLFW_PRESS ) {
// only reacting to press, so the switch doesn't flip back and forth if key is held down // only reacting to press, so the switch doesn't flip back and forth if key is held down
if( Train->ggDimHeadlightsButton.SubModel != nullptr ) { if( Train->ggDimHeadlightsButton.SubModel != nullptr ) {
@@ -4942,7 +4951,12 @@ void TTrain::OnCommand_headlightsdimdisable( TTrain *Train, command_data const &
Train->DynamicObject->DimHeadlights = false; Train->DynamicObject->DimHeadlights = false;
*/ */
Train->mvOccupied->modernDimmerState = 2; // ustawiamy modern dimmer na flage rozjasnienia WriteLog("Switch do 2");
Train->DynamicObject->MoverParameters->modernDimmerState = 2; // ustawiamy modern dimmer na flage rozjasnienia
Train->DynamicObject->RaLightsSet(
Train->DynamicObject->MoverParameters->iLights[0],
Train->DynamicObject->MoverParameters->iLights[1]
); // aktualizacja swiatelek
} }
} }
@@ -9796,7 +9810,7 @@ void TTrain::set_cab_controls( int const Cab ) {
ggRightLightButton.PutValue( -1.f ); ggRightLightButton.PutValue( -1.f );
} }
} }
if( true == DynamicObject->DimHeadlights ) { if( 1 == DynamicObject->MoverParameters->modernDimmerState ) {
ggDimHeadlightsButton.PutValue( 1.f ); ggDimHeadlightsButton.PutValue( 1.f );
} }
// cab lights // cab lights