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

ai braking test, motor overload relay threshold logic enhancement, vehicle max load parameter

This commit is contained in:
tmj-fstate
2021-06-05 21:30:53 +02:00
parent 7b816594ba
commit 2e86b3a5e9
11 changed files with 472 additions and 169 deletions

View File

@@ -1193,6 +1193,7 @@ public:
int IminLo = 0; int IminHi = 0; /*prady przelacznika automatycznego rozruchu, uzywane tez przez ai_driver*/
int ImaxLo = 0; // maksymalny prad niskiego rozruchu
int ImaxHi = 0; // maksymalny prad wysokiego rozruchu
bool MotorOverloadRelayHighThreshold { false };
double nmax = 0.0; /*maksymalna dop. ilosc obrotow /s*/
double InitialCtrlDelay = 0.0; double CtrlDelay = 0.0; /* -//- -//- miedzy kolejnymi poz.*/
double CtrlDownDelay = 0.0; /* -//- -//- przy schodzeniu z poz.*/ /*hunter-101012*/
@@ -1675,6 +1676,7 @@ public:
bool DecBrakeLevel();
bool ChangeCab(int direction);
bool CurrentSwitch(bool const State);
bool IsMotorOverloadRelayHighThresholdOn() const;
void UpdateBatteryVoltage(double dt);
double ComputeMovement(double dt, double dt1, const TTrackShape &Shape, TTrackParam &Track, TTractionParam &ElectricTraction, TLocation const &NewLoc, TRotation const &NewRot); //oblicza przesuniecie pojazdu
double FastComputeMovement(double dt, const TTrackShape &Shape, TTrackParam &Track, TLocation const &NewLoc, TRotation const &NewRot); //oblicza przesuniecie pojazdu - wersja zoptymalizowana
@@ -1841,7 +1843,7 @@ public:
bool CutOffEngine(void); //odlaczenie udszkodzonych silnikow
/*funkcje automatycznego rozruchu np EN57*/
bool MaxCurrentSwitch(bool State); //przelacznik pradu wysokiego rozruchu
bool MaxCurrentSwitch(bool State, range_t const Notify = range_t::consist ); //przelacznik pradu wysokiego rozruchu
bool MinCurrentSwitch(bool State); //przelacznik pradu automatycznego rozruchu
bool AutoRelaySwitch(bool State); //przelacznik automatycznego rozruchu
bool AutoRelayCheck();//symulacja automatycznego rozruchu

View File

