16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-17 23:39:18 +02:00

Separate FFList from DEList, add FFEDList (ffBrakeList)

Added a new optional section to .fiz files: `ffBrakeList`. It is used instead of `ffList` whenever the vehicle has its ED braking engaged.

Example (dynamic/pkp/elf_v1/inverter_kp.fiz):
```
ffList: Size=3
0	2.0
33.7	2.08
34.0	2.12
130.4	8.10
endff

ffBrakeList: Size=4
0	2.0
33.7	2.08
34.8	2.08
34.8	2.17
130.4	8.10
endff
```
This commit is contained in:
jakubg1
2025-09-04 04:36:26 +02:00
parent baadd5f14c
commit dc8de9aa07
2 changed files with 84 additions and 35 deletions

View File

@@ -609,6 +609,13 @@ struct TDEScheme
double Umax = 0.0; /*napiecie maksymalne*/
double Imax = 0.0; /*prad maksymalny*/
};
typedef TDEScheme TDESchemeTable[33]; /*tablica WWList dla silnikow spalinowych*/
struct TFFScheme
{
double v = 0.0; // parametr wejsciowy
double freq = 0.0; // wyjscie: czestotliwosc falownika
};
typedef TFFScheme TFFSchemeTable[33];
struct TWiperScheme
{
@@ -619,8 +626,6 @@ struct TWiperScheme
};
typedef TWiperScheme TWiperSchemeTable[16];
typedef TDEScheme TDESchemeTable[33]; /*tablica rezystorow rozr.*/
struct TShuntScheme
{
double Umin = 0.0;
@@ -1373,6 +1378,10 @@ class TMoverParameters
bool Flat = false;
double Vhyp = 1.0;
TDESchemeTable DElist;
TFFSchemeTable FFlist;
int FFListSize = 0;
TFFSchemeTable FFEDlist;
int FFEDListSize = 0;
TWiperSchemeTable WiperList;
int WiperListSize;
@@ -2063,6 +2072,7 @@ private:
void LoadFIZ_UCList(std::string const &Input);
void LoadFIZ_DList( std::string const &Input );
void LoadFIZ_FFList( std::string const &Input );
void LoadFIZ_FFEDList( std::string const &Input );
void LoadFIZ_WiperList(std::string const &Input);
void LoadFIZ_LightsList( std::string const &Input );
void LoadFIZ_CompressorList(std::string const &Input);
@@ -2084,6 +2094,7 @@ private:
bool readHTCList(std::string const &line);
bool readPmaxList(std::string const &line);
bool readFFList( std::string const &line );
bool readFFEDList( std::string const &line );
bool readWWList( std::string const &line );
bool readWiperList( std::string const &line );
bool readLightsList( std::string const &Input );

View File

@@ -6432,21 +6432,24 @@ double TMoverParameters::TractionForce( double dt ) {
EnginePower = abs(eimv[eimv_Ic] * eimv[eimv_U] * NPoweredAxles) / 1000;
// power inverters
auto const tmpV { std::abs( eimv[ eimv_fp ] ) };
auto const useFFEDList = FFEDListSize > 0 && DynamicBrakeFlag;
auto const list = useFFEDList ? FFEDlist : FFlist;
auto const listSize = useFFEDList ? FFEDListSize : FFListSize;
if( ( RlistSize > 0 )
if( ( listSize > 0 )
&& ( ( std::abs( eimv[ eimv_If ] ) > 1.0 )
&& ( tmpV > 0.0001 ) ) ) {
int i = 0;
while( ( i < RlistSize - 1 )
&& ( DElist[ i + 1 ].RPM < tmpV ) ) {
while( ( i < listSize - 1 )
&& ( list[ i + 1 ].v < tmpV ) ) {
++i;
}
InverterFrequency =
( tmpV - DElist[ i ].RPM )
/ std::max( 1.0, ( DElist[ i + 1 ].RPM - DElist[ i ].RPM ) )
* ( DElist[ i + 1 ].GenPower - DElist[ i ].GenPower )
+ DElist[ i ].GenPower;
( tmpV - list[ i ].v )
/ std::max( 1.0, ( list[ i + 1 ].v - list[ i ].v ) )
* ( list[ i + 1 ].freq - list[ i ].freq )
+ list[ i ].freq;
}
else {
InverterFrequency = 0.0;
@@ -8928,7 +8931,7 @@ bool startBPT;
bool startMPT, startMPT0;
bool startRLIST, startUCLIST;
bool startDIZELMOMENTUMLIST, startDIZELV2NMAXLIST, startHYDROTCLIST, startPMAXLIST;
bool startDLIST, startFFLIST, startWWLIST, startWiperList;
bool startDLIST, startFFLIST, startFFEDLIST, startWWLIST, startWiperList;
bool startLIGHTSLIST;
bool startCOMPRESSORLIST;
int LISTLINE;
@@ -9263,21 +9266,40 @@ bool TMoverParameters::readPmaxList(std::string const &line) {
bool TMoverParameters::readFFList( std::string const &line ) {
cParser parser( line );
if( false == parser.getTokens( 2, false ) ) {
WriteLog( "Read FList: arguments missing in line " + std::to_string( LISTLINE + 1 ) );
return false;
}
int idx = LISTLINE++;
if( idx >= sizeof( DElist ) / sizeof( TDEScheme ) ) {
WriteLog( "Read FList: number of entries exceeded capacity of the data table" );
return false;
}
parser
>> DElist[ idx ].RPM
>> DElist[ idx ].GenPower;
cParser parser( line );
if( false == parser.getTokens( 2, false ) ) {
WriteLog( "Read FList: arguments missing in line " + std::to_string( LISTLINE + 1 ) );
return false;
}
int idx = LISTLINE++;
if( idx >= sizeof( FFlist ) / sizeof( TFFScheme ) ) {
WriteLog( "Read FList: number of entries exceeded capacity of the data table" );
return false;
}
parser
>> FFlist[ idx ].v
>> FFlist[ idx ].freq;
return true;
return true;
}
bool TMoverParameters::readFFEDList( std::string const &line ) {
cParser parser( line );
if( false == parser.getTokens( 2, false ) ) {
WriteLog( "Read FList: arguments missing in line " + std::to_string( LISTLINE + 1 ) );
return false;
}
int idx = LISTLINE++;
if( idx >= sizeof( FFEDlist ) / sizeof( TFFScheme ) ) {
WriteLog( "Read FList: number of entries exceeded capacity of the data table" );
return false;
}
parser
>> FFEDlist[ idx ].v
>> FFEDlist[ idx ].freq;
return true;
}
// parsowanie wiperList
@@ -9481,6 +9503,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
startHYDROTCLIST = false;
startPMAXLIST = false;
startFFLIST = false;
startFFEDLIST = false;
startWWLIST = false;
startWiperList = false;
startLIGHTSLIST = false;
@@ -9581,6 +9604,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
if( issection( "endff", inputline ) ) {
startBPT = false;
startFFLIST = false;
startFFEDLIST = false;
continue;
}
if (issection("endwl", inputline))
@@ -9870,12 +9894,19 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
continue;
}
if( issection( "ffList:", inputline ) ) {
startBPT = false;
startFFLIST = true; LISTLINE = 0;
LoadFIZ_FFList( inputline );
continue;
}
if( issection( "ffList:", inputline ) ) {
startBPT = false;
startFFLIST = true; LISTLINE = 0;
LoadFIZ_FFList( inputline );
continue;
}
if( issection( "ffBrakeList:", inputline ) ) {
startBPT = false;
startFFEDLIST = true; LISTLINE = 0;
LoadFIZ_FFEDList( inputline );
continue;
}
if( issection( "WWList:", inputline ) )
{
@@ -9955,10 +9986,14 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
readPmaxList(inputline);
continue;
}
if( true == startFFLIST ) {
readFFList( inputline );
continue;
}
if( true == startFFLIST ) {
readFFList( inputline );
continue;
}
if( true == startFFEDLIST ) {
readFFEDList( inputline );
continue;
}
if( true == startWWLIST ) {
readWWList( inputline );
continue;
@@ -11315,8 +11350,11 @@ void TMoverParameters::LoadFIZ_DList( std::string const &Input ) {
}
void TMoverParameters::LoadFIZ_FFList( std::string const &Input ) {
extract_value( FFListSize, "Size", Input, "" );
}
extract_value( RlistSize, "Size", Input, "" );
void TMoverParameters::LoadFIZ_FFEDList( std::string const &Input ) {
extract_value( FFEDListSize, "Size", Input, "" );
}