1
0
mirror of https://github.com/metrostroi-repo/MetrostroiAddon.git synced 2026-05-02 00:42:29 +00:00

Simulate air pressure drop while the typhoon is engaged

This commit is contained in:
Moon Horse
2022-04-23 23:25:21 +03:00
parent 0f90ed365d
commit fe29314e2f
3 changed files with 13 additions and 4 deletions

View File

@@ -36,6 +36,8 @@ function TRAIN_SYSTEM:Initialize(parameters)
-- Pressure in trains brake line
self.BrakeLinePressure = 0.0 -- atm
self.EPKPressure = 0.0 -- atm
-- Pressure in train's auxiliary line
self.AuxiliaryLinePressure = 8.0 -- atm
-- Pressure in brake cylinder
self.BrakeCylinderPressure = 0.0 -- atm
-- Pressure in the door line
@@ -155,7 +157,7 @@ end
function TRAIN_SYSTEM:Outputs()
return { "BrakeLinePressure", "BrakeCylinderPressure", "DriverValvePosition",
"ReservoirPressure", "TrainLinePressure", "DoorLinePressure", "WeightLoadRatio", "WorkingChamberPressure" }
"ReservoirPressure", "TrainLinePressure", "DoorLinePressure", "WeightLoadRatio", "WorkingChamberPressure", "AuxiliaryLinePressure" }
end
function TRAIN_SYSTEM:TriggerInput(name,value)
@@ -324,6 +326,7 @@ function TRAIN_SYSTEM:Think(dT)
self.BrakeCylinderPressure_dPdT = 0.0
self.ParkingBrakePressure_dPdT = 0.0
self.WorkingChamberPressure_dPdT = 0.0
self.AuxiliaryLinePressure_dPdT = 0.0
local rnd = math.random(1,10)
local offs = 0.1
@@ -593,6 +596,10 @@ function TRAIN_SYSTEM:Think(dT)
-- Simulate cross-feed between different wagons
self:UpdatePressures(Train,dT)
-- Simulate air pressure drop while the horn is engaged
local horny = self.Train:GetNW2Bool("HornState",false)
self:equalizePressure(dT,"AuxiliaryLinePressure", horny and math.max(0,self.TrainLinePressure - 0.3) or self.TrainLinePressure, 22) --was 12
self.TrainLinePressure = self.TrainLinePressure - (horny and 0.012 or 0)
----------------------------------------------------------------------------
-- Simulate compressor operation and train line depletion
self.Compressor = Train.KK.Value * (Train.Electric.Aux750V > 550 and 1 or 0)