diff --git a/application/driveruipanels.cpp b/application/driveruipanels.cpp index 06c703089..304cf5d1a 100644 --- a/application/driveruipanels.cpp +++ b/application/driveruipanels.cpp @@ -1095,12 +1095,14 @@ debug_panel::update_section_engine( std::vector &Output ) const { if( mover.EngineType == TEngineType::ElectricInductionMotor ) { Output.emplace_back( " eimc: eimv: press:", Global.UITextColor ); + auto const config{ mover.inductionMotor.ConfigListing() }; + auto const state{ mover.inductionMotor.StateListing() }; for( int i = 0; i <= 20; ++i ) { std::string parameters = - TMoverParameters::eimc_labels[ i ] + to_string( mover.inductionMotor.config[ i ], 2, 9 ) + std::string( config[ i ].first ) + to_string( config[ i ].second, 2, 9 ) + " | " - + TMoverParameters::eimv_labels[ i ] + to_string( mover.inductionMotor.state[ i ], 2, 9 ); + + std::string( state[ i ].first ) + to_string( state[ i ].second, 2, 9 ); if( i < 10 ) { parameters += diff --git a/physics/components/body.cpp b/physics/components/body.cpp index 6c700f1ec..aeb604f34 100644 --- a/physics/components/body.cpp +++ b/physics/components/body.cpp @@ -30,12 +30,6 @@ http://mozilla.org/MPL/2.0/. #include "physics/components/internal.h" -std::vector const TMoverParameters::eimc_labels = {"dfic: ", "dfmax:", "p: ", "scfu: ", "cim: ", "icif: ", "Uzmax:", "Uzh: ", "DU: ", "I0: ", "fcfu: ", - "F0: ", "a1: ", "Pmax: ", "Fh: ", "Ph: ", "Vh0: ", "Vh1: ", "Imax: ", "abed: ", "eped: "}; - -std::vector const TMoverParameters::eimv_labels = { - "Fkrt:", "Fmax:", "ks: ", "df: ", "fp: ", "Us: ", "pole:", "Ic: ", "If: ", "M: ", "Fr: ", "Ipoj:", "Pm: ", "Pe: ", "eta: ", "fkr: ", "Uzsm:", "Pmax:", "Fzad:", "Imax:", "Fful:"}; - int DirPatch(int Coupler1, int Coupler2) { // poprawka dla liczenia sil przy ustawieniu przeciwnym obiektow return Coupler1 != Coupler2 ? 1 : -1; @@ -136,12 +130,6 @@ TMoverParameters::TMoverParameters(double VelInitial, std::string const &TypeNam cylindermult = 0.0; } - for (auto &eimcvalue : inductionMotor.config) - { - eimcvalue = 0.0; - } - inductionMotor.config[eimc_p_eped] = 1.5; - for (auto &couplerentry : Couplers) { couplerentry.AllowedFlag = Coupling::coupler | Coupling::brakeHose; // domyślnie hak i hamulec, inne trzeba włączyć jawnie w FIZ @@ -162,11 +150,6 @@ TMoverParameters::TMoverParameters(double VelInitial, std::string const &TypeNam Vel = abs(VelInitial); V = VelInitial / 3.6; - for (auto &eimvvalue : inductionMotor.state) - { - eimvvalue = 0.0; - } - RunningShape.Len = 1.0; RunningTrack.CategoryFlag = CategoryFlag; @@ -456,7 +439,7 @@ void TMoverParameters::compute_movement_(double const Deltatime) // Prad oddawany na rezystor // Wlacz wentylator jesli prad rekuperacji przekroczy maksymalny dla pasywnego chlodzenia rezystora - if (double Irh = abs(inductionMotor.state[eimv_Pe]) - abs(inductionMotor.state[eimv_Ipoj]); Irh > Imaxrpc && inductionMotor.state[eimv_Ipoj] < 0) + if (double Irh = abs(inductionMotor.state.electricalPower) - abs(inductionMotor.state.lineCurrent); Irh > Imaxrpc && inductionMotor.state.lineCurrent < 0) { BRVtimer = 0; BRVentilators = true; diff --git a/physics/components/controllers.cpp b/physics/components/controllers.cpp index c16a8104f..fc0e5e1ee 100644 --- a/physics/components/controllers.cpp +++ b/physics/components/controllers.cpp @@ -1002,8 +1002,8 @@ void TMoverParameters::CheckEIMIC(double dt) double brakeDemand = SplitEDPneumaticBrake ? DynamicBrakeRatio() : LocalBrakeRatio(); if (SplitEDPneumaticBrake) { - double const vh0 = inductionMotor.config[eimc_p_Vh0]; - double const vh1 = inductionMotor.config[eimc_p_Vh1]; + double const vh0 = inductionMotor.braking.offSpeed; + double const vh1 = inductionMotor.braking.fullSpeed; if (vh1 > vh0 + 0.001) { double const vhRamp = std::clamp((Vel - vh0) / (vh1 - vh0), 0.0, 1.0); diff --git a/physics/components/fizsections.cpp b/physics/components/fizsections.cpp index 3b2a4eaaa..7c2d082fc 100644 --- a/physics/components/fizsections.cpp +++ b/physics/components/fizsections.cpp @@ -1380,32 +1380,32 @@ void TMoverParameters::LoadFIZ_EngineInductionMotor(std::string const &Input) RVentnmax = 1.0; extract_value(NominalVoltage, "Volt", Input, ""); - extract_value(inductionMotor.config[eimc_s_dfic], "dfic", Input, ""); - extract_value(inductionMotor.config[eimc_s_dfmax], "dfmax", Input, ""); - extract_value(inductionMotor.config[eimc_s_p], "p", Input, ""); - extract_value(inductionMotor.config[eimc_s_cfu], "cfu", Input, ""); - extract_value(inductionMotor.config[eimc_s_cim], "cim", Input, ""); - extract_value(inductionMotor.config[eimc_s_icif], "icif", Input, ""); - extract_value(inductionMotor.config[eimc_f_Uzmax], "Uzmax", Input, ""); - extract_value(inductionMotor.config[eimc_f_Uzh], "Uzh", Input, ""); - extract_value(inductionMotor.config[eimc_f_DU], "DU", Input, ""); - extract_value(inductionMotor.config[eimc_f_I0], "I0", Input, ""); - extract_value(inductionMotor.config[eimc_f_cfu], "fcfu", Input, ""); - if (false == extract_value(inductionMotor.config[eimc_f_cfuH], "fcfuH", Input, "")) + extract_value(inductionMotor.motor.currentPerSlip, "dfic", Input, ""); + extract_value(inductionMotor.motor.maxSlipFrequency, "dfmax", Input, ""); + extract_value(inductionMotor.motor.polePairs, "p", Input, ""); + extract_value(inductionMotor.motor.voltsPerHertz, "cfu", Input, ""); + extract_value(inductionMotor.motor.torquePerCurrent, "cim", Input, ""); + extract_value(inductionMotor.motor.fieldCurrentRatio, "icif", Input, ""); + extract_value(inductionMotor.converter.maxLinkVoltage, "Uzmax", Input, ""); + extract_value(inductionMotor.converter.brakingLinkVoltage, "Uzh", Input, ""); + extract_value(inductionMotor.converter.voltageDrop, "DU", Input, ""); + extract_value(inductionMotor.converter.noLoadCurrent, "I0", Input, ""); + extract_value(inductionMotor.converter.voltsPerHertz, "fcfu", Input, ""); + if (false == extract_value(inductionMotor.converter.brakingVoltsPerHertz, "fcfuH", Input, "")) { // without its own figure the dynamic brake takes the one of the traction - inductionMotor.config[eimc_f_cfuH] = inductionMotor.config[eimc_f_cfu]; + inductionMotor.converter.brakingVoltsPerHertz = inductionMotor.converter.voltsPerHertz; } - extract_value(inductionMotor.config[eimc_p_F0], "F0", Input, ""); - extract_value(inductionMotor.config[eimc_p_a1], "a1", Input, ""); - extract_value(inductionMotor.config[eimc_p_Pmax], "Pmax", Input, ""); - extract_value(inductionMotor.config[eimc_p_Fh], "Fh", Input, ""); - extract_value(inductionMotor.config[eimc_p_Ph], "Ph", Input, ""); - extract_value(inductionMotor.config[eimc_p_Vh0], "Vh0", Input, ""); - extract_value(inductionMotor.config[eimc_p_Vh1], "Vh1", Input, ""); - extract_value(inductionMotor.config[eimc_p_Imax], "Imax", Input, ""); - extract_value(inductionMotor.config[eimc_p_abed], "abed", Input, ""); - extract_value(inductionMotor.config[eimc_p_eped], "edep", Input, ""); + extract_value(inductionMotor.traction.startingForce, "F0", Input, ""); + extract_value(inductionMotor.traction.forceDropPerSpeed, "a1", Input, ""); + extract_value(inductionMotor.traction.maxPower, "Pmax", Input, ""); + extract_value(inductionMotor.braking.maxForce, "Fh", Input, ""); + extract_value(inductionMotor.braking.maxPower, "Ph", Input, ""); + extract_value(inductionMotor.braking.offSpeed, "Vh0", Input, ""); + extract_value(inductionMotor.braking.fullSpeed, "Vh1", Input, ""); + extract_value(inductionMotor.traction.maxCurrent, "Imax", Input, ""); + extract_value(inductionMotor.braking.cylinderPressureGain, "abed", Input, ""); + extract_value(inductionMotor.braking.maxEpDeceleration, "edep", Input, ""); extract_value(inductionMotor.logForce, "eimclf", Input, ""); extract_value(inductionMotor.inverterCount, "InvNo", Input, ""); extract_value(inductionMotor.inverterControlCouplings, "InvCtrCplFlag", Input, ""); @@ -1413,7 +1413,7 @@ void TMoverParameters::LoadFIZ_EngineInductionMotor(std::string const &Input) extract_value(BRVto, "BRVto", Input, ""); extract_value(Flat, "Flat", Input, ""); - if (inductionMotor.config[eimc_p_Pmax] > 0 && Power > 0 && inductionMotor.inverterCount == 0) + if (inductionMotor.traction.maxPower > 0 && Power > 0 && inductionMotor.inverterCount == 0) { inductionMotor.inverterCount = 1; } diff --git a/physics/components/inductionmotor.h b/physics/components/inductionmotor.h index 0a53ffb5c..45fc35b12 100644 --- a/physics/components/inductionmotor.h +++ b/physics/components/inductionmotor.h @@ -13,6 +13,8 @@ http://mozilla.org/MPL/2.0/. #include #include +#include +#include #include // an inverter of the drive @@ -27,10 +29,87 @@ struct Inverter bool Failure_Const = false; }; +// the motor itself (the s_ entries of eimc before) +struct InductionMotorWinding +{ + double currentPerSlip = 0.0; // dfic: the torque current per hertz of slip, at full flux + double maxSlipFrequency = 0.0; // dfmax: the most slip the drive allows [Hz] + double polePairs = 0.0; // p: the pairs of poles + double voltsPerHertz = 0.0; // cfu: the voltage per hertz of full flux + double torquePerCurrent = 0.0; // cim: the torque per unit of flux and torque current + double fieldCurrentRatio = 0.0; // icif: the field current per unit of torque current +}; + +// the inverter feeding the motors (the f_ entries of eimc before) +struct InductionMotorConverter +{ + double maxLinkVoltage = 0.0; // Uzmax: the most voltage the inverter gives the motors in traction [V] + double brakingLinkVoltage = 0.0; // Uzh: the same in electrodynamic braking [V] + double voltageDrop = 0.0; // DU: the voltage lost in the inverter [V] + double noLoadCurrent = 0.0; // I0: the current the drive draws with no load [A] + double voltsPerHertz = 0.0; // fcfu: the voltage per hertz the inverter gives in traction + double brakingVoltsPerHertz = 0.0; // fcfuH: the same in electrodynamic braking, fcfu without it +}; + +// what the drive gives in traction (the p_ entries of eimc before) +struct InductionMotorTraction +{ + double startingForce = 0.0; // F0: the force at a standstill [kN] + double forceDropPerSpeed = 0.0; // a1: how much of the starting force each km/h takes away [kN/(km/h)] + double maxPower = 0.0; // Pmax: the most power [kW]; follows the table of the most power by the speed, where there is one + double maxCurrent = 0.0; // Imax: the most current of the motors [A] +}; + +// the electrodynamic brake of the drive (the p_ entries of eimc before) +struct InductionMotorBraking +{ + double maxForce = 0.0; // Fh: the most braking force [kN] + double maxPower = 0.0; // Ph: the most braking power [kW] + double offSpeed = 0.0; // Vh0: below this speed the electrodynamic brake gives nothing [km/h] + double fullSpeed = 0.0; // Vh1: above this speed the electrodynamic brake gives all it can; between the two it fades [km/h] + double cylinderPressureGain = 0.0; // abed: the share of the brake cylinder pressure the electrodynamic brake takes; 0: the air brake cuts it off + double maxEpDeceleration = 1.5; // edep: the most the electro-pneumatic brake of a vehicle decelerates its mass before the force goes elsewhere [m/s2] +}; + +// the values of the model of the drive in the step (eimv before) +struct InductionMotorState +{ + // the forces [kN] + double absoluteMaxForce = 0.0; // FMAXMAX: the most force the motors can give at the present speed and voltage + double maxForce = 0.0; // Fmax: the force at the present setting + double fullForce = 0.0; // Fful: the force at a full setting + double force = 0.0; // Fr: the force the motors give + double forceDemand = 0.0; // Fzad: the share of the force asked of the drive, negative in braking + // the frequencies + double slipShare = 0.0; // ks: the force against the most there is, the share of the most slip + double slipFrequency = 0.0; // df [Hz] + double supplyFrequency = 0.0; // fp: the frequency the inverter gives the motors [Hz] + double criticalFrequency = 0.0; // fkr: above this frequency the flux weakens [Hz] + // the motors + double linkVoltage = 0.0; // Uzsmax: the most voltage the inverter can give now [V] + double voltage = 0.0; // U: the voltage of the motors [V] + double flux = 0.0; // pole: the flux against the full one + double torqueCurrent = 0.0; // Ic + double fieldCurrent = 0.0; // If + double torque = 0.0; // M: of a motor + double lineCurrent = 0.0; // Ipoj: the current of the vehicle from the line [A] + double currentLimit = 0.0; // Imax: never set; shown in the debug panel + // the powers [kW] + double powerLimit = 0.0; // Pmax: the most power now, of traction or of braking + double mechanicalPower = 0.0; // Pm + double electricalPower = 0.0; // Pe + double efficiency = 0.0; // eta +}; + struct InductionMotor { + using Listing = std::array, 21>; + // the definition - std::array config; // the parameters, indexed by eimc_* (eimc before) + InductionMotorWinding motor; + InductionMotorConverter converter; + InductionMotorTraction traction; + InductionMotorBraking braking; std::map maxPowerTable; /*tablica mocy maksymalnej od predkosci*/ int inverterCount = 0; // number of inverters double inverterRatio = 0.0; @@ -38,8 +117,58 @@ struct InductionMotor bool logForce = false; // EIMCLogForce // the state - std::array state; // the values of the drive, indexed by eimv_* (eimv before) + InductionMotorState state; double forceShare = 0; /*realizowany procent dostepnej sily rozruchu/hamowania*/ double inverterFrequency{0.0}; // current frequency of power inverters std::vector inverters; // all inverters + + // the definition and the state with their labels, for the debug panel + Listing ConfigListing() const + { + return {{{"dfic: ", motor.currentPerSlip}, + {"dfmax:", motor.maxSlipFrequency}, + {"p: ", motor.polePairs}, + {"scfu: ", motor.voltsPerHertz}, + {"cim: ", motor.torquePerCurrent}, + {"icif: ", motor.fieldCurrentRatio}, + {"Uzmax:", converter.maxLinkVoltage}, + {"Uzh: ", converter.brakingLinkVoltage}, + {"DU: ", converter.voltageDrop}, + {"I0: ", converter.noLoadCurrent}, + {"fcfu: ", converter.voltsPerHertz}, + {"F0: ", traction.startingForce}, + {"a1: ", traction.forceDropPerSpeed}, + {"Pmax: ", traction.maxPower}, + {"Fh: ", braking.maxForce}, + {"Ph: ", braking.maxPower}, + {"Vh0: ", braking.offSpeed}, + {"Vh1: ", braking.fullSpeed}, + {"Imax: ", traction.maxCurrent}, + {"abed: ", braking.cylinderPressureGain}, + {"eped: ", braking.maxEpDeceleration}}}; + } + Listing StateListing() const + { + return {{{"Fkrt:", state.absoluteMaxForce}, + {"Fmax:", state.maxForce}, + {"ks: ", state.slipShare}, + {"df: ", state.slipFrequency}, + {"fp: ", state.supplyFrequency}, + {"Us: ", state.voltage}, + {"pole:", state.flux}, + {"Ic: ", state.torqueCurrent}, + {"If: ", state.fieldCurrent}, + {"M: ", state.torque}, + {"Fr: ", state.force}, + {"Ipoj:", state.lineCurrent}, + {"Pm: ", state.mechanicalPower}, + {"Pe: ", state.electricalPower}, + {"eta: ", state.efficiency}, + {"fkr: ", state.criticalFrequency}, + {"Uzsm:", state.linkVoltage}, + {"Pmax:", state.powerLimit}, + {"Fzad:", state.forceDemand}, + {"Imax:", state.currentLimit}, + {"Fful:", state.fullForce}}}; + } }; diff --git a/physics/components/traction.cpp b/physics/components/traction.cpp index 9e6f60d73..0c95bd223 100644 --- a/physics/components/traction.cpp +++ b/physics/components/traction.cpp @@ -524,8 +524,8 @@ double TMoverParameters::DynamicBrakeRatio(void) const // ************************************************************************************************* bool TMoverParameters::DynamicBrakeAvailable(void) const { - double const vh0{inductionMotor.config[eimc_p_Vh0]}; - if (double const vh1{inductionMotor.config[eimc_p_Vh1]}; vh1 <= 0.001) + double const vh0{inductionMotor.braking.offSpeed}; + if (double const vh1{inductionMotor.braking.fullSpeed}; vh1 <= 0.001) { // brak zdefiniowanej strefy - ED dziala zawsze return true; @@ -1070,7 +1070,7 @@ void TMoverParameters::InductionMotorTractionForce(double dt) inductionMotor.inverterRatio = ActiveInverters / (double)inductionMotor.inverterCount; if (inductionMotor.maxPowerTable.size() > 1) { - inductionMotor.config[eimc_p_Pmax] = TableInterpolation(inductionMotor.maxPowerTable, Vel); + inductionMotor.traction.maxPower = TableInterpolation(inductionMotor.maxPowerTable, Vel); } InductionMotorSpeedControl(dt); InductionMotorBrakeBlending(ActiveInverters, PosRatio, tmp); @@ -1195,7 +1195,7 @@ void TMoverParameters::SpeedControlByTime(double dt) void TMoverParameters::InductionMotorBrakeBlending(double const ActiveInverters, double &PosRatio, double &tmp) { InductionMotorDynamicBrakeFlag(); - auto const edBCP{Hamulec->GetEDBCP() * inductionMotor.config[eimc_p_abed]}; // stala napedu + auto const edBCP{Hamulec->GetEDBCP() * inductionMotor.braking.cylinderPressureGain}; // stala napedu if (DynamicBrakeFlag) { PosRatio = InductionMotorBrakeRatio(ActiveInverters, edBCP); @@ -1204,9 +1204,9 @@ void TMoverParameters::InductionMotorBrakeBlending(double const ActiveInverters, else { PosRatio = std::max(eimic_real, 0.); - inductionMotor.state[eimv_Fzad] = PosRatio; - if (Flat && inductionMotor.config[eimc_p_F0] * inductionMotor.state[eimv_Fful] > 0) - PosRatio = std::min(PosRatio * inductionMotor.config[eimc_p_F0] / inductionMotor.state[eimv_Fful], 1.); + inductionMotor.state.forceDemand = PosRatio; + if (Flat && inductionMotor.traction.startingForce * inductionMotor.state.fullForce > 0) + PosRatio = std::min(PosRatio * inductionMotor.traction.startingForce / inductionMotor.state.fullForce, 1.); /* if (ScndCtrlActualPos > 0) //speed control if (Vmax < 250) PosRatio = std::min(PosRatio, std::max(-1, 0.5 * (ScndCtrlActualPos - Vel))); @@ -1248,9 +1248,9 @@ double TMoverParameters::InductionMotorBrakeRatio(double const ActiveInverters, { double PosRatio; // ustalanie współczynnika blendingu do luzowania hamulca PN - if (inductionMotor.state[eimv_Fmax] * Sign(V) * DirAbsolute < -1) + if (inductionMotor.state.maxForce * Sign(V) * DirAbsolute < -1) { - PosRatio = -Sign(V) * DirAbsolute * inductionMotor.state[eimv_Fr] / (inductionMotor.config[eimc_p_Fh] * std::max(edBCP, std::max(0.01, Hamulec->GetEDBCP())) / MaxBrakePress[0]); + PosRatio = -Sign(V) * DirAbsolute * inductionMotor.state.force / (inductionMotor.braking.maxForce * std::max(edBCP, std::max(0.01, Hamulec->GetEDBCP())) / MaxBrakePress[0]); PosRatio = std::clamp(PosRatio, 0.0, 1.0); } else @@ -1262,27 +1262,27 @@ double TMoverParameters::InductionMotorBrakeRatio(double const ActiveInverters, PosRatio *= 0.9; Hamulec->SetED(std::max(0.0, std::min(PosRatio, 1.0))); // ustalenie stopnia zmniejszenia ciśnienia // ustalanie siły hamowania ED - if (Hamulec->GetEDBCP() > 0.25 && inductionMotor.config[eimc_p_abed] < 0.001 || ActiveInverters < inductionMotor.inverterCount) // jeśli PN wyłącza ED + if (Hamulec->GetEDBCP() > 0.25 && inductionMotor.braking.cylinderPressureGain < 0.001 || ActiveInverters < inductionMotor.inverterCount) // jeśli PN wyłącza ED { PosRatio = 0; - inductionMotor.state[eimv_Fzad] = 0; + inductionMotor.state.forceDemand = 0; } else { // strefa wylaczenia ED (Vh0..Vh1) - mnoznik 0..1 zaleznie od predkosci - double const vhRamp = std::max(0.0, std::min(1.0, (Vel - inductionMotor.config[eimc_p_Vh0]) / (inductionMotor.config[eimc_p_Vh1] - inductionMotor.config[eimc_p_Vh0]))); + double const vhRamp = std::max(0.0, std::min(1.0, (Vel - inductionMotor.braking.offSpeed) / (inductionMotor.braking.fullSpeed - inductionMotor.braking.offSpeed))); if (SplitEDPneumaticBrake) { // w trybie split LocalBrake nie zaleca ED; uzywany jest DynamicBrakeCtrl // oraz zwykle zapotrzebowanie z hamulca zespolonego (edBCP) double const edLeverDemand = DynamicBrakeRatio(); PosRatio = -std::max(std::max(edLeverDemand, std::min(edBCP / MaxBrakePress[0], 1.0)), AnPos) * vhRamp; - inductionMotor.state[eimv_Fzad] = -std::min(1.0, std::max(edLeverDemand, edBCP / MaxBrakePress[0])); + inductionMotor.state.forceDemand = -std::min(1.0, std::max(edLeverDemand, edBCP / MaxBrakePress[0])); } else { PosRatio = -std::max(std::min(edBCP * 1.0 / MaxBrakePress[0], 1.0), AnPos) * vhRamp; - inductionMotor.state[eimv_Fzad] = -std::min(1.0, std::max(LocalBrakeRatio(), edBCP / MaxBrakePress[0])); + inductionMotor.state.forceDemand = -std::min(1.0, std::max(LocalBrakeRatio(), edBCP / MaxBrakePress[0])); } } return PosRatio; @@ -1293,30 +1293,30 @@ void TMoverParameters::InductionMotorDrive(double dt) { double tmp; if (DynamicBrakeFlag) - tmp = inductionMotor.config[eimc_f_Uzh]; + tmp = inductionMotor.converter.brakingLinkVoltage; else - tmp = inductionMotor.config[eimc_f_Uzmax]; + tmp = inductionMotor.converter.maxLinkVoltage; - auto f_cfu{DynamicBrakeFlag ? inductionMotor.config[eimc_f_cfuH] : inductionMotor.config[eimc_f_cfu]}; + auto f_cfu{DynamicBrakeFlag ? inductionMotor.converter.brakingVoltsPerHertz : inductionMotor.converter.voltsPerHertz}; - inductionMotor.state[eimv_Uzsmax] = std::min(EngineVoltage - inductionMotor.config[eimc_f_DU], tmp); - inductionMotor.state[eimv_fkr] = inductionMotor.state[eimv_Uzsmax] / f_cfu; + inductionMotor.state.linkVoltage = std::min(EngineVoltage - inductionMotor.converter.voltageDrop, tmp); + inductionMotor.state.criticalFrequency = inductionMotor.state.linkVoltage / f_cfu; if (inductionMotor.forceShare < 0) { - inductionMotor.state[eimv_Pmax] = inductionMotor.config[eimc_p_Ph]; + inductionMotor.state.powerLimit = inductionMotor.braking.maxPower; } else { - inductionMotor.state[eimv_Pmax] = std::min(inductionMotor.config[eimc_p_Pmax], 0.001 * EngineVoltage * (inductionMotor.config[eimc_p_Imax] - inductionMotor.config[eimc_f_I0]) * Pirazy2 * inductionMotor.config[eimc_s_cim] / inductionMotor.config[eimc_s_p] / inductionMotor.config[eimc_s_cfu]); + inductionMotor.state.powerLimit = std::min(inductionMotor.traction.maxPower, 0.001 * EngineVoltage * (inductionMotor.traction.maxCurrent - inductionMotor.converter.noLoadCurrent) * Pirazy2 * inductionMotor.motor.torquePerCurrent / inductionMotor.motor.polePairs / inductionMotor.motor.voltsPerHertz); if (GensetSelected()) { // on the genset of a dual-mode vehicle the traction takes no more than the genset gives - inductionMotor.state[eimv_Pmax] = std::min(inductionMotor.state[eimv_Pmax], GensetTractionPowerLimit()); + inductionMotor.state.powerLimit = std::min(inductionMotor.state.powerLimit, GensetTractionPowerLimit()); } } - inductionMotor.state[eimv_FMAXMAX] = 0.001 * - square(std::min(1.0, inductionMotor.state[eimv_fkr] / std::max(abs(enrot) * inductionMotor.config[eimc_s_p] + inductionMotor.config[eimc_s_dfmax] * inductionMotor.state[eimv_ks], inductionMotor.config[eimc_s_dfmax])) * f_cfu / inductionMotor.config[eimc_s_cfu]) * - (inductionMotor.config[eimc_s_dfmax] * inductionMotor.config[eimc_s_dfic] * inductionMotor.config[eimc_s_cim]) * Transmision.Ratio * NPoweredAxles * 2.0 / WheelDiameter; + inductionMotor.state.absoluteMaxForce = 0.001 * + square(std::min(1.0, inductionMotor.state.criticalFrequency / std::max(abs(enrot) * inductionMotor.motor.polePairs + inductionMotor.motor.maxSlipFrequency * inductionMotor.state.slipShare, inductionMotor.motor.maxSlipFrequency)) * f_cfu / inductionMotor.motor.voltsPerHertz) * + (inductionMotor.motor.maxSlipFrequency * inductionMotor.motor.currentPerSlip * inductionMotor.motor.torquePerCurrent) * Transmision.Ratio * NPoweredAxles * 2.0 / WheelDiameter; InductionMotorForceLimits(); for (auto &inv : inductionMotor.inverters) { @@ -1324,26 +1324,26 @@ void TMoverParameters::InductionMotorDrive(double dt) inv.Error = inv.Failure_Const || (inv.Failure_Drive && inv.Request != 0); inv.IsActive = inv.Activate && !inv.Error; } - inductionMotor.state[eimv_ks] = inductionMotor.state[eimv_Fr] / inductionMotor.state[eimv_FMAXMAX]; - inductionMotor.state[eimv_df] = inductionMotor.state[eimv_ks] * inductionMotor.config[eimc_s_dfmax]; - inductionMotor.state[eimv_fp] = DirAbsolute * enrot * inductionMotor.config[eimc_s_p] + inductionMotor.state[eimv_df]; // do przemyslenia dzialanie pp z tmpV - // inductionMotor.state[eimv_U]:=std::max(inductionMotor.state[eimv_Uzsmax],std::min(inductionMotor.config[eimc_f_cfu]*inductionMotor.state[eimv_fp],inductionMotor.state[eimv_Uzsmax])); - // inductionMotor.state[eimv_pole]:=inductionMotor.state[eimv_U]/(inductionMotor.state[eimv_fp]*inductionMotor.config[eimc_s_cfu]); - if (abs(inductionMotor.state[eimv_fp]) <= inductionMotor.state[eimv_fkr]) - inductionMotor.state[eimv_pole] = f_cfu / inductionMotor.config[eimc_s_cfu]; + inductionMotor.state.slipShare = inductionMotor.state.force / inductionMotor.state.absoluteMaxForce; + inductionMotor.state.slipFrequency = inductionMotor.state.slipShare * inductionMotor.motor.maxSlipFrequency; + inductionMotor.state.supplyFrequency = DirAbsolute * enrot * inductionMotor.motor.polePairs + inductionMotor.state.slipFrequency; // do przemyslenia dzialanie pp z tmpV + // inductionMotor.state.voltage:=std::max(inductionMotor.state.linkVoltage,std::min(inductionMotor.converter.voltsPerHertz*inductionMotor.state.supplyFrequency,inductionMotor.state.linkVoltage)); + // inductionMotor.state.flux:=inductionMotor.state.voltage/(inductionMotor.state.supplyFrequency*inductionMotor.motor.voltsPerHertz); + if (abs(inductionMotor.state.supplyFrequency) <= inductionMotor.state.criticalFrequency) + inductionMotor.state.flux = f_cfu / inductionMotor.motor.voltsPerHertz; else - inductionMotor.state[eimv_pole] = inductionMotor.state[eimv_Uzsmax] / inductionMotor.config[eimc_s_cfu] / abs(inductionMotor.state[eimv_fp]); - inductionMotor.state[eimv_U] = inductionMotor.state[eimv_pole] * inductionMotor.state[eimv_fp] * inductionMotor.config[eimc_s_cfu]; - inductionMotor.state[eimv_Ic] = (inductionMotor.state[eimv_fp] - DirAbsolute * enrot * inductionMotor.config[eimc_s_p]) * inductionMotor.config[eimc_s_dfic] * inductionMotor.state[eimv_pole]; - inductionMotor.state[eimv_If] = inductionMotor.state[eimv_Ic] * inductionMotor.config[eimc_s_icif]; - inductionMotor.state[eimv_M] = inductionMotor.state[eimv_pole] * inductionMotor.state[eimv_Ic] * inductionMotor.config[eimc_s_cim]; - inductionMotor.state[eimv_Ipoj] = inductionMotor.state[eimv_Ic] * NPoweredAxles * inductionMotor.inverterRatio * inductionMotor.state[eimv_U] / (EngineVoltage - inductionMotor.config[eimc_f_DU]) + inductionMotor.config[eimc_f_I0]; - inductionMotor.state[eimv_Pm] = DirActive * inductionMotor.state[eimv_M] * NPoweredAxles * inductionMotor.inverterRatio * enrot * Pirazy2 / 1000; - inductionMotor.state[eimv_Pe] = inductionMotor.state[eimv_Ipoj] * EngineVoltage / 1000; - inductionMotor.state[eimv_eta] = inductionMotor.state[eimv_Pm] / inductionMotor.state[eimv_Pe]; + inductionMotor.state.flux = inductionMotor.state.linkVoltage / inductionMotor.motor.voltsPerHertz / abs(inductionMotor.state.supplyFrequency); + inductionMotor.state.voltage = inductionMotor.state.flux * inductionMotor.state.supplyFrequency * inductionMotor.motor.voltsPerHertz; + inductionMotor.state.torqueCurrent = (inductionMotor.state.supplyFrequency - DirAbsolute * enrot * inductionMotor.motor.polePairs) * inductionMotor.motor.currentPerSlip * inductionMotor.state.flux; + inductionMotor.state.fieldCurrent = inductionMotor.state.torqueCurrent * inductionMotor.motor.fieldCurrentRatio; + inductionMotor.state.torque = inductionMotor.state.flux * inductionMotor.state.torqueCurrent * inductionMotor.motor.torquePerCurrent; + inductionMotor.state.lineCurrent = inductionMotor.state.torqueCurrent * NPoweredAxles * inductionMotor.inverterRatio * inductionMotor.state.voltage / (EngineVoltage - inductionMotor.converter.voltageDrop) + inductionMotor.converter.noLoadCurrent; + inductionMotor.state.mechanicalPower = DirActive * inductionMotor.state.torque * NPoweredAxles * inductionMotor.inverterRatio * enrot * Pirazy2 / 1000; + inductionMotor.state.electricalPower = inductionMotor.state.lineCurrent * EngineVoltage / 1000; + inductionMotor.state.efficiency = inductionMotor.state.mechanicalPower / inductionMotor.state.electricalPower; - Im = inductionMotor.state[eimv_If]; - if (inductionMotor.state[eimv_Ipoj] >= 0) + Im = inductionMotor.state.fieldCurrent; + if (inductionMotor.state.lineCurrent >= 0) Vadd *= 1.0 - 2.0 * dt; else if (GensetSelected()) Vadd = 1.0; // the genset of a dual-mode vehicle takes nothing back: all the braking energy to the resistors @@ -1351,17 +1351,17 @@ void TMoverParameters::InductionMotorDrive(double dt) Vadd *= 1.0 - dt; else Vadd = std::max(Vadd * (1.0 - 0.2 * dt), 0.007 * (std::abs(EngineVoltage) - (EnginePowerSource.CollectorParameters.MaxV - 100))); - Itot = inductionMotor.state[eimv_Ipoj] * (0.01 + std::min(0.99, 0.99 - Vadd)); + Itot = inductionMotor.state.lineCurrent * (0.01 + std::min(0.99, 0.99 - Vadd)); - EnginePower = abs(inductionMotor.state[eimv_Ic] * inductionMotor.state[eimv_U] * NPoweredAxles) / 1000; + EnginePower = abs(inductionMotor.state.torqueCurrent * inductionMotor.state.voltage * NPoweredAxles) / 1000; // power inverters UpdateInverterFrequency(); - Mm = inductionMotor.state[eimv_M] * DirAbsolute; + Mm = inductionMotor.state.torque * DirAbsolute; Mw = Mm * Transmision.Ratio * Transmision.Efficiency; Fw = Mw * 2.0 / WheelDiameter; Ft = Fw * NPoweredAxles * inductionMotor.inverterRatio; - inductionMotor.state[eimv_Fr] = DirAbsolute * Ft / 1000; + inductionMotor.state.force = DirAbsolute * Ft / 1000; } // the force the motors give at full and at the setting (inductionMotor.forceShare), braking within the power and the force of the @@ -1370,38 +1370,38 @@ void TMoverParameters::InductionMotorForceLimits() { if (inductionMotor.forceShare < 0) { - inductionMotor.state[eimv_Fful] = std::min(inductionMotor.config[eimc_p_Ph] * 3.6 / (Vel != 0.0 ? Vel : 0.001), std::min(inductionMotor.config[eimc_p_Fh], inductionMotor.state[eimv_FMAXMAX])); - inductionMotor.state[eimv_Fmax] = -Sign(V) * DirAbsolute*std::min(inductionMotor.config[eimc_p_Ph] * 3.6 / (Vel != 0.0 ? Vel : 0.001), std::min(-inductionMotor.config[eimc_p_Fh] * inductionMotor.forceShare, inductionMotor.state[eimv_FMAXMAX])); + inductionMotor.state.fullForce = std::min(inductionMotor.braking.maxPower * 3.6 / (Vel != 0.0 ? Vel : 0.001), std::min(inductionMotor.braking.maxForce, inductionMotor.state.absoluteMaxForce)); + inductionMotor.state.maxForce = -Sign(V) * DirAbsolute*std::min(inductionMotor.braking.maxPower * 3.6 / (Vel != 0.0 ? Vel : 0.001), std::min(-inductionMotor.braking.maxForce * inductionMotor.forceShare, inductionMotor.state.absoluteMaxForce)); double pr = inductionMotor.forceShare; if (inductionMotor.logForce) pr = -log(1 - 4 * pr) / log(5); - inductionMotor.state[eimv_Fr] = -Sign(V) * DirAbsolute*std::min(inductionMotor.config[eimc_p_Ph] * 3.6 / (Vel != 0.0 ? Vel : 0.001), std::min(-inductionMotor.config[eimc_p_Fh] * pr, inductionMotor.state[eimv_FMAXMAX])); + inductionMotor.state.force = -Sign(V) * DirAbsolute*std::min(inductionMotor.braking.maxPower * 3.6 / (Vel != 0.0 ? Vel : 0.001), std::min(-inductionMotor.braking.maxForce * pr, inductionMotor.state.absoluteMaxForce)); if (inductionMotor.inverterRatio < 1.0) - inductionMotor.state[eimv_Fful] = 0; - //*std::min(1,(Vel-inductionMotor.config[eimc_p_Vh0])/(inductionMotor.config[eimc_p_Vh1]-inductionMotor.config[eimc_p_Vh0])) + inductionMotor.state.fullForce = 0; + //*std::min(1,(Vel-inductionMotor.braking.offSpeed)/(inductionMotor.braking.fullSpeed-inductionMotor.braking.offSpeed)) } else { - inductionMotor.state[eimv_Fful] = std::min(std::min(3.6 * inductionMotor.state[eimv_Pmax] / std::max(Vel, 1.), inductionMotor.config[eimc_p_F0] - Vel * inductionMotor.config[eimc_p_a1]), inductionMotor.state[eimv_FMAXMAX]); + inductionMotor.state.fullForce = std::min(std::min(3.6 * inductionMotor.state.powerLimit / std::max(Vel, 1.), inductionMotor.traction.startingForce - Vel * inductionMotor.traction.forceDropPerSpeed), inductionMotor.state.absoluteMaxForce); // if(not Flat)then - inductionMotor.state[eimv_Fmax] = inductionMotor.state[eimv_Fful] * inductionMotor.forceShare; + inductionMotor.state.maxForce = inductionMotor.state.fullForce * inductionMotor.forceShare; // else - // inductionMotor.state[eimv_Fmax]:=std::min(inductionMotor.config[eimc_p_F0]*inductionMotor.forceShare,inductionMotor.state[eimv_Fful]); + // inductionMotor.state.maxForce:=std::min(inductionMotor.traction.startingForce*inductionMotor.forceShare,inductionMotor.state.fullForce); double pr = inductionMotor.forceShare; if (inductionMotor.logForce) pr = log(1 + 4 * pr) / log(5); - inductionMotor.state[eimv_Fr] = inductionMotor.state[eimv_Fful] * pr; + inductionMotor.state.force = inductionMotor.state.fullForce * pr; } } // the frequency of the inverters at the motors' slip frequency, from the list of the drive or of its brake void TMoverParameters::UpdateInverterFrequency() { - auto const tmpV{std::abs(inductionMotor.state[eimv_fp])}; + auto const tmpV{std::abs(inductionMotor.state.supplyFrequency)}; auto const useFFEDList = FFEDListSize > 0 && DynamicBrakeFlag; auto const list = useFFEDList ? FFEDlist : FFlist; - if (auto const listSize = useFFEDList ? FFEDListSize : FFListSize; listSize > 0 && std::abs(inductionMotor.state[eimv_If]) > 1.0 && tmpV > 0.0001) + if (auto const listSize = useFFEDList ? FFEDListSize : FFListSize; listSize > 0 && std::abs(inductionMotor.state.fieldCurrent) > 1.0 && tmpV > 0.0001) { int i = 0; @@ -1434,8 +1434,7 @@ void TMoverParameters::InductionMotorOff() inductionMotor.forceShare = 0.0; EnginePower = 0.0; { - for (auto &eimvvalue : inductionMotor.state) - eimvvalue = 0.0; + inductionMotor.state = {}; } Hamulec->SetED(0.0); inductionMotor.inverterFrequency = 0.0; //(Hamulec as TLSt).SetLBP(LocBrakePress); diff --git a/physics/mover.h b/physics/mover.h index 64a555d23..dba810ef7 100644 --- a/physics/mover.h +++ b/physics/mover.h @@ -1148,7 +1148,6 @@ class TMoverParameters /*- dla lokomotyw z silnikami indukcyjnymi -*/ // the drive of induction motors (physics/components/inductionmotor.h) InductionMotor inductionMotor; - static std::vector const eimc_labels; int Imaxrpc = 0; // Maksymalny prad rezystora hamowania chlodzonego pasywnie int BRVto = 0; // Czas jaki wentylatory jeszcze dodatkowo schladzaja rezystor double BRVtimer = 0; // Timer dla podtrzymania wentylatora @@ -1480,7 +1479,6 @@ class TMoverParameters bool EIMCtrlAdditionalZeros = false; /*czy ma dodatkowe zero jazdy i zero hamowania */ bool EIMCtrlEmergency = false; /*czy ma dodatkowe zero jazdy i zero hamowania */ bool EIMCtrlMainEmergency = false; /*czy zadajnik typu 2 (Elf) ma pozycje hamowania naglego ponizej swojej pozycji 0*/ - static std::vector const eimv_labels; double SpeedCtrlTimer = 0; /*zegar dzialania tempomatu z wybieralna predkoscia*/ double eimicSpeedCtrl = 1; /*pozycja sugerowana przez tempomat*/ double eimicSpeedCtrlIntegral = 0; /*calkowany blad ustawienia predkosci*/ @@ -1670,7 +1668,7 @@ class TMoverParameters bool EIMDirectionChangeAllow(void) const; inline double IsVehicleEIMBrakingFactor() const { - return DynamicBrakeFlag && ResistorsFlag ? 0.0 : inductionMotor.state[eimv_Ipoj] < 0 ? -1.0 : 1.0; + return DynamicBrakeFlag && ResistorsFlag ? 0.0 : inductionMotor.state.lineCurrent < 0 ? -1.0 : 1.0; } void BrakeLevelSet(double b); bool BrakeLevelAdd(double b); diff --git a/physics/vehicletypes.h b/physics/vehicletypes.h index d61ad32b1..3e133b0f7 100644 --- a/physics/vehicletypes.h +++ b/physics/vehicletypes.h @@ -421,96 +421,6 @@ enum class train_type skoda181, }; -// stałe dla asynchronów -/// EIM config index: dfic — frequency rise rate at start. -static int const eimc_s_dfic = 0; -/// EIM config index: dfmax — maximum frequency rate of change. -static int const eimc_s_dfmax = 1; -/// EIM config index: p — number of pole pairs. -static int const eimc_s_p = 2; -/// EIM config index: cfu — voltage / frequency conversion coefficient. -static int const eimc_s_cfu = 3; -/// EIM config index: cim — current / current conversion coefficient. -static int const eimc_s_cim = 4; -/// EIM config index: icif — magnetisation current ratio. -static int const eimc_s_icif = 5; -/// EIM config index: Uzmax — maximum DC link voltage. -static int const eimc_f_Uzmax = 7; -/// EIM config index: Uzh — DC link voltage at field-weakening transition. -static int const eimc_f_Uzh = 8; -/// EIM config index: DU — voltage drop at the converter. -static int const eimc_f_DU = 9; -/// EIM config index: I0 — no-load magnetising current. -static int const eimc_f_I0 = 10; -/// EIM config index: cfu — V/f gain in normal mode. -static int const eimc_f_cfu = 11; -/// EIM config index: cfuH — V/f gain in field-weakening region. -static int const eimc_f_cfuH = 12; -/// EIM config index: F0 — starting force at zero speed. -static int const eimc_p_F0 = 13; -/// EIM config index: a1 — force-frequency slope coefficient. -static int const eimc_p_a1 = 14; -/// EIM config index: Pmax — maximum power. -static int const eimc_p_Pmax = 15; -/// EIM config index: Fh — force at field-weakening point. -static int const eimc_p_Fh = 16; -/// EIM config index: Ph — power at field-weakening point. -static int const eimc_p_Ph = 17; -/// EIM config index: Vh0 — speed where field weakening begins. -static int const eimc_p_Vh0 = 18; -/// EIM config index: Vh1 — speed of full field weakening. -static int const eimc_p_Vh1 = 19; -/// EIM config index: Imax — maximum motor current. -static int const eimc_p_Imax = 20; -/// EIM config index: abed — anti-skid set point. -static int const eimc_p_abed = 21; -/// EIM config index: eped — EP brake intensity bias. -static int const eimc_p_eped = 22; - -// zmienne dla asynchronów -/// EIM variable index: FMAXMAX — absolute maximum allowable force. -static int const eimv_FMAXMAX = 0; -/// EIM variable index: Fmax — current force limit. -static int const eimv_Fmax = 1; -/// EIM variable index: ks — slip coefficient. -static int const eimv_ks = 2; -/// EIM variable index: df — frequency offset. -static int const eimv_df = 3; -/// EIM variable index: fp — base frequency. -static int const eimv_fp = 4; -/// EIM variable index: U — applied voltage. -static int const eimv_U = 5; -/// EIM variable index: pole — pole-pair indicator. -static int const eimv_pole = 6; -/// EIM variable index: Ic — control current. -static int const eimv_Ic = 7; -/// EIM variable index: If — field current. -static int const eimv_If = 8; -/// EIM variable index: M — torque. -static int const eimv_M = 9; -/// EIM variable index: Fr — actual force. -static int const eimv_Fr = 10; -/// EIM variable index: Ipoj — line current. -static int const eimv_Ipoj = 11; -/// EIM variable index: Pm — mechanical power. -static int const eimv_Pm = 12; -/// EIM variable index: Pe — electrical power. -static int const eimv_Pe = 13; -/// EIM variable index: eta — efficiency. -static int const eimv_eta = 14; -/// EIM variable index: fkr — critical frequency. -static int const eimv_fkr = 15; -/// EIM variable index: Uzsmax — maximum measured DC link voltage. -static int const eimv_Uzsmax = 16; -/// EIM variable index: Pmax — instantaneous power limit. -static int const eimv_Pmax = 17; -/// EIM variable index: Fzad — set-point force. -static int const eimv_Fzad = 18; -/// EIM variable index: Imax — maximum allowed current. -static int const eimv_Imax = 19; -/// EIM variable index: Fful — full force. -static int const eimv_Fful = 20; - /// Brake-of-mode flag: PS (pneumatic, primary). static int const bom_PS = 1; /// Brake-of-mode flag: PN (pneumatic, no electrodynamic). diff --git a/tests/unit/test_definition.cpp b/tests/unit/test_definition.cpp index 518f9b73f..e9a79d9e4 100644 --- a/tests/unit/test_definition.cpp +++ b/tests/unit/test_definition.cpp @@ -122,7 +122,7 @@ TEST_CASE("definition: the compressor's limits set apart for the rear cab") { } TEST_CASE("definition: the highest power of an induction motor drive by the speed (PmaxList)") { - // the drive's power limit (eimc_p_Pmax) follows the table, between its rows and, by the last two, past its end + // the drive's power limit (traction.maxPower) follows the table, between its rows and, by the last two, past its end auto eu47{definition::fiz("e186_v2/eu47").set("PmaxList", "Size", 3).set("PmaxList", "rows", {{0, 1000}, {50, 3000}, {100, 5600}})}; auto const table{[](double Speed) { return Speed < 50.0 ? 1000.0 + 40.0 * Speed : 3000.0 + 52.0 * (Speed - 50.0); }}; for (auto const speed : {25.0, 75.0, 150.0}) { @@ -131,7 +131,7 @@ TEST_CASE("definition: the highest power of an induction motor drive by the spee auto driven{test::driving(real)}; test::track const line{0.0, 0.0, test::catenary_3kv}; REQUIRE(test::start_up(driven, line)); - CHECK(real->inductionMotor.config[eimc_p_Pmax] == doctest::Approx(table(real->Vel)).epsilon(0.01)); + CHECK(real->inductionMotor.traction.maxPower == doctest::Approx(table(real->Vel)).epsilon(0.01)); } } diff --git a/tests/unit/test_elf_controller.cpp b/tests/unit/test_elf_controller.cpp index 138689f68..d099c3303 100644 --- a/tests/unit/test_elf_controller.cpp +++ b/tests/unit/test_elf_controller.cpp @@ -530,7 +530,7 @@ TEST_CASE("elf holding brake: the force of the motors at 1% against the holding unit.wait(5.0); auto const holding{cab.StopBrakeDecc * mass}; MESSAGE("mass " << mass << " kg, holding " << holding << " N, cars with motors " << powered << ", demand " << cab.eimic_real << ", cab car Ft " << cab.Ft - << " N, Fful " << cab.inductionMotor.state[eimv_Fful] << " kN, speed " << cab.Vel << " km/h after 5 s"); + << " N, Fful " << cab.inductionMotor.state.fullForce << " kN, speed " << cab.Vel << " km/h after 5 s"); CHECK(cab.eimic_real == doctest::Approx(0.01).epsilon(0.02)); CHECK(cab.Ft * powered < 0.1 * holding); } diff --git a/tests/unit/test_fcfuh_default.cpp b/tests/unit/test_fcfuh_default.cpp index e86f29e7b..f52a7cdd5 100644 --- a/tests/unit/test_fcfuh_default.cpp +++ b/tests/unit/test_fcfuh_default.cpp @@ -142,12 +142,12 @@ TEST_CASE("fcfuH: the loader gives the dynamic brake the traction's figure when CAPTURE(fcfu); // the EU47's definition has fcfu only vehicle eu47{definition::fiz("e186_v2/eu47").set("Engine", "fcfu", fcfu)}; - CHECK(eu47->inductionMotor.config[eimc_f_cfu] == read_fcfu(fcfu)); - CHECK(bits(eu47->inductionMotor.config[eimc_f_cfuH]) == bits(eu47->inductionMotor.config[eimc_f_cfu])); - CHECK(bits(eu47->inductionMotor.config[eimc_f_cfuH]) == bits(fcfuh_before(read_fcfu(fcfu)))); + CHECK(eu47->inductionMotor.converter.voltsPerHertz == read_fcfu(fcfu)); + CHECK(bits(eu47->inductionMotor.converter.brakingVoltsPerHertz) == bits(eu47->inductionMotor.converter.voltsPerHertz)); + CHECK(bits(eu47->inductionMotor.converter.brakingVoltsPerHertz) == bits(fcfuh_before(read_fcfu(fcfu)))); // its own figure is kept vehicle own{definition::fiz("e186_v2/eu47").set("Engine", "fcfu", fcfu).set("Engine", "fcfuH", "40.1")}; - CHECK(own->inductionMotor.config[eimc_f_cfu] == read_fcfu(fcfu)); - CHECK(own->inductionMotor.config[eimc_f_cfuH] == read_fcfu("40.1")); + CHECK(own->inductionMotor.converter.voltsPerHertz == read_fcfu(fcfu)); + CHECK(own->inductionMotor.converter.brakingVoltsPerHertz == read_fcfu("40.1")); } } diff --git a/tests/unit/test_genset.cpp b/tests/unit/test_genset.cpp index cba96800f..cb39e532d 100644 --- a/tests/unit/test_genset.cpp +++ b/tests/unit/test_genset.cpp @@ -492,7 +492,7 @@ braking brake_from_60(vehicle &Dragon, track const &Track) { for (auto step_count = 0L; step_count < 2000; ++step_count) { step(Dragon, step_count, Track); result.lowest_current = std::min(result.lowest_current, cab.Itot); - result.electrodynamic |= cab.inductionMotor.forceShare < 0.0 && cab.inductionMotor.state[eimv_Ipoj] < 0.0; + result.electrodynamic |= cab.inductionMotor.forceShare < 0.0 && cab.inductionMotor.state.lineCurrent < 0.0; } result.speed_lost = speed - cab.Vel; return result; diff --git a/vehicle/cab/equipmentcommands.cpp b/vehicle/cab/equipmentcommands.cpp index a7c232c01..38c90754d 100644 --- a/vehicle/cab/equipmentcommands.cpp +++ b/vehicle/cab/equipmentcommands.cpp @@ -417,7 +417,7 @@ void TTrain::OnCommand_inverterenable(TTrain *Train, command_data const &Command TDynamicObject *p = Train->DynamicObject->GetFirstDynamic(Train->mvOccupied->CabOccupied < 0 ? end::rear : end::front, flag); while (p) { - if (p->MoverParameters->inductionMotor.config[eimc_p_Pmax] > 1) + if (p->MoverParameters->inductionMotor.traction.maxPower > 1) { if (itemindex < p->MoverParameters->inductionMotor.inverterCount) { @@ -456,7 +456,7 @@ void TTrain::OnCommand_inverterdisable(TTrain *Train, command_data const &Comman TDynamicObject *p = Train->DynamicObject->GetFirstDynamic(Train->mvOccupied->CabOccupied < 0 ? end::rear : end::front, flag); while (p) { - if (p->MoverParameters->inductionMotor.config[eimc_p_Pmax] > 1) + if (p->MoverParameters->inductionMotor.traction.maxPower > 1) { if (itemindex < p->MoverParameters->inductionMotor.inverterCount) { @@ -495,7 +495,7 @@ void TTrain::OnCommand_invertertoggle(TTrain *Train, command_data const &Command TDynamicObject *p = Train->DynamicObject->GetFirstDynamic(Train->mvOccupied->CabOccupied < 0 ? end::rear : end::front, flag); while (p) { - if (p->MoverParameters->inductionMotor.config[eimc_p_Pmax] > 1) + if (p->MoverParameters->inductionMotor.traction.maxPower > 1) { if (itemindex < p->MoverParameters->inductionMotor.inverterCount) { diff --git a/vehicle/cab/setup.cpp b/vehicle/cab/setup.cpp index 80ffd7fe6..3af70a82e 100644 --- a/vehicle/cab/setup.cpp +++ b/vehicle/cab/setup.cpp @@ -1184,7 +1184,7 @@ void TTrain::set_cab_controls(int const Cab) TDynamicObject *p = DynamicObject->GetFirstDynamic(mvOccupied->CabOccupied < 0 ? end::rear : end::front, flag); while (p) { - if (p->MoverParameters->inductionMotor.config[eimc_p_Pmax] > 1) + if (p->MoverParameters->inductionMotor.traction.maxPower > 1) { if (itemindex < p->MoverParameters->inductionMotor.inverterCount) { diff --git a/vehicle/cab/train.cpp b/vehicle/cab/train.cpp index 2bdb38b0b..9920635bb 100644 --- a/vehicle/cab/train.cpp +++ b/vehicle/cab/train.cpp @@ -319,7 +319,7 @@ std::shared_ptr TTrain::GetTrainState(dictionary_source const int in = 0; while (p && in < 8) { - if (p->MoverParameters->inductionMotor.config[eimc_p_Pmax] > 1) + if (p->MoverParameters->inductionMotor.traction.maxPower > 1) { in++; dict->insert("eimp_c" + std::to_string(in) + "_invno", p->MoverParameters->inductionMotor.inverterCount); diff --git a/vehicle/cab/update.cpp b/vehicle/cab/update.cpp index 1f883ea4d..1639801b5 100644 --- a/vehicle/cab/update.cpp +++ b/vehicle/cab/update.cpp @@ -349,17 +349,17 @@ bool TTrain::Update(double const Deltatime) bCompressors.emplace_back(p->MoverParameters->CompressorAllow || p->MoverParameters->CompressorStart == start_t::automatic, p->MoverParameters->CompressorFlag, i); } bSlip[i] = p->MoverParameters->SlippingWheels; - if (in < 8 && p->MoverParameters->inductionMotor.config[eimc_p_Pmax] > 1) + if (in < 8 && p->MoverParameters->inductionMotor.traction.maxPower > 1) { - fEIMParams[1 + in][0] = static_cast(p->MoverParameters->inductionMotor.state[eimv_Fmax]); + fEIMParams[1 + in][0] = static_cast(p->MoverParameters->inductionMotor.state.maxForce); fEIMParams[1 + in][1] = std::max(fEIMParams[1 + in][0], 0.f); fEIMParams[1 + in][2] = -std::min(fEIMParams[1 + in][0], 0.f); - fEIMParams[1 + in][3] = static_cast(p->MoverParameters->inductionMotor.state[eimv_Fmax] / std::max(p->MoverParameters->inductionMotor.state[eimv_Fful], 1.)); + fEIMParams[1 + in][3] = static_cast(p->MoverParameters->inductionMotor.state.maxForce / std::max(p->MoverParameters->inductionMotor.state.fullForce, 1.)); fEIMParams[1 + in][4] = std::max(fEIMParams[1 + in][3], 0.f); fEIMParams[1 + in][5] = -std::min(fEIMParams[1 + in][3], 0.f); - fEIMParams[1 + in][6] = static_cast(p->MoverParameters->inductionMotor.state[eimv_If]); - fEIMParams[1 + in][7] = static_cast(p->MoverParameters->inductionMotor.state[eimv_U]); - fEIMParams[1 + in][8] = static_cast(p->MoverParameters->Itot); // p->MoverParameters->inductionMotor.state[eimv_Ipoj]; + fEIMParams[1 + in][6] = static_cast(p->MoverParameters->inductionMotor.state.fieldCurrent); + fEIMParams[1 + in][7] = static_cast(p->MoverParameters->inductionMotor.state.voltage); + fEIMParams[1 + in][8] = static_cast(p->MoverParameters->Itot); // p->MoverParameters->inductionMotor.state.lineCurrent; fEIMParams[1 + in][9] = static_cast(p->MoverParameters->EngineVoltage); fEIMParams[0][6] += fEIMParams[1 + in][8]; bMains[in] = p->MoverParameters->Mains; @@ -422,15 +422,15 @@ bool TTrain::Update(double const Deltatime) } // if (mvControlled == mvOccupied) - // fEIMParams[0][3] = mvControlled->inductionMotor.state[eimv_Fzad]; // procent zadany + // fEIMParams[0][3] = mvControlled->inductionMotor.state.forceDemand; // procent zadany // else // fEIMParams[0][3] = - // mvControlled->inductionMotor.state[eimv_Fzad] - mvOccupied->LocalBrakeRatio(); // procent zadany + // mvControlled->inductionMotor.state.forceDemand - mvOccupied->LocalBrakeRatio(); // procent zadany fEIMParams[0][3] = static_cast(mvOccupied->eimic_real); fEIMParams[0][4] = std::max(fEIMParams[0][3], 0.f); fEIMParams[0][5] = -std::min(fEIMParams[0][3], 0.f); - fEIMParams[0][1] = static_cast(fEIMParams[0][4] * mvControlled->inductionMotor.state[eimv_Fful]); - fEIMParams[0][2] = static_cast(fEIMParams[0][5] * mvControlled->inductionMotor.state[eimv_Fful]); + fEIMParams[0][1] = static_cast(fEIMParams[0][4] * mvControlled->inductionMotor.state.fullForce); + fEIMParams[0][2] = static_cast(fEIMParams[0][5] * mvControlled->inductionMotor.state.fullForce); fEIMParams[0][0] = fEIMParams[0][1] - fEIMParams[0][2]; fEIMParams[0][7] = 0; fEIMParams[0][8] = 0; diff --git a/vehicle/dynamic/update.cpp b/vehicle/dynamic/update.cpp index 9fd5df13d..03057e4f8 100644 --- a/vehicle/dynamic/update.cpp +++ b/vehicle/dynamic/update.cpp @@ -294,16 +294,16 @@ bool TDynamicObject::Update(double dt, double dt1) p->MoverParameters->MED_Vref) * 1000; // sila hamowania pn FmaxED += p->MoverParameters->Mains && p->MoverParameters->DirActive != 0 && p->MoverParameters->inductionMotor.inverterRatio == 1.0 && - p->MoverParameters->inductionMotor.config[eimc_p_Fh] * p->MoverParameters->NPoweredAxles > 0 ? - p->MoverParameters->inductionMotor.config[eimc_p_Fh] * 1000 : + p->MoverParameters->inductionMotor.braking.maxForce * p->MoverParameters->NPoweredAxles > 0 ? + p->MoverParameters->inductionMotor.braking.maxForce * 1000 : 0; // chwilowy max ED -> do rozdzialu sil - FED -= std::min(p->MoverParameters->inductionMotor.state[eimv_Fmax], 0.0) * + FED -= std::min(p->MoverParameters->inductionMotor.state.maxForce, 0.0) * 1000; // chwilowy max ED -> do rozdzialu sil - FfulED = std::min(p->MoverParameters->inductionMotor.state[eimv_Fful], 0.0) * + FfulED = std::min(p->MoverParameters->inductionMotor.state.fullForce, 0.0) * 1000; // chwilowy max ED -> do rozdzialu sil - FrED -= std::min(p->MoverParameters->inductionMotor.state[eimv_Fmax], 0.0) * + FrED -= std::min(p->MoverParameters->inductionMotor.state.maxForce, 0.0) * 1000; // chwilowo realizowane ED -> do pneumatyki - Frj += std::max(p->MoverParameters->inductionMotor.state[eimv_Fmax], 0.0) * + Frj += std::max(p->MoverParameters->inductionMotor.state.maxForce, 0.0) * 1000;// chwilowo realizowany napęd -> do utrzymującego masa += p->MoverParameters->TotalMass; osie += p->MoverParameters->NAxles; @@ -341,11 +341,11 @@ bool TDynamicObject::Update(double dt, double dt1) } auto Fzad = amax * LBR * masa; if ((MoverParameters->BrakeCtrlPos == MoverParameters->Handle->GetPos(bh_EB) - && MoverParameters->inductionMotor.config[eimc_p_abed] < 0.001) || + && MoverParameters->inductionMotor.braking.cylinderPressureGain < 0.001) || MoverParameters->EmergencyValveFlow > 0) Fzad = amax * masa; //pętla bezpieczeństwa - pełne służbowe if (MoverParameters->ScndS && - MoverParameters->Vel > MoverParameters->inductionMotor.config[eimc_p_Vh1] && FmaxED > 0) + MoverParameters->Vel > MoverParameters->inductionMotor.braking.fullSpeed && FmaxED > 0) { Fzad = std::min(LBR * FmaxED, FfulED); } @@ -403,7 +403,7 @@ bool TDynamicObject::Update(double dt, double dt1) } } if (MoverParameters->BrakeCtrlPos == MoverParameters->Handle->GetPos(bh_EB) - && MoverParameters->inductionMotor.config[eimc_p_abed] < 0.001) + && MoverParameters->inductionMotor.braking.cylinderPressureGain < 0.001) FzadED = 0; //pętla bezpieczeństwa - bez ED auto const FzadPN = Fzad - FrED * MoverParameters->MED_FrED_factor; std::vector PrzekrF( np ); @@ -458,13 +458,13 @@ bool TDynamicObject::Update(double dt, double dt1) p = kier == true ? p->Next(Coupling::control) : p->Prev(Coupling::control) ) { if (FzEP[i] > 0.01 && - FzEP[i] > p->MoverParameters->TotalMass * p->MoverParameters->inductionMotor.config[eimc_p_eped] + std::min(p->MoverParameters->inductionMotor.state[eimv_Fmax], 0.) * 1000 && + FzEP[i] > p->MoverParameters->TotalMass * p->MoverParameters->inductionMotor.braking.maxEpDeceleration + std::min(p->MoverParameters->inductionMotor.state.maxForce, 0.) * 1000 && !PrzekrF[i]) { - float przek1 = -std::min(p->MoverParameters->inductionMotor.state[eimv_Fmax], 0.) * 1000 + + float przek1 = -std::min(p->MoverParameters->inductionMotor.state.maxForce, 0.) * 1000 + FzEP[i] - p->MoverParameters->TotalMass * - p->MoverParameters->inductionMotor.config[eimc_p_eped] * 0.999; + p->MoverParameters->inductionMotor.braking.maxEpDeceleration * 0.999; PrzekrF[i] = true; test = true; nPrzekrF++;