18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 19:57:06 +01:00
Files
maszyna/tests/unit/test_oil_pump.cpp
T
Hirek 04f76951f5 refactor(physics): the diesel engine, the torque converter and the retarder are components of their own
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.
2026-11-28 15:23:36 +01:00

56 lines
2.0 KiB
C++

#include "stdafx.h"
#include "doctest.h"
#include "vehicle.h"
using test::definition;
using test::vehicle;
// the oil pump lamp of the cab (i-oilpump) shows OilPump.is_active: the pre-lubrication pump of 401Da, which works
// before the engine start and stops once the engine runs and makes the oil pressure itself (eu07/maszyna#546)
// NOTE: the test vehicle has no diesel engine, so the pump check is called the way dizel_Update() calls it
TEST_CASE("oil pump: the pre-lubrication pump works before the engine start and stops once the engine runs") {
vehicle loco{definition::load("cab_vehicle").set("Cntrl", "OilStart", "Manual")};
REQUIRE(loco->OilPump.start_type == start_t::manual);
loco->Power24vIsAvailable = true; // battery on
loco->OilPumpCheck(0.01);
CHECK_FALSE(loco->OilPump.is_active); // not switched on yet
loco->OilPump.is_enabled = true; // pump switch on: pre-lubrication
loco->OilPumpCheck(0.01);
CHECK(loco->OilPump.is_active);
loco->Mains = true; // engine started
loco->OilPumpCheck(0.01);
CHECK_FALSE(loco->OilPump.is_active);
}
TEST_CASE("oil pump: the pump started with the engine start procedure stops once the engine runs") {
vehicle loco{definition::load("cab_vehicle").set("Cntrl", "OilStart", "Automatic")};
REQUIRE(loco->OilPump.start_type == start_t::automatic);
loco->Power24vIsAvailable = true;
loco->diesel.startupRequested = true; // starter button pressed
loco->OilPumpCheck(0.01);
CHECK(loco->OilPump.is_active);
loco->diesel.startupRequested = false; // start procedure done, the pump keeps working until the engine runs
loco->OilPumpCheck(0.01);
CHECK(loco->OilPump.is_active);
loco->Mains = true;
loco->OilPumpCheck(0.01);
CHECK_FALSE(loco->OilPump.is_active);
}
TEST_CASE("oil pump: without power the pump and its lamp stay off") {
vehicle loco{definition::load("cab_vehicle")};
loco->Power24vIsAvailable = false;
loco->Power110vIsAvailable = false;
loco->OilPump.is_enabled = true;
loco->OilPumpCheck(0.01);
CHECK_FALSE(loco->OilPump.is_active);
}