1
0
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:
Moon Horse
2024-07-05 21:49:44 +03:00
parent 14310e2cfe
commit 24a3e9f67c
7 changed files with 50 additions and 53 deletions

View File

@@ -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)