17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-10 19:33:02 +01:00

Merge branch 'master' into feat/renderers-cleanup

This commit is contained in:
2026-11-07 22:12:02 +01:00
18 changed files with 822 additions and 95 deletions

View File

@@ -0,0 +1,46 @@
{
"_comment": "Diesel-electric locomotive made after the SU46 (303D): the line contactors close on the first power position of the master controller, the pressure switch (on by default) opens them with too low a pressure in the main pipe or the brakes applied.",
"Param": { "Category": "train", "M": 105000, "Mred": 15000, "Vmax": 120, "PWR": 1400, "SandCap": 400 },
"Dimensions": { "L": 18.99, "H": 4.292, "W": 2.904, "Cx": 0.3 },
"Wheels": { "D": 1.1, "AIM": 4000, "Tw": 1.435, "Axle": "Co'Co'", "Ad": 1.75, "Bd": 10.3, "Rmin": 100 },
"Brake": {
"BrakeValve": "LSt", "NBpA": 4, "MBF": 85.0, "MaxBP": 4.4, "LocMaxBP": 4.4, "MaxASBP": 1.3, "RM": 0.71, "BCN": 12, "BCR": 0.114,
"BCD": 0.06, "BCM": 5.84, "HiPP": 5, "LoPP": 3.5, "Vv": 0.9, "MinCP": 7, "MaxCP": 8.5, "CompressorSpeed": 0.05, "BCS": 1, "BSA": 2,
"BM": "P10-Bgu", "CompressorPower": "Converter", "BVV": 200, "BRE": 0.8
},
"BuffCoupl": { "CType": "Screw", "kB": 9200, "DmaxB": 0.15, "FmaxB": 740, "kC": 4800, "DmaxC": 0.15, "FmaxC": 780, "beta": 0.58, "AllowedFlag": 103 },
"Cntrl": {
"BrakeHandle": "FV4a", "LocBrakeHandle": "FD1", "BrakeSystem": "Pneumatic", "BDelay1": 15, "BDelay2": 6, "BDelay3": 36, "BDelay4": 32,
"ASB": "Manual", "LocalBrake": "PneumaticBrake", "MCPN": 15, "SCPN": 4, "AutoRelay": "Yes", "IniCDelay": 0.5, "SCDelay": 0.1,
"BrakeDelays": "GPR", "ConverterStart": "Automatic", "ConverterStartDelay": 10
},
"Light": { "Light": "Generator", "LGeneratorEngine": "ElectricSeriesMotor", "LMaxVoltage": 110, "LMaxCurrent": 100 },
"Engine": {
"AIM": 1.6, "EngineType": "DumbDE", "Trans": "18:62", "Ftmax": 317000, "Flat": 0, "Vhyp": 15.0, "Vadd": 3.8, "Cr": 1.0, "RelayType": 46,
"OilMinPressure": 0.055, "OilMaxPressure": 0.6, "WaterMinTemperature": 40, "WaterMaxTemperature": 92, "WaterCoolingTemperature": 76,
"HeatKW": 0.068599, "HeatKV": 0.3, "HeatKFE": 1, "HeatKFS": 87.76269, "HeatKFO": 26.72716, "HeatKFO2": 57.72
},
"Circuit": { "CircuitRes": 0.01, "ImaxLo": 3300, "IminLo": 2500 },
"_power": "rows: engine speed [rpm], power [kW], generator voltage limit, current limit, one per master controller position",
"WWList": {
"Size": 15,
"rows": [
[696, 0, 0, 0],
[696, 0, 0, 0],
[696, 80, 350, 1000],
[696, 80, 350, 1000],
[763, 214, 455, 1400],
[830, 321, 500, 1600],
[897, 428, 545, 1800],
[964, 535, 590, 2000],
[1031, 642, 635, 2200],
[1098, 748, 680, 2400],
[1165, 855, 725, 2600],
[1232, 962, 770, 2800],
[1299, 1069, 815, 3000],
[1366, 1176, 865, 3200],
[1433, 1283, 910, 3400],
[1500, 1390, 960, 3600]
]
}
}