@@ -674,6 +674,12 @@ TMoverParameters::CurrentSwitch(bool const State) {
return false;
};
bool
TMoverParameters::IsMotorOverloadRelayHighThresholdOn() const {
return ( ( ImaxHi > ImaxLo ) && ( Imax > ImaxLo ) );
}
// KURS90 - sprężarka pantografów; Ra 2014-07: teraz jest to zbiornik rozrządu, chociaż to jeszcze nie tak
void TMoverParameters::UpdatePantVolume(double dt) {
// check the pantograph compressor while at it
@@ -1419,6 +1425,23 @@ void TMoverParameters::compute_movement_( double const Deltatime ) {
RunInternalCommand();
// relay settings
if( EngineType == TEngineType::ElectricSeriesMotor ) {
// adjust motor overload relay threshold
if( ImaxHi > ImaxLo ) {
if( MotorOverloadRelayHighThreshold ) { // set high threshold
if( ( TrainType != dt_ET42 ) ? ( RList[ MainCtrlPos ].Bn < 2 ) : ( MainCtrlPos == 0 ) ) {
Imax = ImaxHi;
}
}
else { // set low threshold
if( ( TrainType != dt_ET42 ) || ( MainCtrlPos == 0 ) ) {
Imax = ImaxLo;
}
}
}
}
// automatyczny rozruch
if( EngineType == TEngineType::ElectricSeriesMotor ) {
if( AutoRelayCheck() ) {
@@ -2233,14 +2256,12 @@ bool TMoverParameters::IncMainCtrl(int CtrlSpeed)
OK = true;
if( Imax == ImaxHi ) {
if( RList[ MainCtrlPos ].Bn > 1 ) {
/* NOTE: disabled, relay configuration was moved to compute_movement_
if( true == MaxCurrentSwitch( false )) {
// wylaczanie wysokiego rozruchu
SetFlag( SoundFlag, sound::relay );
} // Q TODO:
// if (EngineType=ElectricSeriesMotor) and (MainCtrlPos=1)
// then
// MainCtrlActualPos:=1;
//
}
*/
if( TrainType == dt_ET42 ) {
--MainCtrlPos;
OK = false;
@@ -3957,7 +3978,7 @@ bool TMoverParameters::SwitchEPBrake(int state)
if ((BrakeHandle == TBrakeHandle::St113) && (CabOccupied != 0))
{
if (state > 0)
temp = Handle->GetCP(); // TODO: przetlumaczyc
temp = Handle->GetEP(); // TODO: przetlumaczyc
else
temp = 0;
Hamulec->SetEPS(temp);
@@ -4519,7 +4540,7 @@ void TMoverParameters::UpdatePipePressure(double dt)
&& (DirActive != 0)
&& (EpFuse)) // tu powinien byc jeszcze bezpiecznik EP i baterie -
// temp = (Handle as TFVel6).GetCP
temp = Handle->GetCP();
temp = Handle->GetEP();
else
temp = 0.0;
@@ -6571,33 +6592,23 @@ bool TMoverParameters::CutOffEngine(void)
// Q: 20160713
// Przełączenie wysoki / niski prąd rozruchu
// *************************************************************************************************
bool TMoverParameters::MaxCurrentSwitch(bool State)
bool TMoverParameters::MaxCurrentSwitch(bool State, range_t const Notify )
{
bool MCS = false;
if (EngineType == TEngineType::ElectricSeriesMotor)
if (ImaxHi > ImaxLo)
{
if (State && (Imax == ImaxLo) && (RList[MainCtrlPos].Bn < 2) &&
!((TrainType == dt_ET42) && (MainCtrlPos > 0)))
{
auto const initialstate { MotorOverloadRelayHighThreshold };
Imax = ImaxHi;
MCS = true;
if (CabActive != 0)
SendCtrlToNext("MaxCurrentSwitch", 1, CabActive);
}
if (!State)
MotorOverloadRelayHighThreshold = State;
if (Imax == ImaxHi)
if (!((TrainType == dt_ET42) && (MainCtrlPos > 0)))
{
Imax = ImaxLo;
MCS = true;
if (CabActive != 0)
SendCtrlToNext("MaxCurrentSwitch", 0, CabActive);
}
}
return MCS;
if( Notify != range_t::local ) {
SendCtrlToNext(
"MaxCurrentSwitch",
( State ? 1 : 0 ),
CabActive,
( Notify == range_t::unit ?
coupling::control | coupling::permanent :
coupling::control ) );
}
return State != initialstate;
}
// *************************************************************************************************
@@ -6739,19 +6750,24 @@ bool TMoverParameters::AutoRelayCheck(void)
}
else
{ // zmieniaj mainctrlactualpos
if ((DirActive < 0) && (TrainType != dt_PseudoDiesel))
if (RList[MainCtrlActualPos + 1].Bn > 1)
{
if( ( DirActive < 0 ) && ( TrainType != dt_PseudoDiesel ) ) {
if( RList[ MainCtrlActualPos + 1 ].Bn > 1 ) {
return false; // nie poprawiamy przy konwersji
// return ARC;// bbylo exit; //Ra: to powoduje, że EN57 nie wyłącza się przy
// IminLo
// return ARC;// bbylo exit; //Ra: to powoduje, że EN57 nie wyłącza się przy IminLo
}
}
// main bez samoczynnego rozruchu
if( ( MainCtrlActualPos < ( sizeof( RList ) / sizeof( TScheme ) - 1 ) ) // crude guard against running out of current fixed table
&& ( ( RList[ MainCtrlActualPos ].Relay < MainCtrlPos )
|| ( ( RList[ MainCtrlActualPos + 1 ].Relay == MainCtrlPos ) && ( MainCtrlActualPos < RlistSize ) )
|| ( ( TrainType == dt_ET22 ) && ( DelayCtrlFlag ) ) ) ) {
// prevent switch to parallel mode if motor overload relay is set to high threshold mode
if( ( IsMotorOverloadRelayHighThresholdOn() )
&& ( RList[ MainCtrlActualPos + 1 ].Bn > 1 ) ) {
return false;
}
if( ( RList[MainCtrlPos].R == 0 )
&& ( MainCtrlPos > 0 )
&& ( MainCtrlPos != MainCtrlPosNo )
@@ -11994,10 +12010,10 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
DropAllPantographs( CValue1 == 1, range_t::local );
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
}
else if (Command == "MaxCurrentSwitch")
{
OK = MaxCurrentSwitch(CValue1 == 1);
}
else if (Command == "MaxCurrentSwitch") {
MaxCurrentSwitch( CValue1 == 1, range_t::local );
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
}
else if (Command == "MinCurrentSwitch")
{
OK = MinCurrentSwitch(CValue1 == 1);

View File

@@ -2282,6 +2282,11 @@ double TDriverHandle::GetCP()
return 0;
}
double TDriverHandle::GetEP()
{
return 0;
}
double TDriverHandle::GetSound(int i)
{
return 0;
@@ -2814,8 +2819,8 @@ double TMHZ_K5P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
void TMHZ_K5P::Init(double Press)
{
CP = Press;
Time = true;
TimeEP = true;
Time = true;
TimeEP = true;
}
void TMHZ_K5P::SetReductor(double nAdj)
@@ -3133,9 +3138,11 @@ double TSt113::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
double ActFlowSpeed;
int BCP;
CP = PP;
BCP = lround(i_bcp);
EPS = BEP_K[BCP+1];
EPS = BEP_K[BCP];
if (BCP > 0)
BCP = BCP - 1;
@@ -3169,7 +3176,12 @@ double TSt113::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
double TSt113::GetCP()
{
return EPS;
return CP;
}
double TSt113::GetEP()
{
return EPS;
}
double TSt113::GetPos(int i)
@@ -3301,6 +3313,8 @@ double TFVel6::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
double dpMainValve;
double ActFlowSpeed;
CP = PP;
LimPP = Min0R(5 * int(i_bcp < 3.5), HP);
if ((i_bcp >= 3.5) && ((i_bcp < 4.3) || (i_bcp > 5.5)))
ActFlowSpeed = 0;
@@ -3334,7 +3348,12 @@ double TFVel6::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
double TFVel6::GetCP()
{
return EPS;
return CP;
}
double TFVel6::GetEP()
{
return EPS;
}
double TFVel6::GetPos(int i)
@@ -3366,6 +3385,8 @@ double TFVE408::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
double dpMainValve;
double ActFlowSpeed;
CP = PP;
LimPP = Min0R(5 * int(i_bcp < 6.5), HP);
if ((i_bcp >= 6.5) && ((i_bcp < 7.5) || (i_bcp > 9.5)))
ActFlowSpeed = 0;
@@ -3398,6 +3419,11 @@ double TFVE408::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
}
double TFVE408::GetCP()
{
return CP;
}
double TFVE408::GetEP()
{
return EPS;
}

View File

@@ -541,6 +541,7 @@ class TDriverHandle {
virtual double GetPF(double i_bcp, double PP, double HP, double dt, double ep);
virtual void Init(double Press);
virtual double GetCP();
virtual double GetEP();
virtual void SetReductor(double nAdj); //korekcja pozycji reduktora cisnienia
virtual double GetSound(int i); //pobranie glosnosci wybranego dzwieku
virtual double GetPos(int i); //pobranie numeru pozycji o zadanym kodzie (funkcji)
@@ -617,7 +618,7 @@ class TMHZ_EN57 : public TDriverHandle {
double GetSound(int i)/*override*/;
double GetPos(int i)/*override*/;
double GetCP()/*override*/;
double GetEP(double pos);
double GetEP(double pos);
void SetParams(bool AO, bool MO, double OverP, double, double OMP, double OPD);
inline TMHZ_EN57(void) :
TDriverHandle()
@@ -762,10 +763,11 @@ class TSt113 : public TH14K1 {
static double const BPT_K[/*?*/ /*-1..4*/ (4) - (-1) + 1][2];
static double const BEP_K[/*?*/ /*-1..5*/ (5) - (-1) + 1];
static double const pos_table[11]; // = {-1, 5, -1, 0, 2, 3, 4, 5, 0, 0, 1};
double CP = 0;
public:
double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/;
double GetCP()/*override*/;
double GetEP()/*override*/;
double GetPos(int i)/*override*/;
void Init(double Press)/*override*/;
@@ -830,10 +832,12 @@ class TFVel6 : public TDriverHandle {
private:
double EPS = 0.0;
static double const pos_table[ 11 ]; // = {-1, 6, -1, 0, 6, 4, 4.7, 5, -1, 0, 1};
double CP = 0.0;
public:
double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/;
double GetCP()/*override*/;
double GetEP()/*override*/;
double GetPos(int i)/*override*/;
double GetSound(int i)/*override*/;
void Init(double Press)/*override*/;
@@ -848,10 +852,12 @@ class TFVE408 : public TDriverHandle {
private:
double EPS = 0.0;
static double const pos_table[11]; // = {-1, 6, -1, 0, 6, 4, 4.7, 5, -1, 0, 1};
double CP = 0.0;
public:
double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/;
double GetCP()/*override*/;
double GetEP()/*override*/;
double GetPos(int i)/*override*/;
double GetSound(int i)/*override*/;
void Init(double Press)/*override*/;