diff --git a/application/driverhints.cpp b/application/driverhints.cpp index 661f4d33d..d59431dc6 100644 --- a/application/driverhints.cpp +++ b/application/driverhints.cpp @@ -89,7 +89,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter ) hint( Action, [this](float const /*Parameter*/) { - return occupied->BatteryStart != start_t::manual || occupied->Power24vIsAvailable == true; } ); + return occupied->lowVoltage.batteryStart != start_t::manual || occupied->lowVoltage.power24vAvailable == true; } ); break; } case driver_hint::batteryoff: { @@ -100,12 +100,12 @@ TController::cue_action( driver_hint const Action, float const Actionparameter ) hint( Action, [this](float const /*Parameter*/) { - return occupied->BatteryStart != start_t::manual || occupied->Power24vIsAvailable == false; } ); + return occupied->lowVoltage.batteryStart != start_t::manual || occupied->lowVoltage.power24vAvailable == false; } ); break; } // battery case driver_hint::cabactivation: { - if (AIControllFlag && occupied->Power24vIsAvailable) { + if (AIControllFlag && occupied->lowVoltage.power24vAvailable) { occupied->CabActivisation(); CheckVehicles(); } @@ -1218,7 +1218,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter ) hint( Action, [this](float const /*Parameter*/) { - return occupied->HeatingAllow == true; } ); + return occupied->trainHeating.allow == true; } ); break; } case driver_hint::consistheatingoff: { @@ -1229,7 +1229,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter ) hint( Action, [this](float const /*Parameter*/) { - return occupied->HeatingAllow == false; } ); + return occupied->trainHeating.allow == false; } ); break; } diff --git a/application/driveruipanels.cpp b/application/driveruipanels.cpp index 8ec1a9997..15ff54b1a 100644 --- a/application/driveruipanels.cpp +++ b/application/driveruipanels.cpp @@ -816,7 +816,7 @@ debug_panel::update_section_vehicle( std::vector &Output ) { m_buffer.data(), m_buffer.size(), STR_C("Devices: %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%s%s\nPower transfers: %.0f@%.0f%s[%.0f]%s%.0f@%.0f :: %.0f@%.0f%s[%.0f]%s%.0f@%.0f"), // devices - physics.Battery ? 'B' : '.', + physics.lowVoltage.batteryOn ? 'B' : '.', physics.pantographAir.valve.is_active ? '+' : '.', physics.pantographs[VehicleEnd::rear].valve.is_active ? 'O' : physics.pantographs[VehicleEnd::rear].valve.is_enabled ? 'o' : @@ -858,8 +858,8 @@ debug_panel::update_section_vehicle( std::vector &Output ) { physics.protection.pressureSwitch ? '!' : physics.lineContactors.closed ? '+' : '.', - physics.Heating ? 'H' : - physics.HeatingAllow ? 'h' : + physics.trainHeating.on ? 'H' : + physics.trainHeating.allow ? 'h' : '.', physics.brakes.distributor->Releaser() ? '^' : '.', std::string( m_input.mechanik ? STR(" R") + ( physics.Radio && physics.RadioFuse ? std::to_string( m_input.mechanik->iRadioChannel ) : "-" ) : "" ).c_str(), diff --git a/physics/components/body.cpp b/physics/components/body.cpp index 9e84a8da9..30d19d59c 100644 --- a/physics/components/body.cpp +++ b/physics/components/body.cpp @@ -440,16 +440,16 @@ void physics::Vehicle::compute_movement_(double const Deltatime) // Prad oddawany na rezystor // Wlacz wentylator jesli prad rekuperacji przekroczy maksymalny dla pasywnego chlodzenia rezystora - if (double Irh = abs(inductionMotor.state.electricalPower) - abs(inductionMotor.state.lineCurrent); Irh > Imaxrpc && inductionMotor.state.lineCurrent < 0) + if (double Irh = abs(inductionMotor.state.electricalPower) - abs(inductionMotor.state.lineCurrent); Irh > brakes.electrodynamic.resistorPassiveMaxCurrent && inductionMotor.state.lineCurrent < 0) { - BRVtimer = 0; - BRVentilators = true; + brakes.electrodynamic.resistorFansTimer = 0; + brakes.electrodynamic.resistorFansRunning = true; } else { - BRVtimer += Deltatime; - if (BRVtimer > BRVto) - BRVentilators = false; + brakes.electrodynamic.resistorFansTimer += Deltatime; + if (brakes.electrodynamic.resistorFansTimer > brakes.electrodynamic.resistorFansSustain) + brakes.electrodynamic.resistorFansRunning = false; } // the master controller set directly, not through IncMainCtrl()/DecMainCtrl() (AI, consist): the locked shunt follows it as well @@ -503,11 +503,11 @@ void physics::Vehicle::compute_movement_(double const Deltatime) if ((brakes.emuDynamic.checkedCoupler & 1) != 0 && Couplers[VehicleEnd::front].CouplingFlag.HasAny(Coupling::control)) { - DynamicBrakeEMUStatus &= Couplers[VehicleEnd::front].Connected->DynamicBrakeEMUStatus; + brakes.electrodynamic.emuWorking &= Couplers[VehicleEnd::front].Connected->brakes.electrodynamic.emuWorking; } if ((brakes.emuDynamic.checkedCoupler & 2) != 0 && Couplers[VehicleEnd::rear].CouplingFlag.HasAny(Coupling::control)) { - DynamicBrakeEMUStatus &= Couplers[VehicleEnd::rear].Connected->DynamicBrakeEMUStatus; + brakes.electrodynamic.emuWorking &= Couplers[VehicleEnd::rear].Connected->brakes.electrodynamic.emuWorking; } if (brakes.antiSlipTimer > 0.8 && brakes.antiSlipType != 128) @@ -525,9 +525,9 @@ void physics::Vehicle::compute_movement_(double const Deltatime) PowerCouplersCheck(Deltatime, Coupling::power110v); PowerCouplersCheck(Deltatime, Coupling::power24v); - Power24vVoltage = std::max(PowerCircuits[0].first, GetTrainsetVoltage(Coupling::power24v)); - Power24vIsAvailable = Power24vVoltage > 0; - Power110vIsAvailable = PowerCircuits[1].first > 0 || GetTrainsetVoltage(Coupling::power110v) > 0; + lowVoltage.power24vVoltage = std::max(PowerCircuits[0].first, GetTrainsetVoltage(Coupling::power24v)); + lowVoltage.power24vAvailable = lowVoltage.power24vVoltage > 0; + lowVoltage.power110vAvailable = PowerCircuits[1].first > 0 || GetTrainsetVoltage(Coupling::power110v) > 0; } // ************************************************************************************************* @@ -963,7 +963,7 @@ double physics::Vehicle::BrakeForceR(double ratio, double velocity) const else { press = brakes.maxCylinderPressure[3]; - if (DynamicBrakeType == dbrake_automatic) + if (brakes.electrodynamic.type == dbrake_automatic) ratio = ratio + (1.5 - ratio) * std::min(1.0, Vel * 0.02); if (brakes.delaySetting & bdelay_R && brakes.method % 128 != bp_Cosid && brakes.method % 128 != bp_D1 && brakes.method % 128 != bp_D2 && Power < 1) ratio *= brakes.distributor->GetRapidRatio(velocity); diff --git a/physics/components/braking.h b/physics/components/braking.h index 43865134c..817403f9c 100644 --- a/physics/components/braking.h +++ b/physics/components/braking.h @@ -94,6 +94,25 @@ struct SpringBrake }; // the braking of a vehicle beside its air brake valves +// the electrodynamic brake of the traction motors and its resistors +struct ElectrodynamicBrake +{ + int type = 0; // dbrake_* + int ammeters = 2; // the ammeters it shows on + bool splitFromPneumatic = false; // its controller is apart from the one of the independent air brake + int controllerPositions = 10; // DBPN: the positions of its controller + double controllerPosition = 0.0; // the position of its controller, 0..1, with splitFromPneumatic only + double resistance = 5.8; // of the braking resistors + double resistance1 = 5.8; // of the first mode + double resistance2 = 5.8; // of the second mode + bool on = false; // braking + bool emuWorking = true; // it works, in a multiple unit + bool resistorFansRunning = false; // the fans of the braking resistor + int resistorFansSustain = 0; // how long the fans still cool the resistor after it stops [s] + double resistorFansTimer = 0; // the timer of that + int resistorPassiveMaxCurrent = 0; // the most current of the resistor cooled passively +}; + // the settings of the driver's brake valve (the Handle_* keys of the .fiz) struct DriverValveSettings { @@ -209,12 +228,15 @@ struct Braking bool alarmChain = false; // the manual emergency brake int delaySetting = 0; // the delay set (bdelay_*) int availableDelays = 0; // the delays it can be set to + // the AI wagon inspector cut the brake out (b_dmg) and puts it back when the train no longer needs it cut out + // (brake_setting::apply). Anyone else cutting it out or putting it back takes it over bool cutOutByInspector = false; int operatingMode = 0; // the mode set (bom_*: PS/PN/EP/MED 1/2/4/8) int availableOperatingModes = 0; double unitForce = 0.0; // the braking force of one braked element double antiSlipTimer = 0.0; // to switch the anti-slip brake off + ElectrodynamicBrake electrodynamic; BrakeBlending blending; EmuDynamicBrake emuDynamic; HoldingBrake holding; diff --git a/physics/components/cab.cpp b/physics/components/cab.cpp index 09716282c..cf9e52321 100644 --- a/physics/components/cab.cpp +++ b/physics/components/cab.cpp @@ -74,7 +74,7 @@ int physics::Vehicle::SoundingHorns(int const Signal) const auto const supplied{[this](horn_supply const Supply) { if (Supply == horn_supply::electric) { - return Power24vIsAvailable || Power110vIsAvailable; + return lowVoltage.power24vAvailable || lowVoltage.power110vAvailable; } if (air.mainReservoirVolume > 0.0) { @@ -204,7 +204,7 @@ bool physics::Vehicle::PulleeModeSwitch(bool const State) DecManualBrakeLevel(ManualBrakePosNo); brakes.spring.activate = false; SecuritySystem.set_enabled(false); - Battery = false; + lowVoltage.batteryOn = false; } return true; } diff --git a/physics/components/collisions.cpp b/physics/components/collisions.cpp index 55e93944b..347100559 100644 --- a/physics/components/collisions.cpp +++ b/physics/components/collisions.cpp @@ -238,7 +238,7 @@ collision::vehicle_kind physics::Vehicle::collision_kind() const auto const unit{is_multiple_unit()}; auto const passengers{std::any_of(LoadAttributes.begin(), LoadAttributes.end(), [](auto const &Load) { return ToLower(Load.name).starts_with("passenger"); })}; // a coach heats its compartments; the crash zone is a matter of each end (crush_of()) - return collision::kind_of(powered, unit || passengers || (false == powered && HeatingPower > 0.0), false); + return collision::kind_of(powered, unit || passengers || (false == powered && trainHeating.power > 0.0), false); } collision::crush_curve physics::Vehicle::crush_curve_at(VehicleEnd const End) const diff --git a/physics/components/commands.cpp b/physics/components/commands.cpp index 42c0885da..a5d6f6a2d 100644 --- a/physics/components/commands.cpp +++ b/physics/components/commands.cpp @@ -273,17 +273,17 @@ bool physics::Vehicle::RunBrakeCommand(VehicleCommand const Command, double CVal if (Command == VehicleCommand::brake) // youBy - jak sie EP hamuje, to trza sygnal wyslac... { if (CValue1 < 0.001) - DynamicBrakeEMUStatus = true; + brakes.electrodynamic.emuWorking = true; double temp1 = CValue1; - if (brakes.emuDynamic.epMaxSpeed > 0.001 && Vel > brakes.emuDynamic.epMaxSpeed && DynamicBrakeEMUStatus) + if (brakes.emuDynamic.epMaxSpeed > 0.001 && Vel > brakes.emuDynamic.epMaxSpeed && brakes.electrodynamic.emuWorking) temp1 = 0; - if (brakes.emuDynamic.epMinCurrent > 0.001 && abs(Im) > brakes.emuDynamic.epMinCurrent && DynamicBrakeEMUStatus) + if (brakes.emuDynamic.epMinCurrent > 0.001 && abs(Im) > brakes.emuDynamic.epMinCurrent && brakes.electrodynamic.emuWorking) temp1 = 0; brakes.distributor->SetEPS(temp1); TUHEX_StageActual = static_cast(CValue1); TUHEX_Active = TUHEX_StageActual > 0; if (CValue1 < 0.001) - DynamicBrakeEMUStatus = true; + brakes.electrodynamic.emuWorking = true; // fBrakeCtrlPos:=BrakeCtrlPos; //to powinnno być w jednym miejscu, aktualnie w C++!!! brakes.actualPressure = brakes.pressureTable[brakes.handlePosition]; OK = SendCtrlToNext(Command, CValue1, CValue2, Couplertype); @@ -325,7 +325,7 @@ bool physics::Vehicle::RunBrakeEquipmentCommand(VehicleCommand const Command, do } else if (Command == VehicleCommand::springBrakeActivate) { - if (Power24vIsAvailable || Power110vIsAvailable) + if (lowVoltage.power24vAvailable || lowVoltage.power110vAvailable) { brakes.spring.activate = CValue1 > 0; OK = SendCtrlToNext(Command, CValue1, CValue2, Couplertype); @@ -373,9 +373,9 @@ bool physics::Vehicle::RunAuxiliariesCommand(VehicleCommand const Command, doubl else if (Command == VehicleCommand::batterySwitch) /*NBMX*/ { // the battery of a vehicle prepared for hauling (PulleeMode) stays off - if (BatteryStart == start_t::manual && (false == PulleeMode || CValue1 <= 0.0)) + if (lowVoltage.batteryStart == start_t::manual && (false == PulleeMode || CValue1 <= 0.0)) { - Battery = CValue1 > 0.0; + lowVoltage.batteryOn = CValue1 > 0.0; } OK = SendCtrlToNext(Command, CValue1, CValue2, Couplertype); } @@ -693,7 +693,7 @@ void physics::Vehicle::DoorRemoteCommand(bool const Open, double const CValue1, { using enum control_t; if (auto const doorcontrol{Open ? Doors.open_control : Doors.close_control}; - (doorcontrol != conductor && doorcontrol != driver && doorcontrol != mixed) || (false == Power24vIsAvailable && false == Power110vIsAvailable)) + (doorcontrol != conductor && doorcontrol != driver && doorcontrol != mixed) || (false == lowVoltage.power24vAvailable && false == lowVoltage.power110vAvailable)) { return; } diff --git a/physics/components/controllers.cpp b/physics/components/controllers.cpp index ea780ab4e..d88cdc6c8 100644 --- a/physics/components/controllers.cpp +++ b/physics/components/controllers.cpp @@ -167,7 +167,7 @@ bool physics::Vehicle::IncMainCtrlSeriesMotor(int const CtrlSpeed) //} } - if (TrainType == train_type::et42 && true == DynamicBrakeFlag && MainCtrlPos > 20) + if (TrainType == train_type::et42 && true == brakes.electrodynamic.on && MainCtrlPos > 20) { MainCtrlPos = 20; OK = false; @@ -350,11 +350,11 @@ bool physics::Vehicle::IncScndCtrl(int CtrlSpeed) { bool OK = false; - if (DynamicBrakeFlag && TrainType == train_type::et42 && CabActive != 0 && IsMainCtrlNoPowerPos() && ScndCtrlPos == 0) + if (brakes.electrodynamic.on && TrainType == train_type::et42 && CabActive != 0 && IsMainCtrlNoPowerPos() && ScndCtrlPos == 0) { OK = DynamicBrakeSwitch(false); } - else if (ScndCtrlPosNo > 0 && CabActive != 0 && !(TrainType == train_type::et42 && (Imax == ImaxHi || (DynamicBrakeFlag && MainCtrlPowerPos() > 0)))) + else if (ScndCtrlPosNo > 0 && CabActive != 0 && !(TrainType == train_type::et42 && (Imax == ImaxHi || (brakes.electrodynamic.on && MainCtrlPowerPos() > 0)))) { // if (RList[MainCtrlPos].R=0) and (MainCtrlPos>0) and (ScndCtrlPos0 OK = DynamicBrakeSwitch(true); @@ -498,7 +498,7 @@ void physics::Vehicle::ScndCtrlResistiveLockCheck() int physics::Vehicle::GetVirtualScndPos() const { - if (TrainType == train_type::et42 && DynamicBrakeFlag && !ScndCtrlPos) + if (TrainType == train_type::et42 && brakes.electrodynamic.on && !ScndCtrlPos) return -1; return ScndCtrlPos; } @@ -550,7 +550,7 @@ bool physics::Vehicle::AutoRelayCheck(void) if (motorconnectorsoff || (HasCamshaft ? IsMainCtrlActualNoPowerPos() : IsMainCtrlNoPowerPos())) { lineContactors.closed = false; - if (false == DynamicBrakeFlag) + if (false == brakes.electrodynamic.on) { Im = 0; Itot = 0; @@ -999,8 +999,8 @@ void physics::Vehicle::CheckEIMIC(double dt) // Dodatkowo zapotrzebowanie ED jest ograniczone przez strefe Vh0..Vh1: powyzej Vh1 - pelny ED, // pomiedzy Vh1 a Vh0 - liniowe zanikanie, ponizej Vh0 - zerowe (brak hamowania pneumatycznego // jako uzupelnienia, poniewaz LocalBrake jest oddzielny i operuje wylacznie pneumatyka). - double brakeDemand = SplitEDPneumaticBrake ? DynamicBrakeRatio() : LocalBrakeRatio(); - if (SplitEDPneumaticBrake) + double brakeDemand = brakes.electrodynamic.splitFromPneumatic ? DynamicBrakeRatio() : LocalBrakeRatio(); + if (brakes.electrodynamic.splitFromPneumatic) { double const vh0 = inductionMotor.braking.offSpeed; double const vh1 = inductionMotor.braking.fullSpeed; diff --git a/physics/components/diesel.cpp b/physics/components/diesel.cpp index 9ed1ad4ff..d7e7ecc85 100644 --- a/physics/components/diesel.cpp +++ b/physics/components/diesel.cpp @@ -50,7 +50,7 @@ double physics::Vehicle::EngineMaxRPM() const void physics::Vehicle::WaterPumpCheck(double const /*Timestep*/) { // NOTE: breaker override with start type is sm42 specific hack, replace with ability to define the presence of the breaker - WaterPump.is_active = true == (Power24vIsAvailable || Power110vIsAvailable) && true == WaterPump.breaker && false == WaterPump.is_disabled && + WaterPump.is_active = true == (lowVoltage.power24vAvailable || lowVoltage.power110vAvailable) && true == WaterPump.breaker && false == WaterPump.is_disabled && (true == WaterPump.is_active || true == WaterPump.is_enabled || WaterPump.start_type == start_t::battery); } @@ -58,7 +58,7 @@ void physics::Vehicle::WaterPumpCheck(double const /*Timestep*/) void physics::Vehicle::WaterHeaterCheck(double const /*Timestep*/) { - WaterHeater.is_active = false == WaterHeater.is_damaged && true == (Power24vIsAvailable || Power110vIsAvailable) && true == WaterHeater.is_enabled && true == WaterHeater.breaker && + WaterHeater.is_active = false == WaterHeater.is_damaged && true == (lowVoltage.power24vAvailable || lowVoltage.power110vAvailable) && true == WaterHeater.is_enabled && true == WaterHeater.breaker && (WaterHeater.is_active || WaterHeater.config.temp_min < 0 || diesel.heat.temperatura1 < WaterHeater.config.temp_min); WaterHeater.is_damaged = true == WaterHeater.is_damaged || (true == WaterHeater.is_active && false == WaterPump.is_active); @@ -74,7 +74,7 @@ void physics::Vehicle::FuelPumpCheck(double const /*Timestep*/) { using enum start_t; - FuelPump.is_active = true == (Power24vIsAvailable || Power110vIsAvailable) && false == FuelPump.is_disabled && + FuelPump.is_active = true == (lowVoltage.power24vAvailable || lowVoltage.power110vAvailable) && false == FuelPump.is_disabled && (FuelPump.is_active || (FuelPump.start_type == manual ? FuelPump.is_enabled : FuelPump.start_type == automatic ? diesel.startupRequested || lineBreaker.closed : FuelPump.start_type == manualwithautofallback ? FuelPump.is_enabled || diesel.startupRequested || lineBreaker.closed : @@ -85,7 +85,7 @@ void physics::Vehicle::FuelPumpCheck(double const /*Timestep*/) void physics::Vehicle::OilPumpCheck(double const Timestep) { - OilPump.is_active = true == (Power24vIsAvailable || Power110vIsAvailable) && false == lineBreaker.closed && false == OilPump.is_disabled && + OilPump.is_active = true == (lowVoltage.power24vAvailable || lowVoltage.power110vAvailable) && false == lineBreaker.closed && false == OilPump.is_disabled && (OilPump.is_active || (OilPump.start_type == start_t::manual ? OilPump.is_enabled : OilPump.start_type == start_t::automatic ? diesel.startupRequested : OilPump.start_type == start_t::manualwithautofallback ? OilPump.is_enabled || diesel.startupRequested : @@ -341,10 +341,10 @@ double physics::Vehicle::DieselElectricTargetRevolutions() else tmp = DElist[protection.pressureSwitch ? MainCtrlNoPowerPos() : MainCtrlPos].RPM / 60.0; - if (true == HeatingAllow && HeatingPower > 0 && EngineHeatingRPM > 0) + if (true == trainHeating.allow && trainHeating.power > 0 && trainHeating.engineRpm > 0) { // bump engine revolutions up if needed, when heating is on - tmp = std::max(tmp, std::min(EngineMaxRPM(), EngineHeatingRPM) / 60.0); + tmp = std::max(tmp, std::min(EngineMaxRPM(), trainHeating.engineRpm) / 60.0); } // NOTE: fake diesel.fill calculation for the sake of smoke emitter which uses this parameter to determine smoke opacity diesel.fill = std::clamp(0.2 + 0.35 * (tmp - enrot) + 0.5 * (std::abs(Im) / DElist[MainCtrlPosNo].Imax), 0.05, 1.0); @@ -385,9 +385,9 @@ void physics::Vehicle::DieselElectricTractionForce(double tmp) auto power = Power; tempImax = DElist[MainCtrlPos].Imax; tempUmax = DElist[MainCtrlPos].Umax; - if (true == Heating) + if (true == trainHeating.on) { - power -= HeatingPower; + power -= trainHeating.power; } power = std::max(power, 0.0); // NOTE: very crude way to approximate power generated at current rpm instead of instant top output @@ -618,7 +618,7 @@ void physics::Vehicle::update_dieselelectric_dynamic_brake(double const dt) brake.level = 0.0; } brake.force = brake.level * dieselelectric_dynamic_brake_limit(); - DynamicBrakeFlag = brake.force > 0.0; + brakes.electrodynamic.on = brake.force > 0.0; if (brake.blending) { // the train brake of the locomotive lets off by the share of the dynamic brake's force (LSt, EStED) @@ -1373,7 +1373,7 @@ void physics::Vehicle::dizel_Heat(double const dt) // engine heat transfers auto const Ge{engineon * (0.21 * diesel.heat.powerfactor * EnginePower + 12) / 3600}; // TODO: replace fixed heating power cost with more accurate calculation - auto const obciazenie{engineon * (diesel.heat.powerfactor * EnginePower / 950 + (Heating ? HeatingPower : 0) + 70)}; + auto const obciazenie{engineon * (diesel.heat.powerfactor * EnginePower / 950 + (trainHeating.on ? trainHeating.power : 0) + 70)}; auto const Qd{qs * Ge - obciazenie}; // silnik oddaje czesc ciepla do wody chlodzacej, a takze pewna niewielka czesc do otoczenia, modyfikowane przez okienko auto const Qs{(Qd - diesel.heat.kfs * (diesel.heat.Ts - diesel.heat.Tsr) - diesel.heat.kfe * /* ( 0.3 + 0.7 * ( diesel.heat.okienko ? 1 : 0 ) ) * */ (diesel.heat.Ts - diesel.heat.Te))}; @@ -1400,7 +1400,7 @@ void physics::Vehicle::dizel_Heat(double const dt) { // auxiliary water circuit setup diesel.heat.water_aux.is_warm = true == diesel.heat.cooling || - (true == lineBreaker.closed && BatteryVoltage > 0.75 * NominalBatteryVoltage /* && !bezpompy && !awaria_chlodzenia && !WS10 */ + (true == lineBreaker.closed && lowVoltage.batteryVoltage > 0.75 * lowVoltage.nominalBatteryVoltage /* && !bezpompy && !awaria_chlodzenia && !WS10 */ && diesel.heat.water_aux.config.temp_cooling > 0 && diesel.heat.temperatura2 > diesel.heat.water_aux.config.temp_cooling - (diesel.heat.water_aux.is_warm ? 8 : 0)); auto const PTC2{(diesel.heat.water_aux.is_warm /*or PTC2p*/ ? 1 : 0)}; diesel.heat.rpmwz2 = static_cast(PTC2 * (diesel.heat.fan_speed >= 0 ? rpm * diesel.heat.fan_speed : diesel.heat.fan_speed * -1)); @@ -1423,7 +1423,7 @@ void physics::Vehicle::dizel_Heat(double const dt) diesel.heat.water.is_flowing = diesel.heat.water.config.temp_flow < 0 || diesel.heat.temperatura1 > diesel.heat.water.config.temp_flow - (diesel.heat.water.is_flowing ? 5 : 0); auto const obieg{(diesel.heat.water.is_flowing ? 1 : 0)}; diesel.heat.water.is_warm = - true == diesel.heat.cooling || (true == lineBreaker.closed && BatteryVoltage > 0.75 * NominalBatteryVoltage /* && !bezpompy && !awaria_chlodzenia && !WS10 */ + true == diesel.heat.cooling || (true == lineBreaker.closed && lowVoltage.batteryVoltage > 0.75 * lowVoltage.nominalBatteryVoltage /* && !bezpompy && !awaria_chlodzenia && !WS10 */ && diesel.heat.water.config.temp_cooling > 0 && diesel.heat.temperatura1 > diesel.heat.water.config.temp_cooling - (diesel.heat.water.is_warm ? 8 : 0)); auto const PTC1{(diesel.heat.water.is_warm /*or PTC1p*/ ? 1 : 0)}; diesel.heat.rpmwz = static_cast(PTC1 * (diesel.heat.fan_speed >= 0 ? rpm * diesel.heat.fan_speed : diesel.heat.fan_speed * -1)); diff --git a/physics/components/doors.cpp b/physics/components/doors.cpp index 2e90c2a88..613d33da4 100644 --- a/physics/components/doors.cpp +++ b/physics/components/doors.cpp @@ -281,7 +281,7 @@ bool physics::Vehicle::OperateDoors(VehicleSide const Door, bool const State, ra else { // remote door operation signals require power to propagate - if (Power24vIsAvailable || Power110vIsAvailable) + if (lowVoltage.power24vAvailable || lowVoltage.power110vAvailable) { door.remote_open = State; door.remote_close = false == State; @@ -486,9 +486,9 @@ bool physics::Vehicle::doors_powered() const } if (Doors.voltage == 24) { - return Power24vIsAvailable || Power110vIsAvailable; + return lowVoltage.power24vAvailable || lowVoltage.power110vAvailable; } - return Doors.voltage == 110 && Power110vIsAvailable; + return Doors.voltage == 110 && lowVoltage.power110vAvailable; } // whether the unfolded step folds: without the permission to stay out, or with the door closing, once it's about to diff --git a/physics/components/drive.cpp b/physics/components/drive.cpp index 938b66069..648c6cac4 100644 --- a/physics/components/drive.cpp +++ b/physics/components/drive.cpp @@ -125,7 +125,7 @@ void updateRadiatorFans(physics::Vehicle &vehicle, double const dt) // else it needs the voltage of the source bool linePowerAvailable(physics::Vehicle const &vehicle) { - return vehicle.lineBreaker.pantographsRequireIt ? vehicle.Power24vIsAvailable || vehicle.Power110vIsAvailable : vehicle.EnginePowerSourceVoltage() > 0.5 * vehicle.EnginePowerSource.MaxVoltage; + return vehicle.lineBreaker.pantographsRequireIt ? vehicle.lowVoltage.power24vAvailable || vehicle.lowVoltage.power110vAvailable : vehicle.EnginePowerSourceVoltage() > 0.5 * vehicle.EnginePowerSource.MaxVoltage; } // a notch of the master controller of the drives without steps of their own (no engine, Dumb, diesel-electric, @@ -199,7 +199,7 @@ public: } bool MainsPowerAvailable(physics::Vehicle const &vehicle) const override { - return vehicle.Power24vIsAvailable; + return vehicle.lowVoltage.power24vAvailable; } bool IncreaseMainController(physics::Vehicle &vehicle, int const speed) const override { @@ -421,7 +421,7 @@ public: } bool MainsPowerAvailable(physics::Vehicle const &vehicle) const override { - return vehicle.Power24vIsAvailable; + return vehicle.lowVoltage.power24vAvailable; } bool UpdateEngine(physics::Vehicle &vehicle, double const dt) const override { @@ -523,7 +523,7 @@ public: } bool MainsPowerAvailable(physics::Vehicle const &vehicle) const override { - return vehicle.Power24vIsAvailable; + return vehicle.lowVoltage.power24vAvailable; } void CheckVoltageRelays(physics::Vehicle &vehicle) const override { diff --git a/physics/components/electrics.cpp b/physics/components/electrics.cpp index 20e734075..178bcab4f 100644 --- a/physics/components/electrics.cpp +++ b/physics/components/electrics.cpp @@ -40,7 +40,7 @@ void physics::Vehicle::UpdatePantVolume(double dt) pantographAir.compressorRunning |= pantographAir.pressure < 4.2 && true == (pantographs[VehicleEnd::front].is_active | pantographs[VehicleEnd::rear].is_active) // TODO: any_pantograph_is_active method && (pantographAir.compressorStart == start_t::automatic || pantographAir.compressorStart == start_t::manualwithautofallback); - auto const lowvoltagepower{Power24vIsAvailable || Power110vIsAvailable}; + auto const lowvoltagepower{lowVoltage.power24vAvailable || lowVoltage.power110vAvailable}; pantographAir.compressorRunning &= lowvoltagepower; if (EnginePowerSource.SourceType == TPowerSource::CurrentCollector // tylko jeśli pantografujący @@ -96,7 +96,7 @@ void physics::Vehicle::PantPressureSwitchCheck() { // NOTE: we require active low power source to prime the pressure switch // this is a work-around for potential isssues caused by the switch activating on otherwise idle vehicles, but should check whether it's accurate - if (true == Power24vIsAvailable || true == Power110vIsAvailable) + if (true == lowVoltage.power24vAvailable || true == lowVoltage.power110vAvailable) { // prime the pressure switch pantographAir.pressureSwitchActive = true; @@ -143,41 +143,41 @@ void physics::Vehicle::PantPressureSwitchTrip() void physics::Vehicle::UpdateBatteryVoltage(double dt) { // przeliczenie obciążenia baterii using enum TEngineType; - if (BatteryVoltage > 0 && EngineType != DieselEngine && EngineType != WheelsDriven && NominalBatteryVoltage > 0) + if (lowVoltage.batteryVoltage > 0 && EngineType != DieselEngine && EngineType != WheelsDriven && lowVoltage.nominalBatteryVoltage > 0) { // HACK: allow to draw power also from adjacent converter, applicable for EMUs // TODO: expand power cables system to include low voltage power transfers // HACK: emulate low voltage generator powered directly by the diesel engine - auto const converteractive{Power110vIsAvailable || (EngineType == DieselElectric && true == lineBreaker.closed) || (EngineType == DieselEngine && true == lineBreaker.closed)}; + auto const converteractive{lowVoltage.power110vAvailable || (EngineType == DieselElectric && true == lineBreaker.closed) || (EngineType == DieselEngine && true == lineBreaker.closed)}; - BatteryVoltage -= BatteryDrain(dt, converteractive); - if (NominalBatteryVoltage / BatteryVoltage > 1.57 && MainSwitch(false) && EngineType != DieselEngine && EngineType != WheelsDriven) + lowVoltage.batteryVoltage -= BatteryDrain(dt, converteractive); + if (lowVoltage.nominalBatteryVoltage / lowVoltage.batteryVoltage > 1.57 && MainSwitch(false) && EngineType != DieselEngine && EngineType != WheelsDriven) EventFlag = true; // wywalanie szybkiego z powodu zbyt niskiego napiecia - if (BatteryVoltage > NominalBatteryVoltage) - BatteryVoltage = NominalBatteryVoltage; // wstrzymanie ładowania pow. 110V - if (BatteryVoltage < 0.01) - BatteryVoltage = 0.01; + if (lowVoltage.batteryVoltage > lowVoltage.nominalBatteryVoltage) + lowVoltage.batteryVoltage = lowVoltage.nominalBatteryVoltage; // wstrzymanie ładowania pow. 110V + if (lowVoltage.batteryVoltage < 0.01) + lowVoltage.batteryVoltage = 0.01; } else { // TODO: check and implement proper way to handle this for diesel engines - BatteryVoltage = NominalBatteryVoltage; + lowVoltage.batteryVoltage = lowVoltage.nominalBatteryVoltage; } }; // the drop of the battery's voltage in dt, by what draws from it, or its rise by the converter charging it double physics::Vehicle::BatteryDrain(double dt, bool const converteractive) const { - if (NominalBatteryVoltage / BatteryVoltage < 1.22 && Battery) + if (lowVoltage.nominalBatteryVoltage / lowVoltage.batteryVoltage < 1.22 && lowVoltage.batteryOn) { // 110V return BatteryDrainCharged(dt, converteractive); } - if (NominalBatteryVoltage / BatteryVoltage >= 1.22 && Battery) + if (lowVoltage.nominalBatteryVoltage / lowVoltage.batteryVoltage >= 1.22 && lowVoltage.batteryOn) { // 90V return BatteryDrainLow(dt, converteractive); } - if (!Battery) + if (!lowVoltage.batteryOn) { return BatteryDrainSwitchedOff(dt); } @@ -254,7 +254,7 @@ double physics::Vehicle::BatteryDrainSwitchedOff(double dt) const double sn3; double sn4; double sn5; - if (NominalBatteryVoltage / BatteryVoltage < 1.22) + if (lowVoltage.nominalBatteryVoltage / lowVoltage.batteryVoltage < 1.22) sn1 = dt * 50; else sn1 = 0; @@ -281,7 +281,7 @@ void physics::Vehicle::MainsCheck(double const Deltatime) } case TPowerSource::Accumulator: { - localvoltage = std::max(localvoltage, Power24vVoltage); + localvoltage = std::max(localvoltage, lowVoltage.power24vVoltage); break; } default: @@ -295,7 +295,7 @@ void physics::Vehicle::MainsCheck(double const Deltatime) localvoltage = Genset.voltage; } // 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 || (lineBreaker.pantographsRequireIt && (Power24vIsAvailable || Power110vIsAvailable))}; + auto const maincircuitpowersupply{std::abs(localvoltage) > 0.1 || GetTrainsetHighVoltage() > 0.1 || (lineBreaker.pantographsRequireIt && (lowVoltage.power24vAvailable || lowVoltage.power110vAvailable))}; if (true == maincircuitpowersupply) { @@ -331,7 +331,7 @@ void physics::Vehicle::MainsCheck(double const Deltatime) void physics::Vehicle::LowVoltagePowerCheck(double const /*Deltatime*/) { - auto const lowvoltagepower{Power24vIsAvailable || Power110vIsAvailable}; + auto const lowvoltagepower{lowVoltage.power24vAvailable || lowVoltage.power110vAvailable}; if (EngineType == TEngineType::ElectricSeriesMotor) { @@ -394,7 +394,7 @@ double physics::Vehicle::LocalPowerVoltage(Coupling const kind) case Coupling::highVoltage: { // heating power sources - if (Heating) + if (trainHeating.on) { switch (HeatingPowerSource.SourceType) { @@ -433,7 +433,7 @@ double physics::Vehicle::LocalPowerVoltage(Coupling const kind) { if (converter.running) { - localvoltage = NominalBatteryVoltage; + localvoltage = lowVoltage.nominalBatteryVoltage; } // TBD, TODO: reduce by current draw? PowerCircuits[1].first = localvoltage; @@ -442,9 +442,9 @@ double physics::Vehicle::LocalPowerVoltage(Coupling const kind) case Coupling::power24v: { - if (Battery) + if (lowVoltage.batteryOn) { - localvoltage = BatteryVoltage; + localvoltage = lowVoltage.batteryVoltage; } // TBD, TODO: reduce by current draw? PowerCircuits[0].first = localvoltage; @@ -487,7 +487,7 @@ void physics::Vehicle::PowerCouplersVoltage(Coupling const kind, double const ab auto const oppositeheatingcoupling{oppositecoupler.CouplingFlag.HasAny(Coupling::heating)}; oppositecouplingispresent = oppositehighvoltagecoupling || oppositeheatingcoupling; - localpowerexportisenabled = oppositehighvoltagecoupling || (oppositeheatingcoupling && localpowersource && Heating); + localpowerexportisenabled = oppositehighvoltagecoupling || (oppositeheatingcoupling && localpowersource && trainHeating.on); break; } @@ -593,7 +593,7 @@ void physics::Vehicle::ConverterCheck(double const Timestep) // TODO: move other converter checks here, to have it all in one place for potential device object if (converter.start != start_t::disabled && converter.overloadRelayOffWithLineBreaker) { - converter.overloaded |= !lineBreaker.closed && Power24vIsAvailable; + converter.overloaded |= !lineBreaker.closed && lowVoltage.power24vAvailable; } switch (converter.start) @@ -663,7 +663,7 @@ void physics::Vehicle::HeatingCheck(double const /*Timestep*/) generator.revolutions = *generator.engine_revolutions; auto const absrevolutions{std::abs(generator.revolutions)}; - generator.voltage = (false == HeatingAllow ? 0.0 : + generator.voltage = (false == trainHeating.allow ? 0.0 : // TODO: add support for desired voltage selector absrevolutions < generator.revolutions_min ? generator.voltage_min * absrevolutions / generator.revolutions_min : @@ -675,9 +675,9 @@ void physics::Vehicle::HeatingCheck(double const /*Timestep*/) } // quick check first to avoid unnecessary calls... - if (false == HeatingAllow) + if (false == trainHeating.allow) { - Heating = false; + trainHeating.on = false; return; } // ...detailed check if we're still here @@ -717,11 +717,11 @@ void physics::Vehicle::HeatingCheck(double const /*Timestep*/) } } - Heating = voltage > heatingpowerthreshold; + trainHeating.on = voltage > heatingpowerthreshold; - if (Heating) + if (trainHeating.on) { - TotalCurrent += 1000 * HeatingPower / voltage; // heater power cost presumably specified in kilowatts + TotalCurrent += 1000 * trainHeating.power / voltage; // heater power cost presumably specified in kilowatts } } @@ -731,7 +731,7 @@ void physics::Vehicle::PantographsCheck(double const /*Timestep*/) { auto const &valve{pantographAir.valve}; - auto const lowvoltagepower{valve.solenoid ? Power24vIsAvailable || Power110vIsAvailable : true}; + auto const lowvoltagepower{valve.solenoid ? lowVoltage.power24vAvailable || lowVoltage.power110vAvailable : true}; auto const autostart{valve.start_type == automatic || valve.start_type == manualwithautofallback}; auto const manualcontrol{valve.start_type == manual || valve.start_type == manualwithautofallback}; @@ -747,7 +747,7 @@ void physics::Vehicle::PantographsCheck(double const /*Timestep*/) { auto &valve{pantograph.valve}; - auto const lowvoltagepower{valve.solenoid ? Power24vIsAvailable || Power110vIsAvailable : true}; + auto const lowvoltagepower{valve.solenoid ? lowVoltage.power24vAvailable || lowVoltage.power110vAvailable : true}; auto const autostart{valve.start_type == automatic || valve.start_type == manualwithautofallback}; auto const manualcontrol{valve.start_type == manual || valve.start_type == manualwithautofallback}; @@ -775,7 +775,7 @@ void physics::Vehicle::GensetCheck(double const Deltatime) } auto &genset{Genset}; auto const wasactive{genset.is_active}; - auto const lowvoltagepower{Power24vIsAvailable || Power110vIsAvailable}; + auto const lowvoltagepower{lowVoltage.power24vAvailable || lowVoltage.power110vAvailable}; auto const requested{lowvoltagepower && false == genset.is_disabled && (genset.start_type == start_t::automatic ? GensetSelected() : genset.is_enabled)}; if (false == requested) { @@ -829,13 +829,13 @@ void physics::Vehicle::LightsCheck(double const /*Timestep*/) light.is_active = // TODO: bind properly power source when ld is in place - (Power24vIsAvailable || Power110vIsAvailable) // power source + (lowVoltage.power24vAvailable || lowVoltage.power110vAvailable) // power source && false == light.is_disabled && (true == light.is_active || (light.start_type == start_t::manual ? light.is_enabled : true)); light.intensity = (light.is_active ? 1.0f : 0.0f) // TODO: bind properly power source when ld is in place - * (Power110vIsAvailable ? 1.0f : - Power24vIsAvailable ? 0.5f : + * (lowVoltage.power110vAvailable ? 1.0f : + lowVoltage.power24vAvailable ? 0.5f : 0.0f) * light.dimming; } @@ -852,12 +852,12 @@ bool physics::Vehicle::BatterySwitch(bool State, range_t const Notify) // the battery of a vehicle prepared for hauling stays off return false; } - auto const initialstate{Battery}; + auto const initialstate{lowVoltage.batteryOn}; // Ra: ukrotnienie załączania baterii jest jakąś fikcją... - if (BatteryStart == start_t::manual) + if (lowVoltage.batteryStart == start_t::manual) { - Battery = State; + lowVoltage.batteryOn = State; } // switching batteries does not require activation @@ -867,7 +867,7 @@ bool physics::Vehicle::BatterySwitch(bool State, range_t const Notify) SendCtrlToNext(VehicleCommand::batterySwitch, State ? 1 : 0, -1, Notify == unit ? Coupling::control | Coupling::permanent : Coupling::control); } - return Battery != initialstate; + return lowVoltage.batteryOn != initialstate; } bool physics::Vehicle::CompartmentLightsSwitch(bool State, range_t const Notify) @@ -1025,7 +1025,7 @@ bool physics::Vehicle::ConverterSwitch(bool State, range_t const Notify) bool physics::Vehicle::HeatingSwitch(bool const State, range_t const Notify) { - bool const initialstate{HeatingAllow}; + bool const initialstate{trainHeating.allow}; HeatingSwitch_(State); @@ -1036,14 +1036,14 @@ bool physics::Vehicle::HeatingSwitch(bool const State, range_t const Notify) SendCtrlToNext(VehicleCommand::heatingSwitch, State ? 1 : 0, CabActive, Notify == range_t::unit ? Coupling::control | Coupling::permanent : Coupling::control); } - return HeatingAllow != initialstate; + return trainHeating.allow != initialstate; } void physics::Vehicle::HeatingSwitch_(bool const State) { // TBD, TODO: activation dependencies? - HeatingAllow = State; + trainHeating.allow = State; } // the start request of the genset of a dual-mode vehicle; one which starts on its own ignores it, but passes it on to @@ -1100,7 +1100,7 @@ double physics::Vehicle::CatenaryCurrent() const { return HeatingPowerSource.SourceType == TPowerSource::CurrentCollector ? TotalCurrent : 0.0; } - return (DynamicBrakeFlag && ResistorsFlag ? 0 : std::abs(Itot) * IsVehicleEIMBrakingFactor()) + TotalCurrent; + return (brakes.electrodynamic.on && ResistorsFlag ? 0 : std::abs(Itot) * IsVehicleEIMBrakingFactor()) + TotalCurrent; } // returns voltage of defined main engine power source @@ -1108,7 +1108,7 @@ double physics::Vehicle::EnginePowerSourceVoltage() const { return EnginePowerSource.SourceType == TPowerSource::CurrentCollector ? TractionSupplyVoltage() : - EnginePowerSource.SourceType == TPowerSource::Accumulator ? Power24vVoltage : + EnginePowerSource.SourceType == TPowerSource::Accumulator ? lowVoltage.power24vVoltage : 0.0; } @@ -1304,7 +1304,7 @@ double physics::Vehicle::GetTrainsetVoltage(CouplingSet const couplings) const double physics::Vehicle::GetTrainsetHighVoltage() const { - return std::max(GetTrainsetVoltage(Coupling::highVoltage), HeatingAllow ? GetTrainsetVoltage(Coupling::heating) : 0.0); + return std::max(GetTrainsetVoltage(Coupling::highVoltage), trainHeating.allow ? GetTrainsetVoltage(Coupling::heating) : 0.0); } int physics::Vehicle::clampDimmerPosition(int const Position) const diff --git a/physics/components/fizsections.cpp b/physics/components/fizsections.cpp index ea183719c..d32c1bda1 100644 --- a/physics/components/fizsections.cpp +++ b/physics/components/fizsections.cpp @@ -62,7 +62,7 @@ void physics::Vehicle::LoadFIZ_Param(std::string const &line) extract_value(Vmax, "Vmax", line, "0"); extract_value(Power, "PWR", line, "0"); extract_value(SandCapacity, "SandCap", line, "0"); - extract_value(HeatingPower, "HeatingP", line, "0"); + extract_value(trainHeating.power, "HeatingP", line, "0"); extract_value(LightPower, "LightP", line, "0"); { @@ -814,20 +814,20 @@ void physics::Vehicle::LoadFIZ_CntrlControllers(std::string const &line) { std::map> dynamicbrakes{{"Passive", dbrake_passive}, {"Switch", dbrake_switch}, {"Reversal", dbrake_reversal}, {"Automatic", dbrake_automatic}}; auto lookup = dynamicbrakes.find(extract_value("DynamicBrake", line)); - DynamicBrakeType = lookup != dynamicbrakes.end() ? lookup->second : dbrake_none; - extract_value(DynamicBrakeAmpmeters, "DBAM", line, ""); + brakes.electrodynamic.type = lookup != dynamicbrakes.end() ? lookup->second : dbrake_none; + extract_value(brakes.electrodynamic.ammeters, "DBAM", line, ""); } // split ED/pneumatic brake control: when true the local brake operates only on the // pneumatic locomotive cylinder while electrodynamic braking is commanded by a // separate "dynamicbrakectrl" lever (or the negative range of jointctrl). - extract_value(SplitEDPneumaticBrake, "SplitEDPneumaticBrake", line, ""); + extract_value(brakes.electrodynamic.splitFromPneumatic, "SplitEDPneumaticBrake", line, ""); // number of stepped positions for the dedicated ED brake controller (default 10) - DynamicBrakeCtrlPosNo = 10; - extract_value(DynamicBrakeCtrlPosNo, "DBPN", line, ""); - if (DynamicBrakeCtrlPosNo < 1) + brakes.electrodynamic.controllerPositions = 10; + extract_value(brakes.electrodynamic.controllerPositions, "DBPN", line, ""); + if (brakes.electrodynamic.controllerPositions < 1) { - DynamicBrakeCtrlPosNo = 10; + brakes.electrodynamic.controllerPositions = 10; } extract_value(MainCtrlPosNo, "MCPN", line, ""); @@ -896,9 +896,9 @@ void physics::Vehicle::LoadFIZ_CntrlControllers(std::string const &line) extract_value(isDoubleClickForMeasureNeeded, "DCMB", line, ""); extract_value(DistanceCounterDoublePressPeriod, "DCDPP", line, ""); - extract_value(isBatteryButtonImpulse, "IBTB", line, ""); - extract_value(shouldHoldBatteryButton, "SBBBH", line, ""); - extract_value(BatteryButtonHoldTime, "BBHT", line, ""); + extract_value(lowVoltage.batteryButtonImpulse, "IBTB", line, ""); + extract_value(lowVoltage.batteryButtonHeld, "SBBBH", line, ""); + extract_value(lowVoltage.batteryButtonHoldTime, "BBHT", line, ""); } // Cntrl.: how the devices start (MainStart, BatteryStart, ...) and their relays @@ -921,7 +921,7 @@ void physics::Vehicle::LoadFIZ_CntrlStarts(std::string const &line) // battery { auto lookup = starts.find(extract_value("BatteryStart", line)); - BatteryStart = lookup != starts.end() ? lookup->second : manual; + lowVoltage.batteryStart = lookup != starts.end() ? lookup->second : manual; } // converter { @@ -1076,8 +1076,8 @@ void physics::Vehicle::LoadFIZ_Light(std::string const &line) LoadFIZ_PowerParamsDecode(AlterLightPowerSource, "AlterL", line); extract_value(NominalVoltage, "Volt", line, ""); - extract_value(BatteryVoltage, "LMaxVoltage", line, ""); - NominalBatteryVoltage = static_cast(BatteryVoltage); + extract_value(lowVoltage.batteryVoltage, "LMaxVoltage", line, ""); + lowVoltage.nominalBatteryVoltage = static_cast(lowVoltage.batteryVoltage); } void physics::Vehicle::LoadFIZ_Clima(std::string const &line) @@ -1368,7 +1368,7 @@ void physics::Vehicle::LoadFIZ_EngineDieselElectric(std::string const &Input) ImaxHi = 2; ImaxLo = 1; } - extract_value(EngineHeatingRPM, "HeatingRPM", Input, ""); + extract_value(trainHeating.engineRpm, "HeatingRPM", Input, ""); extract_value(diesel.shaftInertia, "AIM", Input, "1.25"); extract_value(diesel.revolutionsDecreaseRate, "RPMDecRate", Input, ""); LoadFIZ_DieselElectricDynamicBrake(Input); @@ -1410,8 +1410,8 @@ void physics::Vehicle::LoadFIZ_EngineInductionMotor(std::string const &Input) extract_value(inductionMotor.logForce, "eimclf", Input, ""); extract_value(inductionMotor.inverterCount, "InvNo", Input, ""); extract_value(inductionMotor.inverterControlCouplings, "InvCtrCplFlag", Input, ""); - extract_value(Imaxrpc, "Imaxrpc", Input, ""); - extract_value(BRVto, "BRVto", Input, ""); + extract_value(brakes.electrodynamic.resistorPassiveMaxCurrent, "Imaxrpc", Input, ""); + extract_value(brakes.electrodynamic.resistorFansSustain, "BRVto", Input, ""); extract_value(Flat, "Flat", Input, ""); if (inductionMotor.traction.maxPower > 0 && Power > 0 && inductionMotor.inverterCount == 0) @@ -1471,7 +1471,7 @@ void physics::Vehicle::LoadFIZ_Switches(std::string const &Input) extract_value(pantographCircuit.switchType, "Pantograph", Input, ""); extract_value(converter.switchType, "Converter", Input, ""); extract_value(lineContactors.switchType, "MotorConnectors", Input, ""); - HeatingSwitchImpulse = ToLower(extract_value("TrainHeating", Input)) == "impulse"; + trainHeating.switchImpulse = ToLower(extract_value("TrainHeating", Input)) == "impulse"; // because people can't make up their minds whether it's "impulse" or "Impulse"... pantographCircuit.switchType = ToLower(pantographCircuit.switchType); converter.switchType = ToLower(converter.switchType); @@ -1565,9 +1565,9 @@ void physics::Vehicle::LoadFIZ_RList(std::string const &Input) } extract_value(RVentMinI, "RVentMinI", Input, ""); extract_value(RVentSpeed, "RVentSpeed", Input, ""); - extract_value(DynamicBrakeRes, "DynBrakeRes", Input, ""); - extract_value(DynamicBrakeRes1, "DynBrakeRes1", Input, ""); - extract_value(DynamicBrakeRes2, "DynBrakeRes2", Input, ""); + extract_value(brakes.electrodynamic.resistance, "DynBrakeRes", Input, ""); + extract_value(brakes.electrodynamic.resistance1, "DynBrakeRes1", Input, ""); + extract_value(brakes.electrodynamic.resistance2, "DynBrakeRes2", Input, ""); } // the dynamic brake of a diesel-electric vehicle, from its Engine section: none without EDBrake @@ -1595,7 +1595,7 @@ void physics::Vehicle::LoadFIZ_DieselElectricDynamicBrake(std::string const &Inp if (brake.source == lever) { // the lever of its own, which the commands of the dynamic brake controller move - SplitEDPneumaticBrake = true; + brakes.electrodynamic.splitFromPneumatic = true; } } diff --git a/physics/components/lowvoltage.h b/physics/components/lowvoltage.h new file mode 100644 index 000000000..5127e3455 --- /dev/null +++ b/physics/components/lowvoltage.h @@ -0,0 +1,46 @@ +/* +This Source Code Form is subject to the +terms of the Mozilla Public License, v. +2.0. If a copy of the MPL was not +distributed with this file, You can +obtain one at +http://mozilla.org/MPL/2.0/. +*/ + +// the low voltage supply and the train heating of a vehicle, held by physics::Vehicle as lowVoltage and trainHeating + +#pragma once + +#include "physics/vehicletypes.h" + +namespace physics +{ + +// the battery and the low voltage circuits +struct LowVoltageSupply +{ + bool batteryOn = false; // the battery switched on + double batteryVoltage = 0.0; + float nominalBatteryVoltage = 0.f; + start_t batteryStart = start_t::manual; + bool power110vAvailable = false; // the 110 V circuit has power, as the last step found it + bool power24vAvailable = false; // the 24 V circuit has power, as the last step found it + double power24vVoltage{0.0}; // the voltage of the battery circuit, as the last step found it + // the battery switch of the cab + bool batteryButtonFired = false; // the button already pressed + bool batteryButtonImpulse = false; // the switch works as a single button + bool batteryButtonHeld = false; // the button has to be held to switch the battery on or off + float batteryButtonHoldTime = 1.f; // how long it has to be held [s] +}; + +// the heating of the train fed by the vehicle +struct TrainHeating +{ + bool on = false; + bool allow{false}; // the heating switch. TODO: wrap the heating in a basic device + bool switchImpulse{false}; // the switch springs back to its middle position + double power = 0.0; + double engineRpm{0.0}; // the revolutions of the engine guaranteed with the heating on +}; + +} // namespace physics diff --git a/physics/components/pneumatics.cpp b/physics/components/pneumatics.cpp index c1e9fcd8a..62cd30bb3 100644 --- a/physics/components/pneumatics.cpp +++ b/physics/components/pneumatics.cpp @@ -246,7 +246,7 @@ bool physics::Vehicle::EpFuseSwitch(bool State) // ************************************************************************************************* bool physics::Vehicle::SpringBrakeActivate(bool State) { - if (Power24vIsAvailable || Power110vIsAvailable) + if (lowVoltage.power24vAvailable || lowVoltage.power110vAvailable) { SendCtrlToNext(VehicleCommand::springBrakeActivate, int(State), CabActive, CouplingSet::FromBits(brakes.spring.controlCouplings)); @@ -541,7 +541,7 @@ bool physics::Vehicle::UniversalBrakeButton(int button, int state) bool OK = true; // false tylko jeśli nie uda się wysłać, GF 20161124 brakes.universalButtonPressed[button] = state > 0; int flag = 0; - if (Power24vIsAvailable || Power110vIsAvailable) + if (lowVoltage.power24vAvailable || lowVoltage.power110vAvailable) { for (int i = 0; i < 3; i++) { @@ -588,7 +588,7 @@ bool physics::Vehicle::SwitchEPBrake(int state) bool physics::Vehicle::EPBrakeControlPowered() const { - return Power24vIsAvailable && DirActive != 0 && EpFuse; + return lowVoltage.power24vAvailable && DirActive != 0 && EpFuse; } // ************************************************************************************************* @@ -600,11 +600,11 @@ bool physics::Vehicle::IncBrakePress(double &brake, double PressLimit, double dp bool IBP; // if (DynamicBrakeType<>dbrake_switch) and (DynamicBrakeType<>dbrake_none) and // ((BrakePress>2.0) or (PipePress<3.7{(LowPipePress+0.5)})) then - if (DynamicBrakeType != dbrake_switch && DynamicBrakeType != dbrake_none && brakes.cylinderPressure > 2.0 && TrainType != train_type::emu) // yB radzi nie sprawdzać ciśnienia w przewodzie + if (brakes.electrodynamic.type != dbrake_switch && brakes.electrodynamic.type != dbrake_none && brakes.cylinderPressure > 2.0 && TrainType != train_type::emu) // yB radzi nie sprawdzać ciśnienia w przewodzie // hunter-301211: dla EN57 silnikow nie odlaczamy { - DynamicBrakeFlag = true; // uruchamianie hamulca ED albo odlaczanie silnikow - if (DynamicBrakeType == dbrake_automatic && abs(Im) > 60) // nie napelniaj wiecej, jak na EP09 + brakes.electrodynamic.on = true; // uruchamianie hamulca ED albo odlaczanie silnikow + if (brakes.electrodynamic.type == dbrake_automatic && abs(Im) > 60) // nie napelniaj wiecej, jak na EP09 dp = 0.0; } if (brake + dp < PressLimit) @@ -640,8 +640,8 @@ bool physics::Vehicle::DecBrakePress(double &brake, double PressLimit, double dp } // if ((DynamicBrakeType != dbrake_switch) && ((BrakePress < 0.1) && (PipePress > 0.45 // /*(LowPipePress+0.06)*/ ))) - if (DynamicBrakeType != dbrake_switch && brakes.cylinderPressure < 0.1) // yB radzi nie sprawdzać ciśnienia w przewodzie - DynamicBrakeFlag = false; // wylaczanie hamulca ED i/albo zalaczanie silnikow + if (brakes.electrodynamic.type != dbrake_switch && brakes.cylinderPressure < 0.1) // yB radzi nie sprawdzać ciśnienia w przewodzie + brakes.electrodynamic.on = false; // wylaczanie hamulca ED i/albo zalaczanie silnikow return DBP; } @@ -810,7 +810,7 @@ void physics::Vehicle::CompressorCheck(double dt) } // the main circuit, also for a compressor driven by the engine, otherwise the low voltage - auto const compressorpower{air.compressor.supply == CompressorSupply::mainCircuit || air.compressor.supply == CompressorSupply::engine ? MainCircuitPowered() : Power110vIsAvailable}; + auto const compressorpower{air.compressor.supply == CompressorSupply::mainCircuit || air.compressor.supply == CompressorSupply::engine ? MainCircuitPowered() : lowVoltage.power110vAvailable}; air.compressor.powerTime = compressorpower ? air.compressor.powerTime + dt : 0.0; auto const compressorready{compressorpower && air.compressor.powerTime >= air.compressor.startDelay}; // TBD: split CompressorAllow into separate enable/disable flags, inherit compressor from basic_device @@ -1003,7 +1003,7 @@ void physics::Vehicle::UpdateLocalBrakeValve(double dt) { lbpa = eim_localbrake; } - else if (SplitEDPneumaticBrake) // When LocHandleTimeTraxx and SplitEDPneumaticBrake are both active, lbpa is taken from LocHandleTimeTraxx, which is the desired behavior. + else if (brakes.electrodynamic.splitFromPneumatic) // When LocHandleTimeTraxx and SplitEDPneumaticBrake are both active, lbpa is taken from LocHandleTimeTraxx, which is the desired behavior. { lbpa = brakes.independentPosition; } @@ -1226,12 +1226,12 @@ void physics::Vehicle::UpdateEPBrake() else EpForce = 0.0; - DynamicBrakeEMUStatus = EpForce > 0.001 ? Power110vIsAvailable : true; + brakes.electrodynamic.emuWorking = EpForce > 0.001 ? lowVoltage.power110vAvailable : true; double temp1 = EpForce; - if (brakes.emuDynamic.epMaxSpeed > 0.001 && Vel > brakes.emuDynamic.epMaxSpeed && DynamicBrakeEMUStatus) + if (brakes.emuDynamic.epMaxSpeed > 0.001 && Vel > brakes.emuDynamic.epMaxSpeed && brakes.electrodynamic.emuWorking) temp1 = 0; - if (brakes.emuDynamic.epMinCurrent > 0.001 && abs(Im) > brakes.emuDynamic.epMinCurrent && DynamicBrakeEMUStatus) + if (brakes.emuDynamic.epMinCurrent > 0.001 && abs(Im) > brakes.emuDynamic.epMinCurrent && brakes.electrodynamic.emuWorking) temp1 = 0; brakes.distributor->SetEPS(temp1); TUHEX_StageActual = static_cast(EpForce); diff --git a/physics/components/securitysystem.cpp b/physics/components/securitysystem.cpp index 7eef7086b..5d1fdf2e6 100644 --- a/physics/components/securitysystem.cpp +++ b/physics/components/securitysystem.cpp @@ -248,12 +248,12 @@ void physics::Vehicle::SecuritySystemReset(void) // zbijanie czuwaka/SHP // ************************************************************************************************* void physics::Vehicle::SecuritySystemCheck(double dt) { - bool isPower = Power24vIsAvailable || Power110vIsAvailable; + bool isPower = lowVoltage.power24vAvailable || lowVoltage.power110vAvailable; // the shunt mode of the SM42 switches its vigilance device (CA) off, on the vehicles with AwareOffInShuntMode=Yes (eu07/maszyna#457) SecuritySystem.set_shunt_mode(ShuntMode); SecuritySystem.update(dt, Vel, isPower, CabActive); - if (!Battery || !Radio || !RadioFuse) + if (!lowVoltage.batteryOn || !Radio || !RadioFuse) { // wyłączenie baterii deaktywuje sprzęt RadiostopSwitch(false); } diff --git a/physics/components/setup.cpp b/physics/components/setup.cpp index 9d2ee49db..128047d35 100644 --- a/physics/components/setup.cpp +++ b/physics/components/setup.cpp @@ -41,9 +41,9 @@ bool physics::Vehicle::CheckLocomotiveParameters(bool ReadyFlag, int /*Dir*/) AutoRelayFlag = AutoRelayType == 1; - if (NominalBatteryVoltage == 0.0) + if (lowVoltage.nominalBatteryVoltage == 0.0) { - BatteryStart = start_t::disabled; + lowVoltage.batteryStart = start_t::disabled; } Sand = SandCapacity; @@ -111,7 +111,7 @@ bool physics::Vehicle::CheckLocomotiveParameters(bool ReadyFlag, int /*Dir*/) { HeatingPowerSource.SourceType = TPowerSource::Main; } - if (HeatingPowerSource.SourceType == TPowerSource::NotDefined && HeatingPower > 0) + if (HeatingPowerSource.SourceType == TPowerSource::NotDefined && trainHeating.power > 0) { HeatingPowerSource.SourceType = TPowerSource::PowerCable; HeatingPowerSource.PowerType = TPowerType::ElectricPower; @@ -441,7 +441,7 @@ void physics::Vehicle::SetReadyToDepart() DirAbsolute = DirActive * CabActive; // kierunek jazdy względem sprzęgów brakes.pipeLimiterPressure = brakes.controlReservoirPressure; - Battery = BatteryStart != start_t::disabled; + lowVoltage.batteryOn = lowVoltage.batteryStart != start_t::disabled; } // the air and the brakes of a vehicle standing braked diff --git a/physics/components/traction.cpp b/physics/components/traction.cpp index acddd1fa8..cf25d9509 100644 --- a/physics/components/traction.cpp +++ b/physics/components/traction.cpp @@ -74,7 +74,7 @@ double physics::Vehicle::Current(double n, double U) UpdateSeriesMotorDynamicBrakeFlag(); ResistorsFlag = RList[MainCtrlActualPos].R > 0.01; // and (!DelayCtrlFlag) - ResistorsFlag = ResistorsFlag || (DynamicBrakeFlag == true && DynamicBrakeType == dbrake_automatic); + ResistorsFlag = ResistorsFlag || (brakes.electrodynamic.on == true && brakes.electrodynamic.type == dbrake_automatic); if (TrainType == train_type::et22 && DelayCtrlFlag && MainCtrlActualPos > 1) Bn = 1.0 - 1.0 / RList[MainCtrlActualPos].Bn; @@ -97,10 +97,10 @@ double physics::Vehicle::Current(double n, double U) } } - if (DynamicBrakeFlag && !FuseFlag && DynamicBrakeType == dbrake_automatic && Power110vIsAvailable && lineBreaker.closed) // hamowanie EP09 //TUHEX + if (brakes.electrodynamic.on && !FuseFlag && brakes.electrodynamic.type == dbrake_automatic && lowVoltage.power110vAvailable && lineBreaker.closed) // hamowanie EP09 //TUHEX { // TODO: zrobic bardziej uniwersalne nie tylko dla EP09 - MotorCurrent = -std::max(motor_param(0).fi * (Vadd / (Vadd + motor_param(0).Isat) - motor_param(0).fi0), 0.) * n * 2.0 / DynamicBrakeRes; + MotorCurrent = -std::max(motor_param(0).fi * (Vadd / (Vadd + motor_param(0).Isat) - motor_param(0).fi0), 0.) * n * 2.0 / brakes.electrodynamic.resistance; } else if (RList[MainCtrlActualPos].Bn == 0 || false == lineContactors.closed) { @@ -113,7 +113,7 @@ double physics::Vehicle::Current(double n, double U) } // writepaslog("MotorCurrent ", FloatToStr(MotorCurrent)); - if (DynamicBrakeType == dbrake_switch && (brakes.cylinderPressure > 2.0 || brakePipe.pressure < 3.6)) + if (brakes.electrodynamic.type == dbrake_switch && (brakes.cylinderPressure > 2.0 || brakePipe.pressure < 3.6)) { Im = 0; // Im:=0; @@ -133,17 +133,17 @@ double physics::Vehicle::Current(double n, double U) void physics::Vehicle::UpdateSeriesMotorDynamicBrakeFlag() { // i dzialanie hamulca ED w EP09 - if (DynamicBrakeType == dbrake_automatic && TrainType != train_type::emu) + if (brakes.electrodynamic.type == dbrake_automatic && TrainType != train_type::emu) { if ((brakes.distributor->GetEDBCP() < 0.25 && Vadd < 1) || brakes.cylinderPressure > 2.1) - DynamicBrakeFlag = false; + brakes.electrodynamic.on = false; else if (brakes.cylinderPressure > 0.25 && brakes.distributor->GetEDBCP() > 0.25) - DynamicBrakeFlag = true; - DynamicBrakeFlag = DynamicBrakeFlag && Power110vIsAvailable; + brakes.electrodynamic.on = true; + brakes.electrodynamic.on = brakes.electrodynamic.on && lowVoltage.power110vAvailable; } - if (DynamicBrakeType == dbrake_automatic && TrainType == train_type::emu) + if (brakes.electrodynamic.type == dbrake_automatic && TrainType == train_type::emu) { - DynamicBrakeFlag = Power110vIsAvailable && (TUHEX_Active || Vadd > TUHEX_MinIw) && DynamicBrakeEMUStatus; + brakes.electrodynamic.on = lowVoltage.power110vAvailable && (TUHEX_Active || Vadd > TUHEX_MinIw) && brakes.electrodynamic.emuWorking; } // wylacznik cisnieniowy yBARC - to jest chyba niepotrzebne tutaj Q: no to usuwam... @@ -151,7 +151,7 @@ void physics::Vehicle::UpdateSeriesMotorDynamicBrakeFlag() // BrakeSubsystem = ss_LSt; // if (BrakeSubsystem == ss_LSt) WriteLog("LSt"); // if (BrakeSubsystem == ss_LSt) // zrobiona funkcja virtualna - if (DynamicBrakeFlag) + if (brakes.electrodynamic.on) { brakes.distributor->SetED(abs(Im / 350)); // hamulec ED na EP09 dziala az do zatrzymania lokomotywy //- WriteLog("A"); @@ -180,7 +180,7 @@ double physics::Vehicle::SeriesMotorCurrent(double const n, double const U, doub Rz = Mn * WindingRes + R; - if (DynamicBrakeFlag) // hamowanie + if (brakes.electrodynamic.on) // hamowanie { // if DynamicBrakeType<>dbrake_automatic then // MotorCurrent:=-fi*n/Rz {hamowanie silnikiem na oporach rozruchowych} @@ -191,7 +191,7 @@ double physics::Vehicle::SeriesMotorCurrent(double const n, double const U, doub MotorCurrent:=(U-Isf*Rz-Mn*fi*n+SQRT(Delta))/(2*Rz) end*/ // only the ET42's switched brake brakes on the starting resistors, otherwise the current is cut off (0) - if (DynamicBrakeType == dbrake_switch && TrainType == train_type::et42) + if (brakes.electrodynamic.type == dbrake_switch && TrainType == train_type::et42) { // z Megapacka Rz = WindingRes + R; MotorCurrent = -motor_param(SP).fi * n / Rz; //{hamowanie silnikiem na oporach rozruchowych} @@ -381,9 +381,9 @@ bool physics::Vehicle::MotorBlowerPowerIsAvailable(cooling_fan const &Blower) co switch (Blower.start_type) { case start_t::battery: - return Power24vIsAvailable; + return lowVoltage.power24vAvailable; case start_t::converter: - return Power110vIsAvailable; + return lowVoltage.power110vAvailable; default: return MainCircuitPowered(); } @@ -468,13 +468,13 @@ bool physics::Vehicle::TractionModeSwitch(traction_mode const Mode, range_t cons // ************************************************************************************************* bool physics::Vehicle::IncDynamicBrakeLevel(float const CtrlSpeed) { - if (false == SplitEDPneumaticBrake) + if (false == brakes.electrodynamic.splitFromPneumatic) return false; - if (DynamicBrakeCtrlPosNo < 1) + if (brakes.electrodynamic.controllerPositions < 1) return false; - if (DynamicBrakeCtrlPos < 1.0) + if (brakes.electrodynamic.controllerPosition < 1.0) { - DynamicBrakeCtrlPos = std::min(1.0, DynamicBrakeCtrlPos + (double)CtrlSpeed / (double)DynamicBrakeCtrlPosNo); + brakes.electrodynamic.controllerPosition = std::min(1.0, brakes.electrodynamic.controllerPosition + (double)CtrlSpeed / (double)brakes.electrodynamic.controllerPositions); return true; } return false; @@ -485,13 +485,13 @@ bool physics::Vehicle::IncDynamicBrakeLevel(float const CtrlSpeed) // ************************************************************************************************* bool physics::Vehicle::DecDynamicBrakeLevel(float const CtrlSpeed) { - if (false == SplitEDPneumaticBrake) + if (false == brakes.electrodynamic.splitFromPneumatic) return false; - if (DynamicBrakeCtrlPosNo < 1) + if (brakes.electrodynamic.controllerPositions < 1) return false; - if (DynamicBrakeCtrlPos > 0.0) + if (brakes.electrodynamic.controllerPosition > 0.0) { - DynamicBrakeCtrlPos = std::max(0.0, DynamicBrakeCtrlPos - (double)CtrlSpeed / (double)DynamicBrakeCtrlPosNo); + brakes.electrodynamic.controllerPosition = std::max(0.0, brakes.electrodynamic.controllerPosition - (double)CtrlSpeed / (double)brakes.electrodynamic.controllerPositions); return true; } return false; @@ -502,9 +502,9 @@ bool physics::Vehicle::DecDynamicBrakeLevel(float const CtrlSpeed) // ************************************************************************************************* bool physics::Vehicle::DynamicBrakeLevelSet(double Position) { - if (false == SplitEDPneumaticBrake) + if (false == brakes.electrodynamic.splitFromPneumatic) return false; - DynamicBrakeCtrlPos = std::clamp(Position, 0.0, 1.0); + brakes.electrodynamic.controllerPosition = std::clamp(Position, 0.0, 1.0); return true; } @@ -514,9 +514,9 @@ bool physics::Vehicle::DynamicBrakeLevelSet(double Position) // ************************************************************************************************* double physics::Vehicle::DynamicBrakeRatio(void) const { - if (false == SplitEDPneumaticBrake) + if (false == brakes.electrodynamic.splitFromPneumatic) return 0.0; - return std::clamp(DynamicBrakeCtrlPos, 0.0, 1.0); + return std::clamp(brakes.electrodynamic.controllerPosition, 0.0, 1.0); } // ************************************************************************************************* @@ -542,14 +542,14 @@ bool physics::Vehicle::DynamicBrakeSwitch(bool Switch) { bool DBS; - if (DynamicBrakeType == dbrake_switch && IsMainCtrlNoPowerPos()) + if (brakes.electrodynamic.type == dbrake_switch && IsMainCtrlNoPowerPos()) { - DynamicBrakeFlag = Switch; + brakes.electrodynamic.on = Switch; DBS = true; for (auto &thiscoupler : Couplers) // with Couplers[b] do if (thiscoupler.CouplingFlag.HasAll(Coupling::control)) - thiscoupler.Connected->DynamicBrakeFlag = Switch; + thiscoupler.Connected->brakes.electrodynamic.on = Switch; // end; // if (DynamicBrakeType=dbrake_passive) and (TrainType=train_type::et42) then // begin @@ -632,7 +632,7 @@ void physics::Vehicle::UpdateResistorBlowers(double dt) RventRot += (RVentnmax * std::min(1.0, motorcurrent / NPoweredAxles / RVentMinI) * motorcurrent / ImaxLo - RventRot) * RVentSpeed * dt; } - else if (DynamicBrakeType == dbrake_automatic && true == DynamicBrakeFlag) + else if (brakes.electrodynamic.type == dbrake_automatic && true == brakes.electrodynamic.on) { RventRot += (RVentnmax * motorcurrent / ImaxLo - RventRot) * RVentSpeed * dt; } @@ -712,10 +712,10 @@ void physics::Vehicle::SeriesMotorTractionForce(double dt) { if (Imax == ImaxHi) EngineVoltage = EngineVoltage * 2; - if (DynamicBrakeFlag && abs(Im) > 300) // przeiesione do physics.cpp + if (brakes.electrodynamic.on && abs(Im) > 300) // przeiesione do physics.cpp FuseOff(); } - if (DynamicBrakeType == dbrake_automatic && DynamicBrakeFlag) + if (brakes.electrodynamic.type == dbrake_automatic && brakes.electrodynamic.on) { SeriesMotorDynamicBrake(dt); } @@ -730,7 +730,7 @@ void physics::Vehicle::SeriesMotorTractionForce(double dt) if (Vhyp > CtrlDelay / 2) // jesli czas oddzialywania przekroczony FuseOff(); // wywalanie bezpiecznika z powodu przetezenia silnikow - if ((DynamicBrakeType == dbrake_automatic || DynamicBrakeType == dbrake_switch) && DynamicBrakeFlag) + if ((brakes.electrodynamic.type == dbrake_automatic || brakes.electrodynamic.type == dbrake_switch) && brakes.electrodynamic.on) Itot = Im * 2; // 2x2 silniki w EP09 else if (TrainType == train_type::emu && Imin == IminLo && ScndS) // yBARC - boczniki na szeregu poprawnie Itot = Im; @@ -752,24 +752,24 @@ void physics::Vehicle::SeriesMotorDynamicBrake(double dt) { case 1: TUHEX_Sum = TUHEX_Sum1; - DynamicBrakeRes = DynamicBrakeRes1; + brakes.electrodynamic.resistance = brakes.electrodynamic.resistance1; break; case 2: TUHEX_Sum = TUHEX_Sum2; - DynamicBrakeRes = DynamicBrakeRes1; + brakes.electrodynamic.resistance = brakes.electrodynamic.resistance1; break; case 3: TUHEX_Sum = TUHEX_Sum3; - if (Vadd > 0.99 * TUHEX_MaxIw && DynamicBrakeRes == DynamicBrakeRes1) + if (Vadd > 0.99 * TUHEX_MaxIw && brakes.electrodynamic.resistance == brakes.electrodynamic.resistance1) TUHEX_ResChange = true; if (TUHEX_ResChange && Vadd < 0.5 * TUHEX_MaxIw) { TUHEX_ResChange = false; - DynamicBrakeRes = DynamicBrakeRes2; + brakes.electrodynamic.resistance = brakes.electrodynamic.resistance2; } break; default: - DynamicBrakeRes = DynamicBrakeRes1; + brakes.electrodynamic.resistance = brakes.electrodynamic.resistance1; TUHEX_Sum = 0; break; } @@ -780,10 +780,10 @@ void physics::Vehicle::SeriesMotorDynamicBrake(double dt) if (Vadd < TUHEX_MinIw) { Vadd = 0; - DynamicBrakeFlag = false; + brakes.electrodynamic.on = false; } } - else if (DynamicBrakeFlag && Vadd + abs(Im) < TUHEX_Sum - TUHEX_Diff) + else if (brakes.electrodynamic.on && Vadd + abs(Im) < TUHEX_Sum - TUHEX_Diff) { Vadd += 70.0 * dt; Vadd = std::min(std::max(Vadd, TUHEX_MinIw), TUHEX_MaxIw); @@ -1145,7 +1145,7 @@ void physics::Vehicle::InductionMotorBrakeBlending(double const ActiveInverters, { InductionMotorDynamicBrakeFlag(); auto const edBCP{brakes.distributor->GetEDBCP() * inductionMotor.braking.cylinderPressureGain}; // stala napedu - if (DynamicBrakeFlag) + if (brakes.electrodynamic.on) { PosRatio = InductionMotorBrakeRatio(ActiveInverters, edBCP); tmp = 5; @@ -1177,18 +1177,18 @@ void physics::Vehicle::InductionMotorDynamicBrakeFlag() auto const localbrakeactive{CabOccupied != 0 && brakes.independentValve->GetCP() > 0.25}; // gdy SplitEDPneumaticBrake jest aktywne, hamulec pomocniczy (LocalBrake) NIE wymusza // zalaczenia hamulca elektrodynamicznego - ED jest sterowany wlasnym nastawnikiem - auto const dynbrakectrlactive{SplitEDPneumaticBrake && DynamicBrakeRatio() > 0.01 && DynamicBrakeAvailable()}; - auto const localbrakeforED{SplitEDPneumaticBrake ? false : localbrakeactive}; + auto const dynbrakectrlactive{brakes.electrodynamic.splitFromPneumatic && DynamicBrakeRatio() > 0.01 && DynamicBrakeAvailable()}; + auto const localbrakeforED{brakes.electrodynamic.splitFromPneumatic ? false : localbrakeactive}; if (false == Doors.instances[VehicleSide::left].is_closed || false == Doors.instances[VehicleSide::right].is_closed || (Doors.permit_needed && (Doors.instances[VehicleSide::left].open_permit || Doors.instances[VehicleSide::right].open_permit))) { - DynamicBrakeFlag = true; + brakes.electrodynamic.on = true; } else if ((edBCP < 0.25 && false == localbrakeforED && false == dynbrakectrlactive && AnPos < 0.01) || (edBCP < 0.25 && ShuntModeAllow && false == dynbrakectrlactive && brakes.independentPosition < 0.01)) - DynamicBrakeFlag = false; + brakes.electrodynamic.on = false; else if (brakes.cylinderPressure > 0.25 && edBCP > 0.25 || localbrakeforED || AnPos > 0.02 || dynbrakectrlactive) - DynamicBrakeFlag = true; + brakes.electrodynamic.on = true; } // the share of the electrodynamic brake (negative), and the distributor told how much of the air to let out; none @@ -1220,7 +1220,7 @@ double physics::Vehicle::InductionMotorBrakeRatio(double const ActiveInverters, { // strefa wylaczenia ED (Vh0..Vh1) - mnoznik 0..1 zaleznie od predkosci double const vhRamp = std::max(0.0, std::min(1.0, (Vel - inductionMotor.braking.offSpeed) / (inductionMotor.braking.fullSpeed - inductionMotor.braking.offSpeed))); - if (SplitEDPneumaticBrake) + if (brakes.electrodynamic.splitFromPneumatic) { // w trybie split LocalBrake nie zaleca ED; uzywany jest DynamicBrakeCtrl // oraz zwykle zapotrzebowanie z hamulca zespolonego (edBCP) @@ -1241,12 +1241,12 @@ double physics::Vehicle::InductionMotorBrakeRatio(double const ActiveInverters, void physics::Vehicle::InductionMotorDrive(double dt) { double tmp; - if (DynamicBrakeFlag) + if (brakes.electrodynamic.on) tmp = inductionMotor.converter.brakingLinkVoltage; else tmp = inductionMotor.converter.maxLinkVoltage; - auto f_cfu{DynamicBrakeFlag ? inductionMotor.converter.brakingVoltsPerHertz : inductionMotor.converter.voltsPerHertz}; + auto f_cfu{brakes.electrodynamic.on ? inductionMotor.converter.brakingVoltsPerHertz : inductionMotor.converter.voltsPerHertz}; inductionMotor.state.linkVoltage = std::min(EngineVoltage - inductionMotor.converter.voltageDrop, tmp); inductionMotor.state.criticalFrequency = inductionMotor.state.linkVoltage / f_cfu; @@ -1347,7 +1347,7 @@ void physics::Vehicle::InductionMotorForceLimits() void physics::Vehicle::UpdateInverterFrequency() { auto const tmpV{std::abs(inductionMotor.state.supplyFrequency)}; - auto const useFFEDList = FFEDListSize > 0 && DynamicBrakeFlag; + auto const useFFEDList = FFEDListSize > 0 && brakes.electrodynamic.on; auto const list = useFFEDList ? FFEDlist : FFlist; if (auto const listSize = useFFEDList ? FFEDListSize : FFListSize; listSize > 0 && std::abs(inductionMotor.state.fieldCurrent) > 1.0 && tmpV > 0.0001) @@ -1437,7 +1437,7 @@ void physics::Vehicle::FuseOff(void) bool physics::Vehicle::UniversalResetButton(int const Button, range_t const Notify) { - if (auto const lowvoltagepower{Power24vIsAvailable || Power110vIsAvailable}; false == lowvoltagepower) + if (auto const lowvoltagepower{lowVoltage.power24vAvailable || lowVoltage.power110vAvailable}; false == lowvoltagepower) { return false; } @@ -1457,7 +1457,7 @@ bool physics::Vehicle::UniversalResetButton(int const Button, range_t const Noti bool physics::Vehicle::RelayReset(int const Relays, range_t const Notify) { - auto const lowvoltagepower{Power24vIsAvailable || Power110vIsAvailable}; + auto const lowvoltagepower{lowVoltage.power24vAvailable || lowVoltage.power110vAvailable}; bool reset{false}; if (TestFlag(Relays, relay_t::maincircuitground) && (EngineType == TEngineType::ElectricSeriesMotor || EngineType == TEngineType::DieselElectric) && @@ -1651,8 +1651,8 @@ double physics::Vehicle::ShowCurrentP(int AmpN) const Grupowy = DelayCtrlFlag && TrainType == train_type::et22; // przerzucanie walu grupowego w ET22; Bn = RList[MainCtrlActualPos].Bn; // ile równoległych gałęzi silników - if (DynamicBrakeType == dbrake_automatic && DynamicBrakeFlag) - Bn = DynamicBrakeAmpmeters; + if (brakes.electrodynamic.type == dbrake_automatic && brakes.electrodynamic.on) + Bn = brakes.electrodynamic.ammeters; if (Power > 0.01) { if (AmpN > 0) // podać prąd w gałęzi diff --git a/physics/vehicle.h b/physics/vehicle.h index 45436c2ac..f10c8a038 100644 --- a/physics/vehicle.h +++ b/physics/vehicle.h @@ -29,6 +29,7 @@ http://mozilla.org/MPL/2.0/. #include "physics/components/devices.h" #include "physics/components/pantographs.h" #include "physics/components/maincircuit.h" +#include "physics/components/lowvoltage.h" class TractionDrive; @@ -645,12 +646,7 @@ class Vehicle double Power = 0.0; /*max. predkosc kontrukcyjna, masa wlasna, moc*/ double Mred = 0.0; /*Ra: zredukowane masy wirujące; potrzebne do obliczeń hamowania*/ double TotalMass = 0.0; /*wyliczane przez ComputeMass*/ - double HeatingPower = 0.0; - double EngineHeatingRPM{0.0}; // guaranteed engine revolutions with heating enabled double LightPower = 0.0; /*moc pobierana na ogrzewanie/oswietlenie*/ - double BatteryVoltage = 0.0; /*Winger - baterie w elektrykach*/ - bool Battery = false; /*Czy sa zalaczone baterie*/ - start_t BatteryStart = start_t::manual; bool EpFuse = true; /*Czy jest wlaczony hamulec EP*/ double EpForce = 0.0; /*Poziom zadanej sily EP*/ bool Signalling = false; /*Czy jest zalaczona sygnalizacja hamowania ostatniego wagonu*/ @@ -658,7 +654,6 @@ class Vehicle // the cut-off in the radio's power supply: a fuse in the cabinet, a lever on the desk or the switch on the radio's power // supply (eu07/maszyna#438). Closed unless the driver opens it, so vehicles without such a switch work as before bool RadioFuse = true; - float NominalBatteryVoltage = 0.f; /*Winger - baterie w elektrykach*/ TDimension Dim; /*wymiary*/ double Cx = 0.0; /*wsp. op. aerodyn.*/ float Floor = 0.96f; // poziom podłogi dla ładunków @@ -681,6 +676,8 @@ class Vehicle int wiperSwitchPos = 0; // pozycja przelacznika wycieraczek double WiperAngle = {45.0}; // kat pracy wycieraczek + LowVoltageSupply lowVoltage; // the battery and the low voltage circuits (physics/components/lowvoltage.h) + TrainHeating trainHeating; LineBreaker lineBreaker; // the main circuit (physics/components/maincircuit.h) LineContactors lineContactors; ProtectionRelays protection; @@ -695,10 +692,6 @@ class Vehicle int UniversalResetButtonFlag[3] = {0, 0, 0}; // customizable reset buttons assignments int TurboTest = 0; - bool batterySwAlreadyFired = false; // czy przycisk baterii juz zostal wcisniety - bool isBatteryButtonImpulse = false; // czy przelacznik baterii traktowac jako pojedynczy przycisk - bool shouldHoldBatteryButton = false; // czy nalezy przytrzymac przycisk baterii aby wlaczyc/wylaczyc baterie - float BatteryButtonHoldTime = 1.f; // minimalny czas przytrzymania przycisku baterii /*nastawniki:*/ int MainCtrlPosNo = 0; /*ilosc pozycji nastawnika*/ int ScndCtrlPosNo = 0; @@ -777,10 +770,6 @@ class Vehicle bool FieldShuntSwitch = false; bool CoupledCtrl = false; /*czy mainctrl i scndctrl sa sprzezone*/ bool HasCamshaft{false}; - int DynamicBrakeType = 0; /*patrz dbrake_**/ - int DynamicBrakeAmpmeters = 2; /*liczba amperomierzy przy hamowaniu ED*/ - bool SplitEDPneumaticBrake = false; /*czy hamulec ED i pneumatyczny pomocniczy są rozdzielone na osobne nastawniki*/ - int DynamicBrakeCtrlPosNo = 10; /*ilosc pozycji nastawnika hamulca ED (DBPN, domyslnie 10)*/ // the dynamic brake of a diesel-electric vehicle (Engine: EDBrake=...): the traction motors brake into resistors while // the engine runs, with the force of the definition rather than from a circuit, as the drive of these vehicles is // computed from the generator's power. no definition, no dynamic brake (MaSzyna-EU07/maszyna#82) @@ -804,9 +793,6 @@ class Vehicle double force{0.0}; // [N] the braking force, against the motion }; diesel_electric_dynamic_brake DEDynamicBrake; - double DynamicBrakeRes = 5.8; /*rezystancja oporników przy hamowaniu ED*/ - double DynamicBrakeRes1 = 5.8; /*rezystancja oporników przy hamowaniu ED - 1 tryb*/ - double DynamicBrakeRes2 = 5.8; /*rezystancja oporników przy hamowaniu ED - 2 tryb*/ double TUHEX_Sum = 750; /*nastawa sterownika hamowania ED - aktualna*/ double TUHEX_Diff = 10; /*histereza działania sterownika hamowania ED*/ double TUHEX_MinIw = 60; /*minimalny prąd wzbudzenia przy hamowaniu ED - wynika z chk silnika*/ @@ -859,9 +845,6 @@ class Vehicle /*- dla lokomotyw z silnikami indukcyjnymi -*/ // the drive of induction motors (physics/components/inductionmotor.h) InductionMotor inductionMotor; - int Imaxrpc = 0; // Maksymalny prad rezystora hamowania chlodzonego pasywnie - int BRVto = 0; // Czas jaki wentylatory jeszcze dodatkowo schladzaja rezystor - double BRVtimer = 0; // Timer dla podtrzymania wentylatora /*-dla wagonow*/ struct load_attributes @@ -915,9 +898,6 @@ class Vehicle // (vehicle_table::update_coupler_physics()); with couplerphysics all in eu07.ini every vehicle is covered bool CouplerPhysics{false}; ByEnd Neighbours; // potential collision sources - bool Power110vIsAvailable = false; // cached availability of 110v power - bool Power24vIsAvailable = false; // cached availability of 110v power - double Power24vVoltage{0.0}; // cached battery voltage bool EventFlag = false; /*!o true jesli cos nietypowego sie wydarzy*/ int SoundFlag = 0; /*!o patrz stale sound_ */ int AIFlag{0}; // HACK: events of interest for consist owner @@ -957,7 +937,6 @@ class Vehicle bool SandDoseAutoAllow = true; /*zezwolenie na automatyczne piaskowanie*/ double Sand = 0.0; /*ilosc piasku*/ /*! przyrosty cisnienia w kroku czasowym*/ - bool BRVentilators = false; /* Czy rezystor hamowania pracuje */ fuel_pump FuelPump; oil_pump OilPump; genset_device Genset; // of a dual-mode vehicle, fitted() only with GensetPower @@ -973,14 +952,9 @@ class Vehicle float DoorsOpenWithPermitAfter{-1.f}; // remote open if permit button is held for specified time. NOTE: separate from door data as its cab control thing int DoorsPermitLightBlinking{0}; // when the doors permit signal light is blinking - double DynamicBrakeCtrlPos = 0.0; /*nastawa nastawnika hamulca elektrodynamicznego (0..1) - aktywne tylko gdy SplitEDPneumaticBrake*/ /* */ bool RadioStopFlag = false; /*hamowanie nagle*/ - // the AI wagon inspector cut the brake out (b_dmg) and puts it back when the train no longer needs it - // cut out (brake_setting::apply). Anyone else cutting it out or putting it back takes it over - bool DynamicBrakeFlag = false; /*czy wlaczony hamulec elektrodymiczny*/ - bool DynamicBrakeEMUStatus = true; /*czy hamulec ED dziala w ezt*/ int TUHEX_StageActual = 0; /*aktualny stopien tuhexa*/ bool TUHEX_ResChange = false; /*czy zmiana rezystancji hamowania ED - odwzbudzanie*/ bool TUHEX_Active = false; /*czy hamowanie ED wywołane z zewnątrz*/ @@ -1100,10 +1074,7 @@ class Vehicle bool DoorRightOpened = false; double DoorRightOpenTimer{-1.0}; // right door closing timer for automatic door type #endif - bool HeatingSwitchImpulse{false}; // the train heating switch springs back to its middle position - bool Heating = false; // ogrzewanie 'Winger 020304 - bool HeatingAllow{false}; // heating switch // TODO: wrap heating in a basic device int DoubleTr = 1; // trakcja ukrotniona - przedni pojazd 'Winger 160304 basic_light CompartmentLights; @@ -1265,7 +1236,7 @@ class Vehicle bool EIMDirectionChangeAllow(void) const; inline double IsVehicleEIMBrakingFactor() const { - return DynamicBrakeFlag && ResistorsFlag ? 0.0 : inductionMotor.state.lineCurrent < 0 ? -1.0 : 1.0; + return brakes.electrodynamic.on && ResistorsFlag ? 0.0 : inductionMotor.state.lineCurrent < 0 ? -1.0 : 1.0; } void BrakeLevelSet(double b); bool BrakeLevelAdd(double b); @@ -1607,7 +1578,7 @@ class Vehicle // whether the radio is switched on, its power supply isn't cut off and it has the low voltage to work bool RadioPowered() const { - return Radio && RadioFuse && (Power24vIsAvailable || Power110vIsAvailable); + return Radio && RadioFuse && (lowVoltage.power24vAvailable || lowVoltage.power110vAvailable); } /*obrot kol uwzgledniajacy poslizg*/ double ComputeRotatingWheel(double WForce, double dt, double n) const; diff --git a/rendering/lightarray.cpp b/rendering/lightarray.cpp index 8e9b561ff..33c5415f4 100644 --- a/rendering/lightarray.cpp +++ b/rendering/lightarray.cpp @@ -52,8 +52,8 @@ light_array::update() { light.direction.z = -light.direction.z; } // determine intensity of this light set - if( ( true == light.owner->physics->Power24vIsAvailable ) - || ( true == light.owner->physics->Power110vIsAvailable ) ) { + if( ( true == light.owner->physics->lowVoltage.power24vAvailable ) + || ( true == light.owner->physics->lowVoltage.power110vAvailable ) ) { // with power on, the intensity depends on the state of activated switches // first we cross-check the list of enabled lights with the lights installed in the vehicle... auto const lights { light.owner->physics->iLights[ light.index ] & light.owner->LightList( static_cast( light.index ) ) }; diff --git a/simulation/blackboxrecorder.cpp b/simulation/blackboxrecorder.cpp index fe22a6964..7af23b625 100644 --- a/simulation/blackboxrecorder.cpp +++ b/simulation/blackboxrecorder.cpp @@ -73,13 +73,13 @@ blackbox::driver driver_of(TDynamicObject const &Vehicle) { std::uint32_t devices_of(physics::Vehicle const &Occupied, physics::Vehicle const &Controlling) { namespace device = blackbox::cab_devices; auto const on{[](bool const State, std::uint32_t const Bit) { return State ? Bit : 0u; }}; - return on(Occupied.Battery || Controlling.Battery, device::battery) | on(Controlling.lineBreaker.closed, device::main_breaker) | + return on(Occupied.lowVoltage.batteryOn || Controlling.lowVoltage.batteryOn, device::battery) | on(Controlling.lineBreaker.closed, device::main_breaker) | on(Controlling.pantographs[VehicleEnd::front].is_active, device::pantograph_front) | on(Controlling.pantographs[VehicleEnd::rear].is_active, device::pantograph_rear) | on(Controlling.converter.running, device::converter) | on(Controlling.air.compressor.running, device::compressor) | on(Controlling.lineContactors.closed, device::line_contactors) | on(Controlling.FuseFlag, device::overload_relay) | on(Controlling.SandDose, device::sanding) | on(Occupied.WarningSignal != 0, device::horn) | on(false == Occupied.Doors.instances[VehicleSide::left].is_closed, device::doors_left) | on(false == Occupied.Doors.instances[VehicleSide::right].is_closed, device::doors_right) | on(Occupied.Radio, device::radio) | - on(Controlling.Heating, device::heating) | on(Occupied.brakes.spring.isActive, device::spring_brake) | on(Controlling.ShuntMode, device::shunt_mode) | + on(Controlling.trainHeating.on, device::heating) | on(Occupied.brakes.spring.isActive, device::spring_brake) | on(Controlling.ShuntMode, device::shunt_mode) | // the doors as the cab works them: the permits, the departure signal, the steps and the lock on(Occupied.DepartureSignal, device::departure_signal) | on(Occupied.Doors.instances[VehicleSide::left].open_permit, device::door_permit_left) | on(Occupied.Doors.instances[VehicleSide::right].open_permit, device::door_permit_right) | on(Occupied.Doors.step_enabled, device::door_step) | diff --git a/tests/unit/golden.cpp b/tests/unit/golden.cpp index 36d6010bc..e1769511c 100644 --- a/tests/unit/golden.cpp +++ b/tests/unit/golden.cpp @@ -68,7 +68,7 @@ std::vector traction() { {"enrot", [](auto const &M) { return M.enrot; }}, {"dizel_fill", [](auto const &M) { return M.diesel.fill; }}, {"eimv_pr", [](auto const &M) { return M.inductionMotor.forceShare; }}, - {"DynamicBrakeFlag", [](auto const &M) { return M.DynamicBrakeFlag ? 1.0 : 0.0; }}, + {"DynamicBrakeFlag", [](auto const &M) { return M.brakes.electrodynamic.on ? 1.0 : 0.0; }}, }; } @@ -133,9 +133,9 @@ std::vector parameters() { {"TotalMass", [](auto const &M) { return M.TotalMass; }}, {"Mred", [](auto const &M) { return M.Mred; }}, {"Power", [](auto const &M) { return M.Power; }}, - {"HeatingPower", [](auto const &M) { return M.HeatingPower; }}, + {"HeatingPower", [](auto const &M) { return M.trainHeating.power; }}, {"LightPower", [](auto const &M) { return M.LightPower; }}, - {"BatteryVoltage", [](auto const &M) { return M.BatteryVoltage; }}, + {"BatteryVoltage", [](auto const &M) { return M.lowVoltage.batteryVoltage; }}, {"Cx", [](auto const &M) { return M.Cx; }}, {"WheelDiameter", [](auto const &M) { return M.WheelDiameter; }}, {"TrackW", [](auto const &M) { return M.TrackW; }}, diff --git a/tests/unit/invariants.cpp b/tests/unit/invariants.cpp index c0141c5ca..1942c476a 100644 --- a/tests/unit/invariants.cpp +++ b/tests/unit/invariants.cpp @@ -42,13 +42,13 @@ std::vector const &invariants() { {"every value a number", [](auto const &M, double, auto const *) { std::initializer_list const values{M.V, M.AccS, M.Ft, M.Fb, M.Im, M.Itot, M.EngineVoltage, - M.enrot, M.brakePipe.pressure, M.brakes.cylinderPressure, M.brakes.independentCylinderPressure, M.mainPipe.pressure, M.air.mainReservoirPressure, M.BatteryVoltage}; + M.enrot, M.brakePipe.pressure, M.brakes.cylinderPressure, M.brakes.independentCylinderPressure, M.mainPipe.pressure, M.air.mainReservoirPressure, M.lowVoltage.batteryVoltage}; return std::ranges::all_of(values, [](double const Value) { return std::isfinite(Value); }); }, [](auto const &M) { return values({{"V", M.V}, {"AccS", M.AccS}, {"Ft", M.Ft}, {"Fb", M.Fb}, {"Im", M.Im}, {"Itot", M.Itot}, {"EngineVoltage", M.EngineVoltage}, {"enrot", M.enrot}, {"PipePress", M.brakePipe.pressure}, {"BrakePress", M.brakes.cylinderPressure}, {"LocBrakePress", M.brakes.independentCylinderPressure}, - {"ScndPipePress", M.mainPipe.pressure}, {"Compressor", M.air.mainReservoirPressure}, {"BatteryVoltage", M.BatteryVoltage}}); + {"ScndPipePress", M.mainPipe.pressure}, {"Compressor", M.air.mainReservoirPressure}, {"BatteryVoltage", M.lowVoltage.batteryVoltage}}); }}, {"brake cylinders between empty and the vehicle's highest pressure", [](auto const &M, double, auto const *) { @@ -75,10 +75,10 @@ std::vector const &invariants() { {"no motor current with the line contactors open, but for the dynamic brake", [](auto const &M, double, auto const *) { // the dynamic brake closes its own circuit of the motors and the resistors - return M.lineContactors.closed || M.DynamicBrakeFlag || M.EngineType != TEngineType::ElectricSeriesMotor || std::abs(M.Im) < 1.0; + return M.lineContactors.closed || M.brakes.electrodynamic.on || M.EngineType != TEngineType::ElectricSeriesMotor || std::abs(M.Im) < 1.0; }, [](auto const &M) { - return values({{"StLinFlag", M.lineContactors.closed}, {"DynamicBrakeFlag", M.DynamicBrakeFlag}, {"Im", M.Im}, {"MainCtrlActualPos", M.MainCtrlActualPos}}); + return values({{"StLinFlag", M.lineContactors.closed}, {"DynamicBrakeFlag", M.brakes.electrodynamic.on}, {"Im", M.Im}, {"MainCtrlActualPos", M.MainCtrlActualPos}}); }}, {"no tractive force without power", [](auto const &M, double, auto const *) { return M.Power >= 0.01 || std::abs(M.Ft) < 1.0; }, @@ -93,8 +93,8 @@ std::vector const &invariants() { }, [](auto const &M) { return values({{"enrot", M.enrot}, {"dizel_nmax", M.diesel.maxRevolutions}}); }}, {"battery no higher than its nominal voltage", - [](auto const &M, double, auto const *) { return M.NominalBatteryVoltage <= 0.0 || M.BatteryVoltage <= 1.05 * M.NominalBatteryVoltage; }, - [](auto const &M) { return values({{"BatteryVoltage", M.BatteryVoltage}, {"NominalBatteryVoltage", M.NominalBatteryVoltage}}); }}, + [](auto const &M, double, auto const *) { return M.lowVoltage.nominalBatteryVoltage <= 0.0 || M.lowVoltage.batteryVoltage <= 1.05 * M.lowVoltage.nominalBatteryVoltage; }, + [](auto const &M) { return values({{"BatteryVoltage", M.lowVoltage.batteryVoltage}, {"NominalBatteryVoltage", M.lowVoltage.nominalBatteryVoltage}}); }}, {"distance counted as the speed runs", [](auto const &M, double Time, auto const *Before) { if (Before == nullptr) { diff --git a/tests/unit/test_auxiliaries.cpp b/tests/unit/test_auxiliaries.cpp index de33f2ffb..6334179c8 100644 --- a/tests/unit/test_auxiliaries.cpp +++ b/tests/unit/test_auxiliaries.cpp @@ -14,10 +14,10 @@ namespace { std::vector auxiliaries() { return { - {"BatteryVoltage", [](auto const &M) { return M.BatteryVoltage; }}, - {"Battery", [](auto const &M) { return M.Battery ? 1.0 : 0.0; }}, + {"BatteryVoltage", [](auto const &M) { return M.lowVoltage.batteryVoltage; }}, + {"Battery", [](auto const &M) { return M.lowVoltage.batteryOn ? 1.0 : 0.0; }}, {"ConverterFlag", [](auto const &M) { return M.converter.running ? 1.0 : 0.0; }}, - {"Power110vIsAvailable", [](auto const &M) { return M.Power110vIsAvailable ? 1.0 : 0.0; }}, + {"Power110vIsAvailable", [](auto const &M) { return M.lowVoltage.power110vAvailable ? 1.0 : 0.0; }}, {"PantPress", [](auto const &M) { return M.pantographAir.pressure; }}, {"PantVolume", [](auto const &M) { return M.pantographAir.volume; }}, {"PantCompFlag", [](auto const &M) { return M.pantographAir.compressorRunning ? 1.0 : 0.0; }}, @@ -35,21 +35,21 @@ TEST_CASE("auxiliaries: the battery drained by the lights and the pantographs' c scenario.add("4e_v1/4e", 1); REQUIRE(scenario.start_up()); auto &eu07{scenario.cab()}; - REQUIRE(eu07.BatteryVoltage == doctest::Approx(eu07.NominalBatteryVoltage)); + REQUIRE(eu07.lowVoltage.batteryVoltage == doctest::Approx(eu07.lowVoltage.nominalBatteryVoltage)); scenario.act("converter off, lights on, small compressor on"); eu07.ConverterSwitch(false); eu07.iLights[VehicleEnd::front] = 1 | 2 | 4; eu07.iLights[VehicleEnd::rear] = 16; eu07.pantographAir.compressorRunning = true; scenario.wait(30.0); - CHECK(eu07.BatteryVoltage < 0.83 * eu07.NominalBatteryVoltage); + CHECK(eu07.lowVoltage.batteryVoltage < 0.83 * eu07.lowVoltage.nominalBatteryVoltage); CHECK(eu07.lineBreaker.closed); scenario.wait(5000.0); - CHECK(eu07.BatteryVoltage < eu07.NominalBatteryVoltage / 1.57); + CHECK(eu07.lowVoltage.batteryVoltage < eu07.lowVoltage.nominalBatteryVoltage / 1.57); CHECK_FALSE(eu07.lineBreaker.closed); scenario.act("start up again"); CHECK_FALSE(scenario.start_up()); - CHECK(eu07.BatteryVoltage < eu07.NominalBatteryVoltage / 1.57); + CHECK(eu07.lowVoltage.batteryVoltage < eu07.lowVoltage.nominalBatteryVoltage / 1.57); scenario.check(); } @@ -61,20 +61,20 @@ TEST_CASE("auxiliaries: the battery switched off, and charged by the converter") scenario.act("converter off"); eu07.ConverterSwitch(false); scenario.wait(10.0); - auto const discharged{eu07.BatteryVoltage}; - CHECK(discharged < 0.83 * eu07.NominalBatteryVoltage); + auto const discharged{eu07.lowVoltage.batteryVoltage}; + CHECK(discharged < 0.83 * eu07.lowVoltage.nominalBatteryVoltage); // the converter charges it back at once scenario.act("converter on"); eu07.ConverterSwitch(true); scenario.wait(10.0); - CHECK(eu07.BatteryVoltage == doctest::Approx(eu07.NominalBatteryVoltage)); + CHECK(eu07.lowVoltage.batteryVoltage == doctest::Approx(eu07.lowVoltage.nominalBatteryVoltage)); // switched off, the battery falls to 90 V at once, then holds scenario.act("battery off"); eu07.MainSwitch(false); eu07.ConverterSwitch(false); eu07.BatterySwitch(false); scenario.wait(10.0); - CHECK(eu07.BatteryVoltage == doctest::Approx(discharged).epsilon(0.01)); + CHECK(eu07.lowVoltage.batteryVoltage == doctest::Approx(discharged).epsilon(0.01)); scenario.check(); } diff --git a/tests/unit/test_cab.cpp b/tests/unit/test_cab.cpp index b76911c5e..2cbb7096d 100644 --- a/tests/unit/test_cab.cpp +++ b/tests/unit/test_cab.cpp @@ -68,7 +68,7 @@ TEST_CASE("cab: the engine's idle speed, and the ET42's second controller shown vehicle et42{definition::fiz("et42_v2/112e-a")}; CHECK(et42->GetVirtualScndPos() == 0); - et42->DynamicBrakeFlag = true; + et42->brakes.electrodynamic.on = true; CHECK(et42->GetVirtualScndPos() == -1); et42->ScndCtrlPos = 1; CHECK(et42->GetVirtualScndPos() == 1); @@ -91,9 +91,9 @@ TEST_CASE("cab: the controller of the electrodynamic brake apart from the local CHECK_FALSE(eu47.IncDynamicBrakeLevel(1.f)); CHECK(eu47.DynamicBrakeRatio() == doctest::Approx(0.0)); - scenario.train()[0].physics().SplitEDPneumaticBrake = true; + scenario.train()[0].physics().brakes.electrodynamic.splitFromPneumatic = true; REQUIRE(scenario.start_up()); - REQUIRE(eu47.DynamicBrakeCtrlPosNo == 10); + REQUIRE(eu47.brakes.electrodynamic.controllerPositions == 10); CHECK(eu47.DynamicBrakeAvailable()); scenario.act("dynamic brake up"); for (int i = 0; i < 5; ++i) { @@ -101,7 +101,7 @@ TEST_CASE("cab: the controller of the electrodynamic brake apart from the local } CHECK(eu47.DynamicBrakeRatio() == doctest::Approx(0.5)); scenario.wait(10.0); - CHECK(eu47.DynamicBrakeFlag); + CHECK(eu47.brakes.electrodynamic.on); CHECK(eu47.Im < -50.0); CHECK(eu47.brakes.cylinderPressure < 0.1); scenario.act("dynamic brake full"); diff --git a/tests/unit/test_commands.cpp b/tests/unit/test_commands.cpp index 0fc6ea4c5..58ad83fa3 100644 --- a/tests/unit/test_commands.cpp +++ b/tests/unit/test_commands.cpp @@ -32,7 +32,7 @@ std::vector state() { {"eimic_real", [](auto const &M) { return M.eimic_real; }}, {"TUHEX_StageActual", [](auto const &M) { return M.TUHEX_StageActual; }}, {"TUHEX_Active", [](auto const &M) { return flag(M.TUHEX_Active); }}, - {"DynamicBrakeEMUStatus", [](auto const &M) { return flag(M.DynamicBrakeEMUStatus); }}, + {"DynamicBrakeEMUStatus", [](auto const &M) { return flag(M.brakes.electrodynamic.emuWorking); }}, {"BrakeReleaser", [](auto const &M) { return flag(M.brakes.distributor->Releaser()); }}, {"WaterPumpBreaker", [](auto const &M) { return flag(M.WaterPump.breaker); }}, {"WaterPumpEnabled", [](auto const &M) { return flag(M.WaterPump.is_enabled); }}, @@ -47,14 +47,14 @@ std::vector state() { {"CompartmentLightsEnabled", [](auto const &M) { return flag(M.CompartmentLights.is_enabled); }}, {"CompartmentLightsDisabled", [](auto const &M) { return flag(M.CompartmentLights.is_disabled); }}, {"MainSwitch", [](auto const &M) { return flag(M.lineBreaker.closed); }}, - {"Heating", [](auto const &M) { return flag(M.Heating); }}, + {"Heating", [](auto const &M) { return flag(M.trainHeating.on); }}, {"DirActive", [](auto const &M) { return M.DirActive; }}, {"DirAbsolute", [](auto const &M) { return M.DirAbsolute; }}, {"CabActive", [](auto const &M) { return M.CabActive; }}, {"CabMaster", [](auto const &M) { return flag(M.CabMaster); }}, {"AutoRelayFlag", [](auto const &M) { return flag(M.AutoRelayFlag); }}, {"ConverterAllow", [](auto const &M) { return flag(M.converter.allow); }}, - {"Battery", [](auto const &M) { return flag(M.Battery); }}, + {"Battery", [](auto const &M) { return flag(M.lowVoltage.batteryOn); }}, {"CompressorAllow", [](auto const &M) { return flag(M.air.compressor.allow); }}, {"CompressorListPos", [](auto const &M) { return M.air.compressor.listPosition; }}, {"DoorLock", [](auto const &M) { return flag(M.Doors.lock_enabled); }}, diff --git a/tests/unit/test_compartment_lights.cpp b/tests/unit/test_compartment_lights.cpp index bff60e440..917618544 100644 --- a/tests/unit/test_compartment_lights.cpp +++ b/tests/unit/test_compartment_lights.cpp @@ -20,32 +20,32 @@ void lights_check(vehicle &Car) { TEST_CASE("compartment lights: the lights need low voltage power and the switch") { vehicle car{definition::fiz("elf_v1/21we-a")}; REQUIRE(car->CompartmentLights.start_type == start_t::manual); - car->Power24vIsAvailable = false; - car->Power110vIsAvailable = false; + car->lowVoltage.power24vAvailable = false; + car->lowVoltage.power110vAvailable = false; car->CompartmentLightsSwitch(true, range_t::local); // switch on, no power lights_check(car); CHECK_FALSE(car->CompartmentLights.is_active); - car->Power110vIsAvailable = true; // converter on + car->lowVoltage.power110vAvailable = true; // converter on lights_check(car); CHECK(car->CompartmentLights.is_active); CHECK(car->CompartmentLights.intensity == doctest::Approx(1.0)); - car->Power110vIsAvailable = false; // battery only: the lights stay on, dimmed - car->Power24vIsAvailable = true; + car->lowVoltage.power110vAvailable = false; // battery only: the lights stay on, dimmed + car->lowVoltage.power24vAvailable = true; lights_check(car); CHECK(car->CompartmentLights.is_active); CHECK(car->CompartmentLights.intensity == doctest::Approx(0.5)); - car->Power24vIsAvailable = false; // no power at all + car->lowVoltage.power24vAvailable = false; // no power at all lights_check(car); CHECK_FALSE(car->CompartmentLights.is_active); } TEST_CASE("compartment lights: the off switch turns the lights off, the on switch back on") { vehicle car{definition::fiz("elf_v1/21we-a")}; - car->Power110vIsAvailable = true; + car->lowVoltage.power110vAvailable = true; lights_check(car); CHECK_FALSE(car->CompartmentLights.is_active); // manual start: off until switched on @@ -68,13 +68,13 @@ TEST_CASE("compartment lights: the off switch turns the lights off, the on switc TEST_CASE("compartment lights: lights started automatically come on with the power alone") { vehicle car{definition::fiz("elf_v1/21we-a").set("Cntrl", "CompartmentLightsStart", "Automatic")}; REQUIRE(car->CompartmentLights.start_type == start_t::automatic); - car->Power24vIsAvailable = false; - car->Power110vIsAvailable = false; + car->lowVoltage.power24vAvailable = false; + car->lowVoltage.power110vAvailable = false; lights_check(car); CHECK_FALSE(car->CompartmentLights.is_active); - car->Power110vIsAvailable = true; + car->lowVoltage.power110vAvailable = true; lights_check(car); CHECK(car->CompartmentLights.is_active); } diff --git a/tests/unit/test_compartment_lights_switch.cpp b/tests/unit/test_compartment_lights_switch.cpp index b9ba78398..8bc096c5d 100644 --- a/tests/unit/test_compartment_lights_switch.cpp +++ b/tests/unit/test_compartment_lights_switch.cpp @@ -117,7 +117,7 @@ void toggle(vehicle &Car, cab_controls const &Cab) { // the Elf (21WE-a), its compartment lights started by hand, with the converter running void power_up(vehicle &Car) { REQUIRE(Car->CompartmentLights.start_type == start_t::manual); - Car->Power110vIsAvailable = true; + Car->lowVoltage.power110vAvailable = true; lights_check(Car); REQUIRE_FALSE(Car->CompartmentLights.is_active); } diff --git a/tests/unit/test_compressor.cpp b/tests/unit/test_compressor.cpp index e65935672..13e667ceb 100644 --- a/tests/unit/test_compressor.cpp +++ b/tests/unit/test_compressor.cpp @@ -89,7 +89,7 @@ TEST_CASE("compressor: a compressor fed from the low voltage waits from the low run_compressor(vehicle, 10.0); REQUIRE_FALSE(vehicle->air.compressor.running); - vehicle->Power110vIsAvailable = true; + vehicle->lowVoltage.power110vAvailable = true; run_compressor(vehicle, 4.9); CHECK_FALSE(vehicle->air.compressor.running); run_compressor(vehicle, 0.2); @@ -178,15 +178,15 @@ TEST_CASE("compressor: fed from the converter it waits for the converter start d REQUIRE(loco->converter.startDelay == doctest::Approx(30.0)); loco.run(1.0); // engine off - CHECK_FALSE(loco->Power110vIsAvailable); + CHECK_FALSE(loco->lowVoltage.power110vAvailable); loco->lineBreaker.closed = true; // engine started loco.run(25.0); - CHECK_FALSE(loco->Power110vIsAvailable); + CHECK_FALSE(loco->lowVoltage.power110vAvailable); CHECK_FALSE(loco->air.compressor.running); loco.run(10.0); - CHECK(loco->Power110vIsAvailable); + CHECK(loco->lowVoltage.power110vAvailable); CHECK(loco->air.compressor.running); } @@ -197,7 +197,7 @@ TEST_CASE("compressor: fed from the converter the start delay counts from the co loco.run(1.0); // engine off loco->lineBreaker.closed = true; // engine started loco.run(25.0); - REQUIRE(loco->Power110vIsAvailable); // the converter is up + REQUIRE(loco->lowVoltage.power110vAvailable); // the converter is up CHECK_FALSE(loco->air.compressor.running); // but the compressor waits for its own delay as well loco.run(10.0); diff --git a/tests/unit/test_controls.cpp b/tests/unit/test_controls.cpp index 203624d5a..a7f73561d 100644 --- a/tests/unit/test_controls.cpp +++ b/tests/unit/test_controls.cpp @@ -456,13 +456,13 @@ TEST_CASE("controls: train heating from the locomotive") { scenario.act("heating on"); cab.HeatingSwitch(true); scenario.wait(30.0); - CHECK(cab.Heating); - CHECK(scenario.vehicle(2).Heating); + CHECK(cab.trainHeating.on); + CHECK(scenario.vehicle(2).trainHeating.on); scenario.act("heating off"); cab.HeatingSwitch(false); scenario.wait(10.0); - CHECK_FALSE(cab.Heating); - CHECK_FALSE(scenario.vehicle(2).Heating); + CHECK_FALSE(cab.trainHeating.on); + CHECK_FALSE(scenario.vehicle(2).trainHeating.on); scenario.check(); } @@ -552,11 +552,11 @@ TEST_CASE("controls: the automatic electrodynamic brake of the EP09, in service scenario.add("bdhpumn_v3/bdhpumn", 0, test::consist::full_coupling, 120.0); REQUIRE(scenario.start_up()); auto &ep09{scenario.cab()}; - REQUIRE(ep09.Power110vIsAvailable); + REQUIRE(ep09.lowVoltage.power110vAvailable); scenario.act(std::string{"brake "} + name); ep09.BrakeLevelSet(ep09.brakes.driverValve->GetPos(bh_MB) + steps); scenario.wait(10.0); - CHECK(ep09.DynamicBrakeFlag); + CHECK(ep09.brakes.electrodynamic.on); CHECK(ep09.Im < -100.0); CHECK(ep09.brakes.cylinderPressure < 0.25 * ep09.brakes.distributor->GetEDBCP()); scenario.wait(110.0); @@ -564,7 +564,7 @@ TEST_CASE("controls: the automatic electrodynamic brake of the EP09, in service // less than 2.1 bar, though the motors give nothing; a stronger application drops it before the stop CHECK(ep09.Vel == doctest::Approx(0.0)); CHECK(ep09.Im == doctest::Approx(0.0)); - CHECK(ep09.DynamicBrakeFlag == (ep09.brakes.cylinderPressure <= 2.1)); + CHECK(ep09.brakes.electrodynamic.on == (ep09.brakes.cylinderPressure <= 2.1)); CHECK(ep09.brakes.cylinderPressure == doctest::Approx(ep09.brakes.distributor->GetEDBCP()).epsilon(0.05)); scenario.act("release"); ep09.BrakeLevelSet(ep09.brakes.driverValve->GetPos(bh_RP)); @@ -601,7 +601,7 @@ TEST_CASE("controls: the automatic electrodynamic brake under ep and service bra scenario.wait(Seconds); }}; brake("ep brake", cab.brakes.driverValve->GetPos(bh_EPB), 15.0); - CHECK(cab.DynamicBrakeFlag == epelectric); + CHECK(cab.brakes.electrodynamic.on == epelectric); CHECK((cab.Im < -100.0) == epelectric); brake("ep hold", cab.brakes.driverValve->GetPos(bh_EPN), 5.0); brake("first step", cab.brakes.driverValve->GetPos(bh_MB), 20.0); diff --git a/tests/unit/test_drivingaid.cpp b/tests/unit/test_drivingaid.cpp index a8ef7ffa0..9a4cbdea9 100644 --- a/tests/unit/test_drivingaid.cpp +++ b/tests/unit/test_drivingaid.cpp @@ -46,8 +46,8 @@ test::track const line{0.15, 0.0, test::catenary_3kv}; TEST_CASE("driving aid: the Vectron's ED lever shows as a negative throttle step, and its ED braking") { vehicle vectron{definition::fiz("vectron_v1/wariant_7w"), 80.0 /* km/h */, "vectron", 1}; - REQUIRE(vectron->SplitEDPneumaticBrake); - REQUIRE(vectron->DynamicBrakeCtrlPosNo == 15); + REQUIRE(vectron->brakes.electrodynamic.splitFromPneumatic); + REQUIRE(vectron->brakes.electrodynamic.controllerPositions == 15); REQUIRE(vectron->EIMCtrlType == 0); // lever at zero: the master controller, as before, and no ED braking @@ -79,7 +79,7 @@ TEST_CASE("driving aid: the Vectron's ED lever shows as a negative throttle step TEST_CASE("driving aid: the Traxx's ED braking from its master controller") { vehicle traxx{definition::fiz("e186_v2/eu47"), 80.0 /* km/h */, "traxx", 1}; REQUIRE(traxx->EIMCtrlType == 1); - REQUIRE_FALSE(traxx->SplitEDPneumaticBrake); + REQUIRE_FALSE(traxx->brakes.electrodynamic.splitFromPneumatic); CHECK_FALSE(read(traxx, lever_cab).ed_percent.has_value()); // B+: the braking demand ramps towards full diff --git a/tests/unit/test_dynamic_brake_diesel.cpp b/tests/unit/test_dynamic_brake_diesel.cpp index 165343583..a5ed0ece1 100644 --- a/tests/unit/test_dynamic_brake_diesel.cpp +++ b/tests/unit/test_dynamic_brake_diesel.cpp @@ -22,9 +22,9 @@ std::vector dynamic_brake() { return { {"EDLevel", [](auto const &M) { return M.DEDynamicBrake.level; }}, {"EDForce", [](auto const &M) { return M.DEDynamicBrake.force; }}, - {"DynamicBrakeFlag", [](auto const &M) { return M.DynamicBrakeFlag ? 1.0 : 0.0; }}, + {"DynamicBrakeFlag", [](auto const &M) { return M.brakes.electrodynamic.on ? 1.0 : 0.0; }}, {"eimic_real", [](auto const &M) { return M.eimic_real; }}, - {"DynamicBrakeCtrlPos", [](auto const &M) { return M.DynamicBrakeCtrlPos; }}, + {"DynamicBrakeCtrlPos", [](auto const &M) { return M.brakes.electrodynamic.controllerPosition; }}, }; } @@ -86,7 +86,7 @@ TEST_CASE("diesel-electric dynamic brake: none without its definition") { scenario.wait(15.0); CHECK(locomotive.eimic_real == doctest::Approx(-1.0)); CHECK(locomotive.Ft == doctest::Approx(0.0)); - CHECK_FALSE(locomotive.DynamicBrakeFlag); + CHECK_FALSE(locomotive.brakes.electrodynamic.on); // coasting: braking with the power of the resistors above, it would lose more than 30 km/h CHECK(locomotive.Vel > speed - 12.0); scenario.check(); @@ -112,7 +112,7 @@ TEST_CASE("diesel-electric dynamic brake: the BR285's controller") { scenario.wait(10.0); CHECK(locomotive.eimic_real == doctest::Approx(-1.0)); CHECK(locomotive.DEDynamicBrake.level == doctest::Approx(1.0)); - CHECK(locomotive.DynamicBrakeFlag); + CHECK(locomotive.brakes.electrodynamic.on); REQUIRE(locomotive.Vel > 6.0); CHECK(-locomotive.Ft == doctest::Approx(br285_limit(locomotive)).epsilon(0.01)); CHECK(locomotive.Im > 0.0); @@ -151,7 +151,7 @@ TEST_CASE("diesel-electric dynamic brake: the BR285's controller") { scenario.wait(1.0); } CHECK(locomotive.Ft == doctest::Approx(0.0)); - CHECK_FALSE(locomotive.DynamicBrakeFlag); + CHECK_FALSE(locomotive.brakes.electrodynamic.on); // it doesn't hold the train: the air brake does CHECK(locomotive.Vel > 0.1); scenario.check(); @@ -165,8 +165,8 @@ TEST_CASE("diesel-electric dynamic brake: a resistor brake with its own lever") scenario.train().add(st44_braking(), 1); auto &locomotive{scenario.cab()}; REQUIRE(locomotive.DEDynamicBrake.source == physics::Vehicle::diesel_electric_dynamic_brake::control::lever); - CHECK(locomotive.SplitEDPneumaticBrake); - CHECK(locomotive.DynamicBrakeCtrlPosNo == 8); + CHECK(locomotive.brakes.electrodynamic.splitFromPneumatic); + CHECK(locomotive.brakes.electrodynamic.controllerPositions == 8); REQUIRE(scenario.start_up()); scenario.get_going(); scenario.full_power(90.0); @@ -178,19 +178,19 @@ TEST_CASE("diesel-electric dynamic brake: a resistor brake with its own lever") // the master controller at a power position keeps it off CHECK(locomotive.DEDynamicBrake.level == doctest::Approx(0.0)); CHECK(locomotive.Ft > 0.0); - CHECK_FALSE(locomotive.DynamicBrakeFlag); + CHECK_FALSE(locomotive.brakes.electrodynamic.on); scenario.act("power off"); scenario.notch_back(0); scenario.wait(4.0); CHECK(locomotive.DEDynamicBrake.level == doctest::Approx(1.0)); - CHECK(locomotive.DynamicBrakeFlag); + CHECK(locomotive.brakes.electrodynamic.on); CHECK(-locomotive.Ft == doctest::Approx(st44_limit(locomotive)).epsilon(0.01)); CHECK(locomotive.ShowCurrent(0) > 0.0); scenario.act("half the lever"); locomotive.DecDynamicBrakeLevel(4.0f); - CHECK(locomotive.DynamicBrakeCtrlPos == doctest::Approx(0.5)); + CHECK(locomotive.brakes.electrodynamic.controllerPosition == doctest::Approx(0.5)); for (int i = 0; i < 300 && locomotive.Vel > 20.0; ++i) { scenario.wait(1.0); } @@ -204,7 +204,7 @@ TEST_CASE("diesel-electric dynamic brake: a resistor brake with its own lever") scenario.wait(1.0); CHECK(locomotive.DEDynamicBrake.level == doctest::Approx(0.0)); CHECK(locomotive.Ft == doctest::Approx(0.0)); - CHECK_FALSE(locomotive.DynamicBrakeFlag); + CHECK_FALSE(locomotive.brakes.electrodynamic.on); scenario.check(); } diff --git a/tests/unit/test_engine_shutdown.cpp b/tests/unit/test_engine_shutdown.cpp index a3cab4002..4e54206ed 100644 --- a/tests/unit/test_engine_shutdown.cpp +++ b/tests/unit/test_engine_shutdown.cpp @@ -39,7 +39,7 @@ TEST_CASE("engine shutdown: neither the fuel pump switch nor the battery switch CHECK(shunter->lineBreaker.closed); shunter->BatterySwitch(false); shunter.run(10.0); - CHECK(shunter->Power110vIsAvailable); // the converter run by the engine keeps feeding the fuel pump + CHECK(shunter->lowVoltage.power110vAvailable); // the converter run by the engine keeps feeding the fuel pump CHECK(shunter->lineBreaker.closed); CHECK(shunter->enrot > 0.9 * shunter->diesel.minRevolutions); } diff --git a/tests/unit/test_genset.cpp b/tests/unit/test_genset.cpp index 595abff6e..b51264712 100644 --- a/tests/unit/test_genset.cpp +++ b/tests/unit/test_genset.cpp @@ -430,7 +430,7 @@ TEST_CASE("genset: no battery, no start") { REQUIRE(cab.TractionModeSwitch(traction_mode::genset)); cab.GensetSwitch(true); run(dragon6, 20.0); - CHECK_FALSE(cab.Power24vIsAvailable); + CHECK_FALSE(cab.lowVoltage.power24vAvailable); CHECK_FALSE(cab.Genset.is_cranking); CHECK_FALSE(cab.Genset.is_active); CHECK(cab.Genset.revolutions == 0.0); diff --git a/tests/unit/test_horn.cpp b/tests/unit/test_horn.cpp index cd2e68df3..e606f4105 100644 --- a/tests/unit/test_horn.cpp +++ b/tests/unit/test_horn.cpp @@ -79,9 +79,9 @@ TEST_CASE("horn: an electric horn sounds on the low voltage, whatever the air") REQUIRE(vehicle->Horn3Supply == horn_supply::electric); // the third horn follows the others unless told otherwise vehicle->air.mainReservoirPressure = 0.0; - vehicle->Power24vIsAvailable = true; + vehicle->lowVoltage.power24vAvailable = true; CHECK(vehicle->SoundingHorns(allhorns) == allhorns); - vehicle->Power24vIsAvailable = false; + vehicle->lowVoltage.power24vAvailable = false; CHECK(vehicle->SoundingHorns(allhorns) == 0); } @@ -91,10 +91,10 @@ TEST_CASE("horn: the third horn can have a supply of its own, an electric horn o REQUIRE(vehicle->Horn3Supply == horn_supply::electric); vehicle->air.mainReservoirPressure = 0.0; - vehicle->Power24vIsAvailable = true; + vehicle->lowVoltage.power24vAvailable = true; CHECK(vehicle->SoundingHorns(allhorns) == 4); vehicle->air.mainReservoirPressure = 6.5; - vehicle->Power24vIsAvailable = false; + vehicle->lowVoltage.power24vAvailable = false; CHECK(vehicle->SoundingHorns(allhorns) == (horn::low | horn::high)); } @@ -116,6 +116,6 @@ TEST_CASE("horn: a pneumatic horn sounds from the threshold pressure up") { TEST_CASE("horn: an electric horn sounds on 110 V too") { auto vehicle{horn_vehicle(test::definition::load("wagon").set("Cntrl", "HornType", "Electric"))}; - vehicle->Power110vIsAvailable = true; + vehicle->lowVoltage.power110vAvailable = true; CHECK(vehicle->SoundingHorns(horn::high) == horn::high); } diff --git a/tests/unit/test_line_contactors_interlock.cpp b/tests/unit/test_line_contactors_interlock.cpp index 24e025f09..eb92812e2 100644 --- a/tests/unit/test_line_contactors_interlock.cpp +++ b/tests/unit/test_line_contactors_interlock.cpp @@ -52,7 +52,7 @@ TEST_CASE("line contactors interlock: without one the converter and the blowers TEST_CASE("line contactors interlock: on the converter, they close only with the vehicle's own converter running") { auto locomotive{ready("Converter")}; locomotive->converter.running = false; - locomotive->Power110vIsAvailable = true; // the 110 V from the other section doesn't run this one's fans + locomotive->lowVoltage.power110vAvailable = true; // the 110 V from the other section doesn't run this one's fans CHECK_FALSE(locomotive->MotorConnectorsCheck()); locomotive->converter.running = true; CHECK(locomotive->MotorConnectorsCheck()); @@ -95,16 +95,16 @@ TEST_CASE("line contactors interlock: a blower starting with the speed needs to SUBCASE("off the converter, it needs the 110 V") { rear.start_type = start_t::converter; rear.is_enabled = false; // nothing for the driver to switch on - locomotive->Power110vIsAvailable = false; + locomotive->lowVoltage.power110vAvailable = false; CHECK_FALSE(locomotive->MotorConnectorsCheck()); - locomotive->Power110vIsAvailable = true; + locomotive->lowVoltage.power110vAvailable = true; CHECK(locomotive->MotorConnectorsCheck()); } SUBCASE("off the battery, it needs the 24 V") { rear.start_type = start_t::battery; - locomotive->Power24vIsAvailable = false; + locomotive->lowVoltage.power24vAvailable = false; CHECK_FALSE(locomotive->MotorConnectorsCheck()); - locomotive->Power24vIsAvailable = true; + locomotive->lowVoltage.power24vAvailable = true; CHECK(locomotive->MotorConnectorsCheck()); } SUBCASE("one without a start velocity still has to run") { @@ -271,7 +271,7 @@ TEST_CASE("line contactors interlock: the ET42 section with its fans switched of rear.converter.allowLocal = false; test::drive(driven, line, 2.0); REQUIRE_FALSE(rear.converter.running); - CHECK(rear.Power110vIsAvailable); + CHECK(rear.lowVoltage.power110vAvailable); test::release_brakes(driven.cab); for (int i = 0; i < 3 && driven.cab.DirActive <= 0; ++i) { diff --git a/tests/unit/test_mains_before_pantographs.cpp b/tests/unit/test_mains_before_pantographs.cpp index 7fd62fa35..11d8b889a 100644 --- a/tests/unit/test_mains_before_pantographs.cpp +++ b/tests/unit/test_mains_before_pantographs.cpp @@ -175,7 +175,7 @@ TEST_CASE("mains before pantographs: with the flag the converter and the compres CHECK(loco->lineBreaker.closed); CHECK_FALSE(loco->MainCircuitPowered()); CHECK_FALSE(loco->converter.running); - CHECK_FALSE(loco->Power110vIsAvailable); + CHECK_FALSE(loco->lowVoltage.power110vAvailable); CHECK_FALSE(loco->air.compressor.running); // the pantograph up: the converter starts, and the compressor on its 110 V @@ -184,7 +184,7 @@ TEST_CASE("mains before pantographs: with the flag the converter and the compres CHECK(reservoir_gain(loco, 10.0, line) > 0.1); CHECK(loco->MainCircuitPowered()); CHECK(loco->converter.running); - CHECK(loco->Power110vIsAvailable); + CHECK(loco->lowVoltage.power110vAvailable); CHECK(loco->air.compressor.running); // the voltage gone they stop, behind the line breaker which stays closed @@ -208,7 +208,7 @@ TEST_CASE("mains before pantographs: with the flag the converter and the compres CHECK(loco->lineBreaker.closed); CHECK_FALSE(loco->MainCircuitPowered()); CHECK_FALSE(loco->converter.running); - CHECK_FALSE(loco->Power110vIsAvailable); + CHECK_FALSE(loco->lowVoltage.power110vAvailable); CHECK_FALSE(loco->air.compressor.running); } @@ -231,7 +231,7 @@ TEST_CASE("mains before pantographs: with the flag whatever else the main circui CHECK_FALSE(loco->air.compressor.running); CHECK_FALSE(loco->MotorBlowers[VehicleEnd::front].is_active); CHECK(loco->RventRot == 0.0); - CHECK_FALSE(loco->Heating); + CHECK_FALSE(loco->trainHeating.on); SUBCASE("nor do they run on a voltage below the one the locomotive works on") { raise_pantograph(loco, weak); @@ -241,7 +241,7 @@ TEST_CASE("mains before pantographs: with the flag whatever else the main circui CHECK_FALSE(loco->air.compressor.running); CHECK_FALSE(loco->MotorBlowers[VehicleEnd::front].is_active); CHECK(loco->RventRot == 0.0); - CHECK_FALSE(loco->Heating); + CHECK_FALSE(loco->trainHeating.on); } SUBCASE("with the voltage they do") { raise_pantograph(loco); @@ -250,7 +250,7 @@ TEST_CASE("mains before pantographs: with the flag whatever else the main circui CHECK(loco->air.compressor.running); CHECK(loco->MotorBlowers[VehicleEnd::front].is_active); CHECK(loco->RventRot > 0.0); - CHECK(loco->Heating); + CHECK(loco->trainHeating.on); } } @@ -264,14 +264,14 @@ TEST_CASE("mains before pantographs: without the flag the converter and the comp CHECK(reservoir_gain(loco, 10.0, line) > 0.1); CHECK(loco->MainCircuitPowered()); CHECK(loco->converter.running); - CHECK(loco->Power110vIsAvailable); + CHECK(loco->lowVoltage.power110vAvailable); CHECK(loco->air.compressor.running); // too low a voltage opens the line breaker, and they stop with it loco.run(5.0, weak); CHECK_FALSE(loco->lineBreaker.closed); CHECK_FALSE(loco->MainCircuitPowered()); CHECK_FALSE(loco->converter.running); - CHECK_FALSE(loco->Power110vIsAvailable); + CHECK_FALSE(loco->lowVoltage.power110vAvailable); CHECK_FALSE(loco->air.compressor.running); } diff --git a/tests/unit/test_oil_pump.cpp b/tests/unit/test_oil_pump.cpp index 130145b29..7d7acb902 100644 --- a/tests/unit/test_oil_pump.cpp +++ b/tests/unit/test_oil_pump.cpp @@ -12,7 +12,7 @@ using test::vehicle; TEST_CASE("oil pump: the pre-lubrication pump works before the engine start and stops once the engine runs") { vehicle loco{definition::load("cab_vehicle").set("Cntrl", "OilStart", "Manual")}; REQUIRE(loco->OilPump.start_type == start_t::manual); - loco->Power24vIsAvailable = true; // battery on + loco->lowVoltage.power24vAvailable = true; // battery on loco->OilPumpCheck(0.01); CHECK_FALSE(loco->OilPump.is_active); // not switched on yet @@ -29,7 +29,7 @@ TEST_CASE("oil pump: the pre-lubrication pump works before the engine start and TEST_CASE("oil pump: the pump started with the engine start procedure stops once the engine runs") { vehicle loco{definition::load("cab_vehicle").set("Cntrl", "OilStart", "Automatic")}; REQUIRE(loco->OilPump.start_type == start_t::automatic); - loco->Power24vIsAvailable = true; + loco->lowVoltage.power24vAvailable = true; loco->diesel.startupRequested = true; // starter button pressed loco->OilPumpCheck(0.01); @@ -46,8 +46,8 @@ TEST_CASE("oil pump: the pump started with the engine start procedure stops once TEST_CASE("oil pump: without power the pump and its lamp stay off") { vehicle loco{definition::load("cab_vehicle")}; - loco->Power24vIsAvailable = false; - loco->Power110vIsAvailable = false; + loco->lowVoltage.power24vAvailable = false; + loco->lowVoltage.power110vAvailable = false; loco->OilPump.is_enabled = true; loco->OilPumpCheck(0.01); diff --git a/tests/unit/test_pullee.cpp b/tests/unit/test_pullee.cpp index 3591e6e95..62f620270 100644 --- a/tests/unit/test_pullee.cpp +++ b/tests/unit/test_pullee.cpp @@ -114,13 +114,13 @@ TEST_CASE("pullee: an EU07 with a driver can't release the brakes of a dead Vect test::drive(driven, track, 60.0); if (false == pullee) { // the Vectron has emptied the brake pipe, and both locomotives stand on an emergency application - CHECK(hauled->Battery); + CHECK(hauled->lowVoltage.batteryOn); CHECK(locomotive->brakePipe.pressure < 1.0); CHECK(locomotive->brakes.cylinderPressure > 3.0); CHECK(hauled->brakes.cylinderPressure > 3.0); continue; } - CHECK_FALSE(hauled->Battery); + CHECK_FALSE(hauled->lowVoltage.batteryOn); CHECK(locomotive->brakePipe.pressure > 4.9); CHECK(locomotive->brakes.cylinderPressure < 0.1); CHECK(hauled->brakes.cylinderPressure < 0.1); @@ -335,9 +335,9 @@ TEST_CASE("pullee: entering the mode lets go of the hand brake and the spring br } SUBCASE("a locomotive ready to depart, its battery on") { vehicle vectron{definition::fiz("vectron_v1/wariant_7w"), 0.1}; - REQUIRE(vectron->Battery); + REQUIRE(vectron->lowVoltage.batteryOn); CHECK(vectron->PulleeModeSwitch(true)); - CHECK_FALSE(vectron->Battery); + CHECK_FALSE(vectron->lowVoltage.batteryOn); } } @@ -345,7 +345,7 @@ TEST_CASE("pullee: the battery and the cabs of a vehicle prepared for hauling st vehicle vectron{definition::fiz("vectron_v1/wariant_7w"), 0.0, "test", 1}; REQUIRE(vectron->PulleeModeSwitch(true)); CHECK_FALSE(vectron->BatterySwitch(true)); - CHECK_FALSE(vectron->Battery); + CHECK_FALSE(vectron->lowVoltage.batteryOn); CHECK_FALSE(vectron->CabActivisation()); CHECK_FALSE(vectron->CabActivisation(true)); CHECK(vectron->CabActive == 0); @@ -357,7 +357,7 @@ TEST_CASE("pullee: the battery and the cabs of a vehicle prepared for hauling st REQUIRE(vectron->PulleeModeSwitch(false)); CHECK_FALSE(vectron->PulleeMode); CHECK(vectron->BatterySwitch(true)); - CHECK(vectron->Battery); + CHECK(vectron->lowVoltage.batteryOn); CHECK(vectron->CabActivisation()); CHECK(vectron->CabActive == 1); // a vehicle driven from isn't one to haul @@ -394,14 +394,14 @@ TEST_CASE("pullee: the battery and cab commands of the train's driver pass a veh if (pullee) { REQUIRE(hauled->PulleeModeSwitch(true)); } - REQUIRE_FALSE(hauled->Battery); + REQUIRE_FALSE(hauled->lowVoltage.batteryOn); locomotive->BatterySwitch(true); locomotive->CabActivisation(); train.run(2.0); - CHECK(hauled->Battery == (false == pullee)); + CHECK(hauled->lowVoltage.batteryOn == (false == pullee)); CHECK(hauled->CabActive == (pullee ? 0 : 1)); // the vehicle behind it gets them either way - CHECK(last->Battery); + CHECK(last->lowVoltage.batteryOn); CHECK(last->CabActive == 1); } } @@ -439,7 +439,7 @@ TEST_CASE("pullee: every real vehicle standing braked releases once prepared for auto const &hauled{train.hauled.physics()}; CHECK(hauled.brakes.handBrakePosition == 0); CHECK_FALSE(hauled.brakes.spring.activate); - CHECK_FALSE(hauled.Battery); + CHECK_FALSE(hauled.lowVoltage.batteryOn); train.run(180.0); CHECK(hauled.brakes.emergencyValve.flow == 0.0); CHECK(hauled.brakes.cylinderPressure < 0.1); diff --git a/tests/unit/test_radio.cpp b/tests/unit/test_radio.cpp index b65cc2ced..abe4ef9f8 100644 --- a/tests/unit/test_radio.cpp +++ b/tests/unit/test_radio.cpp @@ -8,8 +8,8 @@ TEST_CASE("radio: a radio switched on with the low voltage works") { test::vehicle vehicle{test::definition::load("wagon")}; vehicle->Radio = true; - SUBCASE("24 V") { vehicle->Power24vIsAvailable = true; } - SUBCASE("110 V") { vehicle->Power110vIsAvailable = true; } + SUBCASE("24 V") { vehicle->lowVoltage.power24vAvailable = true; } + SUBCASE("110 V") { vehicle->lowVoltage.power110vAvailable = true; } CHECK(vehicle->RadioPowered()); } @@ -17,12 +17,12 @@ TEST_CASE("radio: a radio switched off or without the low voltage doesn't") { test::vehicle vehicle{test::definition::load("wagon")}; SUBCASE("switched off") { vehicle->Radio = false; - vehicle->Power24vIsAvailable = true; + vehicle->lowVoltage.power24vAvailable = true; } SUBCASE("batteries off") { vehicle->Radio = true; - vehicle->Power24vIsAvailable = false; - vehicle->Power110vIsAvailable = false; + vehicle->lowVoltage.power24vAvailable = false; + vehicle->lowVoltage.power110vAvailable = false; } CHECK_FALSE(vehicle->RadioPowered()); } @@ -38,7 +38,7 @@ TEST_CASE("radio: the radio fuse is closed by default") { TEST_CASE("radio: an opened radio fuse cuts the radio off") { test::vehicle vehicle{test::definition::load("wagon")}; vehicle->Radio = true; - vehicle->Power24vIsAvailable = true; + vehicle->lowVoltage.power24vAvailable = true; vehicle->RadioFuse = false; CHECK_FALSE(vehicle->RadioPowered()); vehicle->RadioFuse = true; @@ -47,7 +47,7 @@ TEST_CASE("radio: an opened radio fuse cuts the radio off") { TEST_CASE("radio: opening the radio fuse at a standstill resets the radio-stop, as switching the radio off does") { test::vehicle loco{test::definition::fiz("4e_v1/4e")}; - loco->Battery = true; + loco->lowVoltage.batteryOn = true; loco->Radio = true; REQUIRE(loco->RadiostopSwitch(true)); loco->SecuritySystemCheck(0.1); diff --git a/tests/unit/test_switches.cpp b/tests/unit/test_switches.cpp index 72b1e47ce..f2ca6de17 100644 --- a/tests/unit/test_switches.cpp +++ b/tests/unit/test_switches.cpp @@ -7,10 +7,10 @@ TEST_CASE("switches: the train heating switch can spring back (MaSzyna-EU07/maszyna#85)") { SUBCASE("impulse") { test::vehicle vehicle{test::definition::load("cab_vehicle").set("Switches", "TrainHeating", "Impulse")}; - CHECK(vehicle->HeatingSwitchImpulse); // whichever the case it's written in + CHECK(vehicle->trainHeating.switchImpulse); // whichever the case it's written in } SUBCASE("a plain switch by default") { test::vehicle vehicle{test::definition::load("cab_vehicle")}; - CHECK_FALSE(vehicle->HeatingSwitchImpulse); + CHECK_FALSE(vehicle->trainHeating.switchImpulse); } } diff --git a/tests/unit/test_traction.cpp b/tests/unit/test_traction.cpp index 5fd81fd95..4b27a94a6 100644 --- a/tests/unit/test_traction.cpp +++ b/tests/unit/test_traction.cpp @@ -183,7 +183,7 @@ TEST_CASE("traction: the stages of the EW58's electrodynamic brake, set by the p ew58.BrakeLevelSet(position); scenario.wait(6.0); CHECK(ew58.TUHEX_StageActual == stage); - CHECK(ew58.DynamicBrakeFlag); + CHECK(ew58.brakes.electrodynamic.on); CHECK(ew58.Im < 0.0); } scenario.act("release"); @@ -240,7 +240,7 @@ TEST_CASE("traction: the induction motor drive's speed control, its electrodynam scenario.act("local brake"); eu47.IncLocalBrakeLevel(LocalBrakePosNo); scenario.wait(5.0); - CHECK(eu47.DynamicBrakeFlag); + CHECK(eu47.brakes.electrodynamic.on); CHECK(eu47.Im == doctest::Approx(0.0)); CHECK(eu47.brakes.cylinderPressure > 2.0); scenario.act("local brake off"); @@ -254,7 +254,7 @@ TEST_CASE("traction: the induction motor drive's speed control, its electrodynam scenario.act(std::format("service brake at {} V", static_cast(voltage))); eu47.BrakeLevelSet(eu47.brakes.driverValve->GetPos(bh_FB)); scenario.wait(6.0); - CHECK(eu47.DynamicBrakeFlag); + CHECK(eu47.brakes.electrodynamic.on); CHECK(eu47.Im < -100.0); CHECK((eu47.Vadd > 1.0) == (voltage > eu47.EnginePowerSource.CollectorParameters.MaxV)); eu47.BrakeLevelSet(eu47.brakes.driverValve->GetPos(bh_RP)); diff --git a/vehicle/ai/consist.cpp b/vehicle/ai/consist.cpp index 30176ce2f..64e2d1a6a 100644 --- a/vehicle/ai/consist.cpp +++ b/vehicle/ai/consist.cpp @@ -379,8 +379,8 @@ bool TController::CheckVehicles(DriverOrders user) // HACK: wagony muszą mieć baterię załączoną do otwarcia drzwi... p->physics->BatterySwitch( true ); // enable heating and converter in carriages with can be heated - if( p->physics->HeatingPower > 0 ) { - p->physics->HeatingAllow = true; + if( p->physics->trainHeating.power > 0 ) { + p->physics->trainHeating.allow = true; p->physics->ConverterSwitch( true, range_t::local ); hasheaters = true; } @@ -485,7 +485,7 @@ bool TController::CheckVehicles(DriverOrders user) false == isheatingcouplingactive ? false : ispassengertrain ? hasheaters : false) }; - if( mvControlling->HeatingAllow != isheatingneeded ) { + if( mvControlling->trainHeating.allow != isheatingneeded ) { cue_action( isheatingneeded ? driver_hint::consistheatingon : @@ -680,12 +680,12 @@ TController::determine_consist_state() { // ABu-160305 testowanie gotowości do jazdy // Ra: przeniesione z DynObj, skład użytkownika też jest testowany, żeby mu przekazać, że ma odhamować - if (occupied->CabActive == 0 && occupied->Power24vIsAvailable) + if (occupied->CabActive == 0 && occupied->lowVoltage.power24vAvailable) { cue_action( driver_hint::cabactivation ); } else if (!occupied->AutomaticCabActivation - && ( occupied->CabActive == -occupied->CabOccupied || !occupied->CabMaster || !occupied->Power24vIsAvailable ) ) + && ( occupied->CabActive == -occupied->CabOccupied || !occupied->CabMaster || !occupied->lowVoltage.power24vAvailable ) ) { cue_action( driver_hint::cabdeactivation ); } diff --git a/vehicle/ai/controls.cpp b/vehicle/ai/controls.cpp index c2cc203c2..0d5552e7c 100644 --- a/vehicle/ai/controls.cpp +++ b/vehicle/ai/controls.cpp @@ -506,7 +506,7 @@ bool TController::IncSpeed() } // TODO: move all fVoltage assignments to a single, more generic place if( mvControlling->EnginePowerSource.SourceType == TPowerSource::Accumulator ) { - fVoltage = mvControlling->BatteryVoltage; + fVoltage = mvControlling->lowVoltage.batteryVoltage; } if (!IsAnyMotorOverloadRelayOpen && !mvControlling->protection.pressureSwitch && (mvControlling->IsMainCtrlNoPowerPos() || mvControlling->lineContactors.closed) && (Ready || drivingFlags.press)) { // youBy polecił dodać 2012-09-08 v367 diff --git a/vehicle/ai/engine.cpp b/vehicle/ai/engine.cpp index 33884cac8..661a3d7a8 100644 --- a/vehicle/ai/engine.cpp +++ b/vehicle/ai/engine.cpp @@ -339,7 +339,7 @@ bool TController::ReleaseEngine() { // && ( false == IsAnyCompressorEnabled ) // && ( false == IsAnyConverterEnabled ) && false == mvControlling->lineBreaker.closed - && false == occupied->Power24vIsAvailable }; + && false == occupied->lowVoltage.power24vAvailable }; if (OK) { // jeśli się zatrzymał diff --git a/vehicle/ai/orders.cpp b/vehicle/ai/orders.cpp index c50cca135..954c56dfc 100644 --- a/vehicle/ai/orders.cpp +++ b/vehicle/ai/orders.cpp @@ -1178,7 +1178,7 @@ TController::handle_engine() { if( OrderCurrentGet() == DriverOrder::waitForOrders && false == iEngineActive // && ( false == AIControllFlag ) - && true == occupied->Power24vIsAvailable ) { + && true == occupied->lowVoltage.power24vAvailable ) { OrderNext( DriverOrder::prepareEngine ); } // basic engine preparation diff --git a/vehicle/cab/auxiliarycommands.cpp b/vehicle/cab/auxiliarycommands.cpp index cb7540cc8..9bd043955 100644 --- a/vehicle/cab/auxiliarycommands.cpp +++ b/vehicle/cab/auxiliarycommands.cpp @@ -684,7 +684,7 @@ void TTrain::OnCommand_convertertoggle(TTrain *Train, command_data const &Comman // only reacting to press, so the switch doesn't flip back and forth if key is held down auto const overloadrelayisopen{(Train->Dynamic()->Mechanik != nullptr ? Train->Dynamic()->Mechanik->IsAnyConverterOverloadRelayOpen : Train->occupied->converter.overloaded)}; - if (Train->occupied->converter.switchType != "impulse" ? Train->ggConverterButton.GetValue() < 0.5 : false == Train->occupied->Power110vIsAvailable && false == overloadrelayisopen) + if (Train->occupied->converter.switchType != "impulse" ? Train->ggConverterButton.GetValue() < 0.5 : false == Train->occupied->lowVoltage.power110vAvailable && false == overloadrelayisopen) { // turn on OnCommand_converterenable(Train, Command); diff --git a/vehicle/cab/brakecommands.cpp b/vehicle/cab/brakecommands.cpp index 087ee602c..2e60ad77f 100644 --- a/vehicle/cab/brakecommands.cpp +++ b/vehicle/cab/brakecommands.cpp @@ -55,7 +55,7 @@ void TTrain::OnCommand_independentbrakeincrease(TTrain *Train, command_data cons // when SplitEDPneumaticBrake is active the local brake key always operates // the pneumatic local brake directly, never piggy-backing on the joint controller - auto const splitMode{Train->controlled->SplitEDPneumaticBrake}; + auto const splitMode{Train->controlled->brakes.electrodynamic.splitFromPneumatic}; auto const useStepped{Train->ggJointCtrl.SubModel != nullptr && !splitMode}; if (Train->occupied->brakes.localKind != TLocalBrake::ManualBrake) { @@ -81,7 +81,7 @@ void TTrain::OnCommand_independentbrakeincreasefast(TTrain *Train, command_data if (Command.action != GLFW_RELEASE) { - auto const splitMode{Train->controlled->SplitEDPneumaticBrake}; + auto const splitMode{Train->controlled->brakes.electrodynamic.splitFromPneumatic}; auto const useJointAnim{Train->ggJointCtrl.SubModel != nullptr && !splitMode}; if (Train->occupied->brakes.localKind != TLocalBrake::ManualBrake) { @@ -107,7 +107,7 @@ void TTrain::OnCommand_independentbrakedecrease(TTrain *Train, command_data cons if (Command.action != GLFW_RELEASE) { - auto const splitMode{Train->controlled->SplitEDPneumaticBrake}; + auto const splitMode{Train->controlled->brakes.electrodynamic.splitFromPneumatic}; auto const useStepped{Train->ggJointCtrl.SubModel != nullptr && !splitMode}; if (Train->occupied->brakes.localKind != TLocalBrake::ManualBrake // Ra 1014-06: AI potrafi zahamować pomocniczym mimo jego braku - odhamować jakoś trzeba @@ -136,7 +136,7 @@ void TTrain::OnCommand_independentbrakedecreasefast(TTrain *Train, command_data if (Command.action != GLFW_RELEASE) { - auto const splitMode{Train->controlled->SplitEDPneumaticBrake}; + auto const splitMode{Train->controlled->brakes.electrodynamic.splitFromPneumatic}; auto const useJointAnim{Train->ggJointCtrl.SubModel != nullptr && !splitMode}; if (Train->occupied->brakes.localKind != TLocalBrake::ManualBrake // Ra 1014-06: AI potrafi zahamować pomocniczym mimo jego braku - odhamować jakoś trzeba diff --git a/vehicle/cab/cabcommands.cpp b/vehicle/cab/cabcommands.cpp index 25ac96377..30f020482 100644 --- a/vehicle/cab/cabcommands.cpp +++ b/vehicle/cab/cabcommands.cpp @@ -300,7 +300,7 @@ void TTrain::OnCommand_batterytoggle(TTrain *Train, command_data const &Command) if (Train->allowBatteryToggle || Command.action != GLFW_REPEAT) { // keep the switch from flipping back and forth if key is held down - if (false == Train->occupied->Power24vIsAvailable) + if (false == Train->occupied->lowVoltage.power24vAvailable) { // turn on OnCommand_batteryenable(Train, Command); @@ -315,7 +315,7 @@ void TTrain::OnCommand_batterytoggle(TTrain *Train, command_data const &Command) void TTrain::OnCommand_batteryenable(TTrain *Train, command_data const &Command) { - if (!Train->occupied->isBatteryButtonImpulse) + if (!Train->occupied->lowVoltage.batteryButtonImpulse) { // regular button behavior if (Command.action == GLFW_PRESS) { @@ -346,12 +346,12 @@ void TTrain::OnCommand_batteryenable(TTrain *Train, command_data const &Command) { if (Command.action == GLFW_PRESS) { - if (Train->occupied->shouldHoldBatteryButton) + if (Train->occupied->lowVoltage.batteryButtonHeld) { // jesli przycisk trzeba przytrzymac Train->ggBatteryButton.UpdateValue(1.0f, Train->dsbSwitch); Train->ggBatteryOnButton.UpdateValue(1.0f, Train->dsbSwitch); - Train->fBatteryTimer = Train->occupied->BatteryButtonHoldTime; // start timer + Train->fBatteryTimer = Train->occupied->lowVoltage.batteryButtonHoldTime; // start timer } else { @@ -376,15 +376,15 @@ void TTrain::OnCommand_batteryenable(TTrain *Train, command_data const &Command) Train->ggBatteryOnButton.UpdateValue(0.0f, Train->dsbSwitch); Train->fBatteryTimer = -1.f; // Train->allowBatteryToggle = true; - Train->occupied->batterySwAlreadyFired = false; + Train->occupied->lowVoltage.batteryButtonFired = false; } - else if (Command.action == GLFW_REPEAT && Train->occupied->shouldHoldBatteryButton) + else if (Command.action == GLFW_REPEAT && Train->occupied->lowVoltage.batteryButtonHeld) { // trzymamy przycisk - if (Train->fBatteryTimer <= 0.0 && Train->occupied->Battery == false && !Train->occupied->batterySwAlreadyFired) + if (Train->fBatteryTimer <= 0.0 && Train->occupied->lowVoltage.batteryOn == false && !Train->occupied->lowVoltage.batteryButtonFired) { Train->occupied->BatterySwitch(true); - Train->occupied->batterySwAlreadyFired = true; + Train->occupied->lowVoltage.batteryButtonFired = true; // side-effects if (Train->occupied->LightsPosNo > 0) @@ -399,7 +399,7 @@ void TTrain::OnCommand_batteryenable(TTrain *Train, command_data const &Command) void TTrain::OnCommand_batterydisable(TTrain *Train, command_data const &Command) { - if (!Train->occupied->isBatteryButtonImpulse) + if (!Train->occupied->lowVoltage.batteryButtonImpulse) { // regular button behavior if (Command.action == GLFW_PRESS) { @@ -429,12 +429,12 @@ void TTrain::OnCommand_batterydisable(TTrain *Train, command_data const &Command { if (Command.action == GLFW_PRESS) { - if (Train->occupied->shouldHoldBatteryButton) + if (Train->occupied->lowVoltage.batteryButtonHeld) { // jesli przycisk trzeba przytrzymac Train->ggBatteryButton.UpdateValue(1.0f, Train->dsbSwitch); Train->ggBatteryOffButton.UpdateValue(1.0f, Train->dsbSwitch); - Train->fBatteryTimer = Train->occupied->BatteryButtonHoldTime; // start timer + Train->fBatteryTimer = Train->occupied->lowVoltage.batteryButtonHoldTime; // start timer } else { @@ -458,15 +458,15 @@ void TTrain::OnCommand_batterydisable(TTrain *Train, command_data const &Command Train->ggBatteryButton.UpdateValue(0.0f, Train->dsbSwitch); Train->ggBatteryOffButton.UpdateValue(0.0f, Train->dsbSwitch); Train->allowBatteryToggle = true; - Train->occupied->batterySwAlreadyFired = false; + Train->occupied->lowVoltage.batteryButtonFired = false; } - else if (Command.action == GLFW_REPEAT && Train->occupied->shouldHoldBatteryButton) + else if (Command.action == GLFW_REPEAT && Train->occupied->lowVoltage.batteryButtonHeld) { // trzymamy przycisk - if (Train->fBatteryTimer <= 0.0 && Train->occupied->Battery == true && !Train->occupied->batterySwAlreadyFired) + if (Train->fBatteryTimer <= 0.0 && Train->occupied->lowVoltage.batteryOn == true && !Train->occupied->lowVoltage.batteryButtonFired) { Train->occupied->BatterySwitch(false); - Train->occupied->batterySwAlreadyFired = true; + Train->occupied->lowVoltage.batteryButtonFired = true; // side-effects if (Train->occupied->LightsPosNo > 0) diff --git a/vehicle/cab/controllercommands.cpp b/vehicle/cab/controllercommands.cpp index 8028e5e6f..3126ee91c 100644 --- a/vehicle/cab/controllercommands.cpp +++ b/vehicle/cab/controllercommands.cpp @@ -91,7 +91,7 @@ void TTrain::OnCommand_jointcontrollerset(TTrain *Train, command_data const &Com Train->m_mastercontrollerinuse = true; // when SplitEDPneumaticBrake is active the joint controller's negative range // commands the dedicated dynamic-brake lever instead of the local pneumatic brake - if (Train->controlled->SplitEDPneumaticBrake) + if (Train->controlled->brakes.electrodynamic.splitFromPneumatic) { Train->controlled->DynamicBrakeLevelSet(0.0); } @@ -103,11 +103,11 @@ void TTrain::OnCommand_jointcontrollerset(TTrain *Train, command_data const &Com else { auto const negativeRange{std::clamp(1.0 - Command.param1 * 2, 0.0, 1.0)}; - if (Train->controlled->SplitEDPneumaticBrake) + if (Train->controlled->brakes.electrodynamic.splitFromPneumatic) { // negative range of jointctrl drives only ED braking, local pneumatic brake stays untouched. // snap to DBPN discrete stops so the lever animates step-by-step - auto const stepCount{std::max(1, Train->controlled->DynamicBrakeCtrlPosNo)}; + auto const stepCount{std::max(1, Train->controlled->brakes.electrodynamic.controllerPositions)}; auto const snapped{std::round(negativeRange * stepCount) / stepCount}; Train->controlled->DynamicBrakeLevelSet(snapped); } @@ -135,10 +135,10 @@ void TTrain::OnCommand_mastercontrollerincrease(TTrain *Train, command_data cons if (Command.action != GLFW_RELEASE) { // on press or hold - auto const splitMode{Train->controlled->SplitEDPneumaticBrake}; + auto const splitMode{Train->controlled->brakes.electrodynamic.splitFromPneumatic}; // when SplitEDPneumaticBrake is true the joint controller's negative range maps // to the dedicated dynamic-brake lever (DynamicBrakeCtrl) rather than to LocalBrake - auto const negativeRangeActive{splitMode ? Train->controlled->DynamicBrakeCtrlPos > 0.0 : Train->occupied->brakes.independentPosition > 0.0}; + auto const negativeRangeActive{splitMode ? Train->controlled->brakes.electrodynamic.controllerPosition > 0.0 : Train->occupied->brakes.independentPosition > 0.0}; if (Train->ggJointCtrl.SubModel != nullptr && negativeRangeActive) { if (splitMode) @@ -171,8 +171,8 @@ void TTrain::OnCommand_mastercontrollerincreasefast(TTrain *Train, command_data if (Command.action != GLFW_RELEASE) { // on press or hold - auto const splitMode{Train->controlled->SplitEDPneumaticBrake}; - auto const negativeRangeActive{splitMode ? Train->controlled->DynamicBrakeCtrlPos > 0.0 : Train->occupied->brakes.independentPosition > 0.0}; + auto const splitMode{Train->controlled->brakes.electrodynamic.splitFromPneumatic}; + auto const negativeRangeActive{splitMode ? Train->controlled->brakes.electrodynamic.controllerPosition > 0.0 : Train->occupied->brakes.independentPosition > 0.0}; if (Train->ggJointCtrl.SubModel != nullptr && negativeRangeActive) { if (splitMode) @@ -205,7 +205,7 @@ void TTrain::OnCommand_mastercontrollerdecrease(TTrain *Train, command_data cons if (Command.action != GLFW_RELEASE) { // on press or hold - auto const splitMode{Train->controlled->SplitEDPneumaticBrake}; + auto const splitMode{Train->controlled->brakes.electrodynamic.splitFromPneumatic}; if (Train->ggJointCtrl.SubModel != nullptr && Train->controlled->IsMainCtrlNoPowerPos()) { // negative range of jointctrl: ED brake when split, otherwise pneumatic local brake @@ -239,7 +239,7 @@ void TTrain::OnCommand_mastercontrollerdecreasefast(TTrain *Train, command_data if (Command.action != GLFW_RELEASE) { // on press or hold - auto const splitMode{Train->controlled->SplitEDPneumaticBrake}; + auto const splitMode{Train->controlled->brakes.electrodynamic.splitFromPneumatic}; if (Train->ggJointCtrl.SubModel != nullptr && Train->controlled->IsMainCtrlNoPowerPos()) { if (splitMode) @@ -288,7 +288,7 @@ void TTrain::OnCommand_DynamicBrakeControllerIncrease(TTrain *Train, command_dat { return; } - if (false == Train->controlled->SplitEDPneumaticBrake) + if (false == Train->controlled->brakes.electrodynamic.splitFromPneumatic) { return; } @@ -303,12 +303,12 @@ void TTrain::OnCommand_DynamicBrakeControllerIncreaseFast(TTrain *Train, command { return; } - if (false == Train->controlled->SplitEDPneumaticBrake) + if (false == Train->controlled->brakes.electrodynamic.splitFromPneumatic) { return; } - Train->controlled->IncDynamicBrakeLevel(static_cast(Train->controlled->DynamicBrakeCtrlPosNo)); + Train->controlled->IncDynamicBrakeLevel(static_cast(Train->controlled->brakes.electrodynamic.controllerPositions)); } void TTrain::OnCommand_DynamicBrakeControllerDecrease(TTrain *Train, command_data const &Command) @@ -317,7 +317,7 @@ void TTrain::OnCommand_DynamicBrakeControllerDecrease(TTrain *Train, command_dat { return; } - if (false == Train->controlled->SplitEDPneumaticBrake) + if (false == Train->controlled->brakes.electrodynamic.splitFromPneumatic) { return; } @@ -332,12 +332,12 @@ void TTrain::OnCommand_DynamicBrakeControllerDecreaseFast(TTrain *Train, command { return; } - if (false == Train->controlled->SplitEDPneumaticBrake) + if (false == Train->controlled->brakes.electrodynamic.splitFromPneumatic) { return; } - Train->controlled->DecDynamicBrakeLevel(static_cast(Train->controlled->DynamicBrakeCtrlPosNo)); + Train->controlled->DecDynamicBrakeLevel(static_cast(Train->controlled->brakes.electrodynamic.controllerPositions)); } void TTrain::OnCommand_DynamicBrakeControllerSet(TTrain *Train, command_data const &Command) @@ -346,14 +346,14 @@ void TTrain::OnCommand_DynamicBrakeControllerSet(TTrain *Train, command_data con { return; } - if (false == Train->controlled->SplitEDPneumaticBrake) + if (false == Train->controlled->brakes.electrodynamic.splitFromPneumatic) { return; } // when input source uses raw 0..1 value, snap to nearest DBPN step auto const target{std::clamp(Command.param1, 0.0, 1.0)}; - auto const stepCount{std::max(1, Train->controlled->DynamicBrakeCtrlPosNo)}; + auto const stepCount{std::max(1, Train->controlled->brakes.electrodynamic.controllerPositions)}; auto const snapped{std::round(target * stepCount) / stepCount}; Train->controlled->DynamicBrakeLevelSet(snapped); } diff --git a/vehicle/cab/equipmentcommands.cpp b/vehicle/cab/equipmentcommands.cpp index efe5eef28..398836221 100644 --- a/vehicle/cab/equipmentcommands.cpp +++ b/vehicle/cab/equipmentcommands.cpp @@ -62,7 +62,7 @@ void TTrain::OnCommand_heatingtoggle(TTrain *Train, command_data const &Command) if (Command.action == GLFW_PRESS) { // ignore repeats so the switch doesn't flip back and forth if key is held down - if (false == Train->controlled->HeatingAllow) + if (false == Train->controlled->trainHeating.allow) { // turn on OnCommand_heatingenable(Train, Command); @@ -73,7 +73,7 @@ void TTrain::OnCommand_heatingtoggle(TTrain *Train, command_data const &Command) OnCommand_heatingdisable(Train, Command); } } - else if (Command.action == GLFW_RELEASE && (Train->ggTrainHeatingButton.type() == TGaugeType::push || Train->occupied->HeatingSwitchImpulse)) + else if (Command.action == GLFW_RELEASE && (Train->ggTrainHeatingButton.type() == TGaugeType::push || Train->occupied->trainHeating.switchImpulse)) { // impulse switch // visual feedback @@ -91,7 +91,7 @@ void TTrain::OnCommand_heatingenable(TTrain *Train, command_data const &Command) // visual feedback Train->ggTrainHeatingButton.UpdateValue(1.0, Train->dsbSwitch); } - else if (Command.action == GLFW_RELEASE && Train->occupied->HeatingSwitchImpulse) + else if (Command.action == GLFW_RELEASE && Train->occupied->trainHeating.switchImpulse) { // the switch springs back to the middle Train->ggTrainHeatingButton.UpdateValue(0.0, Train->dsbSwitch); @@ -107,7 +107,7 @@ void TTrain::OnCommand_heatingdisable(TTrain *Train, command_data const &Command Train->occupied->HeatingSwitch(false); // visual feedback: an impulse switch is pushed the other way, down auto position{0.0}; - if (Train->occupied->HeatingSwitchImpulse) + if (Train->occupied->trainHeating.switchImpulse) { position = -1.0; } @@ -117,7 +117,7 @@ void TTrain::OnCommand_heatingdisable(TTrain *Train, command_data const &Command } Train->ggTrainHeatingButton.UpdateValue(position, Train->dsbSwitch); } - else if (Command.action == GLFW_RELEASE && Train->occupied->HeatingSwitchImpulse) + else if (Command.action == GLFW_RELEASE && Train->occupied->trainHeating.switchImpulse) { Train->ggTrainHeatingButton.UpdateValue(0.0, Train->dsbSwitch); } diff --git a/vehicle/cab/pantographcommands.cpp b/vehicle/cab/pantographcommands.cpp index c83599f97..a1806c9d6 100644 --- a/vehicle/cab/pantographcommands.cpp +++ b/vehicle/cab/pantographcommands.cpp @@ -590,7 +590,7 @@ void TTrain::OnCommand_pantographcompressoractivate(TTrain *Train, command_data if (Command.action != GLFW_RELEASE) { // press or hold to activate - if (Train->pantographUnit->pantographAir.pressure < 4.8 && true == Train->pantographUnit->Power24vIsAvailable) + if (Train->pantographUnit->pantographAir.pressure < 4.8 && true == Train->pantographUnit->lowVoltage.power24vAvailable) { // needs live power source and low enough pressure to work Train->pantographUnit->pantographAir.compressorRunning = true; diff --git a/vehicle/cab/setup.cpp b/vehicle/cab/setup.cpp index 118a6ff30..fe23cc0fe 100644 --- a/vehicle/cab/setup.cpp +++ b/vehicle/cab/setup.cpp @@ -888,7 +888,7 @@ void TTrain::set_cab_controls(int const Cab) { // switches // battery - ggBatteryButton.PutValue(ggBatteryButton.type() == TGaugeType::push ? 0.5f : occupied->Power24vIsAvailable ? 1.f : 0.f); + ggBatteryButton.PutValue(ggBatteryButton.type() == TGaugeType::push ? 0.5f : occupied->lowVoltage.power24vAvailable ? 1.f : 0.f); // activation ggCabActivationButton.PutValue(ggCabActivationButton.type() == TGaugeType::push ? 0.5f : occupied->IsCabMaster() ? 1.f : 0.f); // line breaker @@ -1077,9 +1077,9 @@ void TTrain::set_cab_controls(int const Cab) ggDoorStepButton.PutValue(occupied->Doors.step_enabled ? 1.f : 0.f); } // heating - if (false == ggTrainHeatingButton.is_push() && false == occupied->HeatingSwitchImpulse) + if (false == ggTrainHeatingButton.is_push() && false == occupied->trainHeating.switchImpulse) { - ggTrainHeatingButton.PutValue(controlled->Heating ? 1.f : 0.f); + ggTrainHeatingButton.PutValue(controlled->trainHeating.on ? 1.f : 0.f); } // brake acting time if (ggBrakeProfileCtrl.SubModel != nullptr) @@ -1340,7 +1340,7 @@ bool TTrain::initialize_button(cParser &Parser, std::string const &Label, int co {"i-doorpermit_any:", &m_doorpermits}, {"i-doorstep:", &occupied->Doors.step_enabled}, {"i-mainpipelock:", &occupied->brakes.pipeLock.locked}, - {"i-battery:", &occupied->Power24vIsAvailable}, + {"i-battery:", &occupied->lowVoltage.power24vAvailable}, {"i-cablight:", &Cabine[iCabn].bLight}, {"i-compartmentlights:", &occupied->CompartmentLights.is_active}, }; diff --git a/vehicle/cab/sounds.cpp b/vehicle/cab/sounds.cpp index 23dd29647..ebf928565 100644 --- a/vehicle/cab/sounds.cpp +++ b/vehicle/cab/sounds.cpp @@ -340,7 +340,7 @@ void TTrain::update_sounds(double const Deltatime) } // power-reliant sounds - if (occupied->Power24vIsAvailable || occupied->Power110vIsAvailable) + if (occupied->lowVoltage.power24vAvailable || occupied->lowVoltage.power110vAvailable) { // buzzer shp diff --git a/vehicle/cab/train.cpp b/vehicle/cab/train.cpp index d0c889eb2..0c6ae06b9 100644 --- a/vehicle/cab/train.cpp +++ b/vehicle/cab/train.cpp @@ -173,11 +173,11 @@ std::shared_ptr TTrain::GetTrainState(dictionary_source const dict->insert("cabactive", occupied->CabActive); dict->insert("master", occupied->CabMaster); // basic systems state data - dict->insert("battery", occupied->Power24vIsAvailable); + dict->insert("battery", occupied->lowVoltage.power24vAvailable); dict->insert("linebreaker", controlled->lineBreaker.closed); dict->insert("main_init", controlled->lineBreaker.initCountdown < controlled->lineBreaker.initTime && controlled->lineBreaker.initCountdown > 0.0); dict->insert("main_ready", false == controlled->lineBreaker.closed && fHVoltage > 0.0 && controlled->lineBreaker.initCountdown <= 0.0); - dict->insert("converter", occupied->Power110vIsAvailable); + dict->insert("converter", occupied->lowVoltage.power110vAvailable); dict->insert("converter_overload", controlled->converter.overloaded); dict->insert("compress", controlled->air.compressor.running); dict->insert("pant_compressor", pantographUnit->pantographAir.compressorRunning); @@ -212,7 +212,7 @@ std::shared_ptr TTrain::GetTrainState(dictionary_source const dict->insert("mainctrl_pos_count", controlled->MainCtrlPosNo); dict->insert("main_ctrl_actual_pos", controlled->MainCtrlActualPos); dict->insert("scndctrl_pos", controlled->ScndCtrlPos); - dict->insert("dynamicbrake_pos", controlled->DynamicBrakeCtrlPos); + dict->insert("dynamicbrake_pos", controlled->brakes.electrodynamic.controllerPosition); dict->insert("scnd_ctrl_actual_pos", controlled->ScndCtrlActualPos); dict->insert("brakectrl_pos", controlled->brakes.handlePositionSmooth); dict->insert("localbrake_pos", controlled->brakes.independentPosition); @@ -429,7 +429,7 @@ TTrain::state_t TTrain::get_state() const occupied->Doors.instances[occupied->CabOccupied < 0 ? VehicleSide::left : VehicleSide::right].open_permit, occupied->Doors.instances[occupied->CabOccupied < 0 ? VehicleSide::left : VehicleSide::right].is_open, occupied->Doors.step_enabled, - occupied->Power24vIsAvailable, + occupied->lowVoltage.power24vAvailable, 0, occupied->brakes.pipeLock.locked, btLampkaRadioMessage.GetValue(), @@ -439,7 +439,7 @@ TTrain::state_t TTrain::get_state() const bool TTrain::is_eztoer() const { - return controlled->TrainType == train_type::emu && occupied->brakes.subsystem == TBrakeSubSystem::ss_ESt && controlled->Power24vIsAvailable == true && controlled->EpFuse == true && + return controlled->TrainType == train_type::emu && occupied->brakes.subsystem == TBrakeSubSystem::ss_ESt && controlled->lowVoltage.power24vAvailable == true && controlled->EpFuse == true && controlled->DirActive != 0; // od yB } @@ -562,7 +562,7 @@ void TTrain::UpdateCab() void TTrain::add_distance(double const Distance) { - auto const meterenabled{m_distancecounter >= 0 && (occupied->Power24vIsAvailable || occupied->Power110vIsAvailable)}; + auto const meterenabled{m_distancecounter >= 0 && (occupied->lowVoltage.power24vAvailable || occupied->lowVoltage.power110vAvailable)}; if (true == meterenabled) { diff --git a/vehicle/cab/update.cpp b/vehicle/cab/update.cpp index 32a0fab22..cf33a899a 100644 --- a/vehicle/cab/update.cpp +++ b/vehicle/cab/update.cpp @@ -65,7 +65,7 @@ bool TTrain::Update(double const Deltatime) updateUnitStates(); updateFeedbackGauges(); updateConverterOverload(Deltatime); - auto const lowvoltagepower{occupied->Power24vIsAvailable || occupied->Power110vIsAvailable}; + auto const lowvoltagepower{occupied->lowVoltage.power24vAvailable || occupied->lowVoltage.power110vAvailable}; updateSecondUnitGauges(); updateClock(); @@ -122,12 +122,12 @@ bool TTrain::Update(double const Deltatime) } // update direction relay - if (prevBatState != occupied->Power24vIsAvailable) + if (prevBatState != occupied->lowVoltage.power24vAvailable) SetupDirectionRelays(); if (prevDirection != occupied->DirActive) UpdateDirectionRelays(); - prevBatState = occupied->Power24vIsAvailable; + prevBatState = occupied->lowVoltage.power24vAvailable; prevDirection = occupied->DirActive; // sounds @@ -483,11 +483,11 @@ void TTrain::updateUnitStates() fEIMParams[1 + in][9] = static_cast(p->physics->EngineVoltage); fEIMParams[0][6] += fEIMParams[1 + in][8]; bMains[in] = p->physics->lineBreaker.closed; - fCntVol[in] = static_cast(p->physics->BatteryVoltage); + fCntVol[in] = static_cast(p->physics->lowVoltage.batteryVoltage); bFuse[in] = p->physics->FuseFlag; - bBatt[in] = p->physics->Battery; + bBatt[in] = p->physics->lowVoltage.batteryOn; bConv[in] = p->physics->converter.running; - bHeat[in] = p->physics->Heating; + bHeat[in] = p->physics->trainHeating.on; // bComp[in][2] = (p->physics->CompressorAllow || (p->physics->CompressorStart == start_t::automatic)); // bComp[in][3] = (p->physics->CompressorFlag); in++; @@ -506,11 +506,11 @@ void TTrain::updateUnitStates() fDieselParams[1 + in][8] = p->physics->diesel.heat.Ts; fDieselParams[1 + in][9] = static_cast(p->physics->retarder.fill); bMains[in] = p->physics->lineBreaker.closed; - fCntVol[in] = static_cast(p->physics->BatteryVoltage); + fCntVol[in] = static_cast(p->physics->lowVoltage.batteryVoltage); bFuse[in] = p->physics->FuseFlag; - bBatt[in] = p->physics->Battery; + bBatt[in] = p->physics->lowVoltage.batteryOn; bConv[in] = p->physics->converter.running; - bHeat[in] = p->physics->Heating; + bHeat[in] = p->physics->trainHeating.on; in++; iPowerNo = in; } @@ -696,7 +696,7 @@ void TTrain::updateEngineGauges() // youBy - napiecie na silnikach if (ggEngineVoltage.SubModel) { - if (controlled->DynamicBrakeFlag) + if (controlled->brakes.electrodynamic.on) { ggEngineVoltage.UpdateValue(static_cast(std::abs(controlled->Im * 5))); } @@ -725,7 +725,7 @@ void TTrain::updateEngineGauges() { // NOTE: since we don't have functional converter object, we're faking it here by simple check whether converter is on // TODO: implement object-based circuits and power systems model so we can have this working more properly - ggLVoltage.UpdateValue(static_cast(std::max(occupied->Power110vIsAvailable ? occupied->NominalBatteryVoltage : 0.0, occupied->Power24vIsAvailable ? occupied->BatteryVoltage : 0.0))); + ggLVoltage.UpdateValue(static_cast(std::max(occupied->lowVoltage.power110vAvailable ? occupied->lowVoltage.nominalBatteryVoltage : 0.0, occupied->lowVoltage.power24vAvailable ? occupied->lowVoltage.batteryVoltage : 0.0))); ggLVoltage.Update(); } @@ -798,7 +798,7 @@ void TTrain::updateBasicLamps() btCabActived.Turn(false); } - if (controlled->Battery && controlled->CabActive != 0) + if (controlled->lowVoltage.batteryOn && controlled->CabActive != 0) btAKLVents.Turn(true); else btAKLVents.Turn(false); @@ -831,8 +831,8 @@ void TTrain::updateCircuitLamps(double const Deltatime) btLampkaMainBreakerReady.Turn(controlled->lineBreaker.initCountdown <= 0.0 && m_linebreakerstate != linebreaker::state::closing && !controlled->lineBreaker.closed); btLampkaMainBreakerBlinkingIfReady.Turn(m_linebreakerstate == linebreaker::state::closing || controlled->lineBreaker.closed || controlled->lineBreaker.initCountdown < 0.0 && simulation::Time.data().wMilliseconds > 500); - btLampkaPrzetw.Turn(occupied->Power110vIsAvailable); - btLampkaPrzetwOff.Turn(!occupied->Power110vIsAvailable); + btLampkaPrzetw.Turn(occupied->lowVoltage.power110vAvailable); + btLampkaPrzetwOff.Turn(!occupied->lowVoltage.power110vAvailable); btLampkaPrzetwAOff.Turn(!controlled->converter.running); btLampkaNadmPrzetw.Turn(Dynamic()->Mechanik ? Dynamic()->Mechanik->IsAnyConverterOverloadRelayOpen : controlled->converter.overloaded); @@ -909,8 +909,8 @@ void TTrain::updateTrainLamps() } default: { - btLampkaHamienie.Turn(occupied->brakes.cylinderPressure >= 0.1 || controlled->DynamicBrakeFlag); - btLampkaBrakingOff.Turn(occupied->brakes.cylinderPressure < 0.1 && !controlled->DynamicBrakeFlag); + btLampkaHamienie.Turn(occupied->brakes.cylinderPressure >= 0.1 || controlled->brakes.electrodynamic.on); + btLampkaBrakingOff.Turn(occupied->brakes.cylinderPressure < 0.1 && !controlled->brakes.electrodynamic.on); break; } } @@ -958,7 +958,7 @@ void TTrain::updateTrainLamps() btLampkaNeutral.Turn(controlled->DirActive == 0); // kierunek neutral } - btLampkaED.Turn(controlled->DynamicBrakeFlag); // hamulec ED + btLampkaED.Turn(controlled->brakes.electrodynamic.on); // hamulec ED btLampkaBrakeProfileG.Turn(TestFlag(occupied->brakes.delaySetting, bdelay_G)); btLampkaBrakeProfileP.Turn(TestFlag(occupied->brakes.delaySetting, bdelay_P)); btLampkaBrakeProfileR.Turn(TestFlag(occupied->brakes.delaySetting, bdelay_R)); @@ -1189,8 +1189,8 @@ void TTrain::updateMasterControllers(bool const lowvoltagepower) 1}; // when SplitEDPneumaticBrake is active the negative range of the joint controller // represents the dedicated dynamic-brake lever (DBPN steps), not the pneumatic local brake - auto const negativePart{controlled->SplitEDPneumaticBrake ? - (controlled->DynamicBrakeCtrlPos > 0.0 ? controlled->DynamicBrakeCtrlPos * controlled->DynamicBrakeCtrlPosNo * -1 * brakerangemultiplier : 0.0) : + auto const negativePart{controlled->brakes.electrodynamic.splitFromPneumatic ? + (controlled->brakes.electrodynamic.controllerPosition > 0.0 ? controlled->brakes.electrodynamic.controllerPosition * controlled->brakes.electrodynamic.controllerPositions * -1 * brakerangemultiplier : 0.0) : occupied->brakes.independentPosition > 0.0 ? occupied->brakes.independentPosition * LocalBrakePosNo * -1 * brakerangemultiplier : 0.0}; ggJointCtrl.UpdateValue(negativePart < 0.0 ? static_cast(negativePart) : @@ -1232,7 +1232,7 @@ void TTrain::updateMasterControllers(bool const lowvoltagepower) // Ra: od byte odejmowane boolean i konwertowane potem na double? if (false == ggScndCtrl.is_push()) { - ggScndCtrl.UpdateValue(static_cast(double(controlled->ScndCtrlPos - (controlled->TrainType == train_type::et42 && controlled->DynamicBrakeFlag))), dsbNastawnikBocz); + ggScndCtrl.UpdateValue(static_cast(double(controlled->ScndCtrlPos - (controlled->TrainType == train_type::et42 && controlled->brakes.electrodynamic.on))), dsbNastawnikBocz); } ggScndCtrl.Update(); } @@ -1374,7 +1374,7 @@ void TTrain::updateHeatingAndInstrumentLights() { //--------- // hunter-080812: poprawka na ogrzewanie w elektrykach - usuniete uzaleznienie od przetwornicy - if (controlled->Heating == true && controlled->converter.overloaded == false) + if (controlled->trainHeating.on == true && controlled->converter.overloaded == false) btLampkaOgrzewanieSkladu.Turn(true); else btLampkaOgrzewanieSkladu.Turn(false); @@ -1382,11 +1382,11 @@ void TTrain::updateHeatingAndInstrumentLights() //---------- // lights - auto const lightpower{(InstrumentLightType == 0 ? occupied->Power24vIsAvailable || occupied->Power110vIsAvailable : + auto const lightpower{(InstrumentLightType == 0 ? occupied->lowVoltage.power24vAvailable || occupied->lowVoltage.power110vAvailable : InstrumentLightType == 1 ? controlled->lineBreaker.closed : - InstrumentLightType == 2 ? occupied->Power110vIsAvailable : - InstrumentLightType == 3 ? occupied->Power24vIsAvailable || occupied->Power110vIsAvailable : - InstrumentLightType == 4 ? occupied->Power24vIsAvailable || occupied->Power110vIsAvailable : + InstrumentLightType == 2 ? occupied->lowVoltage.power110vAvailable : + InstrumentLightType == 3 ? occupied->lowVoltage.power24vAvailable || occupied->lowVoltage.power110vAvailable : + InstrumentLightType == 4 ? occupied->lowVoltage.power24vAvailable || occupied->lowVoltage.power110vAvailable : false)}; InstrumentLightActive = InstrumentLightType == 3 ? true : // TODO: link the light state with the state of the master key InstrumentLightType == 4 ? occupied->iLights[VehicleEnd::front] != 0 || occupied->iLights[VehicleEnd::rear] != 0 : @@ -1574,7 +1574,7 @@ void TTrain::updateCabLightLevels() for (auto &cab : Cabine) { - auto const cablightlevel = (cab.bLight == false ? 0.f : cab.bLightDim == true ? 0.4f : 1.f) * (occupied->Power110vIsAvailable ? 1.f : 0.5f); + auto const cablightlevel = (cab.bLight == false ? 0.f : cab.bLightDim == true ? 0.4f : 1.f) * (occupied->lowVoltage.power110vAvailable ? 1.f : 0.5f); if (cab.LightLevel != cablightlevel) { @@ -1593,21 +1593,21 @@ void TTrain::updateCabLightLevels() void TTrain::UpdateDirectionRelays() { - if (occupied->DirActive < 0 && occupied->Power24vIsAvailable) // wstecz + if (occupied->DirActive < 0 && occupied->lowVoltage.power24vAvailable) // wstecz Dynamic()->sDirectionRelayR.play(); - if (occupied->DirActive == 0 && occupied->Power24vIsAvailable) // neutral + if (occupied->DirActive == 0 && occupied->lowVoltage.power24vAvailable) // neutral Dynamic()->sDirectionRelayN.play(); - if (occupied->DirActive > 0 && occupied->Power24vIsAvailable) // przod + if (occupied->DirActive > 0 && occupied->lowVoltage.power24vAvailable) // przod Dynamic()->sDirectionRelayD.play(); } void TTrain::SetupDirectionRelays() { - if (occupied->Power24vIsAvailable) + if (occupied->lowVoltage.power24vAvailable) { - if (occupied->DirActive < 0 && occupied->Power24vIsAvailable) // wstecz + if (occupied->DirActive < 0 && occupied->lowVoltage.power24vAvailable) // wstecz Dynamic()->sDirectionRelayR.play(); - if (occupied->DirActive > 0 && occupied->Power24vIsAvailable) // przod + if (occupied->DirActive > 0 && occupied->lowVoltage.power24vAvailable) // przod Dynamic()->sDirectionRelayD.play(); } else if (occupied->DirActive != 0) // neutral diff --git a/vehicle/drivingaid.cpp b/vehicle/drivingaid.cpp index 1638c4ddd..9b67d967d 100644 --- a/vehicle/drivingaid.cpp +++ b/vehicle/drivingaid.cpp @@ -63,11 +63,11 @@ input from_vehicles(physics::Vehicle const &Vehicle, physics::Vehicle const &Con input result; result.eim = Vehicle.EngineType == TEngineType::ElectricInductionMotor || Vehicle.EIMCtrlType > 0; result.eimctrltype = Vehicle.EIMCtrlType; - result.splited = Controlling.SplitEDPneumaticBrake; + result.splited = Controlling.brakes.electrodynamic.splitFromPneumatic; result.integratedbrake = Vehicle.UniCtrlIntegratedBrakeCtrl; result.eimic_real = Vehicle.eimic_real; - result.dynamicbrakepos = Controlling.DynamicBrakeCtrlPos; - result.dynamicbrakeposno = Controlling.DynamicBrakeCtrlPosNo; + result.dynamicbrakepos = Controlling.brakes.electrodynamic.controllerPosition; + result.dynamicbrakeposno = Controlling.brakes.electrodynamic.controllerPositions; result.mainctrlpos = Controlling.MainCtrlPos; result.scndctrlpos = Controlling.ScndCtrlPos; result.brakectrlpos = Vehicle.brakes.handlePositionSmooth; diff --git a/vehicle/dynamic/destinations.cpp b/vehicle/dynamic/destinations.cpp index e8ca19457..6311c8799 100644 --- a/vehicle/dynamic/destinations.cpp +++ b/vehicle/dynamic/destinations.cpp @@ -106,7 +106,7 @@ void TDynamicObject::update_destinations() { if( DestinationSign.sign == nullptr ) { return; } - auto const lowvoltagepower { ( physics->Power24vIsAvailable || physics->Power110vIsAvailable ) }; + auto const lowvoltagepower { ( physics->lowVoltage.power24vAvailable || physics->lowVoltage.power110vAvailable ) }; DestinationSign.sign->fLight = DestinationSign.has_light && lowvoltagepower ? 2.0 : -1.0; diff --git a/vehicle/dynamic/sounds.cpp b/vehicle/dynamic/sounds.cpp index 144d8e776..b9f948111 100644 --- a/vehicle/dynamic/sounds.cpp +++ b/vehicle/dynamic/sounds.cpp @@ -137,7 +137,7 @@ void TDynamicObject::renderAuxiliarySounds() { // Odtworzenie dzwieku wentylatora rezystora hamowania - if (physics->BRVentilators) + if (physics->brakes.electrodynamic.resistorFansRunning) { sBRVent.play(sound_flags::exclusive | sound_flags::looping); } @@ -197,7 +197,7 @@ void TDynamicObject::renderAuxiliarySounds() { // heater sound { auto const isdieselenginepowered { physics->EngineType == TEngineType::DieselElectric || physics->EngineType == TEngineType::DieselEngine }; - if( true == physics->Heating + if( true == physics->trainHeating.on && ( false == isdieselenginepowered || std::abs(physics->enrot) > 0.01 ) ) { sHeater @@ -212,7 +212,7 @@ void TDynamicObject::renderAuxiliarySounds() { } // battery sound - if( physics->Battery ) { + if( physics->lowVoltage.batteryOn ) { m_batterysound.play( sound_flags::exclusive | sound_flags::looping ); } else { @@ -487,7 +487,7 @@ void TDynamicObject::renderDepartureSignalSounds() { // NBMX sygnal odjazdu if( physics->Doors.has_warning ) { - auto const lowvoltagepower { physics->Power24vIsAvailable || physics->Power110vIsAvailable }; + auto const lowvoltagepower { physics->lowVoltage.power24vAvailable || physics->lowVoltage.power110vAvailable }; for( auto &doorspeaker : m_doorspeakers ) { // TBD, TODO: per-location door state triggers? if( physics->DepartureSignal @@ -514,7 +514,7 @@ void TDynamicObject::renderAnnouncementSounds() { // announcements { - auto const lowvoltagepower { physics->Power24vIsAvailable || physics->Power110vIsAvailable }; + auto const lowvoltagepower { physics->lowVoltage.power24vAvailable || physics->lowVoltage.power110vAvailable }; if( lowvoltagepower ) { // system is powered up, can play queued announcements if( false == m_pasystem.announcement_queue.empty() @@ -1398,7 +1398,7 @@ TDynamicObject::powertrain_sounds::renderTractionMotorSounds( physics::Vehicle c } } - if( Vehicle.DynamicBrakeFlag + if( Vehicle.brakes.electrodynamic.on && Vehicle.EnginePower > 0.1 ) { // Szociu - 29012012 - jeżeli uruchomiony jest hamulec elektrodynamiczny, odtwarzany jest dźwięk silnika volume += 0.8; diff --git a/vehicle/dynamic/update.cpp b/vehicle/dynamic/update.cpp index 6e929c902..6d41fb379 100644 --- a/vehicle/dynamic/update.cpp +++ b/vehicle/dynamic/update.cpp @@ -735,7 +735,7 @@ void TDynamicObject::switchOffMainsWithoutBattery() { // fragment "z EXE Kursa" if( physics->lineBreaker.closed ) { // nie wchodzić w funkcję bez potrzeby - if( false == (physics->Power24vIsAvailable || physics->Power110vIsAvailable) + if( false == (physics->lowVoltage.power24vAvailable || physics->lowVoltage.power110vAvailable) /* // NOTE: disabled on account of multi-unit setups, where the unmanned unit wouldn't be affected && ( Controller == Humandriver ) @@ -1180,7 +1180,7 @@ void TDynamicObject::updatePantographMotion( int const i, TAnimPant *p, double c else { pantspeedfactor = 0.0; } - if( false == ( physics->Power24vIsAvailable || physics->Power110vIsAvailable ) ) { + if( false == ( physics->lowVoltage.power24vAvailable || physics->lowVoltage.power110vAvailable ) ) { pantspeedfactor = 0.0; } pantspeedfactor = std::max( 0.0, pantspeedfactor ); @@ -1282,12 +1282,12 @@ void TDynamicObject::updateWipers( double const dt1 ) // rozroznienie kabinowe if (physics->CabActive == 1) { - wipersActive = (bytesum & 1 << i) != 0 && physics->Battery; + wipersActive = (bytesum & 1 << i) != 0 && physics->lowVoltage.batteryOn; } else if (physics->CabActive == -1) { // odwroconie indexow wycieraczek - wipersActive = (bytesum & 1 << dWiperPos.size() - 1 - i) != 0 && physics->Battery; + wipersActive = (bytesum & 1 << dWiperPos.size() - 1 - i) != 0 && physics->lowVoltage.batteryOn; } else { wipersActive = false; diff --git a/vehicle/dynamic/visual.cpp b/vehicle/dynamic/visual.cpp index 60a1c5c4b..75dc89a72 100644 --- a/vehicle/dynamic/visual.cpp +++ b/vehicle/dynamic/visual.cpp @@ -345,7 +345,7 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist) btnOn = true; } // else btCPass2.TurnOff(); - if (physics->Power24vIsAvailable || physics->Power110vIsAvailable) + if (physics->lowVoltage.power24vAvailable || physics->lowVoltage.power110vAvailable) { // sygnaly konca pociagu if (m_endsignals1.Active()) { if (TestFlag(physics->iLights[VehicleEnd::front], light::redmarker_left | light::redmarker_right ) ) { @@ -433,7 +433,7 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist) } // vehicle within 400m - if( physics->Power24vIsAvailable || physics->Power110vIsAvailable ) + if( physics->lowVoltage.power24vAvailable || physics->lowVoltage.power110vAvailable ) { // sygnały czoła pociagu //Ra: wyświetlamy bez // ograniczeń odległości, by były widoczne z // daleka diff --git a/widgets/vehicleparams.cpp b/widgets/vehicleparams.cpp index 321cee7de..6bb8274b9 100644 --- a/widgets/vehicleparams.cpp +++ b/widgets/vehicleparams.cpp @@ -68,7 +68,7 @@ void ui::vehicleparams_panel::draw_mini(const physics::Vehicle &physics) if (physics.pantographs[VehicleEnd::front].is_active) draw_infobutton("╨╨╨", ImVec2(290, 10)); - if (physics.Battery) + if (physics.lowVoltage.batteryOn) draw_infobutton(STR_C("bat."), ImVec2(120, 55)); if (physics.lineBreaker.closed) draw_infobutton(STR_C("main.")); @@ -148,7 +148,7 @@ void ui::vehicleparams_panel::render_contents() std::snprintf(buffer.data(), buffer.size(), STR_C("Devices: %c%c%c%c%c%c%c%c%c%c%c%c%c%c%s%s\nPower transfers: %.0f@%.0f%s%s%s%.0f@%.0f"), // devices - (physics.Battery ? 'B' : '.'), (physics.lineBreaker.closed ? 'M' : '.'), (physics.FuseFlag ? '!' : '.'), (physics.pantographs[VehicleEnd::rear].is_active ? (physics.pantographCircuit.rearVoltage > 0.0 ? 'O' : 'o') : '.'), + (physics.lowVoltage.batteryOn ? 'B' : '.'), (physics.lineBreaker.closed ? 'M' : '.'), (physics.FuseFlag ? '!' : '.'), (physics.pantographs[VehicleEnd::rear].is_active ? (physics.pantographCircuit.rearVoltage > 0.0 ? 'O' : 'o') : '.'), (physics.pantographs[VehicleEnd::front].is_active ? (physics.pantographCircuit.frontVoltage > 0.0 ? 'P' : 'p') : '.'), (physics.pantographAir.pressureLockActive ? '!' : (physics.pantographAir.pressureSwitchActive ? '*' : '.')), (physics.WaterPump.is_active ? 'W' : (false == physics.WaterPump.breaker ? '-' : (physics.WaterPump.is_enabled ? 'w' : '.'))), (true == physics.WaterHeater.is_damaged ? '!' : (physics.WaterHeater.is_active ? 'H' : (false == physics.WaterHeater.breaker ? '-' : (physics.WaterHeater.is_enabled ? 'h' : '.')))),