View File

@@ -0,0 +1,53 @@
{
"_comment": "Diesel shunter with a mechanical gearbox, made after the SM03 (Ls150): the fuel pump starts on its own with the engine, a converter run by the engine feeds the low voltage circuit, the only cab control of the engine is the starter button.",
"Param": { "Category": "train", "M": 23200, "Vmax": 25.68, "PWR": 111.855, "SandCap": 200 },
"Dimensions": { "L": 6.94, "H": 3.21, "W": 2.97, "Cx": 0.3 },
"Wheels": { "D": 0.94, "Tw": 1.435, "AIM": 250, "Axle": "B", "Ad": 2.5, "Bd": 2.5, "Rmin": 50, "BearingType": "Roll" },
"Brake": {
"BrakeValve": "K", "NBpA": 2, "MBF": 85.0, "MaxBP": 3.5, "LocMaxBP": 5.0, "BCN": 1, "BCR": 0.114, "BCD": 0.12, "BCM": 10.0,
"HiPP": 5, "LoPP": 3.5, "Vv": 0.3, "MinCP": 7.0, "MaxCP": 8.0, "CompressorSpeed": 0.0125, "CompressorPower": "Main",
"BCS": 0.8, "BSA": 0, "BM": "P10-Bg", "BVV": 40, "BRE": 0.9
},
"BuffCoupl": { "CType": "Screw", "kB": 9200, "DmaxB": 0.15, "FmaxB": 740, "kC": 4800, "DmaxC": 0.15, "FmaxC": 780, "beta": 0.58, "AllowedFlag": 3 },
"Cntrl": {
"BrakeSystem": "Pneumatic", "BDelay1": 15, "BDelay2": 4, "ASB": "Manual", "LocalBrake": "PneumaticBrake", "ManualBrake": "Yes",
"DynamicBrake": "Passive", "MCPN": 9, "SCPN": 7, "AutoRelay": "No", "IniCDelay": 0.5, "SCDelay": 0.1, "BrakeDelays": "P",
"BrakeHandle": "Knorr", "LocBrakeHandle": "Knorr", "FuelStart": "Automatic", "ConverterStart": "Automatic"
},
"Light": { "Light": "Generator", "LGeneratorEngine": "ElectricSeriesMotor", "LMaxVoltage": 24, "LMaxCurrent": 100 },
"Engine": {
"EngineType": "DieselEngine", "Trans": "1:1", "nmin": 900, "nmax": 1500, "nmax_cutoff": 1550, "AIM": 100,
"OilMinPressure": 0.343, "OilMaxPressure": 0.686, "WaterCoolingTemperature": 80, "WaterShutters": "yes", "WaterAuxCircuit": "no",
"HeatKFO": 160, "HeatKFO2": 180, "HeatKFS": 160, "HeatKFE": 7, "HeatKW": 2, "HeatKV": 0.3, "IsTC": "No", "EUS": 0.35, "EDS": 1.0
},
"_gears": "rows: gear, ratio, engagement speed, top speed; the even ones neutral",
"MotorParamTable": {
"minVelfullengage": 3.8, "engageDia": 1, "engageMaxForce": 800, "engagefriction": 1,
"rows": [
[0, 0, 0, -1],
[1, 46.88, -1, 5.73],
[2, 0, 0, -1],
[3, 28.65, 2.9, 9.42],
[4, 0, 0, -1],
[5, 17.12, 4.7, 15.69],
[6, 0, 0, -1],
[7, 10.46, 10.6, 100]
]
},
"_throttle": "rows: position, fill, speed governor mode; position 0 idles",
"DList": {
"Size": 9, "Mmax": 784.5, "nMmax": 15, "Mnmax": 686.4, "nmax": 25, "nominalfill": 1, "Mstand": 200.0,
"rows": [
[0, 0.1, 0],
[1, 0.2, 2],
[2, 0.3, 2],
[3, 0.4, 2],
[4, 0.5, 2],
[5, 0.6, 2],
[6, 0.7, 2],
[7, 0.8, 2],
[8, 0.9, 2],
[9, 1.0, 2]
]
}
}

