From 873365ae98c44aa55601103809fa36a89ad9fb01 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 03:16:49 +0300 Subject: [PATCH 01/43] =?UTF-8?q?=D0=AD=D1=82=D0=BE=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20=D0=9A=D0=A0=D0=A3=20?= =?UTF-8?q?=D0=B2=203=20=D1=80=D1=83=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/metrostroi/systems/sys_81_714_electric.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/metrostroi/systems/sys_81_714_electric.lua b/lua/metrostroi/systems/sys_81_714_electric.lua index 6723fc7..b597ac3 100644 --- a/lua/metrostroi/systems/sys_81_714_electric.lua +++ b/lua/metrostroi/systems/sys_81_714_electric.lua @@ -78,6 +78,7 @@ function TRAIN_SYSTEM:SolveAllInternalCircuits(Train,dT,firstIter) if isMVM then Train:WriteTrainWire(71,S["33D"]*Train.OtklBV.Value) end + Train.RPvozvrat.VozRpPressed = T[17]~=0 --Вагонная часть S["10A"] = BO*Train.A30.Value S["ZR"] = (1-Train.RRP.Value)+(B*Train.A39.Value*(1-Train.RPvozvrat.Value)*Train.RRP.Value)*-1 From c3bfc11d52925ba6a4b2eeb1adcbc86d9272b204 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 03:18:17 +0300 Subject: [PATCH 02/43] =?UTF-8?q?=D0=AD=D1=82=D0=BE=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20=D0=9A=D0=A0=D0=A3=20?= =?UTF-8?q?=D0=B2=203=20=D1=80=D1=83=D0=BA=D0=B8=20=D0=B8=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D1=81=D1=80=D0=B0=D0=B1=D0=B0=D1=82=D1=8B=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=9054=20=D0=BF=D1=80=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D0=B5=20=D1=80?= =?UTF-8?q?=D0=B5=D0=B2=D0=B5=D1=80=D1=81=D0=B0=20=D0=B2=D0=BF=D0=B5=D1=80?= =?UTF-8?q?=D0=B5=D0=B4=20=D0=B2=20=D0=BE=D0=B1=D0=B5=D0=B8=D1=85=20=D0=BA?= =?UTF-8?q?=D0=B0=D0=B1=D0=B8=D0=BD=D0=B0=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/metrostroi/systems/sys_81_717_electric.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/metrostroi/systems/sys_81_717_electric.lua b/lua/metrostroi/systems/sys_81_717_electric.lua index 7f0eafb..83b4202 100644 --- a/lua/metrostroi/systems/sys_81_717_electric.lua +++ b/lua/metrostroi/systems/sys_81_717_electric.lua @@ -88,7 +88,11 @@ function TRAIN_SYSTEM:SolveAllInternalCircuits(Train,dT,firstIter) S["F7"] = S["F"]*KV["F-F7"]+S["14b"]*KRU["11/3-FR1"] Train:WriteTrainWire(5,S["10AK"]*KV["10AK-5"] + KRU["5/3-ZM31"]*-10) - Train:WriteTrainWire(4,S["10AK"]*KV["10AK-4"] + --[[max(0,min(1,T[4])*KV["4-0"]*-10)]]KV["4-0"]*-10) + Train:WriteTrainWire(4,S["10AK"]*KV["10AK-4"]) --[[max(0,min(1,T[4])*KV["4-0"]*-10)KV["4-0"]*-10]] + if T[4]*KV["4-0"] ~= 0 then + Train.A54:TriggerInput("Set",0) + Train:WriteTrainWire(5,0) + end --Train:WriteTrainWire(4,S["10AK"]*KV["10AK-4"]*(1-T[4]*KV["4-0"]*-10)) Panel.LST = T[6]*Train.A40.Value @@ -451,6 +455,7 @@ function TRAIN_SYSTEM:SolveAllInternalCircuits(Train,dT,firstIter) Panel.L1 = T[57] end Panel.M8 = S["V2"]*Train.PVK.Value + Train.RPvozvrat.VozRpPressed = T[17]~=0 local ASNP_VV = Train.ASNP_VV ASNP_VV.Power = BO*Train.AS1.Value*Train.R_ASNPOn.Value From 5dc2b84a038605bc6f3c6179c9395d06d6c6fb27 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 03:30:27 +0300 Subject: [PATCH 03/43] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D1=81=D0=B8=D0=BC=D1=83=D0=BB=D1=8F=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=87=D0=B5=D0=B9=20?= =?UTF-8?q?=D0=BA=D0=B0=D0=BC=D0=B5=D1=80=D1=8B=20=D0=92=D0=A0=20337.004?= =?UTF-8?q?=20=D0=B8=20=D0=9A=D0=9B=D0=A1=D0=97.=20=D0=A0=D0=B0=D0=BD?= =?UTF-8?q?=D0=B4=D0=BE=D0=BC=D0=B8=D0=B7=D0=B8=D1=80=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=BE=20=D1=80=D0=B5=D0=B3=D1=83=D0=BB=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=BE=D1=87=D0=BD=D0=BE=D0=B5=20=D0=B4=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=9A=D0=9C=20=D0=B2=D0=BE=202=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8=D0=B8=20=D0=B2?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B0=D1=85=20=D0=BD?= =?UTF-8?q?=D0=BE=D1=80=D0=BC=20=D0=B4=D0=BE=D0=BF=D1=83=D1=81=D0=BA=D0=BE?= =?UTF-8?q?=D0=B2.=20=D0=A2=D0=BE=20=D0=B6=D0=B5=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=BD=D0=BE=D1=80=D0=BC=D1=8B=20=D0=B4=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=B2=20=D0=A2=D0=A6=20=D0=BE=D1=82=20?= =?UTF-8?q?=D0=9F=D0=A1=D0=A2=20=D0=BD=D0=B0=20=D0=B3=D0=BE=D0=BB=D0=BE?= =?UTF-8?q?=D0=B2=D0=BD=D1=8B=D1=85=20=D0=B8=20=D0=BF=D1=80=D0=BE=D0=BC?= =?UTF-8?q?=D0=B5=D0=B6=D1=83=D1=82=D0=BE=D1=87=D0=BD=D1=8B=D1=85=20=D0=B2?= =?UTF-8?q?=D0=B0=D0=B3=D0=BE=D0=BD=D0=B0=D1=85,=20=D0=BE=D1=82=20=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D0=B2=D1=8B=D1=85=20=D0=B8=20=D0=B2=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D1=8B=D1=85=20=D0=B2=D0=B5=D0=BD=D1=82=D0=B8=D0=BB=D0=B5?= =?UTF-8?q?=D0=B9=20=D0=B7=D0=B0=D0=BC=D0=B5=D1=89=D0=B5=D0=BD=D0=B8=D1=8F?= =?UTF-8?q?.=20=D0=9E=D1=82=D1=80=D0=B5=D0=B3=D1=83=D0=BB=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D1=8B=20=D1=82=D0=B5=D0=BC=D0=BF=D1=8B?= =?UTF-8?q?=20=D0=B7=D0=B0=D1=80=D1=8F=D0=B4=D0=BA=D0=B8=20=D0=A2=D0=9C=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=B8=20=D0=BF=D0=BE=D1=81=D0=B0=D0=B4=D0=BA?= =?UTF-8?q?=D0=B8=20=D1=81=D1=80=D1=8B=D0=B2=D0=BD=D0=BE=D0=B3=D0=BE=20?= =?UTF-8?q?=D0=BA=D0=BB=D0=B0=D0=BF=D0=B0=D0=BD=D0=B0,=20=D0=B8=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=B1=D0=BE=D0=BB=D0=B5=D0=B5=20=D1=80=D0=B5?= =?UTF-8?q?=D0=B0=D0=BB=D0=B8=D1=81=D1=82=D0=B8=D1=87=D0=BD=D0=BE=D0=B9=20?= =?UTF-8?q?=D1=81=D0=BA=D0=BE=D1=80=D0=BE=D1=81=D1=82=D0=B8=20=D0=B7=D0=B0?= =?UTF-8?q?=D1=80=D1=8F=D0=B4=D0=BA=D0=B8-=D1=80=D0=B0=D0=B7=D1=80=D1=8F?= =?UTF-8?q?=D0=B4=D0=BA=D0=B8=20=D0=A2=D0=9C=20=D0=B8=20=D0=A2=D0=A6.=20?= =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=B2?= =?UTF-8?q?=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20?= =?UTF-8?q?=D1=81=D1=80=D1=8B=D0=B2=D0=B0=D1=82=D1=8C=20=D1=81=D1=80=D1=8B?= =?UTF-8?q?=D0=B2=D0=BD=D0=BE=D0=B9=20=D0=BA=D0=BB=D0=B0=D0=BF=D0=B0=D0=BD?= =?UTF-8?q?.=20=D0=9E=D1=82=D1=80=D0=B5=D0=B3=D1=83=D0=BB=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=20=D1=82=D0=B5=D0=BC=D0=BF=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B7=D1=80=D1=8F=D0=B4=D0=BA=D0=B8=20=D0=9D=D0=9C=20?= =?UTF-8?q?=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20=D0=BF=D1=80=D0=B5=D0=B4=D0=BE?= =?UTF-8?q?=D1=85=D1=80=D0=B0=D0=BD=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D1=8B=D0=B9=20=D0=BA=D0=BB=D0=B0=D0=BF=D0=B0=D0=BD=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=B1=D0=BE=D0=BB=D0=B5=D0=B5=20=D1=80=D0=B5?= =?UTF-8?q?=D0=B0=D0=BB=D0=B8=D1=81=D1=82=D0=B8=D1=87=D0=BD=D0=BE=D0=B3?= =?UTF-8?q?=D0=BE=20=D0=BF=D0=BE=D0=B2=D0=B5=D0=B4=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../systems/sys_81_717_pneumatic.lua | 125 ++++++++++++------ 1 file changed, 87 insertions(+), 38 deletions(-) diff --git a/lua/metrostroi/systems/sys_81_717_pneumatic.lua b/lua/metrostroi/systems/sys_81_717_pneumatic.lua index da7ff08..307ccd2 100644 --- a/lua/metrostroi/systems/sys_81_717_pneumatic.lua +++ b/lua/metrostroi/systems/sys_81_717_pneumatic.lua @@ -43,6 +43,14 @@ function TRAIN_SYSTEM:Initialize(parameters) self.OldBrakeLinePressure = 0.0 self.BCPressure = 0 + -- Air distrubutor part + self.WorkingChamberPressure = 0.0 + self.AirDistributorReady = false + self.OverchargeReleaseValve = false + self.WCChargeValve = true + self.PN1 = 0 + self.PN2 = 0 + --DKPT self.Train:LoadSystem("DKPT","Relay","R-52B") -- -- Valve #1 @@ -73,8 +81,11 @@ function TRAIN_SYSTEM:Initialize(parameters) self.Train:LoadSystem("EmergencyBrakeValve","Relay","Switch") -- Воздухораспределитель self.Train:LoadSystem("AirDistributorDisconnect","Relay","Switch") + --Срывной клапан + self.Train:LoadSystem("AutostopValve","Relay","Switch") --УАВА self.Train:LoadSystem("UAVA","Relay","Switch",{ bass = true}) + --self.Train:LoadSystem("UAVAContact","Relay","Switch") self.Train:LoadSystem("UAVAC","Relay","",{normally_closed=true,bass=true}) --Стояночный тормоз self.Train:LoadSystem("ParkingBrake","Relay","Switch",{bass = true}) @@ -141,7 +152,7 @@ end function TRAIN_SYSTEM:Outputs() return { "BrakeLinePressure", "BrakeCylinderPressure", "DriverValvePosition", - "ReservoirPressure", "TrainLinePressure", "DoorLinePressure", "WeightLoadRatio" } + "ReservoirPressure", "TrainLinePressure", "DoorLinePressure", "WeightLoadRatio", "WorkingChamberPressure" } end function TRAIN_SYSTEM:TriggerInput(name,value) @@ -304,9 +315,12 @@ function TRAIN_SYSTEM:Think(dT) self.ReservoirPressure_dPdT = 0.0 self.BrakeCylinderPressure_dPdT = 0.0 self.ParkingBrakePressure_dPdT = 0.0 + self.WorkingChamberPressure_dPdT = 0.0 + + self.KM013offset = self.KM013offset or math.random()*0.2 + 5.0 --регулировочное давление -- Reduce pressure for brake line - self.TrainToBrakeReducedPressure = math.min(5.1,self.TrainLinePressure) -- * 0.725) + self.TrainToBrakeReducedPressure = math.min(self.KM013offset,self.TrainLinePressure) -- * 0.725) -- Feed pressure to door line self.DoorLinePressure = self.TrainToBrakeReducedPressure * 0.90 local trainLineConsumption_dPdT = 0.0 @@ -314,6 +328,12 @@ function TRAIN_SYSTEM:Think(dT) local HaveEPK = not Train.SubwayTrain or not Train.SubwayTrain.ARS or not Train.SubwayTrain.ARS.NoEPK local BLDisconnect,pr_speed = true,1 + ---[[ работа срывного клапана + if Train.AutostopValve.Value ~= 0 then + if self.BrakeLinePressure > 1.86 then self:TriggerInput("Autostop",1) end + Train.AutostopValve.Value = 0 + end--]] + if self.ValveType == 1 then BLDisconnect = Train.DriverValveBLDisconnect.Value > 0 local TLDisconnect = Train.DriverValveTLDisconnect.Value > 0 @@ -366,42 +386,42 @@ function TRAIN_SYSTEM:Think(dT) trainLineConsumption_dPdT = trainLineConsumption_dPdT + math.max(0,self.ReservoirPressure_dPdT)*0.05 else pr_speed = 1.25*wagc --2 - if self.Leak or self.BraieLineOpen then pr_speed = pr_speed*0.7 end + if self.Leak or self.BrakeLineOpen then pr_speed = pr_speed*0.7 end BLDisconnect = self.DisconnectType and Train.DriverValveBLDisconnect.Value > 0 or Train.DriverValveDisconnect.Value > 0 local TLDisconnect = self.DisconnectType and Train.DriverValveTLDisconnect.Value > 0 or Train.DriverValveDisconnect.Value > 0 -- 013: 1 Overcharge if (self.RealDriverValvePosition == 1) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > self.TrainLinePressure) then - self:equalizePressure(dT,"BrakeLinePressure", math.min(6.0,self.TrainLinePressure), pr_speed) + self:equalizePressure(dT,"BrakeLinePressure", math.min(6.4,self.TrainLinePressure), pr_speed,pr_speed*0.35, nil, 1.0) end -- 013: 2 Normal pressure - if (self.RealDriverValvePosition == 2) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > 1.01*math.min(5.1,self.TrainToBrakeReducedPressure)) then - self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(5.1,self.TrainToBrakeReducedPressure), pr_speed,nil, nil, 1.0)-- nil, 1.0) + if (self.RealDriverValvePosition == 2) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > 1.01*math.min(self.KM013offset,self.TrainToBrakeReducedPressure)) then + self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(self.KM013offset,self.TrainToBrakeReducedPressure), pr_speed,pr_speed*0.35, nil, 1.0)-- nil, 1.0) end -- 013: 3 4.3 Atm if (self.RealDriverValvePosition == 3) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > 1.01*math.min(4.3,self.TrainToBrakeReducedPressure)) then - self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(4.3,self.TrainToBrakeReducedPressure), pr_speed,nil, nil, 1.0) + self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(4.3,self.TrainToBrakeReducedPressure), pr_speed,pr_speed*0.35, nil, 1.0) end -- 013: 4 4.0 Atm if (self.RealDriverValvePosition == 4) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > 1.01*math.min(4.0,self.TrainToBrakeReducedPressure)) then - self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(4.0,self.TrainToBrakeReducedPressure), pr_speed,nil, nil, 1.0) + self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(4.0,self.TrainToBrakeReducedPressure), pr_speed,pr_speed*0.35, nil, 1.0) end -- 013: 5 3.7 Atm if (self.RealDriverValvePosition == 5) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > 1.01*math.min(3.7,self.TrainToBrakeReducedPressure)) then - self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(3.7,self.TrainToBrakeReducedPressure), pr_speed,nil, nil, 1.0) + self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(3.7,self.TrainToBrakeReducedPressure), pr_speed,pr_speed*0.35, nil, 1.0) end -- 013: 6 3.0 Atm if (self.RealDriverValvePosition == 6) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > 1.01*math.min(3.0,self.TrainToBrakeReducedPressure)) then - self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(3.0,self.TrainToBrakeReducedPressure), pr_speed,nil, nil, 1.0) + self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(3.0,self.TrainToBrakeReducedPressure), pr_speed,pr_speed*0.35, nil, 1.0) end -- 013: 7 0.0 Atm - if (self.RealDriverValvePosition == 7) and BLDisconnect then - self:equalizePressure(dT,"BrakeLinePressure", 0.0, pr_speed) + if (self.RealDriverValvePosition == 7) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > 0.0) then + self:equalizePressure(dT,"BrakeLinePressure", 0.0, 0.6 + pr_speed*math.exp(math.min(0,self.BrakeLinePressure - 2.8)*1.0),pr_speed*0.35, nil, 1.0) end trainLineConsumption_dPdT = trainLineConsumption_dPdT + math.max(0,self.BrakeLinePressure_dPdT) end @@ -436,22 +456,22 @@ function TRAIN_SYSTEM:Think(dT) else Train:SetPackedRatio("Crane_dPdT", self.BrakeLinePressure_dPdT/wagc*3 ) end - if self.EmergencyValveDisable and (self.BrakeLinePressure-self.OldBrakeLinePressure)>0.01 then + if self.EmergencyValveDisable then--and (self.BrakeLinePressure-self.OldBrakeLinePressure)>0.01 then self.EmergencyValveDisable=false self.EmergencyValve=false end self.OldBrakeLinePressure = self.BrakeLinePressure local leak = 0 if self.EmergencyValve then - local leakst = 1.1*(Train:GetWagonCount())*math.Clamp(self.BrakeLinePressure/4,0,1) - leak = self:equalizePressure(dT,"BrakeLinePressure", 0.0,leakst*2,false,false,0.4) - if (leak >= -0.2*(Train:GetWagonCount()) or Train.UAVA.Value > 0) then + local leakst = BLDisconnect and math.max(0.3,math.log(80*self.BrakeLinePressure - 200,3)) or 1.1*(Train:GetWagonCount())*math.Clamp(self.BrakeLinePressure/4,0,1) + leak = self:equalizePressure(dT,"BrakeLinePressure", 0.0,leakst)--,false,false,10) + if (self.BrakeLinePressure < 1.82 or Train.UAVA.Value > 0) then self.EmergencyValveDisable = true end self.Leak = true end - local UAVABlocked = (self.BrakeLinePressure>3.5 and Train.UAVA.Value==0) + local UAVABlocked = (self.BrakeLinePressure>1.8 and Train.UAVA.Value==0) if (Train.UAVA.Blocked>0) ~= UAVABlocked then Train.UAVA:TriggerInput("Block",UAVABlocked and 1 or 0) end @@ -461,48 +481,75 @@ function TRAIN_SYSTEM:Think(dT) Train.UAVAC:TriggerInput("Block",UAVACBlocked and 1 or 0) end - Train:SetPackedRatio("EmergencyValve_dPdT", -leak/wagc) + Train:SetPackedRatio("EmergencyValve_dPdT", -1.8*leak/wagc) --Регулировка свиста срывного клапана local leak = 0 if Train.EmergencyBrakeValve and Train.EmergencyBrakeValve.Value > 0.5 then --local leakst = (1.6*(Train:GetWagonCount())*(self.BrakeLinePressure-math.min(2.5,self.TrainToBrakeReducedPressure))*0.9) - leak = self:equalizePressure(dT,"BrakeLinePressure", 0.0,(1.1*wagc)*2,false,false,0.4) + leak = self:equalizePressure(dT,"BrakeLinePressure", 0.0,(1.1*wagc)*2,false,false,1) self.Leak = true end Train:SetPackedRatio("EmergencyBrakeValve_dPdT", -leak/wagc) + --[[ + ---------------debug--------------------- + self.dlreadtimer = self.dlreadtimer or CurTime() + if CurTime() - self.dlreadtimer > 1.0 then + self.dlreadtimer = CurTime() + if Train:GetWagonNumber() == 8530 then + PrintMessage(HUD_PRINTTALK, Format("Вагон %u; ТМ dPdT = %.3f; Раб. кам. = %.3f",Train:GetWagonNumber(),self.BrakeLinePressure_dPdT,self.WorkingChamberPressure)) + end + end + ---------------debug---------------------]] + + ---------------------------------------------------------------------------- -- Fill brake cylinders - if Train.AirDistributorDisconnect.Value == 0 then + if self.WCChargeValve == true then + self:equalizePressure(dT,"WorkingChamberPressure",self.BrakeLinePressure,0.187,nil,nil,1.0) --simulate 0.8mm hole btw BL and working chambers + end + self.AirDistributorReady = self.WorkingChamberPressure >= 2.2 + self.WCChargeValve = not ((self.WorkingChamberPressure - self.BrakeLinePressure) > 0.2 and (self.WorkingChamberPressure - self.BrakeLinePressure) < 2.5) + self.OverchargeReleaseValve = self.WorkingChamberPressure > 5.2 and not self.WCChargeValve + if self.OverchargeReleaseValve then + self:equalizePressure(dT,"WorkingChamberPressure",0.0,0.32) -- КЛСЗ + end + + --trainLineConsumption_dPdT = trainLineConsumption_dPdT + math.max(0,self.WorkingChamberPressure_dPdT*0.2) + local _offset2 = self.Train.AR63 and 2.5 or 2.4 + self.GN2Offset = self.GN2Offset or math.random(20,100)*0.002 + _offset2 + local _offset1 = self.Train.AR63 and 0.9 or 0.8 + self.GN1Offset = self.GN1Offset or math.random(20,100)*0.002 + _offset1 + local _vz1pressure = self.GN1Offset + self.WeightLoadRatio*0.7 + self.BcBl = self.BcBl or self.GN2Offset/(self.KM013offset - 3.24) + if Train.AirDistributorDisconnect.Value == 0 and self.AirDistributorReady then -- Valve #1 - self.BrakeCylinderRegulationError = self.BrakeCylinderRegulationError or (math.random()*0.05 - 0.025) - local error = self.BrakeCylinderRegulationError if (Train.PneumaticNo1.Value == 1.0) and (Train.PneumaticNo2.Value == 0.0) then - if self.PN1 == 0 then + if self.PN1 < _vz1pressure then --1,2 - self.PN1 = math.min(self.TrainLinePressure,(1.1 + error + self.WeightLoadRatio*0.6)) + self.PN1 = math.min(self.TrainLinePressure,_vz1pressure) end - elseif self.PN1 ~= 0 then - self.PN1 = 0 + else + self.PN1 = math.max(0,self.PN1-math.exp(3.6*(self.BrakeCylinderPressure - self.GN1Offset))*0.12) end -- Valve #2 if Train.PneumaticNo2.Value == 1.0 then - if self.PN2 == 0 then - self.PN2 = math.min(self.TrainLinePressure,(2.7 + error + self.WeightLoadRatio*1.3)) + self.PN2 = math.min(self.TrainLinePressure,(self.GN2Offset + self.WeightLoadRatio*1.3)) if self.BePN2 == false and self.BrakeCylinderPressure > 1.6 then Train:PlayOnce("PN2end","stop") end self.BePN2 = true - end - elseif self.PN2 ~= 0 then - self.PN2 = 0 + else + self.PN2 = math.max(0,self.PN2-math.exp(1.2*(self.BrakeCylinderPressure - self.GN2Offset))*0.2) end - local targetPres = math.max(0,math.min(5.2,--[[ 1.5--]] 1.35*(math.min(5.1,self.TrainToBrakeReducedPressure) - self.BrakeLinePressure))) - if self.BCPressure < targetPres then + local targetPres = math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - (self.BrakeLinePressure < 3.6 and self.BrakeLinePressure*self.WorkingChamberPressure/6.5 or self.BrakeLinePressure*1.028))) + (self.BrakeLinePressure_dPdT < 0 and self.WeightLoadRatio*1.3 or 0)) + --local targetPres = math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - (self.BrakeLinePressure < 3.56 and (self.BrakeLinePressure - 3)*5.56 or self.BrakeLinePressure*1.028)) + (self.BrakeLinePressure_dPdT < 0 and self.WeightLoadRatio*1.3 or 0))) + --[[if self.BCPressure < targetPres then self.BCPressure = math.min(targetPres,self.BCPressure+(0.5+math.max(0,(targetPres-self.BCPressure)-0.2)*0.6)*dT) elseif self.BCPressure > targetPres then self.BCPressure = math.max(targetPres,self.BCPressure-2*dT) - end - local targetPressure = self.PN1+self.PN2+self.BCPressure + end--]] + --local targetPressure = self.PN1+self.PN2+self.BCPressure + local targetPressure = self.PN1+self.PN2+targetPres if math.abs(self.BrakeCylinderPressure - targetPressure) > 0.150 then self.BrakeCylinderValve = 1 end @@ -510,11 +557,13 @@ function TRAIN_SYSTEM:Think(dT) self.BrakeCylinderValve = 0 end if self.BrakeCylinderValve == 1 then - self:equalizePressure(dT,"BrakeCylinderPressure", math.min(2.7 + self.WeightLoadRatio*1.3,targetPressure), 1+math.Clamp((self.BrakeCylinderPressure-0.5)/2.8,0,0.7), 3.50, nil, 0.8+math.Clamp((self.BrakeCylinderPressure-0.75)/0.6,0,1)) --0.75, 1.25) + self:equalizePressure(dT,"BrakeCylinderPressure", math.min(self.GN2Offset + self.WeightLoadRatio*1.3,targetPressure), 1, (self.BrakeLinePressure > (self.KM013offset+0.1)) and (self.PN2 == 0) and (self.PN1 == 0) and 1.0 or 3.5, nil, (self.BrakeLinePressure_dPdT > 0.1) and (0.8+math.Clamp((1 - self.BrakeCylinderPressure)*0.8,0,1.2)) or 1) + --self:equalizePressure(dT,"BrakeCylinderPressure", math.min(self.GN2Offset + self.WeightLoadRatio*1.3,targetPressure), 0.5+math.Clamp((self.BrakeCylinderPressure-0.5)/2.8,0,0.9), (self.BrakeLinePressure > (self.KM013offset+0.1)) and (self.PN2 == 0) and (self.PN1 == 0) and 0.8 or 3.5, nil, (self.BrakeLinePressure_dPdT > 0.1) and (0.8+math.Clamp((1 - self.BrakeCylinderPressure)*0.8,0,1)) or 1) end trainLineConsumption_dPdT = trainLineConsumption_dPdT + math.max(0,self.BrakeCylinderPressure_dPdT*0.5) - else + elseif Train.AirDistributorDisconnect.Value ~= 0 then self:equalizePressure(dT,"BrakeCylinderPressure", 0.0, 2.00) + self:equalizePressure(dT,"WorkingChamberPressure", 0.0, 2.00) --имитируем потягивание за тросик отпускного клапана end if (self.BrakeCylinderPressure > 0.2 and self.BrakeCylinderPressure_dPdT > 0.1 or self.BrakeCylinderPressure_dPdT > 1) and not self.BrakeEngaged then self.BrakeEngaged = true @@ -560,7 +609,7 @@ function TRAIN_SYSTEM:Think(dT) -- Overpressure if self.TrainLinePressure > 9.2 then self.TrainLineOverpressureValve = 1 end if self.TrainLineOverpressureValve == 1 then - self:equalizePressure(dT,"TrainLinePressure", 0.0, 0.2) + self:equalizePressure(dT,"TrainLinePressure", 0.0, (self.TrainLinePressure-(self.Compressor == 1 and 6.5 or 4))*0.6) --was 0.2 self.TrainLineOpen = true if self.TrainLinePressure < 5.2 then self.TrainLineOverpressureValve = 0 end end From ba46473cb714e44fb25a7a0bc344671e4ac2ed2c Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 03:31:10 +0300 Subject: [PATCH 04/43] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BF=D1=83=D1=81=D1=82=D1=83=D1=8E=20=D1=81=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/metrostroi/systems/sys_als_ars_bis200a.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/metrostroi/systems/sys_als_ars_bis200a.lua b/lua/metrostroi/systems/sys_als_ars_bis200a.lua index 92a36bb..56262b6 100644 --- a/lua/metrostroi/systems/sys_als_ars_bis200a.lua +++ b/lua/metrostroi/systems/sys_als_ars_bis200a.lua @@ -57,7 +57,6 @@ end function TRAIN_SYSTEM:Think(dT) local Train = self.Train local speed = Train.ALSCoil.Speed - --vv При торможении смещение на 2км\ч vv ----[[ if true or self.SpeedDec then From 45686155336442047702e945eb8a21ba2ddf3dca Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 12:47:23 +0300 Subject: [PATCH 05/43] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=B4=D0=BB=D1=8F=20=D0=9A=D0=A0=D0=A3=20?= =?UTF-8?q?=D0=B2=203=20=D1=80=D1=83=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/metrostroi/systems/sys_yar_13b.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lua/metrostroi/systems/sys_yar_13b.lua b/lua/metrostroi/systems/sys_yar_13b.lua index d209f6e..82da9b9 100644 --- a/lua/metrostroi/systems/sys_yar_13b.lua +++ b/lua/metrostroi/systems/sys_yar_13b.lua @@ -30,6 +30,7 @@ function TRAIN_SYSTEM:Initialize() latched = true, -- RPvozvrat latches into place power_open = "None", -- Power source for the open signal power_close = "Mechanical", -- Power source for the close signal + VozRpPressed = false, -- Added to override the blocking action of the energized RP relays on RPVozvrat }) -- Реле времени РВ1 @@ -93,13 +94,13 @@ function TRAIN_SYSTEM:Think() end --self.RUTTarget = 250 + 150*self.Train.Pneumatic.WeightLoadRatio -- RPvozvrat operation - Train.RPvozvrat:TriggerInput("Close", - (Train.DR1.Value == 1.0) or + Train.RPvozvrat:TriggerInput("Close", not Train.RPvozvrat.VozRpPressed and + ((Train.DR1.Value == 1.0) or (Train.DR2.Value == 1.0) or (Train.RPL.Value == 1.0) or (Train.RP1_3.Value == 1.0) or (Train.RP2_4.Value == 1.0) or (Train.RZ_1.Value == 1.0) or (Train.RZ_2.Value == 1.0) or - (Train.RZ_3.Value == 1.0)) + (Train.RZ_3.Value == 1.0))) end From c7071e9467e5f41d316df55a759922b71b234c98 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 12:49:49 +0300 Subject: [PATCH 06/43] =?UTF-8?q?=D0=98=D0=B7-=D0=B7=D0=B0=20=D0=B8=D0=B7?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=B2=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82=D0=B5=20=D0=BF=D0=BD=D0=B5=D0=B2=D0=BC?= =?UTF-8?q?=D0=B0=D1=82=D0=B8=D0=BA=D0=B8=20=D0=BF=D1=80=D0=B8=D1=88=D0=BB?= =?UTF-8?q?=D0=BE=D1=81=D1=8C=20=D1=83=D0=B2=D0=B5=D0=BB=D0=B8=D1=87=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=B7=D0=B0=D0=B4=D0=B5=D1=80=D0=B6=D0=BA=D1=83?= =?UTF-8?q?=20=D0=BD=D0=B0=20=D1=80=D0=B0=D0=B7=D0=BC=D1=8B=D0=BA=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=80=D0=B5=D0=BB=D0=B5-=D0=BF=D0=BE?= =?UTF-8?q?=D0=B2=D1=82=D0=BE=D1=80=D0=B8=D1=82=D0=B5=D0=BB=D1=8F,=20?= =?UTF-8?q?=D1=82=D0=B0=D0=BA=20=D0=BA=D0=B0=D0=BA=20=D0=B1=D0=B5=D0=B7=20?= =?UTF-8?q?=D0=BD=D0=B5=D0=B5=20=D0=B2=20=D0=BA=D0=BE=D0=BD=D1=86=D0=B5=20?= =?UTF-8?q?=D1=8D=D0=BB=D0=B5=D0=BA=D1=82=D1=80=D0=B8=D1=87=D0=B5=D1=81?= =?UTF-8?q?=D0=BA=D0=BE=D0=B3=D0=BE=20=D1=82=D0=BE=D1=80=D0=BC=D0=BE=D0=B6?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B8=D1=85=D0=BE=D0=B4?= =?UTF-8?q?=D1=8F=D1=82=20=D0=B2=D1=82=D0=BE=D1=80=D1=8B=D0=B5=20=D0=B2?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=D0=B8=D0=BB=D1=8F=20(=D0=A0=D0=923=20=D0=BD?= =?UTF-8?q?=D0=B5=20=D1=83=D1=81=D0=BF=D0=B5=D0=B2=D0=B0=D0=B5=D1=82=20?= =?UTF-8?q?=D0=B2=D0=BA=D0=BB=D1=8E=D1=87=D0=B8=D1=82=D1=8C=D1=81=D1=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/metrostroi/systems/sys_yar_27.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/metrostroi/systems/sys_yar_27.lua b/lua/metrostroi/systems/sys_yar_27.lua index 7cf39fe..198f659 100644 --- a/lua/metrostroi/systems/sys_yar_27.lua +++ b/lua/metrostroi/systems/sys_yar_27.lua @@ -15,7 +15,7 @@ function TRAIN_SYSTEM:Initialize(parameters) self.Train:LoadSystem("RV3","Relay","REV-813T",{ open_time = 2.3 }) -- Реле тока (РТ2) self.Train:LoadSystem("RT2","Relay","REV-830",{ trigger_level = 130 }) -- A - self.Train:LoadSystem("RT2r","Relay","REV-830",{ close_time = 0, open_time = 0.2 }) --UNREALISTIC Repeater for RT2 for MSK trains + self.Train:LoadSystem("RT2r","Relay","REV-830",{ close_time = 0, open_time = 0.6 }) --UNREALISTIC Repeater for RT2 for MSK trains -- Реле контроля тормозного тока (РКТТ) self.Train:LoadSystem("RKTT","Relay","R-52B") self.Train.RKTTsh = 1 From 7f7e4f088be78b5c1d74690b7f55fbdbb68c44a8 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 12:52:02 +0300 Subject: [PATCH 07/43] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=81=D1=80=D1=8B=D0=B2=D0=BD=D0=BE=D0=B9=20=D0=BA?= =?UTF-8?q?=D0=BB=D0=B0=D0=BF=D0=B0=D0=BD=20=D0=B8=20=D1=83=D0=B2=D0=B5?= =?UTF-8?q?=D0=BB=D0=B8=D1=87=D0=B8=D0=BB=20=D0=B3=D1=80=D0=BE=D0=BC=D0=BA?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D1=8C=20=D1=88=D0=B8=D0=BF=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=B2=D0=BE=D0=B7=D0=B4=D1=83=D1=85=D0=B0=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=20=D0=BE=D1=82=D0=BF=D1=83=D1=81=D0=BA=D0=B5=20?= =?UTF-8?q?=D0=B2=D0=B5=D0=BD=D1=82=D0=B8=D0=BB=D0=B5=D0=B9=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=BC=D0=B5=D1=89=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gmod_subway_81-717_mvm/cl_init.lua | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lua/entities/gmod_subway_81-717_mvm/cl_init.lua b/lua/entities/gmod_subway_81-717_mvm/cl_init.lua index ed390f8..a8c9629 100644 --- a/lua/entities/gmod_subway_81-717_mvm/cl_init.lua +++ b/lua/entities/gmod_subway_81-717_mvm/cl_init.lua @@ -2087,6 +2087,21 @@ ENT.ButtonMap["AirDistributor"] = { } } +ENT.ButtonMap["AutostopValve"] = { + pos = Vector(365.8,-67.6,-56), + ang = Angle(0,0,90), + width = 130, + height = 40, + scale = 0.1, + hideseat=0.1, + hide=true, + screenHide = true, + + buttons = { + {ID = "AutostopValveToggle",x=0,y=0,w= 130,h = 40,tooltip="Сорвать срывной клапан"}, + } +} + for i=0,4 do ENT.ClientProps["TrainNumberL"..i] = { model = "models/metrostroi_train/common/bort_numbers.mdl", @@ -3190,8 +3205,8 @@ function ENT:Think() --self:SetSoundState("rolling_medium1",0 or rol40*rollings,rol40p) --57 self:SetSoundState("rolling_high2" ,rol70*rollings,rol70p) --70 - self.ReleasedPdT = math.Clamp(self.ReleasedPdT + 2*(-self:GetPackedRatio("BrakeCylinderPressure_dPdT",0)-self.ReleasedPdT)*dT,0,1) - local release1 = math.Clamp((self.ReleasedPdT-0.1)/0.8,0,1)^2 + self.ReleasedPdT = math.Clamp(self.ReleasedPdT + 2*(-self:GetPackedRatio("BrakeCylinderPressure_dPdT",0)-0.8*self.ReleasedPdT)*dT,0,1) + local release1 = math.Clamp((1.1*self.ReleasedPdT-0.1)/0.32,0,8)^2 self:SetSoundState("release1",release1,1) self:SetSoundState("release2",(math.Clamp(0.3-release1,0,0.3)/0.3)*(release1/0.3),1.0) local parking_brake = self:GetPackedRatio("ParkingBrakePressure_dPdT",0) @@ -3409,6 +3424,9 @@ function ENT:DrawPost() self:DrawOnPanel("AirDistributor",function() draw.DrawText(self:GetNW2Bool("AD") and "Air Distributor ON" or "Air Distributor OFF","Trebuchet24",0,0,Color(0,0,0,255)) end) + self:DrawOnPanel("AutostopValve",function() + draw.DrawText("Autostop Valve", "Trebuchet24",0,6,Color(0,0,0,255)) + end) end function ENT:OnButtonPressed(button) From 45586209143e6d7c511020ef9010e664cce3d5a6 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 12:52:28 +0300 Subject: [PATCH 08/43] =?UTF-8?q?=D0=94=D0=BB=D1=8F=20=D1=81=D1=80=D1=8B?= =?UTF-8?q?=D0=B2=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BA=D0=BB=D0=B0=D0=BF=D0=B0?= =?UTF-8?q?=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/entities/gmod_subway_81-717_mvm/init.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/entities/gmod_subway_81-717_mvm/init.lua b/lua/entities/gmod_subway_81-717_mvm/init.lua index 09fc955..241a84b 100644 --- a/lua/entities/gmod_subway_81-717_mvm/init.lua +++ b/lua/entities/gmod_subway_81-717_mvm/init.lua @@ -200,6 +200,10 @@ function ENT:Initialize() ID = "AirDistributorDisconnectToggle", Pos = Vector(-177, -66, -50), Radius = 20, }, + { + ID = "AutostopValveToggle", + Pos = Vector(377, -66, -50), Radius = 20, + }, } local vX = Angle(0,-90-0.2,56.3):Forward() -- For ARS panel From 6071b4913b510bc77176db070ad31d10870c9e23 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 12:53:20 +0300 Subject: [PATCH 09/43] =?UTF-8?q?=D0=9D=D0=B5=D0=BE=D0=B1=D1=85=D0=BE?= =?UTF-8?q?=D0=B4=D0=B8=D0=BC=D1=8B=D0=B5=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B4=D0=BB=D1=8F=20=D0=B8=D0=BD?= =?UTF-8?q?=D0=B8=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D0=B8=20=D0=B4=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=B2=20=D1=80=D0=B0=D0=B1=D0=BE=D1=87=D0=B5=D0=B9=20=D0=BA?= =?UTF-8?q?=D0=B0=D0=BC=D0=B5=D1=80=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/entities/gmod_subway_81-717_mvm/shared.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/entities/gmod_subway_81-717_mvm/shared.lua b/lua/entities/gmod_subway_81-717_mvm/shared.lua index a9320e2..0446e8b 100644 --- a/lua/entities/gmod_subway_81-717_mvm/shared.lua +++ b/lua/entities/gmod_subway_81-717_mvm/shared.lua @@ -972,7 +972,7 @@ ENT.Spawner = { ent.ARS:TriggerInput("Set",(ent.Plombs.RC1 and val==1 and first) and 1 or 0) ent.ALS:TriggerInput("Set",val==1 and 1 or 0) ent.L_1:TriggerInput("Set",val==1 and 1 or 0) - ent.L_3:TriggerInput("Set",vall==1 and 1 or 0) + ent.L_3:TriggerInput("Set",val==1 and 1 or 0) ent.L_4:TriggerInput("Set",val==1 and 1 or 0) ent.EPK:TriggerInput("Set",(ent.Plombs.RC1 and val==1) and 1 or 0) _LastSpawner=CurTime() @@ -993,6 +993,7 @@ ENT.Spawner = { ent._SpawnerStarted = val end ent.Pneumatic.TrainLinePressure = val==3 and math.random()*4 or val==2 and 4.5+math.random()*3 or 7.6+math.random()*0.6 + ent.Pneumatic.WorkingChamberPressure = val==3 and math.random()*1.0 or val==2 and 4.0+math.random()*1.0 or 5.2 if val==4 then ent.Pneumatic.BrakeLinePressure = 5.2 end end}, --{"Lighter","Spawner.717.Lighter","Boolean"}, From 5f321175d1ef33df4e73cfe91f9ac1d40ab9cce1 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 13:01:08 +0300 Subject: [PATCH 10/43] =?UTF-8?q?Revert=20"=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BF=D1=83=D1=81=D1=82=D1=83=D1=8E=20=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=BE=D0=BA=D1=83"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit ba46473cb714e44fb25a7a0bc344671e4ac2ed2c. --- lua/metrostroi/systems/sys_als_ars_bis200a.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/metrostroi/systems/sys_als_ars_bis200a.lua b/lua/metrostroi/systems/sys_als_ars_bis200a.lua index 56262b6..92a36bb 100644 --- a/lua/metrostroi/systems/sys_als_ars_bis200a.lua +++ b/lua/metrostroi/systems/sys_als_ars_bis200a.lua @@ -57,6 +57,7 @@ end function TRAIN_SYSTEM:Think(dT) local Train = self.Train local speed = Train.ALSCoil.Speed + --vv При торможении смещение на 2км\ч vv ----[[ if true or self.SpeedDec then From 82f44627e7b44ce28d5146a79a4b9a3b1ddf01de Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 21:16:14 +0300 Subject: [PATCH 11/43] =?UTF-8?q?=D0=92=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6?= =?UTF-8?q?=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20=D0=B4=D0=B5=D1=80=D0=B6=D0=B0?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BF=D0=BE=20=D0=9B=D0=9A=D0=9C=20=D1=81=D0=BA?= =?UTF-8?q?=D0=BE=D0=B1=D1=83=20=D1=81=D1=80=D1=8B=D0=B2=D0=BD=D0=BE=D0=B3?= =?UTF-8?q?=D0=BE=20=D0=BA=D0=BB=D0=B0=D0=BF=D0=B0=D0=BD=D0=B0=20=D0=BE?= =?UTF-8?q?=D1=82=D1=82=D1=8F=D0=BD=D1=83=D1=82=D0=BE=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/entities/gmod_subway_81-717_mvm/cl_init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/entities/gmod_subway_81-717_mvm/cl_init.lua b/lua/entities/gmod_subway_81-717_mvm/cl_init.lua index a8c9629..3a294dc 100644 --- a/lua/entities/gmod_subway_81-717_mvm/cl_init.lua +++ b/lua/entities/gmod_subway_81-717_mvm/cl_init.lua @@ -2098,7 +2098,7 @@ ENT.ButtonMap["AutostopValve"] = { screenHide = true, buttons = { - {ID = "AutostopValveToggle",x=0,y=0,w= 130,h = 40,tooltip="Сорвать срывной клапан"}, + {ID = "AutostopValveSet",x=0,y=0,w= 130,h = 40,tooltip="Сорвать срывной клапан"}, } } From abf1e34062ca9a258b6ebd19ef62cf4f74c78efb Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 21:18:36 +0300 Subject: [PATCH 12/43] =?UTF-8?q?=D0=A3=D0=B2=D0=B5=D0=BB=D0=B8=D1=87?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=80=D0=B0=D0=B4=D0=B8=D1=83=D1=81=20=D1=88?= =?UTF-8?q?=D0=B8=D0=BF=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=9A=D0=9C=20(=D1=80?= =?UTF-8?q?=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=BC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/entities/gmod_subway_81-717_mvm/shared.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lua/entities/gmod_subway_81-717_mvm/shared.lua b/lua/entities/gmod_subway_81-717_mvm/shared.lua index 0446e8b..0fc81a8 100644 --- a/lua/entities/gmod_subway_81-717_mvm/shared.lua +++ b/lua/entities/gmod_subway_81-717_mvm/shared.lua @@ -441,11 +441,11 @@ function ENT:InitializeSounds() self.SoundPositions["rear_isolation"] = {300,1e9,Vector(-456, 0,-63),1} self.SoundNames["crane013_brake"] = {loop=true,"subway_trains/common/pneumatic/release_2.wav"} - self.SoundPositions["crane013_brake"] = {80,1e9,Vector(431.5,-20.3,-12),0.86} + self.SoundPositions["crane013_brake"] = {400,1e9,Vector(431.5,-20.3,-12),0.86} self.SoundNames["crane013_brake2"] = {loop=true,"subway_trains/common/pneumatic/013_brake2.wav"} - self.SoundPositions["crane013_brake2"] = {80,1e9,Vector(431.5,-20.3,-12),0.86} + self.SoundPositions["crane013_brake2"] = {400,1e9,Vector(431.5,-20.3,-12),0.86} self.SoundNames["crane013_brake_l"] = {loop=true,"subway_trains/common/pneumatic/013_brake_loud2.wav"} - self.SoundPositions["crane013_brake_l"] = {80,1e9,Vector(431.5,-20.3,-12),0.7} + self.SoundPositions["crane013_brake_l"] = {400,1e9,Vector(431.5,-20.3,-12),0.7} self.SoundNames["crane013_release"] = {loop=true,"subway_trains/common/pneumatic/013_release.wav"} self.SoundPositions["crane013_release"] = {80,1e9,Vector(431.5,-20.3,-12),0.4} self.SoundNames["crane334_brake_high"] = {loop=true,"subway_trains/common/pneumatic/334_brake.wav"} @@ -975,6 +975,7 @@ ENT.Spawner = { ent.L_3:TriggerInput("Set",val==1 and 1 or 0) ent.L_4:TriggerInput("Set",val==1 and 1 or 0) ent.EPK:TriggerInput("Set",(ent.Plombs.RC1 and val==1) and 1 or 0) + ent.DriverValveDisconnect:TriggerInput("Set",(val==4 and first) and 1 or 0) _LastSpawner=CurTime() ent.CabinDoor = val==4 and first ent.PassengerDoor = val==4 From 1e27ba923e7e757d696f477f44483ec753b432e2 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 21:21:11 +0300 Subject: [PATCH 13/43] =?UTF-8?q?=D0=A3=D0=B4=D0=B5=D1=80=D0=B6=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=81=D0=BA=D0=BE=D0=B1=D1=8B=20=D1=81?= =?UTF-8?q?=D1=80=D1=8B=D0=B2=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BA=D0=BB=D0=B0?= =?UTF-8?q?=D0=BF=D0=B0=D0=BD=D0=B0=20=D0=BF=D0=BE=20=D0=9B=D0=9A=D0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../systems/sys_81_717_pneumatic.lua | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/lua/metrostroi/systems/sys_81_717_pneumatic.lua b/lua/metrostroi/systems/sys_81_717_pneumatic.lua index 307ccd2..5a7538c 100644 --- a/lua/metrostroi/systems/sys_81_717_pneumatic.lua +++ b/lua/metrostroi/systems/sys_81_717_pneumatic.lua @@ -175,8 +175,13 @@ function TRAIN_SYSTEM:TriggerInput(name,value) local HaveUAVA = not self.Train.SubwayTrain or not self.Train.SubwayTrain.ARS or not self.Train.SubwayTrain.ARS.NoUAVA if HaveUAVA and self.Train.UAVA.Value == 0 then self.EmergencyValve = true - self.Train.UAVAC:TriggerInput("Set",0) - if value > 0 then RunConsoleCommand("say","Autostop braking",self.Train:GetDriverName()) end + if value ~= 2 then + self.Train.UAVAC:TriggerInput("Set",0) + if not self.Train.autosaid then + self.Train.autosaid = true + RunConsoleCommand("say","Autostop braking",self.Train:GetDriverName()) + end + end end end end @@ -317,7 +322,9 @@ function TRAIN_SYSTEM:Think(dT) self.ParkingBrakePressure_dPdT = 0.0 self.WorkingChamberPressure_dPdT = 0.0 - self.KM013offset = self.KM013offset or math.random()*0.2 + 5.0 --регулировочное давление + local rnd = math.random(1,10) + local offs = 0.1 + self.KM013offset = self.KM013offset or math.Clamp(5.1 + (rnd >= 3 and rnd <= 7 and offs or -offs),5.0,5.2) -- Reduce pressure for brake line self.TrainToBrakeReducedPressure = math.min(self.KM013offset,self.TrainLinePressure) -- * 0.725) @@ -328,11 +335,10 @@ function TRAIN_SYSTEM:Think(dT) local HaveEPK = not Train.SubwayTrain or not Train.SubwayTrain.ARS or not Train.SubwayTrain.ARS.NoEPK local BLDisconnect,pr_speed = true,1 - ---[[ работа срывного клапана - if Train.AutostopValve.Value ~= 0 then - if self.BrakeLinePressure > 1.86 then self:TriggerInput("Autostop",1) end - Train.AutostopValve.Value = 0 - end--]] + -- работа срывного клапана + if Train.AutostopValve.Value > 0 then + self:TriggerInput("Autostop",self.BrakeLinePressure > 1.86 and 1 or 2) --value == 2 — просто открыть срывной клапан без размыкания контактов УАВА + end if self.ValveType == 1 then BLDisconnect = Train.DriverValveBLDisconnect.Value > 0 @@ -459,13 +465,14 @@ function TRAIN_SYSTEM:Think(dT) if self.EmergencyValveDisable then--and (self.BrakeLinePressure-self.OldBrakeLinePressure)>0.01 then self.EmergencyValveDisable=false self.EmergencyValve=false + Train.autosaid=false end self.OldBrakeLinePressure = self.BrakeLinePressure local leak = 0 if self.EmergencyValve then local leakst = BLDisconnect and math.max(0.3,math.log(80*self.BrakeLinePressure - 200,3)) or 1.1*(Train:GetWagonCount())*math.Clamp(self.BrakeLinePressure/4,0,1) leak = self:equalizePressure(dT,"BrakeLinePressure", 0.0,leakst)--,false,false,10) - if (self.BrakeLinePressure < 1.82 or Train.UAVA.Value > 0) then + if Train.UAVA.Value > 0 or (self.BrakeLinePressure < 1.82 and Train.AutostopValve.Value == 0) then --пока держим ЛКМ нажатой, срывной клапан открыт self.EmergencyValveDisable = true end self.Leak = true From 64784539ca7d79abad55d6b108ac1ca68579e9fe Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 21:23:24 +0300 Subject: [PATCH 14/43] =?UTF-8?q?=D0=9E=D1=82=D0=BA=D1=80=D1=8B=D1=82?= =?UTF-8?q?=D1=8B=D0=B9=20=D1=80=D0=B0=D0=B7=D0=BE=D0=B1=D1=89=D0=B8=D1=82?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B9=20=D0=B2=20=D0=B3=D0=BE?= =?UTF-8?q?=D0=BB=D0=BE=D0=B2=D0=B5=20=D0=BF=D1=80=D0=B8=20=D1=81=D0=BF?= =?UTF-8?q?=D0=B0=D0=B2=D0=BD=D0=B5=20=D0=B2=20=D1=81=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=BE=D1=8F=D0=BD=D0=B8=D0=B8=20"=D0=B4=D0=B5=D0=BF=D0=BE"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/entities/gmod_subway_81-717_mvm_custom.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/entities/gmod_subway_81-717_mvm_custom.lua b/lua/entities/gmod_subway_81-717_mvm_custom.lua index 02ec7d7..dd16304 100644 --- a/lua/entities/gmod_subway_81-717_mvm_custom.lua +++ b/lua/entities/gmod_subway_81-717_mvm_custom.lua @@ -89,9 +89,10 @@ ENT.Spawner = { ent.ARS:TriggerInput("Set",(ent.Plombs.RC1 and val==1 and first) and 1 or 0) ent.ALS:TriggerInput("Set",val==1 and 1 or 0) ent.L_1:TriggerInput("Set",val==1 and 1 or 0) - ent.L_3:TriggerInput("Set",vall==1 and 1 or 0) + ent.L_3:TriggerInput("Set",val==1 and 1 or 0) ent.L_4:TriggerInput("Set",val==1 and 1 or 0) ent.EPK:TriggerInput("Set",(ent.Plombs.RC1 and val==1) and 1 or 0) + ent.DriverValveDisconnect:TriggerInput("Set",(val==4 and first) and 1 or 0) _LastSpawner=CurTime() ent.CabinDoor = val==4 and first ent.PassengerDoor = val==4 @@ -110,6 +111,7 @@ ENT.Spawner = { ent._SpawnerStarted = val end ent.Pneumatic.TrainLinePressure = val==3 and math.random()*4 or val==2 and 4.5+math.random()*3 or 7.6+math.random()*0.6 - if val==4 then ent.Pneumatic.BrakeLinePressure = 5.2 end + ent.Pneumatic.BrakeLinePressure = val == 4 and 5.2 or val == 1 and 2.3 or math.min(ent.Pneumatic.TrainLinePressure+0.25,math.random()*4) + ent.Pneumatic.WorkingChamberPressure = val==3 and math.random()*1.0 or val==2 and 4.0+math.random()*1.0 or 5.2 end}, } From 4c74dd2ce0c678b807496ef236fc83816963cff0 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Wed, 22 Dec 2021 23:46:42 +0300 Subject: [PATCH 15/43] =?UTF-8?q?=D0=A0=D0=B5=D0=B3=D1=83=D0=BB=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=BA=D0=B0=20=D0=B3=D1=80=D0=BE=D0=BC=D0=BA?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=B8=20=D1=88=D0=B8=D0=BF=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=B2=D0=BE=D0=B7=D0=B4=D1=83=D1=85=D0=B0=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=20=D0=BE=D1=82=D0=BF=D1=83=D1=81=D0=BA=D0=B5=20?= =?UTF-8?q?=D0=B2=D0=B5=D0=BD=D1=82=D0=B8=D0=BB=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/entities/gmod_subway_81-717_mvm/cl_init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/entities/gmod_subway_81-717_mvm/cl_init.lua b/lua/entities/gmod_subway_81-717_mvm/cl_init.lua index 3a294dc..3947b05 100644 --- a/lua/entities/gmod_subway_81-717_mvm/cl_init.lua +++ b/lua/entities/gmod_subway_81-717_mvm/cl_init.lua @@ -3206,7 +3206,7 @@ function ENT:Think() self:SetSoundState("rolling_high2" ,rol70*rollings,rol70p) --70 self.ReleasedPdT = math.Clamp(self.ReleasedPdT + 2*(-self:GetPackedRatio("BrakeCylinderPressure_dPdT",0)-0.8*self.ReleasedPdT)*dT,0,1) - local release1 = math.Clamp((1.1*self.ReleasedPdT-0.1)/0.32,0,8)^2 + local release1 = math.Clamp((1.1*self.ReleasedPdT-0.1)/0.48,0,8)^2 self:SetSoundState("release1",release1,1) self:SetSoundState("release2",(math.Clamp(0.3-release1,0,0.3)/0.3)*(release1/0.3),1.0) local parking_brake = self:GetPackedRatio("ParkingBrakePressure_dPdT",0) From 97c0fb8aedc656c3885422be20bdbb0ce54b24fa Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Wed, 22 Dec 2021 23:48:30 +0300 Subject: [PATCH 16/43] =?UTF-8?q?=D0=A0=D0=B5=D0=B3=D1=83=D0=BB=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=BA=D0=B0=20=D1=82=D0=B5=D0=BC=D0=BF=D0=B0?= =?UTF-8?q?=20=D1=80=D0=B0=D0=B7=D1=80=D1=8F=D0=B4=D0=BA=D0=B8=20=D0=A2?= =?UTF-8?q?=D0=A6=20=D0=BF=D1=80=D0=B8=20=D0=BE=D1=82=D0=BF=D1=83=D1=81?= =?UTF-8?q?=D0=BA=D0=B5=20=D0=B2=D1=82=D0=BE=D1=80=D1=8B=D1=85=20=D0=B2?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=D0=B8=D0=BB=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/metrostroi/systems/sys_81_717_pneumatic.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/metrostroi/systems/sys_81_717_pneumatic.lua b/lua/metrostroi/systems/sys_81_717_pneumatic.lua index 5a7538c..658fde7 100644 --- a/lua/metrostroi/systems/sys_81_717_pneumatic.lua +++ b/lua/metrostroi/systems/sys_81_717_pneumatic.lua @@ -546,7 +546,7 @@ function TRAIN_SYSTEM:Think(dT) end self.BePN2 = true else - self.PN2 = math.max(0,self.PN2-math.exp(1.2*(self.BrakeCylinderPressure - self.GN2Offset))*0.2) + self.PN2 = math.max(0,self.PN2-0.7*math.exp(3.0*(self.BrakeCylinderPressure - self.GN2Offset - self.WeightLoadRatio*1.3)+1.6)) end local targetPres = math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - (self.BrakeLinePressure < 3.6 and self.BrakeLinePressure*self.WorkingChamberPressure/6.5 or self.BrakeLinePressure*1.028))) + (self.BrakeLinePressure_dPdT < 0 and self.WeightLoadRatio*1.3 or 0)) --local targetPres = math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - (self.BrakeLinePressure < 3.56 and (self.BrakeLinePressure - 3)*5.56 or self.BrakeLinePressure*1.028)) + (self.BrakeLinePressure_dPdT < 0 and self.WeightLoadRatio*1.3 or 0))) @@ -565,7 +565,6 @@ function TRAIN_SYSTEM:Think(dT) end if self.BrakeCylinderValve == 1 then self:equalizePressure(dT,"BrakeCylinderPressure", math.min(self.GN2Offset + self.WeightLoadRatio*1.3,targetPressure), 1, (self.BrakeLinePressure > (self.KM013offset+0.1)) and (self.PN2 == 0) and (self.PN1 == 0) and 1.0 or 3.5, nil, (self.BrakeLinePressure_dPdT > 0.1) and (0.8+math.Clamp((1 - self.BrakeCylinderPressure)*0.8,0,1.2)) or 1) - --self:equalizePressure(dT,"BrakeCylinderPressure", math.min(self.GN2Offset + self.WeightLoadRatio*1.3,targetPressure), 0.5+math.Clamp((self.BrakeCylinderPressure-0.5)/2.8,0,0.9), (self.BrakeLinePressure > (self.KM013offset+0.1)) and (self.PN2 == 0) and (self.PN1 == 0) and 0.8 or 3.5, nil, (self.BrakeLinePressure_dPdT > 0.1) and (0.8+math.Clamp((1 - self.BrakeCylinderPressure)*0.8,0,1)) or 1) end trainLineConsumption_dPdT = trainLineConsumption_dPdT + math.max(0,self.BrakeCylinderPressure_dPdT*0.5) elseif Train.AirDistributorDisconnect.Value ~= 0 then From 116d6f735ea8d8e01b6abe65fda7a03582992f50 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Sat, 25 Dec 2021 16:35:07 +0300 Subject: [PATCH 17/43] =?UTF-8?q?=D0=A0=D0=B5=D0=B3=D1=83=D0=BB=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=BA=D0=B0=20=D1=82=D0=B5=D0=BC=D0=BF=D0=B0?= =?UTF-8?q?=20=D1=80=D0=B0=D0=B7=D1=80=D1=8F=D0=B4=D0=BA=D0=B8=20=D0=A2?= =?UTF-8?q?=D0=A6=20=D0=BF=D1=80=D0=B8=20=D0=BE=D1=82=D0=BF=D1=83=D1=81?= =?UTF-8?q?=D0=BA=D0=B5=20=D0=B2=D1=82=D0=BE=D1=80=D1=8B=D1=85=20=D0=B2?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=D0=B8=D0=BB=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/metrostroi/systems/sys_81_717_pneumatic.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/metrostroi/systems/sys_81_717_pneumatic.lua b/lua/metrostroi/systems/sys_81_717_pneumatic.lua index 658fde7..9fec698 100644 --- a/lua/metrostroi/systems/sys_81_717_pneumatic.lua +++ b/lua/metrostroi/systems/sys_81_717_pneumatic.lua @@ -546,7 +546,8 @@ function TRAIN_SYSTEM:Think(dT) end self.BePN2 = true else - self.PN2 = math.max(0,self.PN2-0.7*math.exp(3.0*(self.BrakeCylinderPressure - self.GN2Offset - self.WeightLoadRatio*1.3)+1.6)) + --self.PN2 = math.max(0,self.PN2-0.7*math.exp(3.0*(self.BrakeCylinderPressure - self.GN2Offset - self.WeightLoadRatio*1.3)+1.6)) + self.PN2 = 0.3*math.exp(0.8*(self.BrakeCylinderPressure - dT) - 1) - 0.16 end local targetPres = math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - (self.BrakeLinePressure < 3.6 and self.BrakeLinePressure*self.WorkingChamberPressure/6.5 or self.BrakeLinePressure*1.028))) + (self.BrakeLinePressure_dPdT < 0 and self.WeightLoadRatio*1.3 or 0)) --local targetPres = math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - (self.BrakeLinePressure < 3.56 and (self.BrakeLinePressure - 3)*5.56 or self.BrakeLinePressure*1.028)) + (self.BrakeLinePressure_dPdT < 0 and self.WeightLoadRatio*1.3 or 0))) From 9947789b6c5a38158f1cd0098442fd7d2ae91a79 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 12:47:23 +0300 Subject: [PATCH 18/43] =?UTF-8?q?=D0=AD=D1=82=D0=BE=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20=D0=9A=D0=A0=D0=A3=20?= =?UTF-8?q?=D0=B2=203=20=D1=80=D1=83=D0=BA=D0=B8=20=D0=B8=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D1=81=D1=80=D0=B0=D0=B1=D0=B0=D1=82=D1=8B=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=9054=20=D0=BF=D1=80=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D0=B5=20=D1=80?= =?UTF-8?q?=D0=B5=D0=B2=D0=B5=D1=80=D1=81=D0=B0=20=D0=B2=D0=BF=D0=B5=D1=80?= =?UTF-8?q?=D0=B5=D0=B4=20=D0=B2=20=D0=BE=D0=B1=D0=B5=D0=B8=D1=85=20=D0=BA?= =?UTF-8?q?=D0=B0=D0=B1=D0=B8=D0=BD=D0=B0=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/metrostroi/systems/sys_81_714_electric.lua | 1 + lua/metrostroi/systems/sys_81_717_electric.lua | 7 ++++++- lua/metrostroi/systems/sys_yar_13b.lua | 7 ++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lua/metrostroi/systems/sys_81_714_electric.lua b/lua/metrostroi/systems/sys_81_714_electric.lua index 6723fc7..b597ac3 100644 --- a/lua/metrostroi/systems/sys_81_714_electric.lua +++ b/lua/metrostroi/systems/sys_81_714_electric.lua @@ -78,6 +78,7 @@ function TRAIN_SYSTEM:SolveAllInternalCircuits(Train,dT,firstIter) if isMVM then Train:WriteTrainWire(71,S["33D"]*Train.OtklBV.Value) end + Train.RPvozvrat.VozRpPressed = T[17]~=0 --Вагонная часть S["10A"] = BO*Train.A30.Value S["ZR"] = (1-Train.RRP.Value)+(B*Train.A39.Value*(1-Train.RPvozvrat.Value)*Train.RRP.Value)*-1 diff --git a/lua/metrostroi/systems/sys_81_717_electric.lua b/lua/metrostroi/systems/sys_81_717_electric.lua index 7f0eafb..83b4202 100644 --- a/lua/metrostroi/systems/sys_81_717_electric.lua +++ b/lua/metrostroi/systems/sys_81_717_electric.lua @@ -88,7 +88,11 @@ function TRAIN_SYSTEM:SolveAllInternalCircuits(Train,dT,firstIter) S["F7"] = S["F"]*KV["F-F7"]+S["14b"]*KRU["11/3-FR1"] Train:WriteTrainWire(5,S["10AK"]*KV["10AK-5"] + KRU["5/3-ZM31"]*-10) - Train:WriteTrainWire(4,S["10AK"]*KV["10AK-4"] + --[[max(0,min(1,T[4])*KV["4-0"]*-10)]]KV["4-0"]*-10) + Train:WriteTrainWire(4,S["10AK"]*KV["10AK-4"]) --[[max(0,min(1,T[4])*KV["4-0"]*-10)KV["4-0"]*-10]] + if T[4]*KV["4-0"] ~= 0 then + Train.A54:TriggerInput("Set",0) + Train:WriteTrainWire(5,0) + end --Train:WriteTrainWire(4,S["10AK"]*KV["10AK-4"]*(1-T[4]*KV["4-0"]*-10)) Panel.LST = T[6]*Train.A40.Value @@ -451,6 +455,7 @@ function TRAIN_SYSTEM:SolveAllInternalCircuits(Train,dT,firstIter) Panel.L1 = T[57] end Panel.M8 = S["V2"]*Train.PVK.Value + Train.RPvozvrat.VozRpPressed = T[17]~=0 local ASNP_VV = Train.ASNP_VV ASNP_VV.Power = BO*Train.AS1.Value*Train.R_ASNPOn.Value diff --git a/lua/metrostroi/systems/sys_yar_13b.lua b/lua/metrostroi/systems/sys_yar_13b.lua index d209f6e..82da9b9 100644 --- a/lua/metrostroi/systems/sys_yar_13b.lua +++ b/lua/metrostroi/systems/sys_yar_13b.lua @@ -30,6 +30,7 @@ function TRAIN_SYSTEM:Initialize() latched = true, -- RPvozvrat latches into place power_open = "None", -- Power source for the open signal power_close = "Mechanical", -- Power source for the close signal + VozRpPressed = false, -- Added to override the blocking action of the energized RP relays on RPVozvrat }) -- Реле времени РВ1 @@ -93,13 +94,13 @@ function TRAIN_SYSTEM:Think() end --self.RUTTarget = 250 + 150*self.Train.Pneumatic.WeightLoadRatio -- RPvozvrat operation - Train.RPvozvrat:TriggerInput("Close", - (Train.DR1.Value == 1.0) or + Train.RPvozvrat:TriggerInput("Close", not Train.RPvozvrat.VozRpPressed and + ((Train.DR1.Value == 1.0) or (Train.DR2.Value == 1.0) or (Train.RPL.Value == 1.0) or (Train.RP1_3.Value == 1.0) or (Train.RP2_4.Value == 1.0) or (Train.RZ_1.Value == 1.0) or (Train.RZ_2.Value == 1.0) or - (Train.RZ_3.Value == 1.0)) + (Train.RZ_3.Value == 1.0))) end From 0c77146737a21453c10681b190e4a6908ab17f43 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 03:30:27 +0300 Subject: [PATCH 19/43] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D1=81=D0=B8=D0=BC=D1=83=D0=BB=D1=8F=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=87=D0=B5=D0=B9=20?= =?UTF-8?q?=D0=BA=D0=B0=D0=BC=D0=B5=D1=80=D1=8B=20=D0=92=D0=A0=20337.004?= =?UTF-8?q?=20=D0=B8=20=D0=9A=D0=9B=D0=A1=D0=97.=20=D0=A0=D0=B0=D0=BD?= =?UTF-8?q?=D0=B4=D0=BE=D0=BC=D0=B8=D0=B7=D0=B8=D1=80=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=BE=20=D1=80=D0=B5=D0=B3=D1=83=D0=BB=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=BE=D1=87=D0=BD=D0=BE=D0=B5=20=D0=B4=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=9A=D0=9C=20=D0=B2=D0=BE=202=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8=D0=B8=20=D0=B2?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B0=D1=85=20=D0=BD?= =?UTF-8?q?=D0=BE=D1=80=D0=BC=20=D0=B4=D0=BE=D0=BF=D1=83=D1=81=D0=BA=D0=BE?= =?UTF-8?q?=D0=B2.=20=D0=A2=D0=BE=20=D0=B6=D0=B5=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=BD=D0=BE=D1=80=D0=BC=D1=8B=20=D0=B4=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=B2=20=D0=A2=D0=A6=20=D0=BE=D1=82=20?= =?UTF-8?q?=D0=9F=D0=A1=D0=A2=20=D0=BD=D0=B0=20=D0=B3=D0=BE=D0=BB=D0=BE?= =?UTF-8?q?=D0=B2=D0=BD=D1=8B=D1=85=20=D0=B8=20=D0=BF=D1=80=D0=BE=D0=BC?= =?UTF-8?q?=D0=B5=D0=B6=D1=83=D1=82=D0=BE=D1=87=D0=BD=D1=8B=D1=85=20=D0=B2?= =?UTF-8?q?=D0=B0=D0=B3=D0=BE=D0=BD=D0=B0=D1=85,=20=D0=BE=D1=82=20=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D0=B2=D1=8B=D1=85=20=D0=B8=20=D0=B2=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D1=8B=D1=85=20=D0=B2=D0=B5=D0=BD=D1=82=D0=B8=D0=BB=D0=B5?= =?UTF-8?q?=D0=B9=20=D0=B7=D0=B0=D0=BC=D0=B5=D1=89=D0=B5=D0=BD=D0=B8=D1=8F?= =?UTF-8?q?.=20=D0=9E=D1=82=D1=80=D0=B5=D0=B3=D1=83=D0=BB=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D1=8B=20=D1=82=D0=B5=D0=BC=D0=BF=D1=8B?= =?UTF-8?q?=20=D0=B7=D0=B0=D1=80=D1=8F=D0=B4=D0=BA=D0=B8=20=D0=A2=D0=9C=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=B8=20=D0=BF=D0=BE=D1=81=D0=B0=D0=B4=D0=BA?= =?UTF-8?q?=D0=B8=20=D1=81=D1=80=D1=8B=D0=B2=D0=BD=D0=BE=D0=B3=D0=BE=20?= =?UTF-8?q?=D0=BA=D0=BB=D0=B0=D0=BF=D0=B0=D0=BD=D0=B0,=20=D0=B8=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=B1=D0=BE=D0=BB=D0=B5=D0=B5=20=D1=80=D0=B5?= =?UTF-8?q?=D0=B0=D0=BB=D0=B8=D1=81=D1=82=D0=B8=D1=87=D0=BD=D0=BE=D0=B9=20?= =?UTF-8?q?=D1=81=D0=BA=D0=BE=D1=80=D0=BE=D1=81=D1=82=D0=B8=20=D0=B7=D0=B0?= =?UTF-8?q?=D1=80=D1=8F=D0=B4=D0=BA=D0=B8-=D1=80=D0=B0=D0=B7=D1=80=D1=8F?= =?UTF-8?q?=D0=B4=D0=BA=D0=B8=20=D0=A2=D0=9C=20=D0=B8=20=D0=A2=D0=A6.=20?= =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=B2?= =?UTF-8?q?=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20?= =?UTF-8?q?=D1=81=D1=80=D1=8B=D0=B2=D0=B0=D1=82=D1=8C=20=D1=81=D1=80=D1=8B?= =?UTF-8?q?=D0=B2=D0=BD=D0=BE=D0=B9=20=D0=BA=D0=BB=D0=B0=D0=BF=D0=B0=D0=BD?= =?UTF-8?q?.=20=D0=9E=D1=82=D1=80=D0=B5=D0=B3=D1=83=D0=BB=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=20=D1=82=D0=B5=D0=BC=D0=BF=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B7=D1=80=D1=8F=D0=B4=D0=BA=D0=B8=20=D0=9D=D0=9C=20?= =?UTF-8?q?=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20=D0=BF=D1=80=D0=B5=D0=B4=D0=BE?= =?UTF-8?q?=D1=85=D1=80=D0=B0=D0=BD=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D1=8B=D0=B9=20=D0=BA=D0=BB=D0=B0=D0=BF=D0=B0=D0=BD=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=B1=D0=BE=D0=BB=D0=B5=D0=B5=20=D1=80=D0=B5?= =?UTF-8?q?=D0=B0=D0=BB=D0=B8=D1=81=D1=82=D0=B8=D1=87=D0=BD=D0=BE=D0=B3?= =?UTF-8?q?=D0=BE=20=D0=BF=D0=BE=D0=B2=D0=B5=D0=B4=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../systems/sys_81_717_pneumatic.lua | 125 ++++++++++++------ 1 file changed, 87 insertions(+), 38 deletions(-) diff --git a/lua/metrostroi/systems/sys_81_717_pneumatic.lua b/lua/metrostroi/systems/sys_81_717_pneumatic.lua index da7ff08..307ccd2 100644 --- a/lua/metrostroi/systems/sys_81_717_pneumatic.lua +++ b/lua/metrostroi/systems/sys_81_717_pneumatic.lua @@ -43,6 +43,14 @@ function TRAIN_SYSTEM:Initialize(parameters) self.OldBrakeLinePressure = 0.0 self.BCPressure = 0 + -- Air distrubutor part + self.WorkingChamberPressure = 0.0 + self.AirDistributorReady = false + self.OverchargeReleaseValve = false + self.WCChargeValve = true + self.PN1 = 0 + self.PN2 = 0 + --DKPT self.Train:LoadSystem("DKPT","Relay","R-52B") -- -- Valve #1 @@ -73,8 +81,11 @@ function TRAIN_SYSTEM:Initialize(parameters) self.Train:LoadSystem("EmergencyBrakeValve","Relay","Switch") -- Воздухораспределитель self.Train:LoadSystem("AirDistributorDisconnect","Relay","Switch") + --Срывной клапан + self.Train:LoadSystem("AutostopValve","Relay","Switch") --УАВА self.Train:LoadSystem("UAVA","Relay","Switch",{ bass = true}) + --self.Train:LoadSystem("UAVAContact","Relay","Switch") self.Train:LoadSystem("UAVAC","Relay","",{normally_closed=true,bass=true}) --Стояночный тормоз self.Train:LoadSystem("ParkingBrake","Relay","Switch",{bass = true}) @@ -141,7 +152,7 @@ end function TRAIN_SYSTEM:Outputs() return { "BrakeLinePressure", "BrakeCylinderPressure", "DriverValvePosition", - "ReservoirPressure", "TrainLinePressure", "DoorLinePressure", "WeightLoadRatio" } + "ReservoirPressure", "TrainLinePressure", "DoorLinePressure", "WeightLoadRatio", "WorkingChamberPressure" } end function TRAIN_SYSTEM:TriggerInput(name,value) @@ -304,9 +315,12 @@ function TRAIN_SYSTEM:Think(dT) self.ReservoirPressure_dPdT = 0.0 self.BrakeCylinderPressure_dPdT = 0.0 self.ParkingBrakePressure_dPdT = 0.0 + self.WorkingChamberPressure_dPdT = 0.0 + + self.KM013offset = self.KM013offset or math.random()*0.2 + 5.0 --регулировочное давление -- Reduce pressure for brake line - self.TrainToBrakeReducedPressure = math.min(5.1,self.TrainLinePressure) -- * 0.725) + self.TrainToBrakeReducedPressure = math.min(self.KM013offset,self.TrainLinePressure) -- * 0.725) -- Feed pressure to door line self.DoorLinePressure = self.TrainToBrakeReducedPressure * 0.90 local trainLineConsumption_dPdT = 0.0 @@ -314,6 +328,12 @@ function TRAIN_SYSTEM:Think(dT) local HaveEPK = not Train.SubwayTrain or not Train.SubwayTrain.ARS or not Train.SubwayTrain.ARS.NoEPK local BLDisconnect,pr_speed = true,1 + ---[[ работа срывного клапана + if Train.AutostopValve.Value ~= 0 then + if self.BrakeLinePressure > 1.86 then self:TriggerInput("Autostop",1) end + Train.AutostopValve.Value = 0 + end--]] + if self.ValveType == 1 then BLDisconnect = Train.DriverValveBLDisconnect.Value > 0 local TLDisconnect = Train.DriverValveTLDisconnect.Value > 0 @@ -366,42 +386,42 @@ function TRAIN_SYSTEM:Think(dT) trainLineConsumption_dPdT = trainLineConsumption_dPdT + math.max(0,self.ReservoirPressure_dPdT)*0.05 else pr_speed = 1.25*wagc --2 - if self.Leak or self.BraieLineOpen then pr_speed = pr_speed*0.7 end + if self.Leak or self.BrakeLineOpen then pr_speed = pr_speed*0.7 end BLDisconnect = self.DisconnectType and Train.DriverValveBLDisconnect.Value > 0 or Train.DriverValveDisconnect.Value > 0 local TLDisconnect = self.DisconnectType and Train.DriverValveTLDisconnect.Value > 0 or Train.DriverValveDisconnect.Value > 0 -- 013: 1 Overcharge if (self.RealDriverValvePosition == 1) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > self.TrainLinePressure) then - self:equalizePressure(dT,"BrakeLinePressure", math.min(6.0,self.TrainLinePressure), pr_speed) + self:equalizePressure(dT,"BrakeLinePressure", math.min(6.4,self.TrainLinePressure), pr_speed,pr_speed*0.35, nil, 1.0) end -- 013: 2 Normal pressure - if (self.RealDriverValvePosition == 2) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > 1.01*math.min(5.1,self.TrainToBrakeReducedPressure)) then - self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(5.1,self.TrainToBrakeReducedPressure), pr_speed,nil, nil, 1.0)-- nil, 1.0) + if (self.RealDriverValvePosition == 2) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > 1.01*math.min(self.KM013offset,self.TrainToBrakeReducedPressure)) then + self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(self.KM013offset,self.TrainToBrakeReducedPressure), pr_speed,pr_speed*0.35, nil, 1.0)-- nil, 1.0) end -- 013: 3 4.3 Atm if (self.RealDriverValvePosition == 3) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > 1.01*math.min(4.3,self.TrainToBrakeReducedPressure)) then - self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(4.3,self.TrainToBrakeReducedPressure), pr_speed,nil, nil, 1.0) + self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(4.3,self.TrainToBrakeReducedPressure), pr_speed,pr_speed*0.35, nil, 1.0) end -- 013: 4 4.0 Atm if (self.RealDriverValvePosition == 4) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > 1.01*math.min(4.0,self.TrainToBrakeReducedPressure)) then - self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(4.0,self.TrainToBrakeReducedPressure), pr_speed,nil, nil, 1.0) + self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(4.0,self.TrainToBrakeReducedPressure), pr_speed,pr_speed*0.35, nil, 1.0) end -- 013: 5 3.7 Atm if (self.RealDriverValvePosition == 5) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > 1.01*math.min(3.7,self.TrainToBrakeReducedPressure)) then - self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(3.7,self.TrainToBrakeReducedPressure), pr_speed,nil, nil, 1.0) + self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(3.7,self.TrainToBrakeReducedPressure), pr_speed,pr_speed*0.35, nil, 1.0) end -- 013: 6 3.0 Atm if (self.RealDriverValvePosition == 6) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > 1.01*math.min(3.0,self.TrainToBrakeReducedPressure)) then - self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(3.0,self.TrainToBrakeReducedPressure), pr_speed,nil, nil, 1.0) + self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(3.0,self.TrainToBrakeReducedPressure), pr_speed,pr_speed*0.35, nil, 1.0) end -- 013: 7 0.0 Atm - if (self.RealDriverValvePosition == 7) and BLDisconnect then - self:equalizePressure(dT,"BrakeLinePressure", 0.0, pr_speed) + if (self.RealDriverValvePosition == 7) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > 0.0) then + self:equalizePressure(dT,"BrakeLinePressure", 0.0, 0.6 + pr_speed*math.exp(math.min(0,self.BrakeLinePressure - 2.8)*1.0),pr_speed*0.35, nil, 1.0) end trainLineConsumption_dPdT = trainLineConsumption_dPdT + math.max(0,self.BrakeLinePressure_dPdT) end @@ -436,22 +456,22 @@ function TRAIN_SYSTEM:Think(dT) else Train:SetPackedRatio("Crane_dPdT", self.BrakeLinePressure_dPdT/wagc*3 ) end - if self.EmergencyValveDisable and (self.BrakeLinePressure-self.OldBrakeLinePressure)>0.01 then + if self.EmergencyValveDisable then--and (self.BrakeLinePressure-self.OldBrakeLinePressure)>0.01 then self.EmergencyValveDisable=false self.EmergencyValve=false end self.OldBrakeLinePressure = self.BrakeLinePressure local leak = 0 if self.EmergencyValve then - local leakst = 1.1*(Train:GetWagonCount())*math.Clamp(self.BrakeLinePressure/4,0,1) - leak = self:equalizePressure(dT,"BrakeLinePressure", 0.0,leakst*2,false,false,0.4) - if (leak >= -0.2*(Train:GetWagonCount()) or Train.UAVA.Value > 0) then + local leakst = BLDisconnect and math.max(0.3,math.log(80*self.BrakeLinePressure - 200,3)) or 1.1*(Train:GetWagonCount())*math.Clamp(self.BrakeLinePressure/4,0,1) + leak = self:equalizePressure(dT,"BrakeLinePressure", 0.0,leakst)--,false,false,10) + if (self.BrakeLinePressure < 1.82 or Train.UAVA.Value > 0) then self.EmergencyValveDisable = true end self.Leak = true end - local UAVABlocked = (self.BrakeLinePressure>3.5 and Train.UAVA.Value==0) + local UAVABlocked = (self.BrakeLinePressure>1.8 and Train.UAVA.Value==0) if (Train.UAVA.Blocked>0) ~= UAVABlocked then Train.UAVA:TriggerInput("Block",UAVABlocked and 1 or 0) end @@ -461,48 +481,75 @@ function TRAIN_SYSTEM:Think(dT) Train.UAVAC:TriggerInput("Block",UAVACBlocked and 1 or 0) end - Train:SetPackedRatio("EmergencyValve_dPdT", -leak/wagc) + Train:SetPackedRatio("EmergencyValve_dPdT", -1.8*leak/wagc) --Регулировка свиста срывного клапана local leak = 0 if Train.EmergencyBrakeValve and Train.EmergencyBrakeValve.Value > 0.5 then --local leakst = (1.6*(Train:GetWagonCount())*(self.BrakeLinePressure-math.min(2.5,self.TrainToBrakeReducedPressure))*0.9) - leak = self:equalizePressure(dT,"BrakeLinePressure", 0.0,(1.1*wagc)*2,false,false,0.4) + leak = self:equalizePressure(dT,"BrakeLinePressure", 0.0,(1.1*wagc)*2,false,false,1) self.Leak = true end Train:SetPackedRatio("EmergencyBrakeValve_dPdT", -leak/wagc) + --[[ + ---------------debug--------------------- + self.dlreadtimer = self.dlreadtimer or CurTime() + if CurTime() - self.dlreadtimer > 1.0 then + self.dlreadtimer = CurTime() + if Train:GetWagonNumber() == 8530 then + PrintMessage(HUD_PRINTTALK, Format("Вагон %u; ТМ dPdT = %.3f; Раб. кам. = %.3f",Train:GetWagonNumber(),self.BrakeLinePressure_dPdT,self.WorkingChamberPressure)) + end + end + ---------------debug---------------------]] + + ---------------------------------------------------------------------------- -- Fill brake cylinders - if Train.AirDistributorDisconnect.Value == 0 then + if self.WCChargeValve == true then + self:equalizePressure(dT,"WorkingChamberPressure",self.BrakeLinePressure,0.187,nil,nil,1.0) --simulate 0.8mm hole btw BL and working chambers + end + self.AirDistributorReady = self.WorkingChamberPressure >= 2.2 + self.WCChargeValve = not ((self.WorkingChamberPressure - self.BrakeLinePressure) > 0.2 and (self.WorkingChamberPressure - self.BrakeLinePressure) < 2.5) + self.OverchargeReleaseValve = self.WorkingChamberPressure > 5.2 and not self.WCChargeValve + if self.OverchargeReleaseValve then + self:equalizePressure(dT,"WorkingChamberPressure",0.0,0.32) -- КЛСЗ + end + + --trainLineConsumption_dPdT = trainLineConsumption_dPdT + math.max(0,self.WorkingChamberPressure_dPdT*0.2) + local _offset2 = self.Train.AR63 and 2.5 or 2.4 + self.GN2Offset = self.GN2Offset or math.random(20,100)*0.002 + _offset2 + local _offset1 = self.Train.AR63 and 0.9 or 0.8 + self.GN1Offset = self.GN1Offset or math.random(20,100)*0.002 + _offset1 + local _vz1pressure = self.GN1Offset + self.WeightLoadRatio*0.7 + self.BcBl = self.BcBl or self.GN2Offset/(self.KM013offset - 3.24) + if Train.AirDistributorDisconnect.Value == 0 and self.AirDistributorReady then -- Valve #1 - self.BrakeCylinderRegulationError = self.BrakeCylinderRegulationError or (math.random()*0.05 - 0.025) - local error = self.BrakeCylinderRegulationError if (Train.PneumaticNo1.Value == 1.0) and (Train.PneumaticNo2.Value == 0.0) then - if self.PN1 == 0 then + if self.PN1 < _vz1pressure then --1,2 - self.PN1 = math.min(self.TrainLinePressure,(1.1 + error + self.WeightLoadRatio*0.6)) + self.PN1 = math.min(self.TrainLinePressure,_vz1pressure) end - elseif self.PN1 ~= 0 then - self.PN1 = 0 + else + self.PN1 = math.max(0,self.PN1-math.exp(3.6*(self.BrakeCylinderPressure - self.GN1Offset))*0.12) end -- Valve #2 if Train.PneumaticNo2.Value == 1.0 then - if self.PN2 == 0 then - self.PN2 = math.min(self.TrainLinePressure,(2.7 + error + self.WeightLoadRatio*1.3)) + self.PN2 = math.min(self.TrainLinePressure,(self.GN2Offset + self.WeightLoadRatio*1.3)) if self.BePN2 == false and self.BrakeCylinderPressure > 1.6 then Train:PlayOnce("PN2end","stop") end self.BePN2 = true - end - elseif self.PN2 ~= 0 then - self.PN2 = 0 + else + self.PN2 = math.max(0,self.PN2-math.exp(1.2*(self.BrakeCylinderPressure - self.GN2Offset))*0.2) end - local targetPres = math.max(0,math.min(5.2,--[[ 1.5--]] 1.35*(math.min(5.1,self.TrainToBrakeReducedPressure) - self.BrakeLinePressure))) - if self.BCPressure < targetPres then + local targetPres = math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - (self.BrakeLinePressure < 3.6 and self.BrakeLinePressure*self.WorkingChamberPressure/6.5 or self.BrakeLinePressure*1.028))) + (self.BrakeLinePressure_dPdT < 0 and self.WeightLoadRatio*1.3 or 0)) + --local targetPres = math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - (self.BrakeLinePressure < 3.56 and (self.BrakeLinePressure - 3)*5.56 or self.BrakeLinePressure*1.028)) + (self.BrakeLinePressure_dPdT < 0 and self.WeightLoadRatio*1.3 or 0))) + --[[if self.BCPressure < targetPres then self.BCPressure = math.min(targetPres,self.BCPressure+(0.5+math.max(0,(targetPres-self.BCPressure)-0.2)*0.6)*dT) elseif self.BCPressure > targetPres then self.BCPressure = math.max(targetPres,self.BCPressure-2*dT) - end - local targetPressure = self.PN1+self.PN2+self.BCPressure + end--]] + --local targetPressure = self.PN1+self.PN2+self.BCPressure + local targetPressure = self.PN1+self.PN2+targetPres if math.abs(self.BrakeCylinderPressure - targetPressure) > 0.150 then self.BrakeCylinderValve = 1 end @@ -510,11 +557,13 @@ function TRAIN_SYSTEM:Think(dT) self.BrakeCylinderValve = 0 end if self.BrakeCylinderValve == 1 then - self:equalizePressure(dT,"BrakeCylinderPressure", math.min(2.7 + self.WeightLoadRatio*1.3,targetPressure), 1+math.Clamp((self.BrakeCylinderPressure-0.5)/2.8,0,0.7), 3.50, nil, 0.8+math.Clamp((self.BrakeCylinderPressure-0.75)/0.6,0,1)) --0.75, 1.25) + self:equalizePressure(dT,"BrakeCylinderPressure", math.min(self.GN2Offset + self.WeightLoadRatio*1.3,targetPressure), 1, (self.BrakeLinePressure > (self.KM013offset+0.1)) and (self.PN2 == 0) and (self.PN1 == 0) and 1.0 or 3.5, nil, (self.BrakeLinePressure_dPdT > 0.1) and (0.8+math.Clamp((1 - self.BrakeCylinderPressure)*0.8,0,1.2)) or 1) + --self:equalizePressure(dT,"BrakeCylinderPressure", math.min(self.GN2Offset + self.WeightLoadRatio*1.3,targetPressure), 0.5+math.Clamp((self.BrakeCylinderPressure-0.5)/2.8,0,0.9), (self.BrakeLinePressure > (self.KM013offset+0.1)) and (self.PN2 == 0) and (self.PN1 == 0) and 0.8 or 3.5, nil, (self.BrakeLinePressure_dPdT > 0.1) and (0.8+math.Clamp((1 - self.BrakeCylinderPressure)*0.8,0,1)) or 1) end trainLineConsumption_dPdT = trainLineConsumption_dPdT + math.max(0,self.BrakeCylinderPressure_dPdT*0.5) - else + elseif Train.AirDistributorDisconnect.Value ~= 0 then self:equalizePressure(dT,"BrakeCylinderPressure", 0.0, 2.00) + self:equalizePressure(dT,"WorkingChamberPressure", 0.0, 2.00) --имитируем потягивание за тросик отпускного клапана end if (self.BrakeCylinderPressure > 0.2 and self.BrakeCylinderPressure_dPdT > 0.1 or self.BrakeCylinderPressure_dPdT > 1) and not self.BrakeEngaged then self.BrakeEngaged = true @@ -560,7 +609,7 @@ function TRAIN_SYSTEM:Think(dT) -- Overpressure if self.TrainLinePressure > 9.2 then self.TrainLineOverpressureValve = 1 end if self.TrainLineOverpressureValve == 1 then - self:equalizePressure(dT,"TrainLinePressure", 0.0, 0.2) + self:equalizePressure(dT,"TrainLinePressure", 0.0, (self.TrainLinePressure-(self.Compressor == 1 and 6.5 or 4))*0.6) --was 0.2 self.TrainLineOpen = true if self.TrainLinePressure < 5.2 then self.TrainLineOverpressureValve = 0 end end From 7668b41ccffee17600d4c77c82950383a619f695 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 03:31:10 +0300 Subject: [PATCH 20/43] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BF=D1=83=D1=81=D1=82=D1=83=D1=8E=20=D1=81=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/metrostroi/systems/sys_als_ars_bis200a.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/metrostroi/systems/sys_als_ars_bis200a.lua b/lua/metrostroi/systems/sys_als_ars_bis200a.lua index 92a36bb..56262b6 100644 --- a/lua/metrostroi/systems/sys_als_ars_bis200a.lua +++ b/lua/metrostroi/systems/sys_als_ars_bis200a.lua @@ -57,7 +57,6 @@ end function TRAIN_SYSTEM:Think(dT) local Train = self.Train local speed = Train.ALSCoil.Speed - --vv При торможении смещение на 2км\ч vv ----[[ if true or self.SpeedDec then From 1aee6e3c4d9105ecdafd45d9ec035101788f6c8e Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 13:01:08 +0300 Subject: [PATCH 21/43] =?UTF-8?q?Revert=20"=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BF=D1=83=D1=81=D1=82=D1=83=D1=8E=20=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=BE=D0=BA=D1=83"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit ba46473cb714e44fb25a7a0bc344671e4ac2ed2c. --- lua/metrostroi/systems/sys_als_ars_bis200a.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/metrostroi/systems/sys_als_ars_bis200a.lua b/lua/metrostroi/systems/sys_als_ars_bis200a.lua index 56262b6..92a36bb 100644 --- a/lua/metrostroi/systems/sys_als_ars_bis200a.lua +++ b/lua/metrostroi/systems/sys_als_ars_bis200a.lua @@ -57,6 +57,7 @@ end function TRAIN_SYSTEM:Think(dT) local Train = self.Train local speed = Train.ALSCoil.Speed + --vv При торможении смещение на 2км\ч vv ----[[ if true or self.SpeedDec then From 6c4925ec1f48b4d550eb5d578877408ac6017e0b Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 12:49:49 +0300 Subject: [PATCH 22/43] =?UTF-8?q?=D0=98=D0=B7-=D0=B7=D0=B0=20=D0=B8=D0=B7?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=B2=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82=D0=B5=20=D0=BF=D0=BD=D0=B5=D0=B2=D0=BC?= =?UTF-8?q?=D0=B0=D1=82=D0=B8=D0=BA=D0=B8=20=D0=BF=D1=80=D0=B8=D1=88=D0=BB?= =?UTF-8?q?=D0=BE=D1=81=D1=8C=20=D1=83=D0=B2=D0=B5=D0=BB=D0=B8=D1=87=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=B7=D0=B0=D0=B4=D0=B5=D1=80=D0=B6=D0=BA=D1=83?= =?UTF-8?q?=20=D0=BD=D0=B0=20=D1=80=D0=B0=D0=B7=D0=BC=D1=8B=D0=BA=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=80=D0=B5=D0=BB=D0=B5-=D0=BF=D0=BE?= =?UTF-8?q?=D0=B2=D1=82=D0=BE=D1=80=D0=B8=D1=82=D0=B5=D0=BB=D1=8F,=20?= =?UTF-8?q?=D1=82=D0=B0=D0=BA=20=D0=BA=D0=B0=D0=BA=20=D0=B1=D0=B5=D0=B7=20?= =?UTF-8?q?=D0=BD=D0=B5=D0=B5=20=D0=B2=20=D0=BA=D0=BE=D0=BD=D1=86=D0=B5=20?= =?UTF-8?q?=D1=8D=D0=BB=D0=B5=D0=BA=D1=82=D1=80=D0=B8=D1=87=D0=B5=D1=81?= =?UTF-8?q?=D0=BA=D0=BE=D0=B3=D0=BE=20=D1=82=D0=BE=D1=80=D0=BC=D0=BE=D0=B6?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B8=D1=85=D0=BE=D0=B4?= =?UTF-8?q?=D1=8F=D1=82=20=D0=B2=D1=82=D0=BE=D1=80=D1=8B=D0=B5=20=D0=B2?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=D0=B8=D0=BB=D1=8F=20(=D0=A0=D0=923=20=D0=BD?= =?UTF-8?q?=D0=B5=20=D1=83=D1=81=D0=BF=D0=B5=D0=B2=D0=B0=D0=B5=D1=82=20?= =?UTF-8?q?=D0=B2=D0=BA=D0=BB=D1=8E=D1=87=D0=B8=D1=82=D1=8C=D1=81=D1=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/metrostroi/systems/sys_yar_27.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/metrostroi/systems/sys_yar_27.lua b/lua/metrostroi/systems/sys_yar_27.lua index 7cf39fe..198f659 100644 --- a/lua/metrostroi/systems/sys_yar_27.lua +++ b/lua/metrostroi/systems/sys_yar_27.lua @@ -15,7 +15,7 @@ function TRAIN_SYSTEM:Initialize(parameters) self.Train:LoadSystem("RV3","Relay","REV-813T",{ open_time = 2.3 }) -- Реле тока (РТ2) self.Train:LoadSystem("RT2","Relay","REV-830",{ trigger_level = 130 }) -- A - self.Train:LoadSystem("RT2r","Relay","REV-830",{ close_time = 0, open_time = 0.2 }) --UNREALISTIC Repeater for RT2 for MSK trains + self.Train:LoadSystem("RT2r","Relay","REV-830",{ close_time = 0, open_time = 0.6 }) --UNREALISTIC Repeater for RT2 for MSK trains -- Реле контроля тормозного тока (РКТТ) self.Train:LoadSystem("RKTT","Relay","R-52B") self.Train.RKTTsh = 1 From 51aaafb9cfa9f8578a9074c460c4c2aacce4b507 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 21:21:11 +0300 Subject: [PATCH 23/43] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=81=D1=80=D1=8B=D0=B2=D0=BD=D0=BE=D0=B9=20=D0=BA?= =?UTF-8?q?=D0=BB=D0=B0=D0=BF=D0=B0=D0=BD=20=D0=B8=20=D1=83=D0=B2=D0=B5?= =?UTF-8?q?=D0=BB=D0=B8=D1=87=D0=B8=D0=BB=20=D0=B3=D1=80=D0=BE=D0=BC=D0=BA?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D1=8C=20=D1=88=D0=B8=D0=BF=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=B2=D0=BE=D0=B7=D0=B4=D1=83=D1=85=D0=B0=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=20=D0=BE=D1=82=D0=BF=D1=83=D1=81=D0=BA=D0=B5=20?= =?UTF-8?q?=D0=B2=D0=B5=D0=BD=D1=82=D0=B8=D0=BB=D0=B5=D0=B9=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=BC=D0=B5=D1=89=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gmod_subway_81-717_mvm/cl_init.lua | 22 ++++++++++++++-- lua/entities/gmod_subway_81-717_mvm/init.lua | 4 +++ .../systems/sys_81_717_pneumatic.lua | 25 ++++++++++++------- 3 files changed, 40 insertions(+), 11 deletions(-) diff --git a/lua/entities/gmod_subway_81-717_mvm/cl_init.lua b/lua/entities/gmod_subway_81-717_mvm/cl_init.lua index ed390f8..3a294dc 100644 --- a/lua/entities/gmod_subway_81-717_mvm/cl_init.lua +++ b/lua/entities/gmod_subway_81-717_mvm/cl_init.lua @@ -2087,6 +2087,21 @@ ENT.ButtonMap["AirDistributor"] = { } } +ENT.ButtonMap["AutostopValve"] = { + pos = Vector(365.8,-67.6,-56), + ang = Angle(0,0,90), + width = 130, + height = 40, + scale = 0.1, + hideseat=0.1, + hide=true, + screenHide = true, + + buttons = { + {ID = "AutostopValveSet",x=0,y=0,w= 130,h = 40,tooltip="Сорвать срывной клапан"}, + } +} + for i=0,4 do ENT.ClientProps["TrainNumberL"..i] = { model = "models/metrostroi_train/common/bort_numbers.mdl", @@ -3190,8 +3205,8 @@ function ENT:Think() --self:SetSoundState("rolling_medium1",0 or rol40*rollings,rol40p) --57 self:SetSoundState("rolling_high2" ,rol70*rollings,rol70p) --70 - self.ReleasedPdT = math.Clamp(self.ReleasedPdT + 2*(-self:GetPackedRatio("BrakeCylinderPressure_dPdT",0)-self.ReleasedPdT)*dT,0,1) - local release1 = math.Clamp((self.ReleasedPdT-0.1)/0.8,0,1)^2 + self.ReleasedPdT = math.Clamp(self.ReleasedPdT + 2*(-self:GetPackedRatio("BrakeCylinderPressure_dPdT",0)-0.8*self.ReleasedPdT)*dT,0,1) + local release1 = math.Clamp((1.1*self.ReleasedPdT-0.1)/0.32,0,8)^2 self:SetSoundState("release1",release1,1) self:SetSoundState("release2",(math.Clamp(0.3-release1,0,0.3)/0.3)*(release1/0.3),1.0) local parking_brake = self:GetPackedRatio("ParkingBrakePressure_dPdT",0) @@ -3409,6 +3424,9 @@ function ENT:DrawPost() self:DrawOnPanel("AirDistributor",function() draw.DrawText(self:GetNW2Bool("AD") and "Air Distributor ON" or "Air Distributor OFF","Trebuchet24",0,0,Color(0,0,0,255)) end) + self:DrawOnPanel("AutostopValve",function() + draw.DrawText("Autostop Valve", "Trebuchet24",0,6,Color(0,0,0,255)) + end) end function ENT:OnButtonPressed(button) diff --git a/lua/entities/gmod_subway_81-717_mvm/init.lua b/lua/entities/gmod_subway_81-717_mvm/init.lua index 09fc955..241a84b 100644 --- a/lua/entities/gmod_subway_81-717_mvm/init.lua +++ b/lua/entities/gmod_subway_81-717_mvm/init.lua @@ -200,6 +200,10 @@ function ENT:Initialize() ID = "AirDistributorDisconnectToggle", Pos = Vector(-177, -66, -50), Radius = 20, }, + { + ID = "AutostopValveToggle", + Pos = Vector(377, -66, -50), Radius = 20, + }, } local vX = Angle(0,-90-0.2,56.3):Forward() -- For ARS panel diff --git a/lua/metrostroi/systems/sys_81_717_pneumatic.lua b/lua/metrostroi/systems/sys_81_717_pneumatic.lua index 307ccd2..5a7538c 100644 --- a/lua/metrostroi/systems/sys_81_717_pneumatic.lua +++ b/lua/metrostroi/systems/sys_81_717_pneumatic.lua @@ -175,8 +175,13 @@ function TRAIN_SYSTEM:TriggerInput(name,value) local HaveUAVA = not self.Train.SubwayTrain or not self.Train.SubwayTrain.ARS or not self.Train.SubwayTrain.ARS.NoUAVA if HaveUAVA and self.Train.UAVA.Value == 0 then self.EmergencyValve = true - self.Train.UAVAC:TriggerInput("Set",0) - if value > 0 then RunConsoleCommand("say","Autostop braking",self.Train:GetDriverName()) end + if value ~= 2 then + self.Train.UAVAC:TriggerInput("Set",0) + if not self.Train.autosaid then + self.Train.autosaid = true + RunConsoleCommand("say","Autostop braking",self.Train:GetDriverName()) + end + end end end end @@ -317,7 +322,9 @@ function TRAIN_SYSTEM:Think(dT) self.ParkingBrakePressure_dPdT = 0.0 self.WorkingChamberPressure_dPdT = 0.0 - self.KM013offset = self.KM013offset or math.random()*0.2 + 5.0 --регулировочное давление + local rnd = math.random(1,10) + local offs = 0.1 + self.KM013offset = self.KM013offset or math.Clamp(5.1 + (rnd >= 3 and rnd <= 7 and offs or -offs),5.0,5.2) -- Reduce pressure for brake line self.TrainToBrakeReducedPressure = math.min(self.KM013offset,self.TrainLinePressure) -- * 0.725) @@ -328,11 +335,10 @@ function TRAIN_SYSTEM:Think(dT) local HaveEPK = not Train.SubwayTrain or not Train.SubwayTrain.ARS or not Train.SubwayTrain.ARS.NoEPK local BLDisconnect,pr_speed = true,1 - ---[[ работа срывного клапана - if Train.AutostopValve.Value ~= 0 then - if self.BrakeLinePressure > 1.86 then self:TriggerInput("Autostop",1) end - Train.AutostopValve.Value = 0 - end--]] + -- работа срывного клапана + if Train.AutostopValve.Value > 0 then + self:TriggerInput("Autostop",self.BrakeLinePressure > 1.86 and 1 or 2) --value == 2 — просто открыть срывной клапан без размыкания контактов УАВА + end if self.ValveType == 1 then BLDisconnect = Train.DriverValveBLDisconnect.Value > 0 @@ -459,13 +465,14 @@ function TRAIN_SYSTEM:Think(dT) if self.EmergencyValveDisable then--and (self.BrakeLinePressure-self.OldBrakeLinePressure)>0.01 then self.EmergencyValveDisable=false self.EmergencyValve=false + Train.autosaid=false end self.OldBrakeLinePressure = self.BrakeLinePressure local leak = 0 if self.EmergencyValve then local leakst = BLDisconnect and math.max(0.3,math.log(80*self.BrakeLinePressure - 200,3)) or 1.1*(Train:GetWagonCount())*math.Clamp(self.BrakeLinePressure/4,0,1) leak = self:equalizePressure(dT,"BrakeLinePressure", 0.0,leakst)--,false,false,10) - if (self.BrakeLinePressure < 1.82 or Train.UAVA.Value > 0) then + if Train.UAVA.Value > 0 or (self.BrakeLinePressure < 1.82 and Train.AutostopValve.Value == 0) then --пока держим ЛКМ нажатой, срывной клапан открыт self.EmergencyValveDisable = true end self.Leak = true From 0ac09dce343aa6e7a8ba8c2964e89cabeea02d13 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 12:53:20 +0300 Subject: [PATCH 24/43] =?UTF-8?q?=D0=9D=D0=B5=D0=BE=D0=B1=D1=85=D0=BE?= =?UTF-8?q?=D0=B4=D0=B8=D0=BC=D1=8B=D0=B5=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B4=D0=BB=D1=8F=20=D0=B8=D0=BD?= =?UTF-8?q?=D0=B8=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D0=B8=20=D0=B4=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=B2=20=D1=80=D0=B0=D0=B1=D0=BE=D1=87=D0=B5=D0=B9=20=D0=BA?= =?UTF-8?q?=D0=B0=D0=BC=D0=B5=D1=80=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/entities/gmod_subway_81-717_mvm/shared.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/entities/gmod_subway_81-717_mvm/shared.lua b/lua/entities/gmod_subway_81-717_mvm/shared.lua index a9320e2..0446e8b 100644 --- a/lua/entities/gmod_subway_81-717_mvm/shared.lua +++ b/lua/entities/gmod_subway_81-717_mvm/shared.lua @@ -972,7 +972,7 @@ ENT.Spawner = { ent.ARS:TriggerInput("Set",(ent.Plombs.RC1 and val==1 and first) and 1 or 0) ent.ALS:TriggerInput("Set",val==1 and 1 or 0) ent.L_1:TriggerInput("Set",val==1 and 1 or 0) - ent.L_3:TriggerInput("Set",vall==1 and 1 or 0) + ent.L_3:TriggerInput("Set",val==1 and 1 or 0) ent.L_4:TriggerInput("Set",val==1 and 1 or 0) ent.EPK:TriggerInput("Set",(ent.Plombs.RC1 and val==1) and 1 or 0) _LastSpawner=CurTime() @@ -993,6 +993,7 @@ ENT.Spawner = { ent._SpawnerStarted = val end ent.Pneumatic.TrainLinePressure = val==3 and math.random()*4 or val==2 and 4.5+math.random()*3 or 7.6+math.random()*0.6 + ent.Pneumatic.WorkingChamberPressure = val==3 and math.random()*1.0 or val==2 and 4.0+math.random()*1.0 or 5.2 if val==4 then ent.Pneumatic.BrakeLinePressure = 5.2 end end}, --{"Lighter","Spawner.717.Lighter","Boolean"}, From 08a558b7371a945bf2c62a0ca00cd92998d22c33 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 21:18:36 +0300 Subject: [PATCH 25/43] =?UTF-8?q?=D0=A3=D0=B2=D0=B5=D0=BB=D0=B8=D1=87?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=80=D0=B0=D0=B4=D0=B8=D1=83=D1=81=20=D1=88?= =?UTF-8?q?=D0=B8=D0=BF=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=9A=D0=9C=20(=D1=80?= =?UTF-8?q?=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=BC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/entities/gmod_subway_81-717_mvm/shared.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lua/entities/gmod_subway_81-717_mvm/shared.lua b/lua/entities/gmod_subway_81-717_mvm/shared.lua index 0446e8b..0fc81a8 100644 --- a/lua/entities/gmod_subway_81-717_mvm/shared.lua +++ b/lua/entities/gmod_subway_81-717_mvm/shared.lua @@ -441,11 +441,11 @@ function ENT:InitializeSounds() self.SoundPositions["rear_isolation"] = {300,1e9,Vector(-456, 0,-63),1} self.SoundNames["crane013_brake"] = {loop=true,"subway_trains/common/pneumatic/release_2.wav"} - self.SoundPositions["crane013_brake"] = {80,1e9,Vector(431.5,-20.3,-12),0.86} + self.SoundPositions["crane013_brake"] = {400,1e9,Vector(431.5,-20.3,-12),0.86} self.SoundNames["crane013_brake2"] = {loop=true,"subway_trains/common/pneumatic/013_brake2.wav"} - self.SoundPositions["crane013_brake2"] = {80,1e9,Vector(431.5,-20.3,-12),0.86} + self.SoundPositions["crane013_brake2"] = {400,1e9,Vector(431.5,-20.3,-12),0.86} self.SoundNames["crane013_brake_l"] = {loop=true,"subway_trains/common/pneumatic/013_brake_loud2.wav"} - self.SoundPositions["crane013_brake_l"] = {80,1e9,Vector(431.5,-20.3,-12),0.7} + self.SoundPositions["crane013_brake_l"] = {400,1e9,Vector(431.5,-20.3,-12),0.7} self.SoundNames["crane013_release"] = {loop=true,"subway_trains/common/pneumatic/013_release.wav"} self.SoundPositions["crane013_release"] = {80,1e9,Vector(431.5,-20.3,-12),0.4} self.SoundNames["crane334_brake_high"] = {loop=true,"subway_trains/common/pneumatic/334_brake.wav"} @@ -975,6 +975,7 @@ ENT.Spawner = { ent.L_3:TriggerInput("Set",val==1 and 1 or 0) ent.L_4:TriggerInput("Set",val==1 and 1 or 0) ent.EPK:TriggerInput("Set",(ent.Plombs.RC1 and val==1) and 1 or 0) + ent.DriverValveDisconnect:TriggerInput("Set",(val==4 and first) and 1 or 0) _LastSpawner=CurTime() ent.CabinDoor = val==4 and first ent.PassengerDoor = val==4 From 0382c02bc2ee79c94e0169f6955cb82c92d6028a Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Tue, 21 Dec 2021 21:23:24 +0300 Subject: [PATCH 26/43] =?UTF-8?q?=D0=9E=D1=82=D0=BA=D1=80=D1=8B=D1=82?= =?UTF-8?q?=D1=8B=D0=B9=20=D1=80=D0=B0=D0=B7=D0=BE=D0=B1=D1=89=D0=B8=D1=82?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B9=20=D0=B2=20=D0=B3=D0=BE?= =?UTF-8?q?=D0=BB=D0=BE=D0=B2=D0=B5=20=D0=BF=D1=80=D0=B8=20=D1=81=D0=BF?= =?UTF-8?q?=D0=B0=D0=B2=D0=BD=D0=B5=20=D0=B2=20=D1=81=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=BE=D1=8F=D0=BD=D0=B8=D0=B8=20"=D0=B4=D0=B5=D0=BF=D0=BE"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/entities/gmod_subway_81-717_mvm_custom.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/entities/gmod_subway_81-717_mvm_custom.lua b/lua/entities/gmod_subway_81-717_mvm_custom.lua index 02ec7d7..dd16304 100644 --- a/lua/entities/gmod_subway_81-717_mvm_custom.lua +++ b/lua/entities/gmod_subway_81-717_mvm_custom.lua @@ -89,9 +89,10 @@ ENT.Spawner = { ent.ARS:TriggerInput("Set",(ent.Plombs.RC1 and val==1 and first) and 1 or 0) ent.ALS:TriggerInput("Set",val==1 and 1 or 0) ent.L_1:TriggerInput("Set",val==1 and 1 or 0) - ent.L_3:TriggerInput("Set",vall==1 and 1 or 0) + ent.L_3:TriggerInput("Set",val==1 and 1 or 0) ent.L_4:TriggerInput("Set",val==1 and 1 or 0) ent.EPK:TriggerInput("Set",(ent.Plombs.RC1 and val==1) and 1 or 0) + ent.DriverValveDisconnect:TriggerInput("Set",(val==4 and first) and 1 or 0) _LastSpawner=CurTime() ent.CabinDoor = val==4 and first ent.PassengerDoor = val==4 @@ -110,6 +111,7 @@ ENT.Spawner = { ent._SpawnerStarted = val end ent.Pneumatic.TrainLinePressure = val==3 and math.random()*4 or val==2 and 4.5+math.random()*3 or 7.6+math.random()*0.6 - if val==4 then ent.Pneumatic.BrakeLinePressure = 5.2 end + ent.Pneumatic.BrakeLinePressure = val == 4 and 5.2 or val == 1 and 2.3 or math.min(ent.Pneumatic.TrainLinePressure+0.25,math.random()*4) + ent.Pneumatic.WorkingChamberPressure = val==3 and math.random()*1.0 or val==2 and 4.0+math.random()*1.0 or 5.2 end}, } From ee9d66766da44389ede8b154aad6537fd6664e21 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Wed, 22 Dec 2021 23:46:42 +0300 Subject: [PATCH 27/43] =?UTF-8?q?=D0=A0=D0=B5=D0=B3=D1=83=D0=BB=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=BA=D0=B0=20=D0=B3=D1=80=D0=BE=D0=BC=D0=BA?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=B8=20=D1=88=D0=B8=D0=BF=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=B2=D0=BE=D0=B7=D0=B4=D1=83=D1=85=D0=B0=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=20=D0=BE=D1=82=D0=BF=D1=83=D1=81=D0=BA=D0=B5=20?= =?UTF-8?q?=D0=B2=D0=B5=D0=BD=D1=82=D0=B8=D0=BB=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/entities/gmod_subway_81-717_mvm/cl_init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/entities/gmod_subway_81-717_mvm/cl_init.lua b/lua/entities/gmod_subway_81-717_mvm/cl_init.lua index 3a294dc..3947b05 100644 --- a/lua/entities/gmod_subway_81-717_mvm/cl_init.lua +++ b/lua/entities/gmod_subway_81-717_mvm/cl_init.lua @@ -3206,7 +3206,7 @@ function ENT:Think() self:SetSoundState("rolling_high2" ,rol70*rollings,rol70p) --70 self.ReleasedPdT = math.Clamp(self.ReleasedPdT + 2*(-self:GetPackedRatio("BrakeCylinderPressure_dPdT",0)-0.8*self.ReleasedPdT)*dT,0,1) - local release1 = math.Clamp((1.1*self.ReleasedPdT-0.1)/0.32,0,8)^2 + local release1 = math.Clamp((1.1*self.ReleasedPdT-0.1)/0.48,0,8)^2 self:SetSoundState("release1",release1,1) self:SetSoundState("release2",(math.Clamp(0.3-release1,0,0.3)/0.3)*(release1/0.3),1.0) local parking_brake = self:GetPackedRatio("ParkingBrakePressure_dPdT",0) From 1193795258d519d10e1f8a42347b906e209b64a3 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Sat, 25 Dec 2021 16:35:07 +0300 Subject: [PATCH 28/43] =?UTF-8?q?=D0=A0=D0=B5=D0=B3=D1=83=D0=BB=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=BA=D0=B0=20=D1=82=D0=B5=D0=BC=D0=BF=D0=B0?= =?UTF-8?q?=20=D1=80=D0=B0=D0=B7=D1=80=D1=8F=D0=B4=D0=BA=D0=B8=20=D0=A2?= =?UTF-8?q?=D0=A6=20=D0=BF=D1=80=D0=B8=20=D0=BE=D1=82=D0=BF=D1=83=D1=81?= =?UTF-8?q?=D0=BA=D0=B5=20=D0=B2=D1=82=D0=BE=D1=80=D1=8B=D1=85=20=D0=B2?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=D0=B8=D0=BB=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/metrostroi/systems/sys_81_717_pneumatic.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/metrostroi/systems/sys_81_717_pneumatic.lua b/lua/metrostroi/systems/sys_81_717_pneumatic.lua index 5a7538c..9fec698 100644 --- a/lua/metrostroi/systems/sys_81_717_pneumatic.lua +++ b/lua/metrostroi/systems/sys_81_717_pneumatic.lua @@ -546,7 +546,8 @@ function TRAIN_SYSTEM:Think(dT) end self.BePN2 = true else - self.PN2 = math.max(0,self.PN2-math.exp(1.2*(self.BrakeCylinderPressure - self.GN2Offset))*0.2) + --self.PN2 = math.max(0,self.PN2-0.7*math.exp(3.0*(self.BrakeCylinderPressure - self.GN2Offset - self.WeightLoadRatio*1.3)+1.6)) + self.PN2 = 0.3*math.exp(0.8*(self.BrakeCylinderPressure - dT) - 1) - 0.16 end local targetPres = math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - (self.BrakeLinePressure < 3.6 and self.BrakeLinePressure*self.WorkingChamberPressure/6.5 or self.BrakeLinePressure*1.028))) + (self.BrakeLinePressure_dPdT < 0 and self.WeightLoadRatio*1.3 or 0)) --local targetPres = math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - (self.BrakeLinePressure < 3.56 and (self.BrakeLinePressure - 3)*5.56 or self.BrakeLinePressure*1.028)) + (self.BrakeLinePressure_dPdT < 0 and self.WeightLoadRatio*1.3 or 0))) @@ -565,7 +566,6 @@ function TRAIN_SYSTEM:Think(dT) end if self.BrakeCylinderValve == 1 then self:equalizePressure(dT,"BrakeCylinderPressure", math.min(self.GN2Offset + self.WeightLoadRatio*1.3,targetPressure), 1, (self.BrakeLinePressure > (self.KM013offset+0.1)) and (self.PN2 == 0) and (self.PN1 == 0) and 1.0 or 3.5, nil, (self.BrakeLinePressure_dPdT > 0.1) and (0.8+math.Clamp((1 - self.BrakeCylinderPressure)*0.8,0,1.2)) or 1) - --self:equalizePressure(dT,"BrakeCylinderPressure", math.min(self.GN2Offset + self.WeightLoadRatio*1.3,targetPressure), 0.5+math.Clamp((self.BrakeCylinderPressure-0.5)/2.8,0,0.9), (self.BrakeLinePressure > (self.KM013offset+0.1)) and (self.PN2 == 0) and (self.PN1 == 0) and 0.8 or 3.5, nil, (self.BrakeLinePressure_dPdT > 0.1) and (0.8+math.Clamp((1 - self.BrakeCylinderPressure)*0.8,0,1)) or 1) end trainLineConsumption_dPdT = trainLineConsumption_dPdT + math.max(0,self.BrakeCylinderPressure_dPdT*0.5) elseif Train.AirDistributorDisconnect.Value ~= 0 then From 7026c09e7347466fdcd8ee75966c1fdd13d5e750 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Wed, 5 Jan 2022 01:13:24 +0300 Subject: [PATCH 29/43] =?UTF-8?q?=D0=9E=D0=BA=D0=BE=D0=BD=D1=87=D0=B0?= =?UTF-8?q?=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5=20=D0=B8=D0=B7=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2=20=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=BC=D0=BE=D0=B7=D0=BD=D0=BE=D0=B9=20=D0=BF=D0=BD=D0=B5?= =?UTF-8?q?=D0=B2=D0=BC=D0=B0=D1=82=D0=B8=D0=BA=D0=B5=20(+=D0=90=D0=A0?= =?UTF-8?q?=D0=A1=20=D0=91=D0=98=D0=A1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../systems/sys_81_717_pneumatic.lua | 55 +++++++++---------- .../systems/sys_als_ars_bis200a.lua | 1 - 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/lua/metrostroi/systems/sys_81_717_pneumatic.lua b/lua/metrostroi/systems/sys_81_717_pneumatic.lua index 9fec698..43a1adc 100644 --- a/lua/metrostroi/systems/sys_81_717_pneumatic.lua +++ b/lua/metrostroi/systems/sys_81_717_pneumatic.lua @@ -50,6 +50,7 @@ function TRAIN_SYSTEM:Initialize(parameters) self.WCChargeValve = true self.PN1 = 0 self.PN2 = 0 + self.cranPres = 0 --DKPT self.Train:LoadSystem("DKPT","Relay","R-52B") -- @@ -311,7 +312,7 @@ end function TRAIN_SYSTEM:Think(dT) local Train = self.Train self.WeightLoadRatio = math.max(0,math.min(1,(Train:GetNW2Float("PassengerCount")/200))) - + --self.WeightLoadRatio = (Train.R_ZS and Train.R_ZS.Value > 0 and 0.5 or 0) + (Train.R_G and Train.R_G.Value > 0 and 0.5 or 0) ---------------------------------------------------------------------------- -- Accumulate derivatives self.TrainLinePressure_dPdT = 0.0 @@ -402,7 +403,7 @@ function TRAIN_SYSTEM:Think(dT) -- 013: 2 Normal pressure if (self.RealDriverValvePosition == 2) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > 1.01*math.min(self.KM013offset,self.TrainToBrakeReducedPressure)) then - self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(self.KM013offset,self.TrainToBrakeReducedPressure), pr_speed,pr_speed*0.35, nil, 1.0)-- nil, 1.0) + self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(self.KM013offset,self.TrainToBrakeReducedPressure), pr_speed,pr_speed*0.4, nil, 1.0)-- nil, 1.0) end -- 013: 3 4.3 Atm @@ -468,11 +469,12 @@ function TRAIN_SYSTEM:Think(dT) Train.autosaid=false end self.OldBrakeLinePressure = self.BrakeLinePressure - local leak = 0 - if self.EmergencyValve then - local leakst = BLDisconnect and math.max(0.3,math.log(80*self.BrakeLinePressure - 200,3)) or 1.1*(Train:GetWagonCount())*math.Clamp(self.BrakeLinePressure/4,0,1) - leak = self:equalizePressure(dT,"BrakeLinePressure", 0.0,leakst)--,false,false,10) - if Train.UAVA.Value > 0 or (self.BrakeLinePressure < 1.82 and Train.AutostopValve.Value == 0) then --пока держим ЛКМ нажатой, срывной клапан открыт + local leak = 0 --math.log(80*self.BrakeLinePressure - 200,3) + if self.EmergencyValve then --math.log(self.BrakeLinePressure,1.25) - 2.5 + --local leakst = BLDisconnect and math.max(0.3,math.log(self.BrakeLinePressure,1.2) - 2.5) or 1.1*(Train:GetWagonCount())*math.Clamp(self.BrakeLinePressure/4,0,1) + local leakst = BLDisconnect and math.max(0.3,math.log(self.BrakeLinePressure,1.2) - 2.5) or math.max(1.6,math.log(0.63*self.BrakeLinePressure,1.15)) + leak = self:equalizePressure(dT,"BrakeLinePressure", 0.0,leakst*wagc/6)--,false,false,10) + if Train.UAVA.Value > 0 or (self.BrakeLinePressure < 1.8 and Train.AutostopValve.Value == 0) then --пока держим ЛКМ нажатой, срывной клапан открыт self.EmergencyValveDisable = true end self.Leak = true @@ -502,7 +504,7 @@ function TRAIN_SYSTEM:Think(dT) self.dlreadtimer = self.dlreadtimer or CurTime() if CurTime() - self.dlreadtimer > 1.0 then self.dlreadtimer = CurTime() - if Train:GetWagonNumber() == 8530 then + if Train:GetWagonNumber() == 8938 then PrintMessage(HUD_PRINTTALK, Format("Вагон %u; ТМ dPdT = %.3f; Раб. кам. = %.3f",Train:GetWagonNumber(),self.BrakeLinePressure_dPdT,self.WorkingChamberPressure)) end end @@ -526,17 +528,17 @@ function TRAIN_SYSTEM:Think(dT) self.GN2Offset = self.GN2Offset or math.random(20,100)*0.002 + _offset2 local _offset1 = self.Train.AR63 and 0.9 or 0.8 self.GN1Offset = self.GN1Offset or math.random(20,100)*0.002 + _offset1 - local _vz1pressure = self.GN1Offset + self.WeightLoadRatio*0.7 - self.BcBl = self.BcBl or self.GN2Offset/(self.KM013offset - 3.24) + self.BcBl = (self.GN2Offset + self.WeightLoadRatio*1.3)/1.93 if Train.AirDistributorDisconnect.Value == 0 and self.AirDistributorReady then -- Valve #1 if (Train.PneumaticNo1.Value == 1.0) and (Train.PneumaticNo2.Value == 0.0) then - if self.PN1 < _vz1pressure then - --1,2 - self.PN1 = math.min(self.TrainLinePressure,_vz1pressure) + if self.PN1 < self.GN1Offset then + self.PN1 = math.min(self.TrainLinePressure,self.GN1Offset) end - else - self.PN1 = math.max(0,self.PN1-math.exp(3.6*(self.BrakeCylinderPressure - self.GN1Offset))*0.12) + elseif Train.PneumaticNo1.Value == 0 and self.PN1 > 0.0 then + --self.PN1 = math.max(0,self.PN1-math.exp(3.6*(self.BrakeCylinderPressure - self.GN1Offset))*0.12) + self.PN1 = math.max(0,self.PN1-math.exp(3.6*(self.BrakeCylinderPressure - self.GN1Offset))*1.7*dT) + --self.PN1 = math.exp(8*(self.PN1 - dT) - 8.1) end -- Valve #2 if Train.PneumaticNo2.Value == 1.0 then @@ -545,19 +547,15 @@ function TRAIN_SYSTEM:Think(dT) Train:PlayOnce("PN2end","stop") end self.BePN2 = true - else - --self.PN2 = math.max(0,self.PN2-0.7*math.exp(3.0*(self.BrakeCylinderPressure - self.GN2Offset - self.WeightLoadRatio*1.3)+1.6)) - self.PN2 = 0.3*math.exp(0.8*(self.BrakeCylinderPressure - dT) - 1) - 0.16 + elseif self.PN2 > 0.0 then + self.PN2 = math.max(0,self.PN2-math.exp(1.26*(self.BrakeCylinderPressure - self.GN2Offset))*2.4*dT) + --self.PN2 = 0.3*math.exp(0.6*(self.BrakeCylinderPressure - dT) - 1) - 0.11 end - local targetPres = math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - (self.BrakeLinePressure < 3.6 and self.BrakeLinePressure*self.WorkingChamberPressure/6.5 or self.BrakeLinePressure*1.028))) + (self.BrakeLinePressure_dPdT < 0 and self.WeightLoadRatio*1.3 or 0)) - --local targetPres = math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - (self.BrakeLinePressure < 3.56 and (self.BrakeLinePressure - 3)*5.56 or self.BrakeLinePressure*1.028)) + (self.BrakeLinePressure_dPdT < 0 and self.WeightLoadRatio*1.3 or 0))) - --[[if self.BCPressure < targetPres then - self.BCPressure = math.min(targetPres,self.BCPressure+(0.5+math.max(0,(targetPres-self.BCPressure)-0.2)*0.6)*dT) - elseif self.BCPressure > targetPres then - self.BCPressure = math.max(targetPres,self.BCPressure-2*dT) - end--]] - --local targetPressure = self.PN1+self.PN2+self.BCPressure - local targetPressure = self.PN1+self.PN2+targetPres + --local cranPres = math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - self.BrakeLinePressure)*(self.BrakeLinePressure < 3.6 and (6.2 - self.WorkingChamberPressure) or 1)))--- + --local cranPres = math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - (self.BrakeLinePressure < 3.6 and (self.BrakeLinePressure - 3.0)*0.45*self.WorkingChamberPressure/(self.BrakeLinePressure - 3.0) or self.BrakeLinePressure*(self.BrakeLinePressure > 4.5 and self.BrakeLinePressure_dPdT > 0.02 and 1.06 or 1)))*(self.BrakeLinePressure > self.KM013offset and 0.6 or 1))) + local WcBl = (self.BrakeLinePressure < 3.55 and 0.45*self.WorkingChamberPressure or self.BrakeLinePressure > 3.65 and self.BrakeLinePressure*(self.BrakeLinePressure > 4.5 and self.BrakeLinePressure_dPdT > 0.02 and 1.06 or 1)) + self.cranPres = WcBl and math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - WcBl)*(self.BrakeLinePressure > self.KM013offset and 0.6 or 1))) or self.cranPres + local targetPressure = (self.cranPres < (self.PN1 + self.WeightLoadRatio*0.7) and (Train.PneumaticNo1.Value == 1.0) and (self.PN1 + self.WeightLoadRatio*0.7) or self.PN1) + self.PN2 + self.cranPres if math.abs(self.BrakeCylinderPressure - targetPressure) > 0.150 then self.BrakeCylinderValve = 1 end @@ -565,7 +563,8 @@ function TRAIN_SYSTEM:Think(dT) self.BrakeCylinderValve = 0 end if self.BrakeCylinderValve == 1 then - self:equalizePressure(dT,"BrakeCylinderPressure", math.min(self.GN2Offset + self.WeightLoadRatio*1.3,targetPressure), 1, (self.BrakeLinePressure > (self.KM013offset+0.1)) and (self.PN2 == 0) and (self.PN1 == 0) and 1.0 or 3.5, nil, (self.BrakeLinePressure_dPdT > 0.1) and (0.8+math.Clamp((1 - self.BrakeCylinderPressure)*0.8,0,1.2)) or 1) + --self:equalizePressure(dT,"BrakeCylinderPressure", math.min(self.GN2Offset + self.WeightLoadRatio*1.3,targetPressure), 1, 3.5, nil, (self.BrakeLinePressure_dPdT > 0.02) and (0.9+math.Clamp((1 - self.BrakeCylinderPressure)*0.9,0,1.8)) or 1) + self:equalizePressure(dT,"BrakeCylinderPressure", math.min(self.GN2Offset + self.WeightLoadRatio*1.3,targetPressure), 1, 3.5, nil, 1) end trainLineConsumption_dPdT = trainLineConsumption_dPdT + math.max(0,self.BrakeCylinderPressure_dPdT*0.5) elseif Train.AirDistributorDisconnect.Value ~= 0 then diff --git a/lua/metrostroi/systems/sys_als_ars_bis200a.lua b/lua/metrostroi/systems/sys_als_ars_bis200a.lua index 92a36bb..56262b6 100644 --- a/lua/metrostroi/systems/sys_als_ars_bis200a.lua +++ b/lua/metrostroi/systems/sys_als_ars_bis200a.lua @@ -57,7 +57,6 @@ end function TRAIN_SYSTEM:Think(dT) local Train = self.Train local speed = Train.ALSCoil.Speed - --vv При торможении смещение на 2км\ч vv ----[[ if true or self.SpeedDec then From 57df2595ecc9622bc7804a97966b3cf2f264e3a4 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Wed, 12 Jan 2022 02:32:11 +0300 Subject: [PATCH 30/43] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20?= =?UTF-8?q?=D1=81=D1=82=D0=B8=D0=BB=D0=B8=D1=81=D1=82=D0=B8=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=B4=D0=B0=20=D0=B2=20=D1=81=D0=BE=D0=BE=D1=82?= =?UTF-8?q?=D0=B2=D0=B5=D1=82=D1=81=D1=82=D0=B2=D0=B8=D0=B8=20=D1=81=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=BC=D0=B5=D1=87=D0=B0=D0=BD=D0=B8=D1=8F=D0=BC?= =?UTF-8?q?=D0=B8=20=D1=80=D0=B5=D0=B2=D1=8C=D1=8E=D0=B5=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/entities/gmod_subway_81-717_mvm/init.lua | 10 ++++++++-- lua/entities/gmod_subway_81-717_mvm/shared.lua | 2 +- lua/entities/gmod_subway_81-717_mvm_custom.lua | 4 ++-- lua/metrostroi/systems/sys_81_714_electric.lua | 2 +- lua/metrostroi/systems/sys_81_717_electric.lua | 8 +------- lua/metrostroi/systems/sys_81_717_pneumatic.lua | 10 +++++----- lua/metrostroi/systems/sys_yar_13b.lua | 5 +++-- 7 files changed, 21 insertions(+), 20 deletions(-) diff --git a/lua/entities/gmod_subway_81-717_mvm/init.lua b/lua/entities/gmod_subway_81-717_mvm/init.lua index eadf909..412fc78 100644 --- a/lua/entities/gmod_subway_81-717_mvm/init.lua +++ b/lua/entities/gmod_subway_81-717_mvm/init.lua @@ -561,7 +561,7 @@ function ENT:Think() local power = Panel.V1 > -1.5 local brightness = math.min(1,Panel.Headlights1)*0.60 + math.min(1,Panel.Headlights2)*0.40 - + local T = {} self:SetPackedBool("Headlights1",Panel.Headlights1 > 0) self:SetPackedBool("Headlights2",Panel.Headlights2 > 0) @@ -588,7 +588,13 @@ function ENT:Think() self:SetPackedBool("lightsActive"..i,false) end end - + + -- "" 54 + T[4] = self:ReadTrainWire(4) + T[5] = self:ReadTrainWire(5) + if T[4]*T[5] > 0 then + self.A54:TriggerInput("Set",0) + end -- Door button lights self:SetPackedBool("DoorsLeftL",Panel.DoorsLeft > 0.5) diff --git a/lua/entities/gmod_subway_81-717_mvm/shared.lua b/lua/entities/gmod_subway_81-717_mvm/shared.lua index 77d7823..3b92104 100644 --- a/lua/entities/gmod_subway_81-717_mvm/shared.lua +++ b/lua/entities/gmod_subway_81-717_mvm/shared.lua @@ -978,7 +978,7 @@ ENT.Spawner = { ent.L_3:TriggerInput("Set",val==1 and 1 or 0) ent.L_4:TriggerInput("Set",val==1 and 1 or 0) ent.EPK:TriggerInput("Set",(ent.Plombs.RC1 and val==1) and 1 or 0) - ent.DriverValveDisconnect:TriggerInput("Set",(val==4 and first) and 1 or 0) + ent.DriverValveDisconnect:TriggerInput("Set",(val==4 and first) and 1 or 0) _LastSpawner=CurTime() ent.CabinDoor = val==4 and first ent.PassengerDoor = val==4 diff --git a/lua/entities/gmod_subway_81-717_mvm_custom.lua b/lua/entities/gmod_subway_81-717_mvm_custom.lua index bdfba15..843d2be 100644 --- a/lua/entities/gmod_subway_81-717_mvm_custom.lua +++ b/lua/entities/gmod_subway_81-717_mvm_custom.lua @@ -92,7 +92,7 @@ ENT.Spawner = { ent.L_3:TriggerInput("Set",val==1 and 1 or 0) ent.L_4:TriggerInput("Set",val==1 and 1 or 0) ent.EPK:TriggerInput("Set",(ent.Plombs.RC1 and val==1) and 1 or 0) - ent.DriverValveDisconnect:TriggerInput("Set",(val==4 and first) and 1 or 0) + ent.DriverValveDisconnect:TriggerInput("Set",(val==4 and first) and 1 or 0) _LastSpawner=CurTime() ent.CabinDoor = val==4 and first ent.PassengerDoor = val==4 @@ -111,7 +111,7 @@ ENT.Spawner = { ent._SpawnerStarted = val end ent.Pneumatic.TrainLinePressure = val==3 and math.random()*4 or val==2 and 4.5+math.random()*3 or 7.6+math.random()*0.6 - ent.Pneumatic.BrakeLinePressure = val == 4 and 5.2 or val == 1 and 2.3 or math.min(ent.Pneumatic.TrainLinePressure+0.25,math.random()*4) + ent.Pneumatic.BrakeLinePressure = val == 4 and 5.2 or val == 1 and 2.3 or math.min(ent.Pneumatic.TrainLinePressure+0.25,math.random()*4) ent.Pneumatic.WorkingChamberPressure = val==3 and math.random()*1.0 or val==2 and 4.0+math.random()*1.0 or 5.2 end}, } diff --git a/lua/metrostroi/systems/sys_81_714_electric.lua b/lua/metrostroi/systems/sys_81_714_electric.lua index b597ac3..696fd1e 100644 --- a/lua/metrostroi/systems/sys_81_714_electric.lua +++ b/lua/metrostroi/systems/sys_81_714_electric.lua @@ -78,7 +78,7 @@ function TRAIN_SYSTEM:SolveAllInternalCircuits(Train,dT,firstIter) if isMVM then Train:WriteTrainWire(71,S["33D"]*Train.OtklBV.Value) end - Train.RPvozvrat.VozRpPressed = T[17]~=0 + Train.RPvozvrat.VozRpPressed = T[17] --Вагонная часть S["10A"] = BO*Train.A30.Value S["ZR"] = (1-Train.RRP.Value)+(B*Train.A39.Value*(1-Train.RPvozvrat.Value)*Train.RRP.Value)*-1 diff --git a/lua/metrostroi/systems/sys_81_717_electric.lua b/lua/metrostroi/systems/sys_81_717_electric.lua index c1bcce0..c3e7644 100644 --- a/lua/metrostroi/systems/sys_81_717_electric.lua +++ b/lua/metrostroi/systems/sys_81_717_electric.lua @@ -89,11 +89,6 @@ function TRAIN_SYSTEM:SolveAllInternalCircuits(Train,dT,firstIter) Train:WriteTrainWire(5,S["10AK"]*KV["10AK-5"] + KRU["5/3-ZM31"]*-10) Train:WriteTrainWire(4,S["10AK"]*KV["10AK-4"] + --[[max(0,min(1,T[4])*KV["4-0"]*-10)]]KV["4-0"]*-10) - if T[4]*KV["4-0"] ~= 0 then - Train.A54:TriggerInput("Set",0) - Train:WriteTrainWire(5,0) - end - --Train:WriteTrainWire(4,S["10AK"]*KV["10AK-4"]*(1-T[4]*KV["4-0"]*-10)) Panel.LST = T[6]*Train.A40.Value Panel.LhRK = (T[2]+T[-2])*Train.A57.Value @@ -455,8 +450,7 @@ function TRAIN_SYSTEM:SolveAllInternalCircuits(Train,dT,firstIter) Panel.L1 = T[57] end Panel.M8 = S["V2"]*Train.PVK.Value - Train.RPvozvrat.VozRpPressed = T[17]~=0 - + Train.RPvozvrat.VozRpPressed = T[17] Train.C1:TriggerInput("Set", T[1]) Panel.IST = Train.C1.Value*Train.VKST.Value*T[64] diff --git a/lua/metrostroi/systems/sys_81_717_pneumatic.lua b/lua/metrostroi/systems/sys_81_717_pneumatic.lua index 40c3a98..f7579c9 100644 --- a/lua/metrostroi/systems/sys_81_717_pneumatic.lua +++ b/lua/metrostroi/systems/sys_81_717_pneumatic.lua @@ -323,7 +323,7 @@ function TRAIN_SYSTEM:Think(dT) self.ReservoirPressure_dPdT = 0.0 self.BrakeCylinderPressure_dPdT = 0.0 self.ParkingBrakePressure_dPdT = 0.0 - self.WorkingChamberPressure_dPdT = 0.0 + self.WorkingChamberPressure_dPdT = 0.0 local rnd = math.random(1,10) local offs = 0.1 @@ -400,7 +400,7 @@ function TRAIN_SYSTEM:Think(dT) local TLDisconnect = self.DisconnectType and Train.DriverValveTLDisconnect.Value > 0 or Train.DriverValveDisconnect.Value > 0 -- 013: 1 Overcharge if (self.RealDriverValvePosition == 1) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > self.TrainLinePressure) then - self:equalizePressure(dT,"BrakeLinePressure", math.min(6.4,self.TrainLinePressure), pr_speed,pr_speed*0.35, nil, 1.0) + self:equalizePressure(dT,"BrakeLinePressure", math.min(6.4,self.TrainLinePressure), pr_speed,pr_speed*0.35, nil, 1.0) end -- 013: 2 Normal pressure @@ -468,13 +468,13 @@ function TRAIN_SYSTEM:Think(dT) if self.EmergencyValveDisable then--and (self.BrakeLinePressure-self.OldBrakeLinePressure)>0.01 then self.EmergencyValveDisable=false self.EmergencyValve=false - Train.autosaid=false + Train.autosaid=false end self.OldBrakeLinePressure = self.BrakeLinePressure local leak = 0 --math.log(80*self.BrakeLinePressure - 200,3) if self.EmergencyValve then --math.log(self.BrakeLinePressure,1.25) - 2.5 --local leakst = BLDisconnect and math.max(0.3,math.log(self.BrakeLinePressure,1.2) - 2.5) or 1.1*(Train:GetWagonCount())*math.Clamp(self.BrakeLinePressure/4,0,1) - local leakst = BLDisconnect and math.max(0.3,math.log(self.BrakeLinePressure,1.2) - 2.5) or math.max(1.6,math.log(0.63*self.BrakeLinePressure,1.15)) + local leakst = BLDisconnect and math.max(0.3,math.log(self.BrakeLinePressure,1.2) - 2.5) or math.max(1.6,math.log(0.63*self.BrakeLinePressure,1.15)) leak = self:equalizePressure(dT,"BrakeLinePressure", 0.0,leakst*wagc/6)--,false,false,10) if Train.UAVA.Value > 0 or (self.BrakeLinePressure < 1.8 and Train.AutostopValve.Value == 0) then --пока держим ЛКМ нажатой, срывной клапан открыт self.EmergencyValveDisable = true @@ -518,7 +518,7 @@ function TRAIN_SYSTEM:Think(dT) if self.WCChargeValve == true then self:equalizePressure(dT,"WorkingChamberPressure",self.BrakeLinePressure,0.187,nil,nil,1.0) --simulate 0.8mm hole btw BL and working chambers end - self.AirDistributorReady = self.WorkingChamberPressure >= 2.2 + self.AirDistributorReady = self.WorkingChamberPressure >= 2.2 self.WCChargeValve = not ((self.WorkingChamberPressure - self.BrakeLinePressure) > 0.2 and (self.WorkingChamberPressure - self.BrakeLinePressure) < 2.5) self.OverchargeReleaseValve = self.WorkingChamberPressure > 5.2 and not self.WCChargeValve if self.OverchargeReleaseValve then diff --git a/lua/metrostroi/systems/sys_yar_13b.lua b/lua/metrostroi/systems/sys_yar_13b.lua index 82da9b9..2a6c0fa 100644 --- a/lua/metrostroi/systems/sys_yar_13b.lua +++ b/lua/metrostroi/systems/sys_yar_13b.lua @@ -30,7 +30,7 @@ function TRAIN_SYSTEM:Initialize() latched = true, -- RPvozvrat latches into place power_open = "None", -- Power source for the open signal power_close = "Mechanical", -- Power source for the close signal - VozRpPressed = false, -- Added to override the blocking action of the energized RP relays on RPVozvrat + VozRpPressed = false, -- Added to override the blocking action of the energized RP relays on RPVozvrat }) -- Реле времени РВ1 @@ -94,7 +94,8 @@ function TRAIN_SYSTEM:Think() end --self.RUTTarget = 250 + 150*self.Train.Pneumatic.WeightLoadRatio -- RPvozvrat operation - Train.RPvozvrat:TriggerInput("Close", not Train.RPvozvrat.VozRpPressed and + local A = Train.RPvozvrat.VozRpPressed ~= 0 + Train.RPvozvrat:TriggerInput("Close", not A and ((Train.DR1.Value == 1.0) or (Train.DR2.Value == 1.0) or (Train.RPL.Value == 1.0) or From 701da5fe9d416d083380f0beeee94f1c4f7b6ffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=91=CE=BB=CE=AD=CE=BE=CE=B1=CE=BD=CE=B4=CF=81=CE=BF?= =?UTF-8?q?=CF=82?= <31768135+alexandr-sizov@users.noreply.github.com> Date: Wed, 12 Jan 2022 20:19:01 +0300 Subject: [PATCH 31/43] Delete sys_als_ars_bis200a.lua MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ошибочно закоммичен --- .../systems/sys_als_ars_bis200a.lua | 105 ------------------ 1 file changed, 105 deletions(-) delete mode 100644 lua/metrostroi/systems/sys_als_ars_bis200a.lua diff --git a/lua/metrostroi/systems/sys_als_ars_bis200a.lua b/lua/metrostroi/systems/sys_als_ars_bis200a.lua deleted file mode 100644 index 3296856..0000000 --- a/lua/metrostroi/systems/sys_als_ars_bis200a.lua +++ /dev/null @@ -1,105 +0,0 @@ --------------------------------------------------------------------------------- --- ARS-D/ARS-Ezh3/BKBD safety system BIS-200 unit --------------------------------------------------------------------------------- --- Copyright (C) 2013-2018 Metrostroi Team & FoxWorks Aerospace s.r.o. --- Contains proprietary code. See license.txt for additional information. --------------------------------------------------------------------------------- -Metrostroi.DefineSystem("ALS_ARS_BIS200") -TRAIN_SYSTEM.DontAccelerateSimulation = false - -function TRAIN_SYSTEM:Initialize() - self.Train:LoadSystem("BIS_R0","Relay","ARS",{open_time=7,bass=true,bass_separate=true}) - self.Train:LoadSystem("BIS_PR0","Relay","ARS",{bass=true,bass_separate=true}) - self.Train:LoadSystem("BIS_R1","Relay","ARS",{bass=true,bass_separate=true}) - self.Train:LoadSystem("BIS_R2","Relay","ARS",{bass=true,bass_separate=true}) - self.Train:LoadSystem("BIS_R3","Relay","ARS",{bass=true,bass_separate=true}) - self.Train:LoadSystem("BIS_R4","Relay","ARS",{bass=true,bass_separate=true}) - self.Train:LoadSystem("BIS_R5","Relay","ARS",{bass=true,bass_separate=true}) - self.Train:LoadSystem("BIS_R6","Relay","ARS",{bass=true,bass_separate=true}) - self.Train:LoadSystem("BIS_R7","Relay","ARS",{bass=true,bass_separate=true}) - self.Train:LoadSystem("BIS_R8","Relay","ARS",{bass=true,bass_separate=true}) - self.Train:LoadSystem("BIS_R10","Relay","ARS",{bass=true,bass_separate=true}) - - self.Power = 0 - self.R0 = 0 - self.Speed = 0 - - self.SAdd = 0 -end - -function TRAIN_SYSTEM:Outputs() - return {} -end - -function TRAIN_SYSTEM:Inputs() - return {"SpeedDec"} -end - -function TRAIN_SYSTEM:TriggerInput(name,value) - if name == "SpeedDec" then self.SpeedDec = value > 0 end -end - -local function C(val) - return val and 1 or 0 -end ---[[local function inrange(val,min,max) - return C(min < val and val < max) -end]] - -local function inrange(val,min,max,min2,max2,state) - if state then - return C(min2 < val and val < max2) - else - return C(min < val and val < max) - end -end - -function TRAIN_SYSTEM:Think(dT) - local Train = self.Train - local speed = Train.ALSCoil.Speed - --vv При торможении смещение на 2км\ч vv - ----[[ - if self.SpeedDec then - Train.BIS_R1:TriggerInput("Set", self.Power*inrange(speed,5.5,11.5 ,3.5 ,14.0 ,Train.BIS_R1.Value > 0)) - Train.BIS_R2:TriggerInput("Set", self.Power*inrange(speed,10 ,21.5 ,8.2 ,25.7 ,Train.BIS_R2.Value > 0)) - Train.BIS_R3:TriggerInput("Set", self.Power*inrange(speed,20 ,31.5 ,17.6,35.7 ,Train.BIS_R3.Value > 0)) - Train.BIS_R4:TriggerInput("Set", self.Power*inrange(speed,30 ,41.5 ,27.6,45.7 ,Train.BIS_R4.Value > 0)) - Train.BIS_R5:TriggerInput("Set", self.Power*inrange(speed,40 ,51.5 ,37.6,55.7 ,Train.BIS_R5.Value > 0)) - Train.BIS_R6:TriggerInput("Set", self.Power*inrange(speed,50 ,61.5 ,47.3,65.7 ,Train.BIS_R6.Value > 0)) - Train.BIS_R7:TriggerInput("Set", self.Power*inrange(speed,60 ,71.5 ,56.7,75.6 ,Train.BIS_R7.Value > 0)) - Train.BIS_R8:TriggerInput("Set", self.Power*inrange(speed,70 ,81.5 ,66.7,85.7 ,Train.BIS_R8.Value > 0)) - Train.BIS_R10:TriggerInput("Set",self.Power*inrange(speed,80 ,101.5,74.5,108.4,Train.BIS_R10.Value > 0)) - - --[[ - if speed > self.Speed then - self.SAdd = math.min(1,math.max(-0.3,self.SAdd-(speed-self.Speed)*0.6)) - else - self.SAdd = math.min(1,math.max(-0.3,self.SAdd-(speed-self.Speed)*0.3)) - end - local add = math.max(0,self.SAdd) - --self.R0 = self.Power*C(speed<7)--11.5) - Train.BIS_R1:TriggerInput("Set", self.Power*inrange(speed,5.5-add*2 ,11.5 +add*2.5)) - Train.BIS_R2:TriggerInput("Set", self.Power*inrange(speed,10 -add*1.8,21.5 +add*4.2)) - Train.BIS_R3:TriggerInput("Set", self.Power*inrange(speed,20 -add*2.4,31.5 +add*4.2)) - Train.BIS_R4:TriggerInput("Set", self.Power*inrange(speed,30 -add*2.4,41.5 +add*4.2)) - Train.BIS_R5:TriggerInput("Set", self.Power*inrange(speed,40 -add*2.4,51.5 +add*4.2)) - Train.BIS_R6:TriggerInput("Set", self.Power*inrange(speed,50 -add*2.7,61.5 +add*4.2)) - Train.BIS_R7:TriggerInput("Set", self.Power*inrange(speed,60 -add*3.3,71.5 +add*4.1)) - Train.BIS_R8:TriggerInput("Set", self.Power*inrange(speed,70 -add*3.3,81.5 +add*4.2)) - Train.BIS_R10:TriggerInput("Set",self.Power*inrange(speed,80 -add*5.5,101.5+add*6.9))]] - else - --self.R0 = self.Power*C(speed<7)--11.5) - Train.BIS_R1:TriggerInput("Set",self.Power*inrange(speed,5.5,11.5)) - Train.BIS_R2:TriggerInput("Set",self.Power*inrange(speed,10,21.5)) - Train.BIS_R3:TriggerInput("Set",self.Power*inrange(speed,20,31.5)) - Train.BIS_R4:TriggerInput("Set",self.Power*inrange(speed,30,41.5)) - Train.BIS_R5:TriggerInput("Set",self.Power*inrange(speed,40,51.5)) - Train.BIS_R6:TriggerInput("Set",self.Power*inrange(speed,50,61.5)) - Train.BIS_R7:TriggerInput("Set",self.Power*inrange(speed,60,71.5)) - Train.BIS_R8:TriggerInput("Set",self.Power*inrange(speed,70,81.5)) - Train.BIS_R10:TriggerInput("Set",self.Power*inrange(speed,80,101.5)) - --Train.BIS_R10:TriggerInput("Set",self.Power*C(speed>80)) - end--]] - --^^ При торможении смещение на 2км\ч ^^ - self.Speed = speed -end \ No newline at end of file From 52f4d55fcc23eaaee49654df7a107ddfc8c3c3da Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Thu, 13 Jan 2022 18:07:40 +0300 Subject: [PATCH 32/43] =?UTF-8?q?=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BE?= =?UTF-8?q?=D0=BA=20=D0=B2=20=D1=8D=D0=BB=D0=B5=D0=BA=D1=82=D1=80=D0=B8?= =?UTF-8?q?=D0=BA=D0=B5=20+=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BF=D0=BD=D0=B5=D0=B2=D0=BC=D0=B0=D1=82=D0=B8?= =?UTF-8?q?=D0=BA=D0=B8=20(=D0=92=D0=97=E2=84=962=20=D0=B8=20=D0=AD=D0=9F?= =?UTF-8?q?=D0=92)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/entities/gmod_subway_81-717_mvm/init.lua | 6 ++---- lua/metrostroi/systems/sys_81_714_electric.lua | 1 - lua/metrostroi/systems/sys_81_717_electric.lua | 1 - lua/metrostroi/systems/sys_81_717_pneumatic.lua | 12 ++++-------- lua/metrostroi/systems/sys_yar_13b.lua | 5 ++--- 5 files changed, 8 insertions(+), 17 deletions(-) diff --git a/lua/entities/gmod_subway_81-717_mvm/init.lua b/lua/entities/gmod_subway_81-717_mvm/init.lua index 412fc78..4fff2b7 100644 --- a/lua/entities/gmod_subway_81-717_mvm/init.lua +++ b/lua/entities/gmod_subway_81-717_mvm/init.lua @@ -561,7 +561,7 @@ function ENT:Think() local power = Panel.V1 > -1.5 local brightness = math.min(1,Panel.Headlights1)*0.60 + math.min(1,Panel.Headlights2)*0.40 - local T = {} + --local T = {} self:SetPackedBool("Headlights1",Panel.Headlights1 > 0) self:SetPackedBool("Headlights2",Panel.Headlights2 > 0) @@ -590,9 +590,7 @@ function ENT:Think() end -- "" 54 - T[4] = self:ReadTrainWire(4) - T[5] = self:ReadTrainWire(5) - if T[4]*T[5] > 0 then + if self:ReadTrainWire(4)*self:ReadTrainWire(5) > 0 then self.A54:TriggerInput("Set",0) end diff --git a/lua/metrostroi/systems/sys_81_714_electric.lua b/lua/metrostroi/systems/sys_81_714_electric.lua index 696fd1e..6723fc7 100644 --- a/lua/metrostroi/systems/sys_81_714_electric.lua +++ b/lua/metrostroi/systems/sys_81_714_electric.lua @@ -78,7 +78,6 @@ function TRAIN_SYSTEM:SolveAllInternalCircuits(Train,dT,firstIter) if isMVM then Train:WriteTrainWire(71,S["33D"]*Train.OtklBV.Value) end - Train.RPvozvrat.VozRpPressed = T[17] --Вагонная часть S["10A"] = BO*Train.A30.Value S["ZR"] = (1-Train.RRP.Value)+(B*Train.A39.Value*(1-Train.RPvozvrat.Value)*Train.RRP.Value)*-1 diff --git a/lua/metrostroi/systems/sys_81_717_electric.lua b/lua/metrostroi/systems/sys_81_717_electric.lua index c3e7644..de9f1a3 100644 --- a/lua/metrostroi/systems/sys_81_717_electric.lua +++ b/lua/metrostroi/systems/sys_81_717_electric.lua @@ -450,7 +450,6 @@ function TRAIN_SYSTEM:SolveAllInternalCircuits(Train,dT,firstIter) Panel.L1 = T[57] end Panel.M8 = S["V2"]*Train.PVK.Value - Train.RPvozvrat.VozRpPressed = T[17] Train.C1:TriggerInput("Set", T[1]) Panel.IST = Train.C1.Value*Train.VKST.Value*T[64] diff --git a/lua/metrostroi/systems/sys_81_717_pneumatic.lua b/lua/metrostroi/systems/sys_81_717_pneumatic.lua index f7579c9..fba75f4 100644 --- a/lua/metrostroi/systems/sys_81_717_pneumatic.lua +++ b/lua/metrostroi/systems/sys_81_717_pneumatic.lua @@ -405,7 +405,7 @@ function TRAIN_SYSTEM:Think(dT) -- 013: 2 Normal pressure if (self.RealDriverValvePosition == 2) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > 1.01*math.min(self.KM013offset,self.TrainToBrakeReducedPressure)) then - self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(self.KM013offset,self.TrainToBrakeReducedPressure), pr_speed,pr_speed*0.4, nil, 1.0)-- nil, 1.0) + self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(self.KM013offset,self.TrainToBrakeReducedPressure), pr_speed,Train.EPKC.Value==0 and Train.EPK.Value > 0 and pr_speed*2 or pr_speed*0.4, nil, 1.0)-- nil, 1.0) end -- 013: 3 4.3 Atm @@ -471,9 +471,8 @@ function TRAIN_SYSTEM:Think(dT) Train.autosaid=false end self.OldBrakeLinePressure = self.BrakeLinePressure - local leak = 0 --math.log(80*self.BrakeLinePressure - 200,3) - if self.EmergencyValve then --math.log(self.BrakeLinePressure,1.25) - 2.5 - --local leakst = BLDisconnect and math.max(0.3,math.log(self.BrakeLinePressure,1.2) - 2.5) or 1.1*(Train:GetWagonCount())*math.Clamp(self.BrakeLinePressure/4,0,1) + local leak = 0 + if self.EmergencyValve then local leakst = BLDisconnect and math.max(0.3,math.log(self.BrakeLinePressure,1.2) - 2.5) or math.max(1.6,math.log(0.63*self.BrakeLinePressure,1.15)) leak = self:equalizePressure(dT,"BrakeLinePressure", 0.0,leakst*wagc/6)--,false,false,10) if Train.UAVA.Value > 0 or (self.BrakeLinePressure < 1.8 and Train.AutostopValve.Value == 0) then --пока держим ЛКМ нажатой, срывной клапан открыт @@ -550,11 +549,8 @@ function TRAIN_SYSTEM:Think(dT) end self.BePN2 = true elseif self.PN2 > 0.0 then - self.PN2 = math.max(0,self.PN2-math.exp(1.26*(self.BrakeCylinderPressure - self.GN2Offset))*2.4*dT) - --self.PN2 = 0.3*math.exp(0.6*(self.BrakeCylinderPressure - dT) - 1) - 0.11 + self.PN2 = self.BrakeCylinderPressure > 0.4 and 0.2 or self.PN2 - 0.5*dT end - --local cranPres = math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - self.BrakeLinePressure)*(self.BrakeLinePressure < 3.6 and (6.2 - self.WorkingChamberPressure) or 1)))--- - --local cranPres = math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - (self.BrakeLinePressure < 3.6 and (self.BrakeLinePressure - 3.0)*0.45*self.WorkingChamberPressure/(self.BrakeLinePressure - 3.0) or self.BrakeLinePressure*(self.BrakeLinePressure > 4.5 and self.BrakeLinePressure_dPdT > 0.02 and 1.06 or 1)))*(self.BrakeLinePressure > self.KM013offset and 0.6 or 1))) local WcBl = (self.BrakeLinePressure < 3.55 and 0.45*self.WorkingChamberPressure or self.BrakeLinePressure > 3.65 and self.BrakeLinePressure*(self.BrakeLinePressure > 4.5 and self.BrakeLinePressure_dPdT > 0.02 and 1.06 or 1)) self.cranPres = WcBl and math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - WcBl)*(self.BrakeLinePressure > self.KM013offset and 0.6 or 1))) or self.cranPres local targetPressure = (self.cranPres < (self.PN1 + self.WeightLoadRatio*0.7) and (Train.PneumaticNo1.Value == 1.0) and (self.PN1 + self.WeightLoadRatio*0.7) or self.PN1) + self.PN2 + self.cranPres diff --git a/lua/metrostroi/systems/sys_yar_13b.lua b/lua/metrostroi/systems/sys_yar_13b.lua index 2a6c0fa..883e424 100644 --- a/lua/metrostroi/systems/sys_yar_13b.lua +++ b/lua/metrostroi/systems/sys_yar_13b.lua @@ -30,7 +30,6 @@ function TRAIN_SYSTEM:Initialize() latched = true, -- RPvozvrat latches into place power_open = "None", -- Power source for the open signal power_close = "Mechanical", -- Power source for the close signal - VozRpPressed = false, -- Added to override the blocking action of the energized RP relays on RPVozvrat }) -- Реле времени РВ1 @@ -94,8 +93,8 @@ function TRAIN_SYSTEM:Think() end --self.RUTTarget = 250 + 150*self.Train.Pneumatic.WeightLoadRatio -- RPvozvrat operation - local A = Train.RPvozvrat.VozRpPressed ~= 0 - Train.RPvozvrat:TriggerInput("Close", not A and + --local A = Train.RPvozvrat.VozRpPressed ~= 0 + Train.RPvozvrat:TriggerInput("Close", Train:ReadTrainWire(17) == 0 and -- condition added to override the blocking action of the energized RP relays on RPVozvrat ((Train.DR1.Value == 1.0) or (Train.DR2.Value == 1.0) or (Train.RPL.Value == 1.0) or From 0ae202278a46567ae544bf2ea456d8e7b7404f0a Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Sat, 15 Jan 2022 19:32:21 +0300 Subject: [PATCH 33/43] =?UTF-8?q?=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BE?= =?UTF-8?q?=D0=BA=20=D0=B2=20=D1=8D=D0=BB=D0=B5=D0=BA=D1=82=D1=80=D0=B8?= =?UTF-8?q?=D0=BA=D0=B5=20+=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BF=D0=BD=D0=B5=D0=B2=D0=BC=D0=B0=D1=82=D0=B8?= =?UTF-8?q?=D0=BA=D0=B8=20(=D0=92=D0=97=E2=84=962=20=D0=B8=20=D0=AD=D0=9F?= =?UTF-8?q?=D0=92)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gmod_subway_81-717_mvm/cl_init.lua | 4 ++-- lua/entities/gmod_subway_81-717_mvm/init.lua | 6 ++---- lua/metrostroi/systems/sys_81_714_electric.lua | 1 - lua/metrostroi/systems/sys_81_717_electric.lua | 1 - .../systems/sys_81_717_pneumatic.lua | 18 +++++++----------- lua/metrostroi/systems/sys_yar_13b.lua | 5 ++--- 6 files changed, 13 insertions(+), 22 deletions(-) diff --git a/lua/entities/gmod_subway_81-717_mvm/cl_init.lua b/lua/entities/gmod_subway_81-717_mvm/cl_init.lua index a279f2d..25c48a1 100644 --- a/lua/entities/gmod_subway_81-717_mvm/cl_init.lua +++ b/lua/entities/gmod_subway_81-717_mvm/cl_init.lua @@ -3209,9 +3209,9 @@ function ENT:Think() self:SetSoundState("crane334_release",math.Clamp(self.CraneRamp,0,1)^2,1.0) end local emergencyValveEPK = self:GetPackedRatio("EmergencyValveEPK_dPdT",0) - self.EmergencyValveEPKRamp = math.Clamp(self.EmergencyValveEPKRamp + 1.0*((0.5*emergencyValveEPK)-self.EmergencyValveEPKRamp)*dT,0,1) + self.EmergencyValveEPKRamp = math.Clamp(self.EmergencyValveEPKRamp + 1.0*((0.5*emergencyValveEPK)-self.EmergencyValveEPKRamp)*12*dT,0,1) if self.EmergencyValveEPKRamp < 0.01 then self.EmergencyValveEPKRamp = 0 end - self:SetSoundState("epk_brake",self.EmergencyValveEPKRamp,1.0) + self:SetSoundState("epk_brake",self.EmergencyValveEPKRamp,2.8) --[[ local emergencyBrakeValve = self:GetPackedRatio("EmergencyBrakeValve_dPdT", 0) diff --git a/lua/entities/gmod_subway_81-717_mvm/init.lua b/lua/entities/gmod_subway_81-717_mvm/init.lua index 412fc78..4fff2b7 100644 --- a/lua/entities/gmod_subway_81-717_mvm/init.lua +++ b/lua/entities/gmod_subway_81-717_mvm/init.lua @@ -561,7 +561,7 @@ function ENT:Think() local power = Panel.V1 > -1.5 local brightness = math.min(1,Panel.Headlights1)*0.60 + math.min(1,Panel.Headlights2)*0.40 - local T = {} + --local T = {} self:SetPackedBool("Headlights1",Panel.Headlights1 > 0) self:SetPackedBool("Headlights2",Panel.Headlights2 > 0) @@ -590,9 +590,7 @@ function ENT:Think() end -- "" 54 - T[4] = self:ReadTrainWire(4) - T[5] = self:ReadTrainWire(5) - if T[4]*T[5] > 0 then + if self:ReadTrainWire(4)*self:ReadTrainWire(5) > 0 then self.A54:TriggerInput("Set",0) end diff --git a/lua/metrostroi/systems/sys_81_714_electric.lua b/lua/metrostroi/systems/sys_81_714_electric.lua index 696fd1e..6723fc7 100644 --- a/lua/metrostroi/systems/sys_81_714_electric.lua +++ b/lua/metrostroi/systems/sys_81_714_electric.lua @@ -78,7 +78,6 @@ function TRAIN_SYSTEM:SolveAllInternalCircuits(Train,dT,firstIter) if isMVM then Train:WriteTrainWire(71,S["33D"]*Train.OtklBV.Value) end - Train.RPvozvrat.VozRpPressed = T[17] --Вагонная часть S["10A"] = BO*Train.A30.Value S["ZR"] = (1-Train.RRP.Value)+(B*Train.A39.Value*(1-Train.RPvozvrat.Value)*Train.RRP.Value)*-1 diff --git a/lua/metrostroi/systems/sys_81_717_electric.lua b/lua/metrostroi/systems/sys_81_717_electric.lua index c3e7644..de9f1a3 100644 --- a/lua/metrostroi/systems/sys_81_717_electric.lua +++ b/lua/metrostroi/systems/sys_81_717_electric.lua @@ -450,7 +450,6 @@ function TRAIN_SYSTEM:SolveAllInternalCircuits(Train,dT,firstIter) Panel.L1 = T[57] end Panel.M8 = S["V2"]*Train.PVK.Value - Train.RPvozvrat.VozRpPressed = T[17] Train.C1:TriggerInput("Set", T[1]) Panel.IST = Train.C1.Value*Train.VKST.Value*T[64] diff --git a/lua/metrostroi/systems/sys_81_717_pneumatic.lua b/lua/metrostroi/systems/sys_81_717_pneumatic.lua index f7579c9..5cdebb4 100644 --- a/lua/metrostroi/systems/sys_81_717_pneumatic.lua +++ b/lua/metrostroi/systems/sys_81_717_pneumatic.lua @@ -400,12 +400,12 @@ function TRAIN_SYSTEM:Think(dT) local TLDisconnect = self.DisconnectType and Train.DriverValveTLDisconnect.Value > 0 or Train.DriverValveDisconnect.Value > 0 -- 013: 1 Overcharge if (self.RealDriverValvePosition == 1) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > self.TrainLinePressure) then - self:equalizePressure(dT,"BrakeLinePressure", math.min(6.4,self.TrainLinePressure), pr_speed,pr_speed*0.35, nil, 1.0) + self:equalizePressure(dT,"BrakeLinePressure", math.min(6.4,self.TrainLinePressure), pr_speed,Train.EPKC.Value==0 and Train.EPK.Value > 0 and pr_speed*2.2 or pr_speed*0.35, nil, 1.0) end -- 013: 2 Normal pressure if (self.RealDriverValvePosition == 2) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > 1.01*math.min(self.KM013offset,self.TrainToBrakeReducedPressure)) then - self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(self.KM013offset,self.TrainToBrakeReducedPressure), pr_speed,pr_speed*0.4, nil, 1.0)-- nil, 1.0) + self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(self.KM013offset,self.TrainToBrakeReducedPressure), pr_speed,Train.EPKC.Value==0 and Train.EPK.Value > 0 and pr_speed*2 or pr_speed*0.35, nil, 1.0)-- nil, 1.0) end -- 013: 3 4.3 Atm @@ -442,10 +442,10 @@ function TRAIN_SYSTEM:Think(dT) local epkDiff = math.abs(self.EPKPressure-self.BrakeLinePressure) if BLDisconnect and Train.EPK.Value>0 then if Train.EPKC.Value>0 then - self:equalizePressure(dT,"EPKPressure", self.BrakeLinePressure,math.min(1,epkDiff)*6--[[ pr_speed*math.min(1,epkDiff)*2--]] ,false,false,4*epkDiff*2) + self:equalizePressure(dT,"EPKPressure", self.BrakeLinePressure,math.min(1,epkDiff)*6--[[ pr_speed*math.min(1,epkDiff)*2--]] ,math.min(1,epkDiff)*26,false,4*epkDiff*2) end if self.EPKPressure0.3 then - leak = self:equalizePressure(dT,"BrakeLinePressure", self.EPKPressure,pr_speed*epkDiff/2,pr_speed*epkDiff/2) + leak = self:equalizePressure(dT,"BrakeLinePressure", self.EPKPressure,pr_speed*epkDiff/1.28,pr_speed*epkDiff/1.28) --[[ if self.ValveType==1 then leak = self:equalizePressure(dT,"ReservoirPressure", self.EPKPressure,epkDiff/2,epkDiff/2) end--]] @@ -471,9 +471,8 @@ function TRAIN_SYSTEM:Think(dT) Train.autosaid=false end self.OldBrakeLinePressure = self.BrakeLinePressure - local leak = 0 --math.log(80*self.BrakeLinePressure - 200,3) - if self.EmergencyValve then --math.log(self.BrakeLinePressure,1.25) - 2.5 - --local leakst = BLDisconnect and math.max(0.3,math.log(self.BrakeLinePressure,1.2) - 2.5) or 1.1*(Train:GetWagonCount())*math.Clamp(self.BrakeLinePressure/4,0,1) + local leak = 0 + if self.EmergencyValve then local leakst = BLDisconnect and math.max(0.3,math.log(self.BrakeLinePressure,1.2) - 2.5) or math.max(1.6,math.log(0.63*self.BrakeLinePressure,1.15)) leak = self:equalizePressure(dT,"BrakeLinePressure", 0.0,leakst*wagc/6)--,false,false,10) if Train.UAVA.Value > 0 or (self.BrakeLinePressure < 1.8 and Train.AutostopValve.Value == 0) then --пока держим ЛКМ нажатой, срывной клапан открыт @@ -550,11 +549,8 @@ function TRAIN_SYSTEM:Think(dT) end self.BePN2 = true elseif self.PN2 > 0.0 then - self.PN2 = math.max(0,self.PN2-math.exp(1.26*(self.BrakeCylinderPressure - self.GN2Offset))*2.4*dT) - --self.PN2 = 0.3*math.exp(0.6*(self.BrakeCylinderPressure - dT) - 1) - 0.11 + self.PN2 = self.BrakeCylinderPressure > 0.4 and 0.2 or self.PN2 - 0.5*dT end - --local cranPres = math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - self.BrakeLinePressure)*(self.BrakeLinePressure < 3.6 and (6.2 - self.WorkingChamberPressure) or 1)))--- - --local cranPres = math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - (self.BrakeLinePressure < 3.6 and (self.BrakeLinePressure - 3.0)*0.45*self.WorkingChamberPressure/(self.BrakeLinePressure - 3.0) or self.BrakeLinePressure*(self.BrakeLinePressure > 4.5 and self.BrakeLinePressure_dPdT > 0.02 and 1.06 or 1)))*(self.BrakeLinePressure > self.KM013offset and 0.6 or 1))) local WcBl = (self.BrakeLinePressure < 3.55 and 0.45*self.WorkingChamberPressure or self.BrakeLinePressure > 3.65 and self.BrakeLinePressure*(self.BrakeLinePressure > 4.5 and self.BrakeLinePressure_dPdT > 0.02 and 1.06 or 1)) self.cranPres = WcBl and math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - WcBl)*(self.BrakeLinePressure > self.KM013offset and 0.6 or 1))) or self.cranPres local targetPressure = (self.cranPres < (self.PN1 + self.WeightLoadRatio*0.7) and (Train.PneumaticNo1.Value == 1.0) and (self.PN1 + self.WeightLoadRatio*0.7) or self.PN1) + self.PN2 + self.cranPres diff --git a/lua/metrostroi/systems/sys_yar_13b.lua b/lua/metrostroi/systems/sys_yar_13b.lua index 2a6c0fa..883e424 100644 --- a/lua/metrostroi/systems/sys_yar_13b.lua +++ b/lua/metrostroi/systems/sys_yar_13b.lua @@ -30,7 +30,6 @@ function TRAIN_SYSTEM:Initialize() latched = true, -- RPvozvrat latches into place power_open = "None", -- Power source for the open signal power_close = "Mechanical", -- Power source for the close signal - VozRpPressed = false, -- Added to override the blocking action of the energized RP relays on RPVozvrat }) -- Реле времени РВ1 @@ -94,8 +93,8 @@ function TRAIN_SYSTEM:Think() end --self.RUTTarget = 250 + 150*self.Train.Pneumatic.WeightLoadRatio -- RPvozvrat operation - local A = Train.RPvozvrat.VozRpPressed ~= 0 - Train.RPvozvrat:TriggerInput("Close", not A and + --local A = Train.RPvozvrat.VozRpPressed ~= 0 + Train.RPvozvrat:TriggerInput("Close", Train:ReadTrainWire(17) == 0 and -- condition added to override the blocking action of the energized RP relays on RPVozvrat ((Train.DR1.Value == 1.0) or (Train.DR2.Value == 1.0) or (Train.RPL.Value == 1.0) or From 20a3869ad19c41380e35479d17accedf2c2ed779 Mon Sep 17 00:00:00 2001 From: Moon Horse Date: Sat, 15 Jan 2022 20:12:02 +0300 Subject: [PATCH 35/43] Revert "Merge remote-tracking branch 'origin/##386,387,388,243' into ##386,387,388,243" This reverts commit aec6f25b8f38cc4a3e2fed64043778a530c8e4eb, reversing changes made to 0e3ec0fbb22278a604862997d907d09c94e50442. --- .../systems/sys_81_717_pneumatic.lua | 4 - .../systems/sys_als_ars_bis200a.lua | 105 ------------------ 2 files changed, 109 deletions(-) delete mode 100644 lua/metrostroi/systems/sys_als_ars_bis200a.lua diff --git a/lua/metrostroi/systems/sys_81_717_pneumatic.lua b/lua/metrostroi/systems/sys_81_717_pneumatic.lua index 6a8517c..5cdebb4 100644 --- a/lua/metrostroi/systems/sys_81_717_pneumatic.lua +++ b/lua/metrostroi/systems/sys_81_717_pneumatic.lua @@ -405,11 +405,7 @@ function TRAIN_SYSTEM:Think(dT) -- 013: 2 Normal pressure if (self.RealDriverValvePosition == 2) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > 1.01*math.min(self.KM013offset,self.TrainToBrakeReducedPressure)) then -<<<<<<< HEAD self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(self.KM013offset,self.TrainToBrakeReducedPressure), pr_speed,Train.EPKC.Value==0 and Train.EPK.Value > 0 and pr_speed*2 or pr_speed*0.35, nil, 1.0)-- nil, 1.0) -======= - self:equalizePressure(dT,"BrakeLinePressure", 1.01*math.min(self.KM013offset,self.TrainToBrakeReducedPressure), pr_speed,Train.EPKC.Value==0 and Train.EPK.Value > 0 and pr_speed*2 or pr_speed*0.4, nil, 1.0)-- nil, 1.0) ->>>>>>> origin/##386,387,388,243 end -- 013: 3 4.3 Atm diff --git a/lua/metrostroi/systems/sys_als_ars_bis200a.lua b/lua/metrostroi/systems/sys_als_ars_bis200a.lua deleted file mode 100644 index 3296856..0000000 --- a/lua/metrostroi/systems/sys_als_ars_bis200a.lua +++ /dev/null @@ -1,105 +0,0 @@ --------------------------------------------------------------------------------- --- ARS-D/ARS-Ezh3/BKBD safety system BIS-200 unit --------------------------------------------------------------------------------- --- Copyright (C) 2013-2018 Metrostroi Team & FoxWorks Aerospace s.r.o. --- Contains proprietary code. See license.txt for additional information. --------------------------------------------------------------------------------- -Metrostroi.DefineSystem("ALS_ARS_BIS200") -TRAIN_SYSTEM.DontAccelerateSimulation = false - -function TRAIN_SYSTEM:Initialize() - self.Train:LoadSystem("BIS_R0","Relay","ARS",{open_time=7,bass=true,bass_separate=true}) - self.Train:LoadSystem("BIS_PR0","Relay","ARS",{bass=true,bass_separate=true}) - self.Train:LoadSystem("BIS_R1","Relay","ARS",{bass=true,bass_separate=true}) - self.Train:LoadSystem("BIS_R2","Relay","ARS",{bass=true,bass_separate=true}) - self.Train:LoadSystem("BIS_R3","Relay","ARS",{bass=true,bass_separate=true}) - self.Train:LoadSystem("BIS_R4","Relay","ARS",{bass=true,bass_separate=true}) - self.Train:LoadSystem("BIS_R5","Relay","ARS",{bass=true,bass_separate=true}) - self.Train:LoadSystem("BIS_R6","Relay","ARS",{bass=true,bass_separate=true}) - self.Train:LoadSystem("BIS_R7","Relay","ARS",{bass=true,bass_separate=true}) - self.Train:LoadSystem("BIS_R8","Relay","ARS",{bass=true,bass_separate=true}) - self.Train:LoadSystem("BIS_R10","Relay","ARS",{bass=true,bass_separate=true}) - - self.Power = 0 - self.R0 = 0 - self.Speed = 0 - - self.SAdd = 0 -end - -function TRAIN_SYSTEM:Outputs() - return {} -end - -function TRAIN_SYSTEM:Inputs() - return {"SpeedDec"} -end - -function TRAIN_SYSTEM:TriggerInput(name,value) - if name == "SpeedDec" then self.SpeedDec = value > 0 end -end - -local function C(val) - return val and 1 or 0 -end ---[[local function inrange(val,min,max) - return C(min < val and val < max) -end]] - -local function inrange(val,min,max,min2,max2,state) - if state then - return C(min2 < val and val < max2) - else - return C(min < val and val < max) - end -end - -function TRAIN_SYSTEM:Think(dT) - local Train = self.Train - local speed = Train.ALSCoil.Speed - --vv При торможении смещение на 2км\ч vv - ----[[ - if self.SpeedDec then - Train.BIS_R1:TriggerInput("Set", self.Power*inrange(speed,5.5,11.5 ,3.5 ,14.0 ,Train.BIS_R1.Value > 0)) - Train.BIS_R2:TriggerInput("Set", self.Power*inrange(speed,10 ,21.5 ,8.2 ,25.7 ,Train.BIS_R2.Value > 0)) - Train.BIS_R3:TriggerInput("Set", self.Power*inrange(speed,20 ,31.5 ,17.6,35.7 ,Train.BIS_R3.Value > 0)) - Train.BIS_R4:TriggerInput("Set", self.Power*inrange(speed,30 ,41.5 ,27.6,45.7 ,Train.BIS_R4.Value > 0)) - Train.BIS_R5:TriggerInput("Set", self.Power*inrange(speed,40 ,51.5 ,37.6,55.7 ,Train.BIS_R5.Value > 0)) - Train.BIS_R6:TriggerInput("Set", self.Power*inrange(speed,50 ,61.5 ,47.3,65.7 ,Train.BIS_R6.Value > 0)) - Train.BIS_R7:TriggerInput("Set", self.Power*inrange(speed,60 ,71.5 ,56.7,75.6 ,Train.BIS_R7.Value > 0)) - Train.BIS_R8:TriggerInput("Set", self.Power*inrange(speed,70 ,81.5 ,66.7,85.7 ,Train.BIS_R8.Value > 0)) - Train.BIS_R10:TriggerInput("Set",self.Power*inrange(speed,80 ,101.5,74.5,108.4,Train.BIS_R10.Value > 0)) - - --[[ - if speed > self.Speed then - self.SAdd = math.min(1,math.max(-0.3,self.SAdd-(speed-self.Speed)*0.6)) - else - self.SAdd = math.min(1,math.max(-0.3,self.SAdd-(speed-self.Speed)*0.3)) - end - local add = math.max(0,self.SAdd) - --self.R0 = self.Power*C(speed<7)--11.5) - Train.BIS_R1:TriggerInput("Set", self.Power*inrange(speed,5.5-add*2 ,11.5 +add*2.5)) - Train.BIS_R2:TriggerInput("Set", self.Power*inrange(speed,10 -add*1.8,21.5 +add*4.2)) - Train.BIS_R3:TriggerInput("Set", self.Power*inrange(speed,20 -add*2.4,31.5 +add*4.2)) - Train.BIS_R4:TriggerInput("Set", self.Power*inrange(speed,30 -add*2.4,41.5 +add*4.2)) - Train.BIS_R5:TriggerInput("Set", self.Power*inrange(speed,40 -add*2.4,51.5 +add*4.2)) - Train.BIS_R6:TriggerInput("Set", self.Power*inrange(speed,50 -add*2.7,61.5 +add*4.2)) - Train.BIS_R7:TriggerInput("Set", self.Power*inrange(speed,60 -add*3.3,71.5 +add*4.1)) - Train.BIS_R8:TriggerInput("Set", self.Power*inrange(speed,70 -add*3.3,81.5 +add*4.2)) - Train.BIS_R10:TriggerInput("Set",self.Power*inrange(speed,80 -add*5.5,101.5+add*6.9))]] - else - --self.R0 = self.Power*C(speed<7)--11.5) - Train.BIS_R1:TriggerInput("Set",self.Power*inrange(speed,5.5,11.5)) - Train.BIS_R2:TriggerInput("Set",self.Power*inrange(speed,10,21.5)) - Train.BIS_R3:TriggerInput("Set",self.Power*inrange(speed,20,31.5)) - Train.BIS_R4:TriggerInput("Set",self.Power*inrange(speed,30,41.5)) - Train.BIS_R5:TriggerInput("Set",self.Power*inrange(speed,40,51.5)) - Train.BIS_R6:TriggerInput("Set",self.Power*inrange(speed,50,61.5)) - Train.BIS_R7:TriggerInput("Set",self.Power*inrange(speed,60,71.5)) - Train.BIS_R8:TriggerInput("Set",self.Power*inrange(speed,70,81.5)) - Train.BIS_R10:TriggerInput("Set",self.Power*inrange(speed,80,101.5)) - --Train.BIS_R10:TriggerInput("Set",self.Power*C(speed>80)) - end--]] - --^^ При торможении смещение на 2км\ч ^^ - self.Speed = speed -end \ No newline at end of file From afc5d43bebb23ebeb2ec4400a81d62f0111e94f0 Mon Sep 17 00:00:00 2001 From: BlueSnooty <89611276+BlueSnooty@users.noreply.github.com> Date: Fri, 28 Jan 2022 23:09:48 +0300 Subject: [PATCH 36/43] Update sys_81_717_pneumatic.lua --- .../systems/sys_81_717_pneumatic.lua | 84 ++++++++----------- 1 file changed, 36 insertions(+), 48 deletions(-) diff --git a/lua/metrostroi/systems/sys_81_717_pneumatic.lua b/lua/metrostroi/systems/sys_81_717_pneumatic.lua index 5cdebb4..b8bdf85 100644 --- a/lua/metrostroi/systems/sys_81_717_pneumatic.lua +++ b/lua/metrostroi/systems/sys_81_717_pneumatic.lua @@ -179,12 +179,12 @@ function TRAIN_SYSTEM:TriggerInput(name,value) if HaveUAVA and self.Train.UAVA.Value == 0 then self.EmergencyValve = true if value ~= 2 then - self.Train.UAVAC:TriggerInput("Set",0) - if not self.Train.autosaid then - self.Train.autosaid = true - RunConsoleCommand("say","Autostop braking",self.Train:GetDriverName()) - end - end + self.Train.UAVAC:TriggerInput("Set",0) + if not self.Train.autosaid then + self.Train.autosaid = true + RunConsoleCommand("say","Autostop braking",self.Train:GetDriverName()) + end + end end end end @@ -314,7 +314,7 @@ end function TRAIN_SYSTEM:Think(dT) local Train = self.Train self.WeightLoadRatio = math.max(0,math.min(1,(Train:GetNW2Float("PassengerCount")/200))) - --self.WeightLoadRatio = (Train.R_ZS and Train.R_ZS.Value > 0 and 0.5 or 0) + (Train.R_G and Train.R_G.Value > 0 and 0.5 or 0) + --self.WeightLoadRatio = (Train.R_ZS and Train.R_ZS.Value > 0 and 0.5 or 0) + (Train.R_G and Train.R_G.Value > 0 and 0.5 or 0) ---------------------------------------------------------------------------- -- Accumulate derivatives self.TrainLinePressure_dPdT = 0.0 @@ -325,9 +325,9 @@ function TRAIN_SYSTEM:Think(dT) self.ParkingBrakePressure_dPdT = 0.0 self.WorkingChamberPressure_dPdT = 0.0 - local rnd = math.random(1,10) - local offs = 0.1 - self.KM013offset = self.KM013offset or math.Clamp(5.1 + (rnd >= 3 and rnd <= 7 and offs or -offs),5.0,5.2) + local rnd = math.random(1,10) + local offs = 0.1 + self.KM013offset = self.KM013offset or math.Clamp(5.1 + (rnd >= 3 and rnd <= 7 and offs or -offs),5.0,5.2) -- Reduce pressure for brake line self.TrainToBrakeReducedPressure = math.min(self.KM013offset,self.TrainLinePressure) -- * 0.725) @@ -338,10 +338,10 @@ function TRAIN_SYSTEM:Think(dT) local HaveEPK = not Train.SubwayTrain or not Train.SubwayTrain.ARS or not Train.SubwayTrain.ARS.NoEPK local BLDisconnect,pr_speed = true,1 - -- работа срывного клапана - if Train.AutostopValve.Value > 0 then - self:TriggerInput("Autostop",self.BrakeLinePressure > 1.86 and 1 or 2) --value == 2 — просто открыть срывной клапан без размыкания контактов УАВА - end + -- работа срывного клапана + if Train.AutostopValve.Value > 0 then + self:TriggerInput("Autostop",self.BrakeLinePressure > 1.86 and 1 or 2) --value == 2 — просто открыть срывной клапан без размыкания контактов УАВА + end if self.ValveType == 1 then BLDisconnect = Train.DriverValveBLDisconnect.Value > 0 @@ -400,7 +400,7 @@ function TRAIN_SYSTEM:Think(dT) local TLDisconnect = self.DisconnectType and Train.DriverValveTLDisconnect.Value > 0 or Train.DriverValveDisconnect.Value > 0 -- 013: 1 Overcharge if (self.RealDriverValvePosition == 1) and BLDisconnect and (TLDisconnect or self.BrakeLinePressure > self.TrainLinePressure) then - self:equalizePressure(dT,"BrakeLinePressure", math.min(6.4,self.TrainLinePressure), pr_speed,Train.EPKC.Value==0 and Train.EPK.Value > 0 and pr_speed*2.2 or pr_speed*0.35, nil, 1.0) + self:equalizePressure(dT,"BrakeLinePressure", math.min(6.4,self.TrainLinePressure), pr_speed,Train.EPKC.Value==0 and Train.EPK.Value > 0 and pr_speed*2.2 or pr_speed*0.35, nil, 1.0) end -- 013: 2 Normal pressure @@ -468,12 +468,12 @@ function TRAIN_SYSTEM:Think(dT) if self.EmergencyValveDisable then--and (self.BrakeLinePressure-self.OldBrakeLinePressure)>0.01 then self.EmergencyValveDisable=false self.EmergencyValve=false - Train.autosaid=false + Train.autosaid=false end self.OldBrakeLinePressure = self.BrakeLinePressure local leak = 0 if self.EmergencyValve then - local leakst = BLDisconnect and math.max(0.3,math.log(self.BrakeLinePressure,1.2) - 2.5) or math.max(1.6,math.log(0.63*self.BrakeLinePressure,1.15)) + local leakst = BLDisconnect and math.max(0.3,math.log(self.BrakeLinePressure,1.2) - 2.5) or math.max(1.6,math.log(0.63*self.BrakeLinePressure,1.15)) leak = self:equalizePressure(dT,"BrakeLinePressure", 0.0,leakst*wagc/6)--,false,false,10) if Train.UAVA.Value > 0 or (self.BrakeLinePressure < 1.8 and Train.AutostopValve.Value == 0) then --пока держим ЛКМ нажатой, срывной клапан открыт self.EmergencyValveDisable = true @@ -500,36 +500,24 @@ function TRAIN_SYSTEM:Think(dT) self.Leak = true end Train:SetPackedRatio("EmergencyBrakeValve_dPdT", -leak/wagc) - --[[ - ---------------debug--------------------- - self.dlreadtimer = self.dlreadtimer or CurTime() - if CurTime() - self.dlreadtimer > 1.0 then - self.dlreadtimer = CurTime() - if Train:GetWagonNumber() == 8938 then - PrintMessage(HUD_PRINTTALK, Format("Вагон %u; ТМ dPdT = %.3f; Раб. кам. = %.3f",Train:GetWagonNumber(),self.BrakeLinePressure_dPdT,self.WorkingChamberPressure)) - end - end - ---------------debug---------------------]] - - ---------------------------------------------------------------------------- -- Fill brake cylinders - if self.WCChargeValve == true then - self:equalizePressure(dT,"WorkingChamberPressure",self.BrakeLinePressure,0.187,nil,nil,1.0) --simulate 0.8mm hole btw BL and working chambers - end + if self.WCChargeValve == true then + self:equalizePressure(dT,"WorkingChamberPressure",self.BrakeLinePressure,0.187,nil,nil,1.0) --simulate 0.8mm hole btw BL and working chambers + end self.AirDistributorReady = self.WorkingChamberPressure >= 2.2 self.WCChargeValve = not ((self.WorkingChamberPressure - self.BrakeLinePressure) > 0.2 and (self.WorkingChamberPressure - self.BrakeLinePressure) < 2.5) - self.OverchargeReleaseValve = self.WorkingChamberPressure > 5.2 and not self.WCChargeValve - if self.OverchargeReleaseValve then - self:equalizePressure(dT,"WorkingChamberPressure",0.0,0.32) -- КЛСЗ - end + self.OverchargeReleaseValve = self.WorkingChamberPressure > 5.2 and not self.WCChargeValve + if self.OverchargeReleaseValve then + self:equalizePressure(dT,"WorkingChamberPressure",0.0,0.32) -- КЛСЗ + end - --trainLineConsumption_dPdT = trainLineConsumption_dPdT + math.max(0,self.WorkingChamberPressure_dPdT*0.2) - local _offset2 = self.Train.AR63 and 2.5 or 2.4 - self.GN2Offset = self.GN2Offset or math.random(20,100)*0.002 + _offset2 - local _offset1 = self.Train.AR63 and 0.9 or 0.8 - self.GN1Offset = self.GN1Offset or math.random(20,100)*0.002 + _offset1 - self.BcBl = (self.GN2Offset + self.WeightLoadRatio*1.3)/1.93 + --trainLineConsumption_dPdT = trainLineConsumption_dPdT + math.max(0,self.WorkingChamberPressure_dPdT*0.2) + local _offset2 = self.Train.AR63 and 2.5 or 2.4 + self.GN2Offset = self.GN2Offset or math.random(20,100)*0.002 + _offset2 + local _offset1 = self.Train.AR63 and 0.9 or 0.8 + self.GN1Offset = self.GN1Offset or math.random(20,100)*0.002 + _offset1 + self.BcBl = (self.GN2Offset + self.WeightLoadRatio*1.3)/1.93 if Train.AirDistributorDisconnect.Value == 0 and self.AirDistributorReady then -- Valve #1 if (Train.PneumaticNo1.Value == 1.0) and (Train.PneumaticNo2.Value == 0.0) then @@ -543,16 +531,16 @@ function TRAIN_SYSTEM:Think(dT) end -- Valve #2 if Train.PneumaticNo2.Value == 1.0 then - self.PN2 = math.min(self.TrainLinePressure,(self.GN2Offset + self.WeightLoadRatio*1.3)) - if self.BePN2 == false and self.BrakeCylinderPressure > 1.6 then - Train:PlayOnce("PN2end","stop") - end - self.BePN2 = true + self.PN2 = math.min(self.TrainLinePressure,(self.GN2Offset + self.WeightLoadRatio*1.3)) + if self.BePN2 == false and self.BrakeCylinderPressure > 1.6 then + Train:PlayOnce("PN2end","stop") + end + self.BePN2 = true elseif self.PN2 > 0.0 then self.PN2 = self.BrakeCylinderPressure > 0.4 and 0.2 or self.PN2 - 0.5*dT end local WcBl = (self.BrakeLinePressure < 3.55 and 0.45*self.WorkingChamberPressure or self.BrakeLinePressure > 3.65 and self.BrakeLinePressure*(self.BrakeLinePressure > 4.5 and self.BrakeLinePressure_dPdT > 0.02 and 1.06 or 1)) - self.cranPres = WcBl and math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - WcBl)*(self.BrakeLinePressure > self.KM013offset and 0.6 or 1))) or self.cranPres + self.cranPres = WcBl and math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - WcBl)*(self.BrakeLinePressure > self.KM013offset and 0.6 or 1))) or self.cranPres local targetPressure = (self.cranPres < (self.PN1 + self.WeightLoadRatio*0.7) and (Train.PneumaticNo1.Value == 1.0) and (self.PN1 + self.WeightLoadRatio*0.7) or self.PN1) + self.PN2 + self.cranPres if math.abs(self.BrakeCylinderPressure - targetPressure) > 0.150 then self.BrakeCylinderValve = 1 From 33a614e9db2d3ef641fa4dcdd161d306bb481145 Mon Sep 17 00:00:00 2001 From: BlueSnooty <89611276+BlueSnooty@users.noreply.github.com> Date: Fri, 28 Jan 2022 23:23:59 +0300 Subject: [PATCH 37/43] Update sys_81_717_pneumatic.lua --- lua/metrostroi/systems/sys_81_717_pneumatic.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lua/metrostroi/systems/sys_81_717_pneumatic.lua b/lua/metrostroi/systems/sys_81_717_pneumatic.lua index b8bdf85..1680e02 100644 --- a/lua/metrostroi/systems/sys_81_717_pneumatic.lua +++ b/lua/metrostroi/systems/sys_81_717_pneumatic.lua @@ -503,13 +503,13 @@ function TRAIN_SYSTEM:Think(dT) ---------------------------------------------------------------------------- -- Fill brake cylinders if self.WCChargeValve == true then - self:equalizePressure(dT,"WorkingChamberPressure",self.BrakeLinePressure,0.187,nil,nil,1.0) --simulate 0.8mm hole btw BL and working chambers + self:equalizePressure(dT,"WorkingChamberPressure",self.BrakeLinePressure,0.107,nil,nil,1.0) --simulate 0.8mm hole btw BL and working chambers end self.AirDistributorReady = self.WorkingChamberPressure >= 2.2 self.WCChargeValve = not ((self.WorkingChamberPressure - self.BrakeLinePressure) > 0.2 and (self.WorkingChamberPressure - self.BrakeLinePressure) < 2.5) self.OverchargeReleaseValve = self.WorkingChamberPressure > 5.2 and not self.WCChargeValve if self.OverchargeReleaseValve then - self:equalizePressure(dT,"WorkingChamberPressure",0.0,0.32) -- КЛСЗ + self:equalizePressure(dT,"WorkingChamberPressure",0.0,0.14) -- КЛСЗ end --trainLineConsumption_dPdT = trainLineConsumption_dPdT + math.max(0,self.WorkingChamberPressure_dPdT*0.2) @@ -525,9 +525,7 @@ function TRAIN_SYSTEM:Think(dT) self.PN1 = math.min(self.TrainLinePressure,self.GN1Offset) end elseif Train.PneumaticNo1.Value == 0 and self.PN1 > 0.0 then - --self.PN1 = math.max(0,self.PN1-math.exp(3.6*(self.BrakeCylinderPressure - self.GN1Offset))*0.12) self.PN1 = math.max(0,self.PN1-math.exp(3.6*(self.BrakeCylinderPressure - self.GN1Offset))*1.7*dT) - --self.PN1 = math.exp(8*(self.PN1 - dT) - 8.1) end -- Valve #2 if Train.PneumaticNo2.Value == 1.0 then @@ -539,9 +537,10 @@ function TRAIN_SYSTEM:Think(dT) elseif self.PN2 > 0.0 then self.PN2 = self.BrakeCylinderPressure > 0.4 and 0.2 or self.PN2 - 0.5*dT end - local WcBl = (self.BrakeLinePressure < 3.55 and 0.45*self.WorkingChamberPressure or self.BrakeLinePressure > 3.65 and self.BrakeLinePressure*(self.BrakeLinePressure > 4.5 and self.BrakeLinePressure_dPdT > 0.02 and 1.06 or 1)) - self.cranPres = WcBl and math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - WcBl)*(self.BrakeLinePressure > self.KM013offset and 0.6 or 1))) or self.cranPres - local targetPressure = (self.cranPres < (self.PN1 + self.WeightLoadRatio*0.7) and (Train.PneumaticNo1.Value == 1.0) and (self.PN1 + self.WeightLoadRatio*0.7) or self.PN1) + self.PN2 + self.cranPres + local WcBl = (self.BrakeLinePressure < 3.55 and 0.45*(self.WorkingChamberPressure - 2.2) or self.BrakeLinePressure > 3.65 and self.BrakeLinePressure*(self.BrakeLinePressure > 4.5 and self.BrakeLinePressure_dPdT > 0.02 and 1.06 or 1)) + --self.cranPres = WcBl and math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - WcBl)*(self.BrakeLinePressure > self.KM013offset and 0.6 or 1))) or self.cranPres + self.cranPres = WcBl and math.max(0,self.BcBl*(self.WorkingChamberPressure - WcBl)*(self.BrakeLinePressure > self.KM013offset and 0.48 or 1)) or self.cranPres + local targetPressure = math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3, (self.cranPres < (self.PN1 + self.WeightLoadRatio*0.7) and (Train.PneumaticNo1.Value == 1.0) and (self.PN1 + self.WeightLoadRatio*0.7) or self.PN1) + self.PN2 + self.cranPres)) if math.abs(self.BrakeCylinderPressure - targetPressure) > 0.150 then self.BrakeCylinderValve = 1 end From 3725ee0977528f83bb475f3c20cbfa308122ebe4 Mon Sep 17 00:00:00 2001 From: BlueSnooty <89611276+BlueSnooty@users.noreply.github.com> Date: Mon, 31 Jan 2022 22:51:48 +0300 Subject: [PATCH 38/43] Update sys_81_717_pneumatic.lua --- lua/metrostroi/systems/sys_81_717_pneumatic.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/metrostroi/systems/sys_81_717_pneumatic.lua b/lua/metrostroi/systems/sys_81_717_pneumatic.lua index 1680e02..95dcce6 100644 --- a/lua/metrostroi/systems/sys_81_717_pneumatic.lua +++ b/lua/metrostroi/systems/sys_81_717_pneumatic.lua @@ -509,7 +509,7 @@ function TRAIN_SYSTEM:Think(dT) self.WCChargeValve = not ((self.WorkingChamberPressure - self.BrakeLinePressure) > 0.2 and (self.WorkingChamberPressure - self.BrakeLinePressure) < 2.5) self.OverchargeReleaseValve = self.WorkingChamberPressure > 5.2 and not self.WCChargeValve if self.OverchargeReleaseValve then - self:equalizePressure(dT,"WorkingChamberPressure",0.0,0.14) -- КЛСЗ + self:equalizePressure(dT,"WorkingChamberPressure",0.0,0.22) -- КЛСЗ end --trainLineConsumption_dPdT = trainLineConsumption_dPdT + math.max(0,self.WorkingChamberPressure_dPdT*0.2) @@ -539,7 +539,7 @@ function TRAIN_SYSTEM:Think(dT) end local WcBl = (self.BrakeLinePressure < 3.55 and 0.45*(self.WorkingChamberPressure - 2.2) or self.BrakeLinePressure > 3.65 and self.BrakeLinePressure*(self.BrakeLinePressure > 4.5 and self.BrakeLinePressure_dPdT > 0.02 and 1.06 or 1)) --self.cranPres = WcBl and math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3,self.BcBl*(self.WorkingChamberPressure - WcBl)*(self.BrakeLinePressure > self.KM013offset and 0.6 or 1))) or self.cranPres - self.cranPres = WcBl and math.max(0,self.BcBl*(self.WorkingChamberPressure - WcBl)*(self.BrakeLinePressure > self.KM013offset and 0.48 or 1)) or self.cranPres + self.cranPres = WcBl and math.max(0,self.BcBl*(self.WorkingChamberPressure - WcBl)*(self.BrakeLinePressure > self.KM013offset and (0.56 + self.PN1*0.43) or 1)) or self.cranPres local targetPressure = math.max(0,math.min(self.GN2Offset + self.WeightLoadRatio*1.3, (self.cranPres < (self.PN1 + self.WeightLoadRatio*0.7) and (Train.PneumaticNo1.Value == 1.0) and (self.PN1 + self.WeightLoadRatio*0.7) or self.PN1) + self.PN2 + self.cranPres)) if math.abs(self.BrakeCylinderPressure - targetPressure) > 0.150 then self.BrakeCylinderValve = 1 From 5e783b405339487dde0276dfab8321a692ad5a7c Mon Sep 17 00:00:00 2001 From: Ilya Krasnow Date: Thu, 7 Apr 2022 17:07:42 +0300 Subject: [PATCH 39/43] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=B4=D0=B8=D1=80=D0=BE=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/entities/gmod_subway_81-717_mvm/init.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lua/entities/gmod_subway_81-717_mvm/init.lua b/lua/entities/gmod_subway_81-717_mvm/init.lua index 4fff2b7..db29fbb 100644 --- a/lua/entities/gmod_subway_81-717_mvm/init.lua +++ b/lua/entities/gmod_subway_81-717_mvm/init.lua @@ -589,10 +589,9 @@ function ENT:Think() end end - -- "" 54 - if self:ReadTrainWire(4)*self:ReadTrainWire(5) > 0 then - self.A54:TriggerInput("Set",0) - end + if self:ReadTrainWire(4)*self:ReadTrainWire(5) > 0 then + self.A54:TriggerInput("Set",0) + end -- Door button lights self:SetPackedBool("DoorsLeftL",Panel.DoorsLeft > 0.5) From 898d723d44a125e3472c21341e71f37fc9a914d0 Mon Sep 17 00:00:00 2001 From: alexandr_sizov Date: Thu, 7 Apr 2022 18:33:13 +0300 Subject: [PATCH 40/43] Revert "Delete sys_als_ars_bis200a.lua" This reverts commit 701da5fe9d416d083380f0beeee94f1c4f7b6ffb. --- .../systems/sys_als_ars_bis200a.lua | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 lua/metrostroi/systems/sys_als_ars_bis200a.lua diff --git a/lua/metrostroi/systems/sys_als_ars_bis200a.lua b/lua/metrostroi/systems/sys_als_ars_bis200a.lua new file mode 100644 index 0000000..3296856 --- /dev/null +++ b/lua/metrostroi/systems/sys_als_ars_bis200a.lua @@ -0,0 +1,105 @@ +-------------------------------------------------------------------------------- +-- ARS-D/ARS-Ezh3/BKBD safety system BIS-200 unit +-------------------------------------------------------------------------------- +-- Copyright (C) 2013-2018 Metrostroi Team & FoxWorks Aerospace s.r.o. +-- Contains proprietary code. See license.txt for additional information. +-------------------------------------------------------------------------------- +Metrostroi.DefineSystem("ALS_ARS_BIS200") +TRAIN_SYSTEM.DontAccelerateSimulation = false + +function TRAIN_SYSTEM:Initialize() + self.Train:LoadSystem("BIS_R0","Relay","ARS",{open_time=7,bass=true,bass_separate=true}) + self.Train:LoadSystem("BIS_PR0","Relay","ARS",{bass=true,bass_separate=true}) + self.Train:LoadSystem("BIS_R1","Relay","ARS",{bass=true,bass_separate=true}) + self.Train:LoadSystem("BIS_R2","Relay","ARS",{bass=true,bass_separate=true}) + self.Train:LoadSystem("BIS_R3","Relay","ARS",{bass=true,bass_separate=true}) + self.Train:LoadSystem("BIS_R4","Relay","ARS",{bass=true,bass_separate=true}) + self.Train:LoadSystem("BIS_R5","Relay","ARS",{bass=true,bass_separate=true}) + self.Train:LoadSystem("BIS_R6","Relay","ARS",{bass=true,bass_separate=true}) + self.Train:LoadSystem("BIS_R7","Relay","ARS",{bass=true,bass_separate=true}) + self.Train:LoadSystem("BIS_R8","Relay","ARS",{bass=true,bass_separate=true}) + self.Train:LoadSystem("BIS_R10","Relay","ARS",{bass=true,bass_separate=true}) + + self.Power = 0 + self.R0 = 0 + self.Speed = 0 + + self.SAdd = 0 +end + +function TRAIN_SYSTEM:Outputs() + return {} +end + +function TRAIN_SYSTEM:Inputs() + return {"SpeedDec"} +end + +function TRAIN_SYSTEM:TriggerInput(name,value) + if name == "SpeedDec" then self.SpeedDec = value > 0 end +end + +local function C(val) + return val and 1 or 0 +end +--[[local function inrange(val,min,max) + return C(min < val and val < max) +end]] + +local function inrange(val,min,max,min2,max2,state) + if state then + return C(min2 < val and val < max2) + else + return C(min < val and val < max) + end +end + +function TRAIN_SYSTEM:Think(dT) + local Train = self.Train + local speed = Train.ALSCoil.Speed + --vv При торможении смещение на 2км\ч vv + ----[[ + if self.SpeedDec then + Train.BIS_R1:TriggerInput("Set", self.Power*inrange(speed,5.5,11.5 ,3.5 ,14.0 ,Train.BIS_R1.Value > 0)) + Train.BIS_R2:TriggerInput("Set", self.Power*inrange(speed,10 ,21.5 ,8.2 ,25.7 ,Train.BIS_R2.Value > 0)) + Train.BIS_R3:TriggerInput("Set", self.Power*inrange(speed,20 ,31.5 ,17.6,35.7 ,Train.BIS_R3.Value > 0)) + Train.BIS_R4:TriggerInput("Set", self.Power*inrange(speed,30 ,41.5 ,27.6,45.7 ,Train.BIS_R4.Value > 0)) + Train.BIS_R5:TriggerInput("Set", self.Power*inrange(speed,40 ,51.5 ,37.6,55.7 ,Train.BIS_R5.Value > 0)) + Train.BIS_R6:TriggerInput("Set", self.Power*inrange(speed,50 ,61.5 ,47.3,65.7 ,Train.BIS_R6.Value > 0)) + Train.BIS_R7:TriggerInput("Set", self.Power*inrange(speed,60 ,71.5 ,56.7,75.6 ,Train.BIS_R7.Value > 0)) + Train.BIS_R8:TriggerInput("Set", self.Power*inrange(speed,70 ,81.5 ,66.7,85.7 ,Train.BIS_R8.Value > 0)) + Train.BIS_R10:TriggerInput("Set",self.Power*inrange(speed,80 ,101.5,74.5,108.4,Train.BIS_R10.Value > 0)) + + --[[ + if speed > self.Speed then + self.SAdd = math.min(1,math.max(-0.3,self.SAdd-(speed-self.Speed)*0.6)) + else + self.SAdd = math.min(1,math.max(-0.3,self.SAdd-(speed-self.Speed)*0.3)) + end + local add = math.max(0,self.SAdd) + --self.R0 = self.Power*C(speed<7)--11.5) + Train.BIS_R1:TriggerInput("Set", self.Power*inrange(speed,5.5-add*2 ,11.5 +add*2.5)) + Train.BIS_R2:TriggerInput("Set", self.Power*inrange(speed,10 -add*1.8,21.5 +add*4.2)) + Train.BIS_R3:TriggerInput("Set", self.Power*inrange(speed,20 -add*2.4,31.5 +add*4.2)) + Train.BIS_R4:TriggerInput("Set", self.Power*inrange(speed,30 -add*2.4,41.5 +add*4.2)) + Train.BIS_R5:TriggerInput("Set", self.Power*inrange(speed,40 -add*2.4,51.5 +add*4.2)) + Train.BIS_R6:TriggerInput("Set", self.Power*inrange(speed,50 -add*2.7,61.5 +add*4.2)) + Train.BIS_R7:TriggerInput("Set", self.Power*inrange(speed,60 -add*3.3,71.5 +add*4.1)) + Train.BIS_R8:TriggerInput("Set", self.Power*inrange(speed,70 -add*3.3,81.5 +add*4.2)) + Train.BIS_R10:TriggerInput("Set",self.Power*inrange(speed,80 -add*5.5,101.5+add*6.9))]] + else + --self.R0 = self.Power*C(speed<7)--11.5) + Train.BIS_R1:TriggerInput("Set",self.Power*inrange(speed,5.5,11.5)) + Train.BIS_R2:TriggerInput("Set",self.Power*inrange(speed,10,21.5)) + Train.BIS_R3:TriggerInput("Set",self.Power*inrange(speed,20,31.5)) + Train.BIS_R4:TriggerInput("Set",self.Power*inrange(speed,30,41.5)) + Train.BIS_R5:TriggerInput("Set",self.Power*inrange(speed,40,51.5)) + Train.BIS_R6:TriggerInput("Set",self.Power*inrange(speed,50,61.5)) + Train.BIS_R7:TriggerInput("Set",self.Power*inrange(speed,60,71.5)) + Train.BIS_R8:TriggerInput("Set",self.Power*inrange(speed,70,81.5)) + Train.BIS_R10:TriggerInput("Set",self.Power*inrange(speed,80,101.5)) + --Train.BIS_R10:TriggerInput("Set",self.Power*C(speed>80)) + end--]] + --^^ При торможении смещение на 2км\ч ^^ + self.Speed = speed +end \ No newline at end of file From ab52a138d39a4d64b5d6a19b8bf349572c45aff9 Mon Sep 17 00:00:00 2001 From: BlueSnooty <89611276+BlueSnooty@users.noreply.github.com> Date: Fri, 8 Apr 2022 22:09:56 +0300 Subject: [PATCH 41/43] Update sys_81_717_pneumatic.lua MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Табуляция --- .../systems/sys_81_717_pneumatic.lua | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lua/metrostroi/systems/sys_81_717_pneumatic.lua b/lua/metrostroi/systems/sys_81_717_pneumatic.lua index 95dcce6..ad8aaaa 100644 --- a/lua/metrostroi/systems/sys_81_717_pneumatic.lua +++ b/lua/metrostroi/systems/sys_81_717_pneumatic.lua @@ -43,14 +43,14 @@ function TRAIN_SYSTEM:Initialize(parameters) self.OldBrakeLinePressure = 0.0 self.BCPressure = 0 - -- Air distrubutor part - self.WorkingChamberPressure = 0.0 - self.AirDistributorReady = false - self.OverchargeReleaseValve = false - self.WCChargeValve = true - self.PN1 = 0 - self.PN2 = 0 - self.cranPres = 0 + -- Air distrubutor part + self.WorkingChamberPressure = 0.0 + self.AirDistributorReady = false + self.OverchargeReleaseValve = false + self.WCChargeValve = true + self.PN1 = 0 + self.PN2 = 0 + self.cranPres = 0 --DKPT self.Train:LoadSystem("DKPT","Relay","R-52B") -- @@ -82,8 +82,8 @@ function TRAIN_SYSTEM:Initialize(parameters) self.Train:LoadSystem("EmergencyBrakeValve","Relay","Switch") -- Воздухораспределитель self.Train:LoadSystem("AirDistributorDisconnect","Relay","Switch") - --Срывной клапан - self.Train:LoadSystem("AutostopValve","Relay","Switch") + --Срывной клапан + self.Train:LoadSystem("AutostopValve","Relay","Switch") --УАВА self.Train:LoadSystem("UAVA","Relay","Switch",{ bass = true}) --self.Train:LoadSystem("UAVAContact","Relay","Switch") From c1dead2a471810e378a8a56651aaa0899ef24539 Mon Sep 17 00:00:00 2001 From: BlueSnooty <89611276+BlueSnooty@users.noreply.github.com> Date: Sat, 9 Apr 2022 01:16:23 +0300 Subject: [PATCH 42/43] Update sys_81_717_pneumatic.lua MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Заменил локальными переменными лишние поля в системе пневматики --- .../systems/sys_81_717_pneumatic.lua | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lua/metrostroi/systems/sys_81_717_pneumatic.lua b/lua/metrostroi/systems/sys_81_717_pneumatic.lua index ad8aaaa..58b974b 100644 --- a/lua/metrostroi/systems/sys_81_717_pneumatic.lua +++ b/lua/metrostroi/systems/sys_81_717_pneumatic.lua @@ -45,8 +45,8 @@ function TRAIN_SYSTEM:Initialize(parameters) -- Air distrubutor part self.WorkingChamberPressure = 0.0 - self.AirDistributorReady = false - self.OverchargeReleaseValve = false + --self.AirDistributorReady = false --заменено на локальные + --self.OverchargeReleaseValve = false --переменные self.WCChargeValve = true self.PN1 = 0 self.PN2 = 0 @@ -180,8 +180,8 @@ function TRAIN_SYSTEM:TriggerInput(name,value) self.EmergencyValve = true if value ~= 2 then self.Train.UAVAC:TriggerInput("Set",0) - if not self.Train.autosaid then - self.Train.autosaid = true + if not self.Train.avtostopmsg then + self.Train.avtostopmsg = true RunConsoleCommand("say","Autostop braking",self.Train:GetDriverName()) end end @@ -468,7 +468,7 @@ function TRAIN_SYSTEM:Think(dT) if self.EmergencyValveDisable then--and (self.BrakeLinePressure-self.OldBrakeLinePressure)>0.01 then self.EmergencyValveDisable=false self.EmergencyValve=false - Train.autosaid=false + Train.avtostopmsg=false end self.OldBrakeLinePressure = self.BrakeLinePressure local leak = 0 @@ -505,10 +505,12 @@ function TRAIN_SYSTEM:Think(dT) if self.WCChargeValve == true then self:equalizePressure(dT,"WorkingChamberPressure",self.BrakeLinePressure,0.107,nil,nil,1.0) --simulate 0.8mm hole btw BL and working chambers end - self.AirDistributorReady = self.WorkingChamberPressure >= 2.2 + --self.AirDistributorReady = self.WorkingChamberPressure >= 2.2 + local aird_ready = self.WorkingChamberPressure >= 2.2 self.WCChargeValve = not ((self.WorkingChamberPressure - self.BrakeLinePressure) > 0.2 and (self.WorkingChamberPressure - self.BrakeLinePressure) < 2.5) - self.OverchargeReleaseValve = self.WorkingChamberPressure > 5.2 and not self.WCChargeValve - if self.OverchargeReleaseValve then + --self.OverchargeReleaseValve = self.WorkingChamberPressure > 5.2 and not self.WCChargeValve + local KLSZ = self.WorkingChamberPressure > 5.2 and not self.WCChargeValve + if KLSZ then self:equalizePressure(dT,"WorkingChamberPressure",0.0,0.22) -- КЛСЗ end @@ -518,7 +520,7 @@ function TRAIN_SYSTEM:Think(dT) local _offset1 = self.Train.AR63 and 0.9 or 0.8 self.GN1Offset = self.GN1Offset or math.random(20,100)*0.002 + _offset1 self.BcBl = (self.GN2Offset + self.WeightLoadRatio*1.3)/1.93 - if Train.AirDistributorDisconnect.Value == 0 and self.AirDistributorReady then + if Train.AirDistributorDisconnect.Value == 0 and aird_ready then -- Valve #1 if (Train.PneumaticNo1.Value == 1.0) and (Train.PneumaticNo2.Value == 0.0) then if self.PN1 < self.GN1Offset then From df515b29a23610d50ab263b064d8602e581861a1 Mon Sep 17 00:00:00 2001 From: Ilya Krasnow Date: Sat, 9 Apr 2022 23:27:47 +0300 Subject: [PATCH 43/43] Fix variable name --- lua/metrostroi/systems/sys_81_717_pneumatic.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/metrostroi/systems/sys_81_717_pneumatic.lua b/lua/metrostroi/systems/sys_81_717_pneumatic.lua index 58b974b..2518110 100644 --- a/lua/metrostroi/systems/sys_81_717_pneumatic.lua +++ b/lua/metrostroi/systems/sys_81_717_pneumatic.lua @@ -180,8 +180,8 @@ function TRAIN_SYSTEM:TriggerInput(name,value) self.EmergencyValve = true if value ~= 2 then self.Train.UAVAC:TriggerInput("Set",0) - if not self.Train.avtostopmsg then - self.Train.avtostopmsg = true + if not self.Train.AutoStopNotify then + self.Train.AutoStopNotify = true RunConsoleCommand("say","Autostop braking",self.Train:GetDriverName()) end end @@ -468,7 +468,7 @@ function TRAIN_SYSTEM:Think(dT) if self.EmergencyValveDisable then--and (self.BrakeLinePressure-self.OldBrakeLinePressure)>0.01 then self.EmergencyValveDisable=false self.EmergencyValve=false - Train.avtostopmsg=false + Train.AutoStopNotify=false end self.OldBrakeLinePressure = self.BrakeLinePressure local leak = 0