18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-27 20:40:48 +01:00

state_manager: Optimize computation of pressure flow for Oerlikon ESt valves

TNESt3::GetPF() is a *major* hotspot in simulation state update. The leading cause is the use of typeid (RTTI) which is implemented in the C++ runtime essentially as a string compare. This change eliminates the use of typeid and instead caches statically typed pointers for the few TPrzekladnik subclass objects that need their parameters adjusted in TNESt3::GetPF(). As a bonus some virtual methods on TPrzekladnik can now be removed. Overall this change reduces the TNESt3::GetPF() contribution from about 25% to 16%.
This commit is contained in:
combolek
2026-07-26 17:56:44 -07:00
parent d9eb705d4a
commit 00bb44a789
2 changed files with 43 additions and 35 deletions

View File

@@ -76,12 +76,6 @@ class TPrzekladnik : public TReservoir // przekladnik (powtarzacz)
TPrzekladnik() : TReservoir() {};
virtual void Update(double dt);
virtual void SetPoslizg(bool flag) {};
virtual void SetP(double P) {};
virtual void SetMult(double m) {};
virtual void SetLBP(double P) {};
virtual void SetRapidParams(double mult, double size) {};
virtual void SetRapidStatus(bool rs) {};
};
class TRura : public TPrzekladnik // nieprzekladnik, rura laczaca
@@ -185,7 +179,13 @@ class TNESt3 : public TBrake {
private:
std::shared_ptr<TReservoir> CntrlRes; // zbiornik sterujacy
std::shared_ptr<TReservoir> Miedzypoj; // pojemnosc posrednia (urojona) do napelniania ZP i ZS
std::shared_ptr<TPrzekladnik> Przekladniki[ 4 ];
std::shared_ptr<TPrzekladnik> Przekladniki[ 4 ]; // indeksowane od 1, indeks jest zarazem pojemnoscia
// bezposrednie wskazniki do przekladnikow dostrajanych w GetPF, inicjowane przy tworzeniu
std::shared_ptr<TRapid> PrzekRapid;
std::shared_ptr<TPrzeciwposlizg> PrzekPoslizg;
std::shared_ptr<TPrzekED> PrzekED;
std::shared_ptr<TPrzekCiagly> PrzekCiagly;
std::shared_ptr<TPrzek_PZZ> PrzekPZZ;
double Nozzles[ dMAX ]; // dysze
double BVM = 0.0; // przelozenie PG-CH
// ValveFlag: byte; //polozenie roznych zaworkow