18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 22:07:55 +01:00

refactor(physics): the demand of the integrated controller is private to the vehicle

eimic_real, the demand of the integrated controller the vehicle goes by with
the speed control counted, which TDynamicObject and the consist braking set
for the vehicle that leads, is private: EimicReal() and SetEimicReal(). The
field of the same name of drivingaid::input stays as it is.

No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
This commit is contained in:
2026-11-29 13:39:07 +01:00
parent f0978c36c7
commit 23b695752a
23 changed files with 76 additions and 73 deletions
+6 -6
View File
@@ -22,7 +22,7 @@ std::vector<test::channel> cruise() {
{"SpeedCtrlValue", [](auto const &M) { return M.SpeedCtrlValue; }},
{"eimic", [](auto const &M) { return M.eimic; }},
{"eimicSpeedCtrl", [](auto const &M) { return M.eimicSpeedCtrl(); }},
{"eimic_real", [](auto const &M) { return M.eimic_real; }},
{"eimic_real", [](auto const &M) { return M.EimicReal(); }},
};
}
@@ -199,7 +199,7 @@ TEST_CASE("speed control: the field shunting of the vehicles with a cruise contr
CHECK(loco.Vel > 100.0);
CHECK(loco.ScndCtrlPos() == 1);
CHECK_FALSE(loco.SpeedCtrlUnit.IsActive);
CHECK(loco.eimic_real == doctest::Approx(loco.eimic));
CHECK(loco.EimicReal() == doctest::Approx(loco.eimic));
// the driver can't move the shunt
CHECK_FALSE(loco.IncScndCtrl(1));
CHECK_FALSE(loco.DecScndCtrl(2));
@@ -224,7 +224,7 @@ TEST_CASE("speed control: the field shunting of the vehicles with a cruise contr
CHECK(loco.Vel > 130.0);
CHECK(most == 0);
CHECK_FALSE(loco.SpeedCtrlUnit.IsActive);
CHECK(loco.eimic_real == doctest::Approx(loco.eimic));
CHECK(loco.EimicReal() == doctest::Approx(loco.eimic));
// the speed buttons do nothing with the cruise control off
loco.SpeedCtrlButton(4);
loco.SpeedCtrlInc();
@@ -300,7 +300,7 @@ TEST_CASE("speed control apart: the 6Dg's cruise control on its own switch, the
count_shunting(scenario, loco, 60, shunted, unshunted);
CHECK(loco.Vel == doctest::Approx(held).epsilon(0.03));
CHECK_FALSE(loco.SpeedCtrlUnit.Standby);
CHECK(loco.eimic_real < loco.eimic); // the cruise control holding the power back
CHECK(loco.EimicReal() < loco.eimic); // the cruise control holding the power back
scenario.act("two steps up");
loco.SpeedCtrlInc();
@@ -337,7 +337,7 @@ TEST_CASE("speed control apart: the 6Dg's cruise control on its own switch, the
CHECK_FALSE(loco.SpeedCtrlUnit.IsActive);
CHECK(loco.SpeedCtrlValue == 0.0);
scenario.wait(5.0);
CHECK(loco.eimic_real == doctest::Approx(loco.eimic)); // the controller's demand again
CHECK(loco.EimicReal() == doctest::Approx(loco.eimic)); // the controller's demand again
scenario.check();
}
@@ -364,7 +364,7 @@ TEST_CASE("speed control apart: the ST45's cruise control on its own switch, wit
CHECK(loco.SpeedCtrlUnit.DesiredPower == doctest::Approx(0.9));
scenario.wait(60.0);
CHECK(loco.Vel == doctest::Approx(65.0).epsilon(0.03));
CHECK(loco.eimic_real <= 0.9 + 1e-9);
CHECK(loco.EimicReal() <= 0.9 + 1e-9);
scenario.act("cruise control off");
CHECK(loco.SpeedCtrlSwitch(false));
// off, its buttons do nothing