18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-02 07:22:42 +01:00

refactor(physics): the definition and the state of the induction motor drive as named fields

The arrays eimc[26] and eimv[21] of InductionMotor, indexed by the eimc_* and
eimv_* constants, become structs with named and described fields. The
definition splits into blocks by what it describes:

  motor      dfic currentPerSlip, dfmax maxSlipFrequency, p polePairs,
             cfu voltsPerHertz, cim torquePerCurrent, icif fieldCurrentRatio
  converter  Uzmax maxLinkVoltage, Uzh brakingLinkVoltage, DU voltageDrop,
             I0 noLoadCurrent, fcfu voltsPerHertz, fcfuH brakingVoltsPerHertz
  traction   F0 startingForce, a1 forceDropPerSpeed, Pmax maxPower,
             Imax maxCurrent
  braking    Fh maxForce, Ph maxPower, Vh0 offSpeed, Vh1 fullSpeed,
             abed cylinderPressureGain, edep maxEpDeceleration

and the state (InductionMotorState) groups the forces, the frequencies, the
values of the motors and the powers: FMAXMAX absoluteMaxForce, Fmax maxForce,
Fful fullForce, Fr force, Fzad forceDemand, ks slipShare, df slipFrequency,
fp supplyFrequency, fkr criticalFrequency, Uzsmax linkVoltage, U voltage,
pole flux, Ic torqueCurrent, If fieldCurrent, M torque, Ipoj lineCurrent,
Imax currentLimit, Pmax powerLimit, Pm mechanicalPower, Pe electricalPower,
eta efficiency.

The old comments of the constants took the "h" entries (Uzh, fcfuH, Fh, Ph,
Vh0, Vh1) for field weakening; the code uses them for the electrodynamic
brake, and the new names say so. The .fiz keys don't change. The constants
eimc_* / eimv_* are gone from physics/vehicletypes.h, and the labels of the
debug panel (TMoverParameters::eimc_labels, eimv_labels) move into
InductionMotor::ConfigListing() and StateListing().

One change on the screen: the eimc column of the debug panel (the engine
section of an induction motor vehicle) showed the labels from "Uzmax:" on
next to the wrong values (shifted by one entry, from "F0:" on by two), and
never showed abed and eped. It now shows each label with its own value. The
eimv column is as it was.

No change in the simulation: 1144/1144 tests, golden traces exact against
staging 62f7a29b.
This commit is contained in:
2026-11-28 16:29:17 +01:00
parent 95e7b55495
commit f4ef43feec
17 changed files with 258 additions and 237 deletions
+1 -18
View File
@@ -30,12 +30,6 @@ http://mozilla.org/MPL/2.0/.
#include "physics/components/internal.h"
std::vector<std::string> 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<std::string> 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;