View File

@@ -5,6 +5,21 @@
namespace test {
namespace {
// whether the pressure switch of a vehicle in the train still cuts the start off: a half of a locomotive whose
// switch is on when the controller leaves zero doesn't close its line contactors until the controller is back at zero
bool start_cut_off(consist &Train) {
for (std::size_t i = 0; i < Train.size(); ++i) {
if (Train[i].mover().ControlPressureSwitch) {
return true;
}
}
return false;
}
} // namespace
scenario::scenario(std::string Name, std::vector<channel> Channels, track const &Track) : m_name(std::move(Name)), m_channels(std::move(Channels)), m_track(Track) {
reseed_random();
}
@@ -53,6 +68,11 @@ void scenario::get_going() {
void scenario::full_power(double Seconds) {
auto &controlling{driver().controlling};
// as a driver does, wait for the brakes to let go far enough for every pressure switch of the train to allow the
// start; otherwise whether all the halves of a locomotive start hangs on thousandths of a bar of their cylinders
for (int i = 0; i < 120 && start_cut_off(m_train); ++i) {
wait(1.0);
}
controlling.IncMainCtrl(1);
for (int i = 0; i < 90 && false == controlling.StLinFlag; ++i) {
wait(1.0);

View File

@@ -0,0 +1,74 @@
#include "stdafx.h"
#include "doctest.h"
#include "vehicle.h"
// stopping the engine of a diesel shunter like the SM03 (eu07/maszyna#427): its fuel pump starts on its own with the
// engine and the engine runs the converter which feeds the low voltage circuit, so neither the fuel pump switch nor the
// battery switch stop it. the cab has only the starter button, and the command opening the main circuit has to stop it
namespace {
// the shunter with its engine started from the cab and idling
test::vehicle running_shunter() {
test::vehicle shunter{test::definition::load("diesel_shunter")};
shunter->CabOccupied = 1;
shunter->CabActivisation();
shunter->BatterySwitch(true);
shunter->OilPumpSwitch(true);
shunter.run(20.0); // the oil pressure builds up
shunter->MainSwitch(true);
shunter.run(15.0);
return shunter;
}
} // namespace
TEST_CASE("engine shutdown: the shunter starts with the starter button") {
auto shunter{running_shunter()};
REQUIRE(shunter->EngineType == TEngineType::DieselEngine);
REQUIRE(shunter->FuelPump.start_type == start_t::automatic);
CHECK(shunter->Mains);
CHECK(shunter->FuelPump.is_active);
CHECK(shunter->enrot > 0.9 * shunter->dizel_nmin);
}
TEST_CASE("engine shutdown: neither the fuel pump switch nor the battery switch stop the engine") {
auto shunter{running_shunter()};
shunter->FuelPumpSwitchOff(true, range_t::local); // the pump started automatically ignores its switch
shunter.run(10.0);
CHECK(shunter->Mains);
shunter->BatterySwitch(false);
shunter.run(10.0);
CHECK(shunter->Power110vIsAvailable); // the converter run by the engine keeps feeding the fuel pump
CHECK(shunter->Mains);
CHECK(shunter->enrot > 0.9 * shunter->dizel_nmin);
}
TEST_CASE("engine shutdown: the command opening the main circuit stops the engine and it stays stopped") {
auto shunter{running_shunter()};
REQUIRE(shunter->MainCircuitOpensWithStarterOnly()); // the cab passes the command on with only the starter button
CHECK(shunter->MainSwitch(false));
shunter.run(20.0);
CHECK_FALSE(shunter->Mains);
CHECK_FALSE(shunter->FuelPump.is_active);
CHECK(shunter->enrot == 0.0);
}
TEST_CASE("engine shutdown: the engine starts again after it was stopped") {
auto shunter{running_shunter()};
shunter->MainSwitch(false);
shunter.run(20.0);
REQUIRE(shunter->enrot == 0.0);
shunter->MainSwitch(true);
shunter.run(15.0);
CHECK(shunter->Mains);
CHECK(shunter->enrot > 0.9 * shunter->dizel_nmin);
}
TEST_CASE("engine shutdown: vehicles without a diesel keep ignoring the command with only the button closing the circuit") {
test::vehicle wagon{test::definition::load("wagon")};
CHECK_FALSE(wagon->MainCircuitOpensWithStarterOnly());
test::vehicle electric{test::definition::load("wagon").set("Engine", "EngineType", "ElectricSeriesMotor")};
REQUIRE(electric->EngineType == TEngineType::ElectricSeriesMotor);
CHECK_FALSE(electric->MainCircuitOpensWithStarterOnly());
}

View File

@@ -57,3 +57,74 @@ TEST_CASE("line contactors: the ground relay and overload lamps follow the same
vehicle->MotorConnectorsCheck();
CHECK_FALSE(vehicle->MainCircuitLampsEnabled());
}
// on the diesel-electric SU45 and SU46 (eu07/maszyna#263) the lamp tells just the line contactors are open: lit with the
// master controller at 0 and with the start cut off by too low a pressure in the main pipe, out on the power positions
namespace {
// the diesel-electric locomotive with its engine running and the brakes released, the master controller at 0
test::vehicle diesel_electric() {
test::vehicle vehicle{test::definition::load("diesel_electric")};
vehicle->CabOccupied = 1;
vehicle->CabActivisation();
vehicle->BatterySwitch(true);
vehicle->OilPumpSwitch(true);
vehicle->FuelPumpSwitch(true);
vehicle.run(20.0); // the oil pressure builds up
vehicle.hold_brake_pipe(5.0); // bar
vehicle->MainSwitch(true);
vehicle.run(30.0);
vehicle->DirectionForward();
vehicle.run(60.0); // the brakes release
return vehicle;
}
} // namespace
TEST_CASE("line contactors: on a diesel-electric the lamp is lit at 0 and goes out on a power position") {
auto vehicle{diesel_electric()};
REQUIRE(vehicle->EngineType == TEngineType::DieselElectric);
REQUIRE(vehicle->Mains);
REQUIRE_FALSE(vehicle->ControlPressureSwitch);
CHECK_FALSE(vehicle->StLinFlag);
CHECK(vehicle->LineContactorsLampLit());
vehicle->IncMainCtrl(1);
vehicle.run(3.0);
CHECK(vehicle->StLinFlag);
CHECK_FALSE(vehicle->LineContactorsLampLit());
vehicle->DecMainCtrl(1);
vehicle.run(3.0);
CHECK_FALSE(vehicle->StLinFlag);
CHECK(vehicle->LineContactorsLampLit());
}
TEST_CASE("line contactors: on a diesel-electric the lamp lights with the contactors opened by too low a main pipe pressure") {
auto vehicle{diesel_electric()};
vehicle->IncMainCtrl(1);
vehicle.run(1.0);
vehicle->IncMainCtrl(1);
vehicle.run(2.0);
REQUIRE(vehicle->StLinFlag);
vehicle.hold_brake_pipe(2.5); // bar, below the 3.6 bar of the pressure switch
vehicle.run(10.0);
REQUIRE(vehicle->ControlPressureSwitch);
CHECK_FALSE(vehicle->StLinFlag);
CHECK(vehicle->LineContactorsLampLit()); // it went out here
CHECK_FALSE(vehicle->MainCircuitLampsEnabled()); // the ground relay and overload lamps still go out with the start cut off
// the pressure back, the contactors stay open on the second position and the lamp stays lit, as it should;
// they close again only on the first one
vehicle.hold_brake_pipe(5.0);
vehicle.run(60.0);
REQUIRE_FALSE(vehicle->ControlPressureSwitch);
CHECK_FALSE(vehicle->StLinFlag);
CHECK(vehicle->LineContactorsLampLit());
vehicle->DecMainCtrl(1);
vehicle.run(3.0);
CHECK(vehicle->StLinFlag);
CHECK_FALSE(vehicle->LineContactorsLampLit());
}