From 107ad16ffc0ec8238001ff834f37a980807847a2 Mon Sep 17 00:00:00 2001 From: Hellss Date: Mon, 12 Jul 2021 03:31:07 +0300 Subject: [PATCH 1/2] #87 --- lua/metrostroi/systems/sys_81_722_electric.lua | 2 ++ lua/metrostroi/systems/sys_81_722_pneumatic.lua | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lua/metrostroi/systems/sys_81_722_electric.lua b/lua/metrostroi/systems/sys_81_722_electric.lua index 943d893..12d3ac7 100644 --- a/lua/metrostroi/systems/sys_81_722_electric.lua +++ b/lua/metrostroi/systems/sys_81_722_electric.lua @@ -137,6 +137,8 @@ function TRAIN_SYSTEM:Think(dT) Train:WriteTrainWire(30,self.BTB*S["RU"]*C(Panel.Controller<=-1)) Panel.V4 = (S["RVnE"]*C(Train.KRO.Value~=1)+S["RU"])*Train.SF6.Value + Train:WriteTrainWire(11,Panel.V4*Train.ParkingBrake.Value) + Train:WriteTrainWire(31,Panel.V4*(1-Train.ParkingBrake.Value)) Train:WriteTrainWire(-8,BO*min(1,(S["RV"]+S["RU"]))*Train.SF7.Value) Train:WriteTrainWire(9,W[8]*(1-self.CabActive)*C(Train.VRU.Value==1)*Train.SF7.Value) diff --git a/lua/metrostroi/systems/sys_81_722_pneumatic.lua b/lua/metrostroi/systems/sys_81_722_pneumatic.lua index 97fd110..74c1429 100644 --- a/lua/metrostroi/systems/sys_81_722_pneumatic.lua +++ b/lua/metrostroi/systems/sys_81_722_pneumatic.lua @@ -42,6 +42,8 @@ function TRAIN_SYSTEM:Initialize() self.Train:LoadSystem("S1","Relay","") --Двери self.V4 = false --Включение РУ + + self.ParkingBrake = -1 self.K1 = false self.K2 = false @@ -436,10 +438,18 @@ function TRAIN_SYSTEM:Think(dT) else self:equalizePressure(dT,"BrakeCylinderPressure", 0.0, 2.00) end - if Train.BUKV.ParkingBrake==0 then - self:equalizePressure(dT,"ParkingBrakePressure", self.TrainLinePressure, 0.4,1,nil,0.5) - else + if Train:ReadTrainWire(11)*(1-Train:ReadTrainWire(31)) == 1 then + self.ParkingBrake = 1 + elseif Train:ReadTrainWire(31)*(1-Train:ReadTrainWire(11)) == 1 then + self.ParkingBrake = 0 + elseif Train:ReadTrainWire(11)+Train:ReadTrainWire(31) == 2 then + self.ParkingBrake = -1 --блокировка + end + + if self.ParkingBrake == 1 then self:equalizePressure(dT,"ParkingBrakePressure", 0, 0.4,1,nil,0.5) + elseif self.ParkingBrake == 0 then + self:equalizePressure(dT,"ParkingBrakePressure", self.TrainLinePressure, 0.4,1,nil,0.5) end Train:SetPackedRatio("ParkingBrakePressure_dPdT",self.ParkingBrakePressure_dPdT+0.02) trainLineConsumption_dPdT = trainLineConsumption_dPdT + math.max(0,self.BrakeCylinderPressure_dPdT + self.ParkingBrakePressure_dPdT) From b3e1513ebf1150a45d9931fea54f83bc653c924e Mon Sep 17 00:00:00 2001 From: Hellss Date: Mon, 8 Nov 2021 23:40:49 +0300 Subject: [PATCH 2/2] fix --- lua/metrostroi/systems/sys_81_722_bukp.lua | 1 - lua/metrostroi/systems/sys_81_722_bukv.lua | 1 - lua/metrostroi/systems/sys_81_722_pneumatic.lua | 15 +++------------ 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/lua/metrostroi/systems/sys_81_722_bukp.lua b/lua/metrostroi/systems/sys_81_722_bukp.lua index 02ce486..ba638ec 100644 --- a/lua/metrostroi/systems/sys_81_722_bukp.lua +++ b/lua/metrostroi/systems/sys_81_722_bukp.lua @@ -382,7 +382,6 @@ function TRAIN_SYSTEM:Think(dT) self:CState("CloseDoors",RR and Train.SF7.Value>0 and (Train.DoorClose.Value == 0 or (not self.CloseRing and Train.DoorClose.Value==2 or self.CloseRing and CurTime()-self.CloseRing>4))) self:CState("PassLight",Train.PassLight.Value>0) self:CState("PassVent",Train.PassVent.Value-1) - self:CState("ParkingBrake",Train.ParkingBrake.Value) if BARSPower and Train.BARS.V2 > 0 or not BARSPower and math.abs(self.Speed) < 0.5 and self.PowerCommand < 0 then self.StopV2 = true elseif self.PowerCommand > 0 then diff --git a/lua/metrostroi/systems/sys_81_722_bukv.lua b/lua/metrostroi/systems/sys_81_722_bukv.lua index 753225d..6fe93e7 100644 --- a/lua/metrostroi/systems/sys_81_722_bukv.lua +++ b/lua/metrostroi/systems/sys_81_722_bukv.lua @@ -276,7 +276,6 @@ function TRAIN_SYSTEM:Think() self.EnableMK = (not self:Get("PVU4") and self:Get("Compressor")) and 1 or 0 self.DisableTP = (self:Get("PVU5") or self:Get("PVU6")) and 1 or 0 self.DisablePant = (self:Get("DisablePant") or self:Get("PVU7")) and 1 or 0 - self.ParkingBrake = self:Get("ParkingBrake") local vent = self:Get("PassVent") or 0 if vent==1 then self.VentMode = Train.Pneumatic.WeightLoadRatio>0.6 and 2 or Train.Pneumatic.WeightLoadRatio>0.1 and 1 or 0 diff --git a/lua/metrostroi/systems/sys_81_722_pneumatic.lua b/lua/metrostroi/systems/sys_81_722_pneumatic.lua index 74c1429..11a6c3b 100644 --- a/lua/metrostroi/systems/sys_81_722_pneumatic.lua +++ b/lua/metrostroi/systems/sys_81_722_pneumatic.lua @@ -43,8 +43,6 @@ function TRAIN_SYSTEM:Initialize() self.V4 = false --Включение РУ - self.ParkingBrake = -1 - self.K1 = false self.K2 = false self.SD2 = 0 @@ -438,17 +436,10 @@ function TRAIN_SYSTEM:Think(dT) else self:equalizePressure(dT,"BrakeCylinderPressure", 0.0, 2.00) end - if Train:ReadTrainWire(11)*(1-Train:ReadTrainWire(31)) == 1 then - self.ParkingBrake = 1 - elseif Train:ReadTrainWire(31)*(1-Train:ReadTrainWire(11)) == 1 then - self.ParkingBrake = 0 - elseif Train:ReadTrainWire(11)+Train:ReadTrainWire(31) == 2 then - self.ParkingBrake = -1 --блокировка - end - - if self.ParkingBrake == 1 then + local w11, w31 = Train:ReadTrainWire(11), Train:ReadTrainWire(31) + if w11*(1-w31) > 0 then self:equalizePressure(dT,"ParkingBrakePressure", 0, 0.4,1,nil,0.5) - elseif self.ParkingBrake == 0 then + elseif w31*(1-w11) > 0 then self:equalizePressure(dT,"ParkingBrakePressure", self.TrainLinePressure, 0.4,1,nil,0.5) end Train:SetPackedRatio("ParkingBrakePressure_dPdT",self.ParkingBrakePressure_dPdT+0.02)