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

build 170515. added converter start parameters, partial unification for traction render paths, minor fixes for multi-unit cab instruments

This commit is contained in:
tmj-fstate
2017-05-15 17:23:25 +02:00
parent 98d99baa82
commit 52a76f0ba1
8 changed files with 451 additions and 368 deletions

View File

@@ -139,6 +139,7 @@ static int const ctrain_passenger = 16; //mostek przejściowy
static int const ctrain_scndpneumatic = 32; //przewody 8 atm (żółte; zasilanie powietrzem)
static int const ctrain_heating = 64; //przewody ogrzewania WN
static int const ctrain_depot = 128; //nie rozłączalny podczas zwykłych manewrów (międzyczłonowy), we wpisie wartość ujemna
// possible coupling types; can be combined
enum coupling {
faux = 0x0,
coupler = 0x1,
@@ -150,11 +151,16 @@ enum coupling {
heating = 0x40,
permanent = 0x80
};
/*! przesylanie komend sterujacych*/
enum command_range {
// possible effect ranges for control commands; exclusive
enum range {
local,
unit,
consist
};
// start method for devices; exclusive
enum start {
manual,
automatic
};
/*typ hamulca elektrodynamicznego*/
static int const dbrake_none = 0;
@@ -842,9 +848,14 @@ public:
bool PantCompFlag = false; /*!o czy wlaczona sprezarka pantografow*/
bool CompressorAllow = false; /*! zezwolenie na uruchomienie sprezarki NBMX*/
bool CompressorGovernorLock{ false }; // indicates whether compressor pressure switch was activated due to reaching cut-out pressure
bool ConverterFlag = false ; /*! czy wlaczona przetwornica NBMX*/
// TODO converter parameters, for when we start cleaning up mover parameters
start ConverterStart{ 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
double ConverterStartDelayTimer{ 0.0 }; // helper, for tracking whether converter start delay passed
bool ConverterAllow = false; /*zezwolenie na prace przetwornicy NBMX*/
int BrakeCtrlPos = -2; /*nastawa hamulca zespolonego*/
bool ConverterFlag = false; /*! czy wlaczona przetwornica NBMX*/
int BrakeCtrlPos = -2; /*nastawa hamulca zespolonego*/
double BrakeCtrlPosR = 0.0; /*nastawa hamulca zespolonego - plynna dla FV4a*/
double BrakeCtrlPos2 = 0.0; /*nastawa hamulca zespolonego - kapturek dla FV4a*/
int LocalBrakePos = 0; /*nastawa hamulca indywidualnego*/
@@ -1045,7 +1056,7 @@ public:
bool AddPulseForce(int Multipler);/*dla drezyny*/
bool Sandbox( bool const State, int const Notify = command_range::consist );/*wlacza/wylacza sypanie piasku*/
bool Sandbox( bool const State, int const Notify = range::consist );/*wlacza/wylacza sypanie piasku*/
/*! zbijanie czuwaka/SHP*/
void SSReset(void);
@@ -1101,12 +1112,12 @@ public:
/*--funkcje dla lokomotyw*/
bool DirectionBackward(void);/*! kierunek ruchu*/
bool MainSwitch( bool const State, int const Notify = command_range::consist );/*! wylacznik glowny*/
bool ConverterSwitch( bool State, int const Notify = command_range::consist );/*! wl/wyl przetwornicy*/
bool CompressorSwitch( bool State, int const Notify = command_range::consist );/*! wl/wyl sprezarki*/
bool MainSwitch( bool const State, int const Notify = range::consist );/*! wylacznik glowny*/
bool ConverterSwitch( bool State, int const Notify = range::consist );/*! wl/wyl przetwornicy*/
bool CompressorSwitch( bool State, int const Notify = range::consist );/*! wl/wyl sprezarki*/
/*-funkcje typowe dla lokomotywy elektrycznej*/
void ConverterCheck(); // przetwornica
void ConverterCheck( double const Timestep ); // przetwornica
bool FuseOn(void); //bezpiecznik nadamiary
bool FuseFlagCheck(void); // sprawdzanie flagi nadmiarowego
void FuseOff(void); // wylaczenie nadmiarowego
@@ -1129,8 +1140,8 @@ public:
bool AutoRelayCheck(void);//symulacja automatycznego rozruchu
bool ResistorsFlagCheck(void); //sprawdzenie kontrolki oporow rozruchowych NBMX
bool PantFront( bool const State, int const Notify = command_range::consist ); //obsluga pantografou przedniego
bool PantRear( bool const State, int const Notify = command_range::consist ); //obsluga pantografu tylnego
bool PantFront( bool const State, int const Notify = range::consist ); //obsluga pantografou przedniego
bool PantRear( bool const State, int const Notify = range::consist ); //obsluga pantografu tylnego
/*-funkcje typowe dla lokomotywy spalinowej z przekladnia mechaniczna*/
bool dizel_EngageSwitch(double state);

View File

@@ -773,7 +773,7 @@ void TMoverParameters::UpdatePantVolume(double dt)
// wywalenie szybkiego z powodu niskiego ciśnienia
if( GetTrainsetVoltage() < 0.5 * EnginePowerSource.MaxVoltage ) {
// to jest trochę proteza; zasilanie członu może być przez sprzęg WN
if( MainSwitch( false, ( TrainType == dt_EZT ? command_range::unit : command_range::local ) ) ) {
if( MainSwitch( false, ( TrainType == dt_EZT ? range::unit : range::local ) ) ) {
EventFlag = true;
}
}
@@ -1366,7 +1366,7 @@ double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShap
Compressor = 0;
CompressorFlag = false;
};
ConverterCheck();
ConverterCheck(dt);
if (CompressorSpeed > 0.0) // sprężarka musi mieć jakąś niezerową wydajność
CompressorCheck(dt); //żeby rozważać jej załączenie i pracę
UpdateBrakePressure(dt);
@@ -1522,7 +1522,7 @@ double TMoverParameters::FastComputeMovement(double dt, const TTrackShape &Shape
Compressor = 0;
CompressorFlag = false;
};
ConverterCheck();
ConverterCheck(dt);
if (CompressorSpeed > 0.0) // sprężarka musi mieć jakąś niezerową wydajność
CompressorCheck(dt); //żeby rozważać jej załączenie i pracę
UpdateBrakePressure(dt);
@@ -1561,15 +1561,23 @@ double TMoverParameters::ShowEngineRotation(int VehN)
return 0.0;
};
void TMoverParameters::ConverterCheck()
{ // sprawdzanie przetwornicy
// sprawdzanie przetwornicy
void TMoverParameters::ConverterCheck( double const Timestep ) {
// TODO: move other converter checks here, to have it all in one place for potential device object
if( ( ConverterAllow )
&& ( false == PantPressLockActive )
&& ( Mains ) ) {
ConverterFlag = true;
// delay timer can be optionally configured, and is set anew whenever converter goes off
if( ConverterStartDelayTimer <= 0.0 ) {
ConverterFlag = true;
}
else {
ConverterStartDelayTimer -= Timestep;
}
}
else {
ConverterFlag = false;
ConverterStartDelayTimer = static_cast<double>( ConverterStartDelay );
}
};
@@ -2087,10 +2095,10 @@ bool TMoverParameters::Sandbox( bool const State, int const Notify )
}
}
if( Notify != command_range::local ) {
if( Notify != range::local ) {
// if requested pass the command on
auto const couplingtype =
( Notify == command_range::unit ?
( Notify == range::unit ?
ctrain_controll | ctrain_depot :
ctrain_controll );
@@ -2348,11 +2356,11 @@ bool TMoverParameters::MainSwitch( bool const State, int const Notify )
{
if( Mains ) {
// jeśli był załączony
if( Notify != command_range::local ) {
if( Notify != range::local ) {
// wysłanie wyłączenia do pozostałych?
SendCtrlToNext(
"MainSwitch", int( State ), CabNo,
( Notify == command_range::unit ?
( Notify == range::unit ?
ctrain_controll | ctrain_depot :
ctrain_controll ) );
}
@@ -2360,11 +2368,11 @@ bool TMoverParameters::MainSwitch( bool const State, int const Notify )
Mains = State;
if( Mains ) {
// jeśli został załączony
if( Notify != command_range::local ) {
if( Notify != range::local ) {
// wysłanie wyłączenia do pozostałych?
SendCtrlToNext(
"MainSwitch", int( State ), CabNo,
( Notify == command_range::unit ?
( Notify == range::unit ?
ctrain_controll | ctrain_depot :
ctrain_controll ) );
}
@@ -2399,19 +2407,19 @@ bool TMoverParameters::ConverterSwitch( bool State, int const Notify )
CompressorAllow = ConverterAllow;
}
if( ConverterAllow == true ) {
if( Notify != command_range::local ) {
if( Notify != range::local ) {
SendCtrlToNext(
"ConverterSwitch", 1, CabNo,
( Notify == command_range::unit ?
( Notify == range::unit ?
ctrain_controll | ctrain_depot :
ctrain_controll ) );
}
}
else {
if( Notify != command_range::local ) {
if( Notify != range::local ) {
SendCtrlToNext(
"ConverterSwitch", 0, CabNo,
( Notify == command_range::unit ?
( Notify == range::unit ?
ctrain_controll | ctrain_depot :
ctrain_controll ) );
}
@@ -2436,19 +2444,19 @@ bool TMoverParameters::CompressorSwitch( bool State, int const Notify )
CS = true;
}
if( CompressorAllow == true ) {
if( Notify != command_range::local ) {
if( Notify != range::local ) {
SendCtrlToNext(
"CompressorSwitch", 1, CabNo,
( Notify == command_range::unit ?
( Notify == range::unit ?
ctrain_controll | ctrain_depot :
ctrain_controll ) );
}
}
else {
if( Notify != command_range::local ) {
if( Notify != range::local ) {
SendCtrlToNext(
"CompressorSwitch", 0, CabNo,
( Notify == command_range::unit ?
( Notify == range::unit ?
ctrain_controll | ctrain_depot :
ctrain_controll ) );
}
@@ -4165,7 +4173,7 @@ double TMoverParameters::TractionForce(double dt)
if ( (std::max(GetTrainsetVoltage(), std::abs(Voltage)) < EnginePowerSource.CollectorParameters.MinV) ||
(std::max(GetTrainsetVoltage(), std::abs(Voltage)) * EnginePowerSource.CollectorParameters.OVP >
EnginePowerSource.CollectorParameters.MaxV))
if( MainSwitch( false, ( TrainType == dt_EZT ? command_range::unit : command_range::local ) ) ) // TODO: check whether we need to send this EMU-wide
if( MainSwitch( false, ( TrainType == dt_EZT ? range::unit : range::local ) ) ) // TODO: check whether we need to send this EMU-wide
EventFlag = true; // wywalanie szybkiego z powodu niewłaściwego napięcia
if (((DynamicBrakeType == dbrake_automatic) || (DynamicBrakeType == dbrake_switch)) &&
@@ -4464,7 +4472,7 @@ double TMoverParameters::TractionForce(double dt)
// nie wchodzić w funkcję bez potrzeby
if( ( std::max( std::abs( Voltage ), GetTrainsetVoltage() ) < EnginePowerSource.CollectorParameters.MinV )
|| ( std::max( std::abs( Voltage ), GetTrainsetVoltage() ) > EnginePowerSource.CollectorParameters.MaxV + 200 ) ) {
MainSwitch( false, ( TrainType == dt_EZT ? command_range::unit : command_range::local ) ); // TODO: check whether we need to send this EMU-wide
MainSwitch( false, ( TrainType == dt_EZT ? range::unit : range::local ) ); // TODO: check whether we need to send this EMU-wide
}
}
tmpV = abs(nrot) * (PI * WheelDiameter) * 3.6; //*DirAbsolute*eimc[eimc_s_p]; - do przemyslenia dzialanie pp
@@ -4538,21 +4546,21 @@ double TMoverParameters::TractionForce(double dt)
{
PosRatio = 0;
tmp = 4;
Sandbox( true, command_range::local );
Sandbox( true, range::local );
} // przeciwposlizg
if ((abs((PosRatio + 9.80 * dizel_fill) * dmoment * 100) >
0.95 * Adhesive(RunningTrack.friction) * TotalMassxg))
{
PosRatio = 0;
tmp = 9;
Sandbox( true, command_range::local );
Sandbox( true, range::local );
} // przeciwposlizg
if ((SlippingWheels))
{
// PosRatio = -PosRatio * 0; // serio -0 ???
PosRatio = 0;
tmp = 9;
Sandbox( true, command_range::local );
Sandbox( true, range::local );
} // przeciwposlizg
dizel_fill += Max0R(Min0R(PosRatio - dizel_fill, 0.1), -0.1) * 2 *
@@ -5190,22 +5198,22 @@ bool TMoverParameters::PantFront( bool const State, int const Notify )
PantFrontUp = State;
if( State == true ) {
PantFrontStart = 0;
if( Notify != command_range::local ) {
if( Notify != range::local ) {
// wysłanie wyłączenia do pozostałych?
SendCtrlToNext(
"PantFront", 1, CabNo,
( Notify == command_range::unit ?
( Notify == range::unit ?
ctrain_controll | ctrain_depot :
ctrain_controll ) );
}
}
else {
PantFrontStart = 1;
if( Notify != command_range::local ) {
if( Notify != range::local ) {
// wysłanie wyłączenia do pozostałych?
SendCtrlToNext(
"PantFront", 0, CabNo,
( Notify == command_range::unit ?
( Notify == range::unit ?
ctrain_controll | ctrain_depot :
ctrain_controll ) );
}
@@ -5243,22 +5251,22 @@ bool TMoverParameters::PantRear( bool const State, int const Notify )
PantRearUp = State;
if( State == true ) {
PantRearStart = 0;
if( Notify != command_range::local ) {
if( Notify != range::local ) {
// wysłanie wyłączenia do pozostałych?
SendCtrlToNext(
"PantRear", 1, CabNo,
( Notify == command_range::unit ?
( Notify == range::unit ?
ctrain_controll | ctrain_depot :
ctrain_controll ) );
}
}
else {
PantRearStart = 1;
if( Notify != command_range::local ) {
if( Notify != range::local ) {
// wysłanie wyłączenia do pozostałych?
SendCtrlToNext(
"PantRear", 0, CabNo,
( Notify == command_range::unit ?
( Notify == range::unit ?
ctrain_controll | ctrain_depot :
ctrain_controll ) );
}
@@ -7048,6 +7056,20 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) {
0;
extract_value( StopBrakeDecc, "SBD", line, "" );
// converter
{
std::map<std::string, start> starts{
{ "Manual", start::manual },
{ "Automatic", start::automatic }
};
auto lookup = starts.find( extract_value( "ConverterStart", line ) );
ConverterStart =
lookup != starts.end() ?
lookup->second :
start::manual;
}
extract_value( ConverterStartDelay, "ConverterStartDelay", line, "" );
}
void TMoverParameters::LoadFIZ_Light( std::string const &line ) {
@@ -8148,7 +8170,7 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
}
else if (Command == "Sandbox")
{
OK = Sandbox( CValue1 == 1, command_range::local );
OK = Sandbox( CValue1 == 1, range::local );
}
else if (Command == "CabSignal") /*SHP,Indusi*/
{ // Ra: to powinno działać tylko w członie obsadzonym