mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-21 17:54:58 +01:00
Merge pull request #278 from MaSzyna-EU07/feat/shunt-lock-resistive
Field shunting locked at zero and on resistive positions (eu07/maszyna#402)
This commit is contained in:
@@ -1987,6 +1987,7 @@ class TMoverParameters
|
||||
double MirrorVelClose{5.0};
|
||||
bool MirrorForbidden{false}; /*czy jest pozwolenie na otworzenie lusterek (przycisk)*/
|
||||
bool ScndS = false; /*Czy jest bocznikowanie na szeregowej*/
|
||||
bool ScndCtrlResistiveLock{false}; // the shunt controller can't be moved, up or down, while the master controller is at zero or on a resistive position, and drops to 0 when the master controller gets there (ScndCtrlResistiveLock=Yes in Cntrl.)
|
||||
bool SpeedCtrl = false; /*czy jest tempomat*/
|
||||
speed_control SpeedCtrlUnit; /*parametry tempomatu*/
|
||||
double SpeedCtrlButtons[10]{30, 40, 50, 60, 70, 80, 90, 100, 110, 120}; /*przyciski prędkości*/
|
||||
@@ -2430,6 +2431,11 @@ class TMoverParameters
|
||||
bool IncScndCtrl(int CtrlSpeed);
|
||||
bool DecScndCtrl(int CtrlSpeed);
|
||||
int GetVirtualScndPos() const;
|
||||
// whether ScndCtrlResistiveLock keeps the shunt controller from being moved at the current master controller position
|
||||
bool IsScndCtrlLockedByMainCtrl() const;
|
||||
// ScndCtrlResistiveLock: the shunt controller drops to 0 once the master controller is at zero or on a resistive position, so it
|
||||
// can't stay engaged there, locked in place (eu07/maszyna#402)
|
||||
void ScndCtrlResistiveLockCheck();
|
||||
bool IsScndCtrlNoPowerPos() const;
|
||||
bool IsScndCtrlMaxPowerPos() const;
|
||||
|
||||
|
||||
@@ -1698,6 +1698,8 @@ void TMoverParameters::compute_movement_(double const Deltatime)
|
||||
BRVentilators = false;
|
||||
}
|
||||
|
||||
// the master controller set directly, not through IncMainCtrl()/DecMainCtrl() (AI, consist): the locked shunt follows it as well
|
||||
ScndCtrlResistiveLockCheck();
|
||||
// automatyczny rozruch
|
||||
if (EngineType == TEngineType::ElectricSeriesMotor && AutoRelayCheck())
|
||||
{
|
||||
@@ -2604,6 +2606,7 @@ bool TMoverParameters::IncMainCtrl(int CtrlSpeed)
|
||||
|
||||
if (true == OK)
|
||||
{
|
||||
ScndCtrlResistiveLockCheck(); // e.g. from the last series position on to the resistive parallel ones
|
||||
SendCtrlToNext("MainCtrl", MainCtrlPos, CabActive); //???
|
||||
SendCtrlToNext("ScndCtrl", ScndCtrlPos, CabActive);
|
||||
}
|
||||
@@ -2729,6 +2732,7 @@ bool TMoverParameters::DecMainCtrl(int CtrlSpeed)
|
||||
|
||||
if (OK)
|
||||
{
|
||||
ScndCtrlResistiveLockCheck(); // the shunt drops when the master controller leaves a resistance-free position
|
||||
/*OK:=*/SendCtrlToNext("MainCtrl", MainCtrlPos, CabActive); // hmmmm...???!!!
|
||||
/*OK:=*/SendCtrlToNext("ScndCtrl", ScndCtrlPos, CabActive);
|
||||
}
|
||||
@@ -2818,7 +2822,7 @@ bool TMoverParameters::IncScndCtrl(int CtrlSpeed)
|
||||
{
|
||||
// if (RList[MainCtrlPos].R=0) and (MainCtrlPos>0) and (ScndCtrlPos<ScndCtrlPosNo) and
|
||||
// (not CoupledCtrl) then
|
||||
if (ScndCtrlPos < ScndCtrlPosNo && !CoupledCtrl)
|
||||
if (ScndCtrlPos < ScndCtrlPosNo && !CoupledCtrl && !IsScndCtrlLockedByMainCtrl())
|
||||
{
|
||||
// TBD, TODO: refactor this validation as part of relay check routine (currently in tractionforce()
|
||||
// TBD, TODO: diesel electric engine utilize scndctrlactualpos like the other types?
|
||||
@@ -2889,7 +2893,7 @@ bool TMoverParameters::DecScndCtrl(int CtrlSpeed)
|
||||
}
|
||||
else if (ScndCtrlPosNo > 0 && CabActive != 0)
|
||||
{
|
||||
if (ScndCtrlPos > 0 && !CoupledCtrl && (EngineType != TEngineType::DieselElectric || !AutoRelayFlag))
|
||||
if (ScndCtrlPos > 0 && !CoupledCtrl && (EngineType != TEngineType::DieselElectric || !AutoRelayFlag) && !IsScndCtrlLockedByMainCtrl())
|
||||
{
|
||||
if (CtrlSpeed == 1)
|
||||
{
|
||||
@@ -2939,6 +2943,22 @@ bool TMoverParameters::DecScndCtrl(int CtrlSpeed)
|
||||
return OK;
|
||||
}
|
||||
|
||||
bool TMoverParameters::IsScndCtrlLockedByMainCtrl() const
|
||||
{
|
||||
// ET21, ET22, EP09: the field shunting engages only on the resistance-free positions of the master controller (eu07/maszyna#402)
|
||||
return ScndCtrlResistiveLock && (IsMainCtrlNoPowerPos() || RList[MainCtrlPos].R >= 0.01);
|
||||
}
|
||||
|
||||
void TMoverParameters::ScndCtrlResistiveLockCheck()
|
||||
{
|
||||
// the shunt controller, locked in both directions on zero and the resistive positions, would otherwise stay engaged there once the
|
||||
// master controller is taken back (or set from elsewhere, e.g. by the AI or another vehicle of the consist) with the shunt on
|
||||
if (ScndCtrlPos > 0 && !CoupledCtrl && IsScndCtrlLockedByMainCtrl())
|
||||
{
|
||||
ScndCtrlPos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int TMoverParameters::GetVirtualScndPos() const
|
||||
{
|
||||
if (TrainType == dt_ET42 && DynamicBrakeFlag && !ScndCtrlPos)
|
||||
@@ -11105,6 +11125,7 @@ void TMoverParameters::LoadFIZ_Cntrl(std::string const &line)
|
||||
extract_value(EIMCtrlEmergency, "EIMCtrlEmergency", line, "");
|
||||
|
||||
extract_value(ScndS, "ScndS", line, ""); // brak pozycji rownoleglej przy niskiej nastawie PSR
|
||||
extract_value(ScndCtrlResistiveLock, "ScndCtrlResistiveLock", line, ""); // bocznikowanie tylko na pozycjach bezoporowych
|
||||
|
||||
extract_value(InitialCtrlDelay, "IniCDelay", line, "");
|
||||
extract_value(CtrlDelay, "SCDelay", line, "");
|
||||
|
||||
Reference in New Issue
Block a user