17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-19 16:36:52 +02:00
Files
maszyna/tests/unit/test_line_contactors.cpp
jerrrrycho 00805cfe77 fix: review findings of PR 217
- the pressures of the mover are in bar (MinCP=7.0 in the vehicle definitions), so the 0.2 the pneumatic horns
  needed was 0.2 bar; it's 2 bar now, and the tests take their pressures in bar too,
- the lamps of the ground relay and of the motor overload relays follow the pressure switch as the line
  contactors one does, TMoverParameters::MainCircuitLampsEnabled(), so the lamps of one cab go out together,
- the joint oil and fuel pump switch leaves out a pump started automatically, which ignores the switching:
  with one, it couldn't turn the other off, and showed off with both running (OilFuelPumpsEnabled()),
- the kind of the train heating switch comes from the occupied vehicle on entering the cab too, as in the
  switch commands; in a multiple unit these are different vehicles,
- CouplerForce() put the force taken back by the other vehicle on its far coupler when the vehicles faced each
  other (Couplers[1 - End] rather than the coupler it's coupled with),
- the velocity difference along the coupler axis computed once, CouplerVelocityDifference(), for CouplerForce()
  and CollisionVelocity(),
- the attachcoupler flag added without the SetFlag() call with 0, the index of the mirror moves noted as by side.

Tests: the coupler force of vehicles facing each other, the joint switch with an automatic pump, the lamps of
the main circuit, the horn and compressor pressures in bar.
2026-10-17 17:15:28 +02:00

60 lines
2.1 KiB
C++

#include "stdafx.h"
#include "doctest.h"
#include "vehicle.h"
// the lamp of the open line contactors (eu07/maszyna#470): lit, it tells the start can be made, so it should go out
// where the start is cut off, by the pressure switch at 2 bar in the brake cylinders, not at 1 bar already
namespace {
test::vehicle locomotive(bool const Pressureswitch) {
test::vehicle vehicle{test::definition::load("wagon").set("Engine", "PressureSwitch", Pressureswitch)};
vehicle->StLinFlag = false; // the line contactors open
vehicle->PipePress = 5.0;
return vehicle;
}
} // namespace
TEST_CASE("line contactors: with a pressure switch the lamp goes out with the start cut off") {
auto vehicle{locomotive(true)};
REQUIRE(vehicle->HasControlPressureSwitch);
vehicle->BrakePress = 1.5; // braked, the start can still be made
vehicle->MotorConnectorsCheck(); // updates the pressure switch
REQUIRE_FALSE(vehicle->ControlPressureSwitch);
CHECK(vehicle->LineContactorsLampLit());
vehicle->BrakePress = 2.5; // the pressure switch cuts the start off
vehicle->MotorConnectorsCheck();
REQUIRE(vehicle->ControlPressureSwitch);
CHECK_FALSE(vehicle->LineContactorsLampLit());
}
TEST_CASE("line contactors: without a pressure switch the lamp goes out with the brakes applied, as before") {
auto vehicle{locomotive(false)};
vehicle->BrakePress = 0.5;
vehicle->MotorConnectorsCheck();
CHECK(vehicle->LineContactorsLampLit());
vehicle->BrakePress = 1.5;
vehicle->MotorConnectorsCheck();
CHECK_FALSE(vehicle->LineContactorsLampLit());
}
TEST_CASE("line contactors: closed contactors put the lamp out") {
auto vehicle{locomotive(true)};
vehicle->StLinFlag = true;
CHECK_FALSE(vehicle->LineContactorsLampLit());
}
TEST_CASE("line contactors: the ground relay and overload lamps follow the same rule") {
// all the lamps of the main circuit go out together, with the pressure switch where it's fitted
auto vehicle{locomotive(true)};
vehicle->BrakePress = 1.5;
vehicle->MotorConnectorsCheck();
CHECK(vehicle->MainCircuitLampsEnabled());
vehicle->BrakePress = 2.5;
vehicle->MotorConnectorsCheck();
CHECK_FALSE(vehicle->MainCircuitLampsEnabled());
}