mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-21 00:24:57 +01:00
Merge remote-tracking branch 'origin/master' into fix/et42-fans-compressor-lamps-et22-louvre
Conflict in McZapkie/Mover.cpp, MotorBlowersCheck(): the blower's power source stays in MotorBlowerPowerIsAvailable(), which for a blower on the main circuit now asks MainCircuitPowered() instead of Mains (PantRequiresMain, #272), so the line contactors interlock sees it too. MotorConnectorsCheck() merged by itself: master's undervoltage relay in connectorsoff, and LineContactorsInterlockReleased() on the return.
This commit is contained in:
@@ -438,7 +438,7 @@ double TMoverParameters::Current(double n, double U)
|
||||
// writepaslog("Delta ", FloatToStr(Delta));
|
||||
// writepaslog("DeltaQ ", FloatToStr(DeltaQ));
|
||||
// writepaslog("U ", FloatToStr(U));
|
||||
if (Mains)
|
||||
if (MainCircuitPowered())
|
||||
{
|
||||
if (U > 0)
|
||||
MotorCurrent = (U1 - Isf * Rz - Mn * motor_param(SP).fi * n + std::sqrt(Delta)) / (2.0 * Rz);
|
||||
@@ -1531,6 +1531,8 @@ void TMoverParameters::Derail(DerailReason const Reason)
|
||||
ErrorLog("Bad dynamic: " + Name + " derailed due to wrong track type"); // błąd w scenerii
|
||||
else if (Reason == COLLISION)
|
||||
WriteLog("Bad driving: " + Name + " derailed"); // This reason also generates its own message in `TMoverParameters::CollisionDetect()`
|
||||
else if (Reason == TRAILED_SWITCH)
|
||||
ErrorLog("Bad driving: " + Name + " derailed trailing through a switch with a movable nose set the other way");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1872,7 +1874,8 @@ void TMoverParameters::MainsCheck(double const Deltatime)
|
||||
break;
|
||||
}
|
||||
}
|
||||
auto const maincircuitpowersupply{std::abs(localvoltage) > 0.1 || GetTrainsetHighVoltage() > 0.1};
|
||||
// a line breaker closed ahead of the pantographs gets ready on the low voltage circuits
|
||||
auto const maincircuitpowersupply{std::abs(localvoltage) > 0.1 || GetTrainsetHighVoltage() > 0.1 || (PantographsRequireMains && (Power24vIsAvailable || Power110vIsAvailable))};
|
||||
|
||||
if (true == maincircuitpowersupply)
|
||||
{
|
||||
@@ -1951,7 +1954,7 @@ void TMoverParameters::PowerCouplersCheck(double const /*Deltatime*/, coupling c
|
||||
case TPowerSource::Main:
|
||||
{
|
||||
// HACK: main circuit can be fed through couplers, so we explicitly check pantograph supply here
|
||||
localvoltage = true == Mains ? PantographVoltage : 0.0;
|
||||
localvoltage = MainCircuitPowered() ? PantographVoltage : 0.0;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -2208,7 +2211,7 @@ void TMoverParameters::ConverterCheck(double const Timestep)
|
||||
if (ConverterAllow && ConverterAllowLocal && false == ConvOvldFlag &&
|
||||
false == PantPressLockActive
|
||||
// HACK: allow carriages to operate converter without (missing) fuse prerequisite
|
||||
&& (Power > 1.0 ? Mains : GetTrainsetHighVoltage() > 0.0))
|
||||
&& (Power > 1.0 ? MainCircuitPowered() : GetTrainsetHighVoltage() > 0.0))
|
||||
{
|
||||
// delay timer can be optionally configured, and is set anew whenever converter goes off
|
||||
if (ConverterStartDelayTimer <= 0.0)
|
||||
@@ -2294,7 +2297,7 @@ void TMoverParameters::HeatingCheck(double const /*Timestep*/)
|
||||
}
|
||||
case TPowerSource::Main:
|
||||
{
|
||||
voltage = true == Mains ? std::max(GetTrainsetHighVoltage(), PantographVoltage) : 0.0;
|
||||
voltage = MainCircuitPowered() ? std::max(GetTrainsetHighVoltage(), PantographVoltage) : 0.0;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -2442,7 +2445,7 @@ bool TMoverParameters::MotorBlowerPowerIsAvailable(cooling_fan const &Blower) co
|
||||
case start_t::converter:
|
||||
return Power110vIsAvailable;
|
||||
default:
|
||||
return Mains;
|
||||
return MainCircuitPowered();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2475,7 +2478,8 @@ void TMoverParameters::PantographsCheck(double const /*Timestep*/)
|
||||
valve.is_active = (valve.spring ? lowvoltagepower : true) // spring actuator needs power to maintain non-default state
|
||||
&& (manualcontrol && lowvoltagepower ? false == valve.is_disabled : true) // needs power to change state, without it just pass through
|
||||
&& (manualcontrol && lowvoltagepower ? false == PantAllDown : true) &&
|
||||
(valve.is_active || (manualcontrol && lowvoltagepower && valve.is_enabled) || (autostart && lowvoltagepower)); // shouldn't ever get this far but, eh
|
||||
(Mains || false == PantographsRequireMains) // fed through the closed line breaker, where it comes first
|
||||
&& (valve.is_active || (manualcontrol && lowvoltagepower && valve.is_enabled) || (autostart && lowvoltagepower)); // shouldn't ever get this far but, eh
|
||||
|
||||
auto const pantographexists{EnginePowerSource.SourceType == TPowerSource::CurrentCollector && EnginePowerSource.CollectorParameters.PhysicalLayout & 1 << pant_id};
|
||||
|
||||
@@ -3872,7 +3876,8 @@ bool TMoverParameters::MainSwitchCheck() const
|
||||
case ElectricInductionMotor:
|
||||
{
|
||||
// TODO: check whether we can simplify this check and skip the outer EngineType switch
|
||||
powerisavailable = EnginePowerSourceVoltage() > 0.5 * EnginePowerSource.MaxVoltage;
|
||||
// closed ahead of the pantographs, the line breaker runs on the low voltage circuits
|
||||
powerisavailable = PantographsRequireMains ? Power24vIsAvailable || Power110vIsAvailable : EnginePowerSourceVoltage() > 0.5 * EnginePowerSource.MaxVoltage;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -3882,7 +3887,8 @@ bool TMoverParameters::MainSwitchCheck() const
|
||||
}
|
||||
|
||||
return powerisavailable && (ScndCtrlPos == 0 || EngineType == ElectricInductionMotor) && MainsInitTimeCountdown <= 0.0 &&
|
||||
(ConvOvldFlag == false || ConverterOverloadRelayOffWhenMainIsOff) && true == GroundRelay && true == NoVoltRelay && true == OvervoltageRelay && LastSwitchingTime > CtrlDelay &&
|
||||
(ConvOvldFlag == false || ConverterOverloadRelayOffWhenMainIsOff) && true == GroundRelay && (true == NoVoltRelay || PantographsRequireMains) && true == OvervoltageRelay &&
|
||||
LastSwitchingTime > CtrlDelay &&
|
||||
(HasCamshaft ? IsMainCtrlActualNoPowerPos() :
|
||||
LineBreakerClosesOnlyAtNoPowerPos ? IsMainCtrlNoPowerPos() :
|
||||
true) &&
|
||||
@@ -3987,6 +3993,25 @@ double TMoverParameters::EnginePowerSourceVoltage() const
|
||||
0.0;
|
||||
}
|
||||
|
||||
// whether the main circuit feeds what runs on it: the converter, a compressor, the heating, the motor and resistor
|
||||
// blowers, the traction motors
|
||||
bool TMoverParameters::MainCircuitPowered() const
|
||||
{
|
||||
if (false == Mains)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (false == PantographsRequireMains || EnginePowerSource.SourceType != TPowerSource::CurrentCollector)
|
||||
{
|
||||
// the closed line breaker says it all: the undervoltage trip opens it without traction voltage, and an engine
|
||||
// which runs is its own supply
|
||||
return true;
|
||||
}
|
||||
// closed ahead of the pantographs the line breaker holds without the voltage, which the undervoltage trip isn't
|
||||
// there to vouch for
|
||||
return EnginePowerSourceVoltage() >= EnginePowerSource.CollectorParameters.MinV;
|
||||
}
|
||||
|
||||
// *************************************************************************************************
|
||||
// Q: 20160711
|
||||
// zwiększenie nastawy hamulca
|
||||
@@ -4580,7 +4605,7 @@ void TMoverParameters::CompressorCheck(double dt)
|
||||
}
|
||||
|
||||
// the main circuit, also for a compressor driven by the engine, otherwise the low voltage
|
||||
auto const compressorpower{CompressorPower == 0 || CompressorPower == 3 ? Mains : Power110vIsAvailable};
|
||||
auto const compressorpower{CompressorPower == 0 || CompressorPower == 3 ? MainCircuitPowered() : Power110vIsAvailable};
|
||||
CompressorPowerTime = compressorpower ? CompressorPowerTime + dt : 0.0;
|
||||
auto const compressorready{compressorpower && CompressorPowerTime >= CompressorStartDelay};
|
||||
// TBD: split CompressorAllow into separate enable/disable flags, inherit compressor from basic_device
|
||||
@@ -5917,7 +5942,7 @@ double TMoverParameters::TractionForce(double dt)
|
||||
|
||||
case TEngineType::ElectricSeriesMotor:
|
||||
{
|
||||
if (true == Mains)
|
||||
if (MainCircuitPowered())
|
||||
{
|
||||
switch (RVentType)
|
||||
{
|
||||
@@ -6049,11 +6074,18 @@ double TMoverParameters::TractionForce(double dt)
|
||||
{
|
||||
// update the state of voltage relays
|
||||
auto const voltage{std::max(GetTrainsetHighVoltage(), PantographVoltage)};
|
||||
NoVoltRelay = EnginePowerSource.SourceType != TPowerSource::CurrentCollector || voltage >= EnginePowerSource.CollectorParameters.MinV;
|
||||
// where the line breaker holds without voltage (closed ahead of the pantographs) the undervoltage relay opens the
|
||||
// line contactors instead, see MotorConnectorsCheck(). it picks up again only with the master controller back
|
||||
// where a start begins, as the line breaker it stands in for wouldn't close on a running position either: at
|
||||
// zero, or at the first position, which is the first resistance step, where the line contactors close on any
|
||||
// start, and where the AI waits for them rather than going back to zero
|
||||
auto const novoltrelaypicksup{false == PantographsRequireMains || NoVoltRelay || MainCtrlPowerPos() <= 1};
|
||||
NoVoltRelay = EnginePowerSource.SourceType != TPowerSource::CurrentCollector || (voltage >= EnginePowerSource.CollectorParameters.MinV && novoltrelaypicksup);
|
||||
OvervoltageRelay =
|
||||
EnginePowerSource.SourceType != TPowerSource::CurrentCollector || voltage <= EnginePowerSource.CollectorParameters.MaxV || false == EnginePowerSource.CollectorParameters.OVP;
|
||||
// wywalanie szybkiego z powodu niewłaściwego napięcia
|
||||
EventFlag |= true == Mains && (false == NoVoltRelay || false == OvervoltageRelay) &&
|
||||
// (a line breaker closed ahead of the pantographs holds without voltage)
|
||||
EventFlag |= true == Mains && ((false == NoVoltRelay && false == PantographsRequireMains) || false == OvervoltageRelay) &&
|
||||
MainSwitch(false, TrainType == dt_EZT ? range_t::unit : range_t::local); // TODO: check whether we need to send this EMU-wide
|
||||
break;
|
||||
}
|
||||
@@ -6062,7 +6094,8 @@ double TMoverParameters::TractionForce(double dt)
|
||||
{
|
||||
// TODO: check if we can use instead the code for electricseriesmotor
|
||||
// nie wchodzić w funkcję bez potrzeby
|
||||
if (Mains && (std::max(GetTrainsetHighVoltage(), PantographVoltage) < EnginePowerSource.CollectorParameters.MinV ||
|
||||
// (a line breaker closed ahead of the pantographs holds without voltage)
|
||||
if (Mains && ((std::max(GetTrainsetHighVoltage(), PantographVoltage) < EnginePowerSource.CollectorParameters.MinV && false == PantographsRequireMains) ||
|
||||
std::max(GetTrainsetHighVoltage(), PantographVoltage) > EnginePowerSource.CollectorParameters.MaxV + 200))
|
||||
{
|
||||
MainSwitch(false, TrainType == dt_EZT ? range_t::unit : range_t::local); // TODO: check whether we need to send this EMU-wide
|
||||
@@ -6583,7 +6616,7 @@ double TMoverParameters::TractionForce(double dt)
|
||||
|
||||
case TEngineType::ElectricInductionMotor:
|
||||
{
|
||||
if (true == Mains && !SecuritySystem.is_engine_blocked())
|
||||
if (MainCircuitPowered() && !SecuritySystem.is_engine_blocked())
|
||||
{
|
||||
double ActiveInverters = 0.0;
|
||||
for (auto const &inv : Inverters)
|
||||
@@ -7501,7 +7534,11 @@ bool TMoverParameters::MotorConnectorsCheck()
|
||||
return false;
|
||||
}
|
||||
|
||||
auto const connectorsoff{false == Mains || true == FuseFlag || true == StLinSwitchOff || DirActive == 0};
|
||||
// a line breaker closed ahead of the pantographs holds without voltage; what cuts the motors off there is its
|
||||
// undervoltage relay, which elsewhere opens the line breaker
|
||||
auto const undervoltage{PantographsRequireMains && false == NoVoltRelay};
|
||||
|
||||
auto const connectorsoff{false == Mains || undervoltage || true == FuseFlag || true == StLinSwitchOff || DirActive == 0};
|
||||
|
||||
return false == connectorsoff && LineContactorsInterlockReleased();
|
||||
}
|
||||
@@ -7899,7 +7936,7 @@ void TMoverParameters::CheckEIMIC(double dt)
|
||||
eimic = 0;
|
||||
}
|
||||
|
||||
auto const eimicpowerenabled{(true == Mains || Power == 0.0) && (!SpringBrake.IsActive || !SpringBrakeCutsOffDrive) && !LockPipe && DirAbsolute != 0};
|
||||
auto const eimicpowerenabled{(MainCircuitPowered() || Power == 0.0) && (!SpringBrake.IsActive || !SpringBrakeCutsOffDrive) && !LockPipe && DirAbsolute != 0};
|
||||
auto const eimicdoorenabled{(SpringBrake.IsActive && ReleaseParkingBySpringBrakeWhenDoorIsOpen)};
|
||||
double eimic_max = 0.0;
|
||||
if (Doors.instances[side::left].open_permit == false && Doors.instances[side::right].open_permit == false)
|
||||
@@ -11604,6 +11641,7 @@ void TMoverParameters::LoadFIZ_Cntrl(std::string const &line)
|
||||
auto lookup = starts.find(extract_value("MainStart", line));
|
||||
MainsStart = lookup != starts.end() ? lookup->second : start_t::manual;
|
||||
}
|
||||
extract_value(PantographsRequireMains, "PantRequiresMain", line, "");
|
||||
// battery
|
||||
{
|
||||
auto lookup = starts.find(extract_value("BatteryStart", line));
|
||||
|
||||
Reference in New Issue
Block a user