mirror of
https://github.com/metrostroi-repo/MetrostroiAddon.git
synced 2026-05-02 00:42:29 +00:00
Improved battery charging and control circuits current computing; also added more correct BPSN overload protection code
This commit is contained in:
@@ -131,7 +131,7 @@ function ENT:Initialize()
|
||||
Pos = Vector(-177, -66, -50), Radius = 20,
|
||||
},
|
||||
}
|
||||
self.BattCurrent = 0
|
||||
--self.BattCurrent = 0
|
||||
self.eds_eq = 0
|
||||
|
||||
-- Cross connections in train wires
|
||||
@@ -231,7 +231,7 @@ end
|
||||
function ENT:TrainSpawnerUpdate()
|
||||
self:SetNW2Bool("Custom",self.CustomSettings)
|
||||
self.Battery:TriggerInput("CarType",1)
|
||||
self.Battery:TriggerInput("InitialVoltage",math.random(62,75))
|
||||
--self.Battery:TriggerInput("InitialVoltage",math.random(62,75))
|
||||
self.Battery:TriggerInput("Dischargeable",self:GetNW2Bool("BattCharge"))
|
||||
local num = self.WagonNumber
|
||||
math.randomseed(num+817171)
|
||||
@@ -386,7 +386,7 @@ function ENT:Think()
|
||||
----------------------------------*****************************--------------------------------
|
||||
|
||||
self:SetPackedRatio("BatteryVoltage",(self.Battery.eds_eq)/150.0)
|
||||
self:SetPackedRatio("BatteryCurrent",self.BattCurrent/1000)
|
||||
self:SetPackedRatio("BatteryCurrent",self.Battery.Ibatt/1000)
|
||||
self:SetPackedRatio("EnginesCurrent", 0.5 + 0.5*(self.Electric.I24/500.0))
|
||||
|
||||
self:SetPackedBool("Compressor",Pneumatic.Compressor > 0)
|
||||
|
||||
@@ -224,7 +224,7 @@ function ENT:Initialize()
|
||||
self.PassengerDoor = false
|
||||
self.OtsekDoor1 = false
|
||||
self.OtsekDoor2 = false
|
||||
self.BattCurrent = 0
|
||||
--self.BattCurrent = 0
|
||||
self.eds_eq = 0
|
||||
|
||||
self.Lamps = {
|
||||
@@ -385,7 +385,7 @@ function ENT:TrainSpawnerUpdate()
|
||||
local num = self.WagonNumber
|
||||
self:SetNW2Bool("Custom",self.CustomSettings)
|
||||
self.Battery:TriggerInput("CarType",1)
|
||||
self.Battery:TriggerInput("InitialVoltage",math.random(62,75))
|
||||
--self.Battery:TriggerInput("InitialVoltage",math.random(62,75))
|
||||
self.Battery:TriggerInput("Dischargeable",self:GetNW2Bool("BattCharge"))
|
||||
local ccc = 0
|
||||
self.ComputerCar = false
|
||||
@@ -689,6 +689,7 @@ function ENT:Think()
|
||||
self:SetPackedRatio("EnginesCurrent2", 0.5 + 0.5*(self.Electric.I13/500.0))
|
||||
self:SetPackedRatio("EnginesCurrent", 0.5 + 0.5*(self.Electric.I24/500.0))
|
||||
|
||||
-- Эту залупу надо либо убирать, либо переписывать с учетом токов ЦУ
|
||||
----------------------------------*****************************--------------------------------
|
||||
--imitating converter overload protection only when control circuits are energized and at least one PC on the train is off; pretty useless btw (but fun)
|
||||
local pcloadratio = #self.WagonList/(self.Battery.hvcounter > 0 and self.Battery.hvcounter or 0.5)
|
||||
|
||||
Reference in New Issue
Block a user