From ebd3607e4be6b8a2e61ea5e42041ef399957f0d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=B3lik=20Uszasty?= Date: Wed, 12 Oct 2022 22:17:01 +0200 Subject: [PATCH] Added Pmax curve for EIM, e.g. EN57AL --- McZapkie/MOVER.h | 2 ++ McZapkie/Mover.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h index 890bb816..7ac0bf53 100644 --- a/McZapkie/MOVER.h +++ b/McZapkie/MOVER.h @@ -1338,6 +1338,7 @@ public: double InvertersRatio = 0.0; std::vector Inverters; //all inverters int InverterControlCouplerFlag = 4; //which coupling flag is necessary to controll inverters + std::map EIM_Pmax_Table; /*tablica mocy maksymalnej od predkosci*/ /* -dla pojazdów z blendingiem EP/ED (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 @@ -1989,6 +1990,7 @@ private: bool readDMList(std::string const &line); bool readV2NMAXList(std::string const &line); bool readHTCList(std::string const &line); + bool readPmaxList(std::string const &line); bool readFFList( std::string const &line ); bool readWWList( std::string const &line ); bool readLightsList( std::string const &Input ); diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index 230e65bf..f864df5d 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -6159,6 +6159,10 @@ double TMoverParameters::TractionForce( double dt ) { ActiveInverters += 1.0; } InvertersRatio = ActiveInverters / (double)InvertersNo; + if (EIM_Pmax_Table.size() > 1) + { + eimc[eimc_p_Pmax] = TableInterpolation(EIM_Pmax_Table, Vel); + } //tempomat if (ScndCtrlPosNo == 4 && SpeedCtrlTypeTime) { @@ -8905,7 +8909,7 @@ bool TMoverParameters::switch_physics(bool const State) // DO PRZETLUMACZENIA NA bool startBPT; bool startMPT, startMPT0; bool startRLIST, startUCLIST; -bool startDIZELMOMENTUMLIST, startDIZELV2NMAXLIST, startHYDROTCLIST; +bool startDIZELMOMENTUMLIST, startDIZELV2NMAXLIST, startHYDROTCLIST, startPMAXLIST; bool startDLIST, startFFLIST, startWWLIST; bool startLIGHTSLIST; bool startCOMPRESSORLIST; @@ -9219,6 +9223,26 @@ bool TMoverParameters::readHTCList(std::string const &line) { return true; } +bool TMoverParameters::readPmaxList(std::string const &line) { + + cParser parser(line); + if (false == parser.getTokens(2, false)) { + + WriteLog("Read PmaxList: arguments missing in line " + std::to_string(LISTLINE + 1)); + return false; + } + auto idx = LISTLINE++; + double x = 0.0; + double y = 0.0; + parser + >> x + >> y; + + EIM_Pmax_Table.emplace(x, y); + + return true; +} + bool TMoverParameters::readFFList( std::string const &line ) { cParser parser( line ); @@ -9418,7 +9442,8 @@ bool TMoverParameters::LoadFIZ(std::string chkpath) startDIZELMOMENTUMLIST = false; startDIZELV2NMAXLIST = false; startHYDROTCLIST = false; - startFFLIST = false; + startPMAXLIST = false; + startFFLIST = false; startWWLIST = false; startLIGHTSLIST = false; startCOMPRESSORLIST = false; @@ -9510,6 +9535,11 @@ bool TMoverParameters::LoadFIZ(std::string chkpath) startHYDROTCLIST = false; continue; } + if (issection("END-PML", inputline)) { + startBPT = false; + startPMAXLIST = false; + continue; + } if( issection( "endff", inputline ) ) { startBPT = false; startFFLIST = false; @@ -9771,6 +9801,14 @@ bool TMoverParameters::LoadFIZ(std::string chkpath) continue; } + if (issection("PmaxList:", inputline)) + { + startBPT = false; + fizlines.emplace("PmaxList", inputline); + startPMAXLIST = true; LISTLINE = 0; + continue; + } + if (issection("V2NList:", inputline)) { startBPT = false; @@ -9847,6 +9885,10 @@ bool TMoverParameters::LoadFIZ(std::string chkpath) readHTCList(inputline); continue; } + if (true == startPMAXLIST) { + readPmaxList(inputline); + continue; + } if( true == startFFLIST ) { readFFList( inputline ); continue;