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

@@ -20,10 +20,12 @@ function TRAIN_SYSTEM:Initialize()
self.X6_2 = 0
self.X2_1 = 0
self.OutputVoltage = 76--math.random(78,82) -- volts
self.IResistance = 0.01 --Ohm (сам выдумал, примерно на полтора порядка ниже, чем у АКБ)
self.car_control_load= 0 --Amp
self.VoltageOut = 0
self.OutputVoltage = 76 -- volts
self.IResistance = 0.01 -- Ohm (сам выдумал, примерно на полтора порядка ниже, чем у АКБ)
self.car_control_load = 0 -- Amp
self.Icosume = 0 -- 3rd rail current consumption, amp
self.Iout = 0 -- output current, amp
self.VoltageOut = 0
self.Active = 0
self.Train:LoadSystem("ConverterProtection","Relay","Switch", {bass = true})
@@ -34,7 +36,7 @@ function TRAIN_SYSTEM:Inputs()
end
function TRAIN_SYSTEM:Outputs()
return { "X2_2", "X6_2", "car_control_load", "VoltageOut", "OutputVoltage" }
return { "X2_2", "X6_2", "car_control_load", "VoltageOut", "OutputVoltage", "Icosume", "Iout" }
end
@@ -49,9 +51,11 @@ function TRAIN_SYSTEM:Think()
local Train = self.Train
-- Get high-voltage input
self.X2_1 = Train.KPP.Value * (1-Train.RZP.Value) * (1-self.X2[3]) -- P4
self.Icosume = self.VoltageOut*self.Iout/Train.Electric.Aux750V
-- Get battery input
local XT3_1 = self.X2[5]*self.X2_1
if Train.Electric.Aux750V*self.X2_1 > 975 then
if Train.Electric.Aux750V*self.X2_1 > 975 or self.Icosume > 28 then -- should be 25 - 30 amp
Train.RZP:TriggerInput("Close",1)
self.X2_1 = 0
XT3_1 = 0