mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 09:36:48 +01:00
04f76951f5
TMoverParameters held some 80 fields of the diesel engine and its hydraulic
transmission among its other 600, named dizel_*, hydro_TC_* and hydro_R_*.
They are now three structures of physics/components/dieselengine.h, with
English names:
- DieselEngine diesel: the definition (maxMoment, maxRevolutions,
minRevolutions, the governor, the clutch, the fuel consumption, the tables)
and the state (fill, clutchState, clutchPressure, torque, power, the start
up, the fuel consumed) and its heat (EngineHeat, heat_data before)
- TorqueConverter torqueConverter: present, the ratios, the lockup, the
fill rates, the table, and its state (fill, lockedUp, torqueRatio, the
revolutions in and out)
- Retarder retarder: present, its placement, torque, power, fill rates,
clutch, and its state
The .fiz keywords, the keys of the dictionaries of the Python screens and the
names of the golden channels (dizel_fill...) are unchanged; only the C++
names changed. The functions of the engine (dizel_Update, dizel_Momentum...)
stay members of TMoverParameters for now.
No change in behaviour: 1144/1144 tests, golden traces exact against staging
62f7a29b.
47 lines
1.6 KiB
C++
47 lines
1.6 KiB
C++
/*
|
|
This Source Code Form is subject to the
|
|
terms of the Mozilla Public License, v.
|
|
2.0. If a copy of the MPL was not
|
|
distributed with this file, You can
|
|
obtain one at
|
|
http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#include "stdafx.h"
|
|
#include "vehicle/smoke.h"
|
|
|
|
#include "physics/mover.h"
|
|
|
|
namespace smoke {
|
|
|
|
namespace {
|
|
|
|
// how hard the engine works, scaling the spawn rate of the source
|
|
double engine_load(TMoverParameters const &Mover) {
|
|
if (Mover.diesel.spinningUp) {
|
|
// starting up, it puffs harder the faster it turns
|
|
return ((Mover.enrot / 4) * 0.01);
|
|
}
|
|
auto const rpmrise{(Mover.DElist[Mover.MainCtrlPosNo].RPM - Mover.enrot) / 60};
|
|
if (Mover.DirAbsolute == 0 || Mover.Im == 0) {
|
|
// idling: speeding up to the revolutions of the master controller
|
|
return ((rpmrise * 0.02) * (Mover.EnginePower * 0.005));
|
|
}
|
|
// under load: the more current the traction motors draw, the more smoke
|
|
return ((rpmrise * (std::sqrt(Mover.Im) * 0.01) * 0.02) * (Mover.EnginePower * 0.005));
|
|
}
|
|
|
|
} // namespace
|
|
|
|
float vehicle_spawn_count(TMoverParameters const &Mover, bool const Ontracks, spawn_rate const &Rate, double const Timedelta) {
|
|
if (false == Ontracks || Mover.diesel.firingCountdown > 0.0) {
|
|
return 0.f;
|
|
}
|
|
// the steady rate of the source, the way a source of the scenery spawns...
|
|
auto const steady{std::min<float>(static_cast<float>(Rate.pending + (Rate.rate * Timedelta * Rate.fidelity)), Rate.limit)};
|
|
// ...and on top of it the share of the engine
|
|
return std::min<float>(static_cast<float>(steady + (Rate.rate * Timedelta * Rate.fidelity * engine_load(Mover))), Rate.limit);
|
|
}
|
|
|
|
} // namespace smoke
|