mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 13:59:19 +02:00
refactoring: vehicle parameters loader boolean import uniformization
This commit is contained in:
@@ -10,9 +10,9 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "MOVER.h"
|
#include "MOVER.h"
|
||||||
|
|
||||||
|
#include "utilities.h"
|
||||||
#include "DynObj.h"
|
#include "DynObj.h"
|
||||||
#include "Oerlikon_ESt.h"
|
#include "Oerlikon_ESt.h"
|
||||||
#include "utilities.h"
|
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "Logs.h"
|
#include "Logs.h"
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
@@ -2562,7 +2562,8 @@ void TMoverParameters::SecuritySystemCheck(double dt)
|
|||||||
&& (Battery)) // Ra: EZT ma teraz czuwak w rozrządczym
|
&& (Battery)) // Ra: EZT ma teraz czuwak w rozrządczym
|
||||||
{
|
{
|
||||||
// CA
|
// CA
|
||||||
if( ( SecuritySystem.AwareMinSpeed > 0.0 ?
|
if( ( false == ShuntMode ) // TBD, TODO: check if alerter inactivity in shunt mode is general rule or vehicle specific, may need a config flag
|
||||||
|
&& ( SecuritySystem.AwareMinSpeed > 0.0 ?
|
||||||
( Vel >= SecuritySystem.AwareMinSpeed ) :
|
( Vel >= SecuritySystem.AwareMinSpeed ) :
|
||||||
( ActiveDir != 0 ) ) ) {
|
( ActiveDir != 0 ) ) ) {
|
||||||
// domyślnie predkość większa od 10% Vmax, albo podanej jawnie w FIZ
|
// domyślnie predkość większa od 10% Vmax, albo podanej jawnie w FIZ
|
||||||
@@ -9417,10 +9418,10 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) {
|
|||||||
lookup->second :
|
lookup->second :
|
||||||
TBrakeHandle::NoHandle;
|
TBrakeHandle::NoHandle;
|
||||||
}
|
}
|
||||||
Handle_AutomaticOverload = (extract_value("HAO", line) == "Yes");
|
extract_value( Handle_AutomaticOverload, "HAO", line, "" );
|
||||||
Handle_ManualOverload = (extract_value("HMO", line) == "Yes");
|
extract_value( Handle_ManualOverload, "HMO", line, "" );
|
||||||
extract_value(Handle_GenericDoubleParameter1, "HGDP1", line, "");
|
extract_value( Handle_GenericDoubleParameter1, "HGDP1", line, "" );
|
||||||
extract_value(Handle_GenericDoubleParameter2, "HGDP2", line, "");
|
extract_value( Handle_GenericDoubleParameter2, "HGDP2", line, "" );
|
||||||
// brakelochandle
|
// brakelochandle
|
||||||
{
|
{
|
||||||
std::map<std::string, TBrakeHandle> locbrakehandles{
|
std::map<std::string, TBrakeHandle> locbrakehandles{
|
||||||
@@ -9442,17 +9443,16 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// asbtype
|
// asbtype
|
||||||
std::string asb;
|
std::string const asb { ToLower( extract_value( "ASB", line ) ) };
|
||||||
extract_value( asb, "ASB", line, "" );
|
|
||||||
if( BrakeCtrlPosNo > 0 ) {
|
if( BrakeCtrlPosNo > 0 ) {
|
||||||
|
|
||||||
if( asb == "Manual" ) { ASBType = 1; }
|
if( asb == "manual" ) { ASBType = 1; }
|
||||||
else if( asb == "Automatic" ) { ASBType = 2; }
|
else if( asb == "automatic" ) { ASBType = 2; }
|
||||||
else if (asb == "Yes") { ASBType = 128; }
|
else if( asb == "yes") { ASBType = 128; }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
if( asb == "Yes" ) { ASBType = 128; }
|
if( asb == "yes" ) { ASBType = 128; }
|
||||||
}
|
}
|
||||||
} // brakesystem != individual
|
} // brakesystem != individual
|
||||||
|
|
||||||
@@ -9470,7 +9470,7 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) {
|
|||||||
TLocalBrake::NoBrake;
|
TLocalBrake::NoBrake;
|
||||||
}
|
}
|
||||||
// mbrake
|
// mbrake
|
||||||
MBrake = ( extract_value( "ManualBrake", line ) == "Yes" );
|
extract_value( MBrake, "ManualBrake", line, "" );
|
||||||
// dynamicbrake
|
// dynamicbrake
|
||||||
{
|
{
|
||||||
std::map<std::string, int> dynamicbrakes{
|
std::map<std::string, int> dynamicbrakes{
|
||||||
@@ -9492,17 +9492,16 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) {
|
|||||||
extract_value( ScndInMain, "SCIM", line, "" );
|
extract_value( ScndInMain, "SCIM", line, "" );
|
||||||
extract_value( MaxMainCtrlPosNoDirChange, "DirChangeMaxPos", line, "" );
|
extract_value( MaxMainCtrlPosNoDirChange, "DirChangeMaxPos", line, "" );
|
||||||
|
|
||||||
std::string autorelay;
|
auto const autorelay { ToLower( extract_value( "AutoRelay", line ) ) };
|
||||||
extract_value( autorelay, "AutoRelay", line, "" );
|
if( autorelay == "optional" ) { AutoRelayType = 2; }
|
||||||
if( autorelay == "Optional" ) { AutoRelayType = 2; }
|
else if( autorelay == "yes" ) { AutoRelayType = 1; }
|
||||||
else if( autorelay == "Yes" ) { AutoRelayType = 1; }
|
|
||||||
else { AutoRelayType = 0; }
|
else { AutoRelayType = 0; }
|
||||||
|
|
||||||
extract_value( CoupledCtrl, "CoupledCtrl", line, "" );
|
extract_value( CoupledCtrl, "CoupledCtrl", line, "" );
|
||||||
extract_value( EIMCtrlType, "EIMCtrlType", line, "" );
|
extract_value( EIMCtrlType, "EIMCtrlType", line, "" );
|
||||||
clamp( EIMCtrlType, 0, 3 );
|
EIMCtrlType = clamp( EIMCtrlType, 0, 3 );
|
||||||
LocHandleTimeTraxx = (extract_value("LocalBrakeTraxx", line) == "Yes");
|
extract_value( LocHandleTimeTraxx, "LocalBrakeTraxx", line, "" );
|
||||||
EIMCtrlAdditionalZeros = (extract_value("EIMCtrlAddZeros", line) == "Yes");
|
extract_value( EIMCtrlAdditionalZeros, "EIMCtrlAddZeros", line, "" );
|
||||||
|
|
||||||
extract_value( ScndS, "ScndS", line, "" ); // brak pozycji rownoleglej przy niskiej nastawie PSR
|
extract_value( ScndS, "ScndS", line, "" ); // brak pozycji rownoleglej przy niskiej nastawie PSR
|
||||||
|
|
||||||
@@ -9513,7 +9512,7 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) {
|
|||||||
|
|
||||||
//hunter-111012: dla siodemek 303E
|
//hunter-111012: dla siodemek 303E
|
||||||
FastSerialCircuit =
|
FastSerialCircuit =
|
||||||
( extract_value( "FSCircuit", line ) == "Yes" ) ?
|
( ToLower( extract_value( "FSCircuit", line ) ) == "yes" ) ?
|
||||||
1 :
|
1 :
|
||||||
0;
|
0;
|
||||||
|
|
||||||
@@ -9701,7 +9700,7 @@ void TMoverParameters::LoadFIZ_Power( std::string const &Line ) {
|
|||||||
|
|
||||||
void TMoverParameters::LoadFIZ_SpeedControl(std::string const &Line) {
|
void TMoverParameters::LoadFIZ_SpeedControl(std::string const &Line) {
|
||||||
// speed control
|
// speed control
|
||||||
SpeedCtrl = extract_value("SpeedCtrl", Line) == "Yes";
|
extract_value( SpeedCtrl, "SpeedCtrl", Line, "" );
|
||||||
if ((!SpeedCtrl) && (EngineType == TEngineType::ElectricInductionMotor) && (ScndCtrlPosNo > 0)) //backward compatibility
|
if ((!SpeedCtrl) && (EngineType == TEngineType::ElectricInductionMotor) && (ScndCtrlPosNo > 0)) //backward compatibility
|
||||||
SpeedCtrl = true;
|
SpeedCtrl = true;
|
||||||
extract_value(SpeedCtrlDelay, "SpeedCtrlDelay", Line, "");
|
extract_value(SpeedCtrlDelay, "SpeedCtrlDelay", Line, "");
|
||||||
@@ -9717,16 +9716,8 @@ void TMoverParameters::LoadFIZ_SpeedControl(std::string const &Line) {
|
|||||||
SpeedCtrlButtons[speed_no++] = std::stod(speed);
|
SpeedCtrlButtons[speed_no++] = std::stod(speed);
|
||||||
if (speed_no > 9) break;
|
if (speed_no > 9) break;
|
||||||
}
|
}
|
||||||
SpeedCtrlUnit.ManualStateOverride =
|
extract_value( SpeedCtrlUnit.ManualStateOverride, "OverrideManual", Line, "");
|
||||||
(extract_value("OverrideManual", Line) == "Yes") ?
|
extract_value( SpeedCtrlUnit.BrakeIntervention, "BrakeIntervention", Line, "" );
|
||||||
true :
|
|
||||||
false;
|
|
||||||
|
|
||||||
SpeedCtrlUnit.BrakeIntervention =
|
|
||||||
(extract_value("BrakeIntervention", Line) == "Yes") ?
|
|
||||||
true :
|
|
||||||
false;
|
|
||||||
|
|
||||||
extract_value(SpeedCtrlUnit.InitialPower, "InitPwr", Line, "");
|
extract_value(SpeedCtrlUnit.InitialPower, "InitPwr", Line, "");
|
||||||
extract_value(SpeedCtrlUnit.FullPowerVelocity, "MaxPwrVel", Line, "");
|
extract_value(SpeedCtrlUnit.FullPowerVelocity, "MaxPwrVel", Line, "");
|
||||||
extract_value(SpeedCtrlUnit.StartVelocity, "StartVel", Line, "");
|
extract_value(SpeedCtrlUnit.StartVelocity, "StartVel", Line, "");
|
||||||
@@ -10003,17 +9994,17 @@ void TMoverParameters::LoadFIZ_RList( std::string const &Input ) {
|
|||||||
|
|
||||||
extract_value( RlistSize, "Size", Input, "" );
|
extract_value( RlistSize, "Size", Input, "" );
|
||||||
|
|
||||||
auto const venttype = extract_value( "RVent", Input );
|
auto const venttype { ToLower( extract_value( "RVent", Input ) ) };
|
||||||
if( venttype == "Automatic" ) {
|
if( venttype == "automatic" ) {
|
||||||
|
|
||||||
RVentType = 2;
|
RVentType = 2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
RVentType =
|
RVentType = (
|
||||||
venttype == "Yes" ?
|
venttype == "yes" ?
|
||||||
1 :
|
1 :
|
||||||
0;
|
0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( RVentType > 0 ) {
|
if( RVentType > 0 ) {
|
||||||
@@ -10031,9 +10022,9 @@ void TMoverParameters::LoadFIZ_RList( std::string const &Input ) {
|
|||||||
|
|
||||||
void TMoverParameters::LoadFIZ_UCList(std::string const &Input) {
|
void TMoverParameters::LoadFIZ_UCList(std::string const &Input) {
|
||||||
|
|
||||||
extract_value(UniCtrlListSize, "Size", Input, "");
|
extract_value( UniCtrlListSize, "Size", Input, "" );
|
||||||
UniCtrlIntegratedBrakeCtrl = (extract_value("IntegratedBrake", Input) == "Yes");
|
extract_value( UniCtrlIntegratedBrakeCtrl, "IntegratedBrake", Input, "" );
|
||||||
UniCtrlIntegratedBrakePNCtrl = (extract_value("IntegratedBrakePN", Input) == "Yes");
|
extract_value( UniCtrlIntegratedBrakePNCtrl, "IntegratedBrakePN", Input, "" );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user