mirror of
https://github.com/metrostroi-repo/MetrostroiAddon.git
synced 2026-05-02 00:42:29 +00:00
implemented control circuits current calculations for BPSN with respect to number of 10th wire connected ones
This commit is contained in:
@@ -23,9 +23,11 @@ function TRAIN_SYSTEM:Initialize()
|
||||
self.OutputVoltage = 76 -- volts
|
||||
self.IResistance = 0.01 -- Ohm (сам выдумал, примерно на полтора порядка ниже, чем у АКБ)
|
||||
self.car_control_load = 0 -- Amp
|
||||
self.car_control_sigma = 0 -- Amp
|
||||
self.Icosume = 0 -- 3rd rail current consumption, amp
|
||||
self.Iout = 0 -- output current, amp
|
||||
self.VoltageOut = 0
|
||||
self.ISumpSetpoint = math.random(25,30) -- overload consumption current protection setpoint
|
||||
|
||||
self.Active = 0
|
||||
self.Train:LoadSystem("ConverterProtection","Relay","Switch", {bass = true})
|
||||
@@ -36,7 +38,7 @@ function TRAIN_SYSTEM:Inputs()
|
||||
end
|
||||
|
||||
function TRAIN_SYSTEM:Outputs()
|
||||
return { "X2_2", "X6_2", "car_control_load", "VoltageOut", "OutputVoltage", "Icosume", "Iout" }
|
||||
return { "X2_2", "X6_2", "car_control_load", "car_control_sigma", "VoltageOut", "OutputVoltage", "Icosume", "Iout" }
|
||||
end
|
||||
|
||||
|
||||
@@ -57,13 +59,26 @@ function TRAIN_SYSTEM:Think()
|
||||
else
|
||||
self.VoltageOut = math.max(0,self.X2_1*(Train.Electric.Aux750V - 300)*76/300)
|
||||
end
|
||||
|
||||
if self.car_control_sigma > 0 then
|
||||
self.Iout = Train.A24.Value*Train.PowerSupply.X2_1*self.car_control_sigma
|
||||
for k,v in ipairs(Train.WagonList) do
|
||||
if v ~= Train then
|
||||
self.Iout = math.max(0,self.Iout - v.A24.Value*v.PowerSupply.X2_1*(v.PowerSupply.car_control_load + v.A56.Value*v.Battery.Ibatt))
|
||||
end
|
||||
end
|
||||
self.car_control_sigma = 0
|
||||
end
|
||||
|
||||
self.Icosume = Train.NR.Value*self.VoltageOut*self.Iout/(Train.Electric.Aux750V > 0 and Train.Electric.Aux750V or 1)
|
||||
|
||||
-- Get battery input
|
||||
local XT3_1 = self.X2[5]*self.X2_1
|
||||
if Train.Electric.Aux750V*self.X2_1 > 975 or self.Icosume > 28 then -- should be 25 - 30 amp
|
||||
if Train.Electric.Aux750V*self.X2_1 > 975 or self.Icosume > self.ISumpSetpoint then
|
||||
Train.RZP:TriggerInput("Close",1)
|
||||
--print("self.Icosume = "..self.Icosume, "Train.Electric.Aux750V = "..Train.Electric.Aux750V, "self.Iout = "..self.Iout)
|
||||
print "-------------------------------------------------------------------------------------------\n"
|
||||
print(Format("Сработала защита БПСН вагона %s:",Train.WagonNumber))
|
||||
print(Format("I потр = %.2f A\tI вых = %.2f A\tI уст = %.2f A\tU кс = %.1f B", self.Icosume, self.Iout, self.ISumpSetpoint, Train.Electric.Aux750V))
|
||||
--print("Train.Battery.eds_eq = "..Train.Battery.eds_eq, "self.VoltageOut = "..self.VoltageOut)
|
||||
self.X2_1 = 0
|
||||
XT3_1 = 0
|
||||
|
||||
Reference in New Issue
Block a user