mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 13:06:46 +01:00
22ebc41d70
The line breaker, the line contactors, the protective relays and the converter
(physics/components/maincircuit.h) become classes: what the .fiz defines is in
their public `config`, their state is private, read through queries
(IsClosed(), UndervoltageHolds(), IsRunning()) and changed through operations
(Close(), ResetGround(), Switch()). The logic that concerns only them moves in:
the initialisation of the main circuit, the ground relay, the pressure switch,
the resets of the relays, and the whole step of the converter, which gets what
it needs from the vehicle as plain values (ConverterSupply).
The vehicle still decides when they act (the interlocks, the controller
positions, the voltages); the parts don't take a physics::Vehicle.
No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
56 lines
2.0 KiB
C++
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->lowVoltage.power24vAvailable = 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->lineBreaker.Close(); // 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->lowVoltage.power24vAvailable = 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->lineBreaker.Close();
|
|
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->lowVoltage.power24vAvailable = false;
|
|
loco->lowVoltage.power110vAvailable = false;
|
|
|
|
loco->OilPump.is_enabled = true;
|
|
loco->OilPumpCheck(0.01);
|
|
CHECK_FALSE(loco->OilPump.is_active);
|
|
}
|