mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 02:42:46 +01:00
4679201cb9
Four more switches on EngineType go into the classes of the drives:
- TractionDrive::MainsPowerAvailable(): whether the line breaker has the
power to close; the low voltage circuits for the diesel engines and Dumb,
the line (or the low voltage, closed ahead of the pantographs) for the
series and the induction motors, always for the others (from
MainSwitchCheck())
- TractionDrive::CheckVoltageRelays(): the undervoltage and the overvoltage
relay of the series motors, the line voltage out of range of the induction
motors, the line contactors of the diesel-electric (the body of
VoltageRelaysCheck())
- TractionDrive::UpdateEngine(): the automatic start of the series motors,
the step of the diesel engine; returns whether a relay clicked (from
compute_movement_())
- TractionDrive::UpdateEngineVoltage(): the voltage of the motors, by the
reverser for the series motors, which also count the time since their
last relay, from the traction supply for the others (from
ComputeTotalForce())
The reading of the Engine and MotorParamTable sections of the .fiz still
switches on the engine type: it fills private members of the loader, and
stays with it.
No change in behaviour: 1144/1144 tests, golden traces exact against staging
62f7a29b.
72 lines
3.8 KiB
C++
72 lines
3.8 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/.
|
|
*/
|
|
|
|
// the drive of a vehicle, by the kind of its engine (EngineType, the Engine section of the .fiz): what each kind of
|
|
// drive does in the step of the vehicle, in place of a switch on the engine type in each of those places. the drives
|
|
// hold no state of their own yet (it is in TMoverParameters): there is one of each kind, shared by the vehicles
|
|
|
|
#pragma once
|
|
|
|
#include "physics/vehicletypes.h"
|
|
|
|
class TMoverParameters;
|
|
|
|
// what the step of the traction gives the drive
|
|
struct DriveStep
|
|
{
|
|
double dt{0.0}; // the length of the step [s]
|
|
double posRatio{0.0}; // the share of the controller positions, of the drive of no engine model (Dumb)
|
|
double revolutions{0.0}; // the revolutions of the engine
|
|
double moment{0.0}; // the moment of the diesel engine
|
|
double transmission{0.0}; // the ratio of the transmission of the diesel engine
|
|
};
|
|
|
|
class TractionDrive
|
|
{
|
|
public:
|
|
virtual ~TractionDrive() = default;
|
|
|
|
// the power of the engine for the controller positions; returns the share of the positions (Dumb), 0 for the others
|
|
virtual double UpdateEnginePower(TMoverParameters &vehicle) const;
|
|
// before the traction force, whether the reverser is set or not
|
|
virtual void BeforeTractionForce(TMoverParameters &vehicle, double dt) const;
|
|
// the traction force of the step (Ft), the reverser set
|
|
virtual void UpdateTractionForce(TMoverParameters &vehicle, DriveStep const &step) const;
|
|
// after the traction force, whether the reverser is set or not
|
|
virtual void AfterTractionForce(TMoverParameters &vehicle) const;
|
|
// the blowers of the starting resistors and the fans of the radiators
|
|
virtual void UpdateVentilators(TMoverParameters &vehicle, double dt) const;
|
|
// the current the given ammeter of the cab shows
|
|
virtual double ShowCurrent(TMoverParameters const &vehicle, int ammeter) const;
|
|
// the revolutions of the engine against the most it gives at the present controller position, 0..1; 1 with no
|
|
// engine of revolutions
|
|
virtual double EngineRpmRatio(TMoverParameters const &vehicle) const;
|
|
// the revolutions of the engine idling and at most [rpm]; the largest double with no engine of revolutions
|
|
virtual double EngineIdleRpm(TMoverParameters const &vehicle) const;
|
|
virtual double EngineMaxRpm(TMoverParameters const &vehicle) const;
|
|
// the revolutions of the engine in the step (enrot); returns the revolutions a diesel-electric engine aims for, 0 for
|
|
// the others. a diesel engine with a mechanical transmission gives its ratio and its moment through the references
|
|
virtual double UpdateEngineRevolutions(TMoverParameters &vehicle, double dt, double &transmission, double &moment) const;
|
|
// a notch up and down of the master controller, as the kind of the engine takes it; return whether it moved
|
|
virtual bool IncreaseMainController(TMoverParameters &vehicle, int speed) const;
|
|
virtual bool DecreaseMainController(TMoverParameters &vehicle, int speed) const;
|
|
// whether the line breaker has the power it needs to close, before the genset of a dual-mode vehicle has its say
|
|
virtual bool MainsPowerAvailable(TMoverParameters const &vehicle) const;
|
|
// the relays that open the line breaker at a voltage out of range, or the line contactors
|
|
virtual void CheckVoltageRelays(TMoverParameters &vehicle) const;
|
|
// the engine in the step of the vehicle: the automatic start of the series motors, the diesel engine; returns
|
|
// whether a relay clicked
|
|
virtual bool UpdateEngine(TMoverParameters &vehicle, double dt) const;
|
|
// the voltage of the traction motors in the step (EngineVoltage)
|
|
virtual void UpdateEngineVoltage(TMoverParameters &vehicle, double dt) const;
|
|
};
|
|
|
|
// the drive of the given kind of engine
|
|
TractionDrive const &DriveOf(TEngineType type);
|