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

bug fixes, some adjustments

This commit is contained in:
Moon Horse
2024-07-09 17:17:47 +03:00
parent 5fe1db4e0e
commit 232a976d0b
5 changed files with 19 additions and 15 deletions

View File

@@ -108,15 +108,14 @@ function TRAIN_SYSTEM:Think(dT)
v.Battery.Ibatt = math.min(1,(2-self.Train.PA1.Value-self.Train.PA2.Value))
*(math.min(1,(v.VB.Value*v.A56.Value+v.A24.Value))*v.VB.Value*((v.A56.Value*(eds_eq - v.Battery.Voltage)
+ v.PowerSupply.X2_1*(1-v.A56.Value)*(v.PowerSupply.VoltageOut*v.A24.Value - v.Battery.Voltage))))/v.Battery.IResistance
v.PowerSupply.Iout = v.VB.Value*math.min(1,(2-self.Train.PA1.Value-self.Train.PA2.Value))*v.A24.Value*(v.PowerSupply.VoltageOut - eds_eq)/v.PowerSupply.IResistance
+ v.VB.Value*v.A56.Value*v.A24.Value*(v.PowerSupply.VoltageOut - eds_eq)*consumers_cond
v.PowerSupply.Iout = v.PowerSupply.car_control_load + v.Battery.Ibatt
v.Battery.eds_eq = eds_eq
v.eds_eq = v.Battery.eds_eq
-- DEBUG
--if self.Train.R_VPR and self.Train.R_VPR.Value < 0.5 then
--print(v.eds_eq, nodecurr_sum, branchcond_sum)
--print("v.PowerSupply.X2_1 = "..v.PowerSupply.X2_1)
--print(v.PowerSupply.car_control_load,v.Battery.Ibatt,v.Battery.IResistance)
--print(v.PowerSupply.Iout,v.PowerSupply.Icosume)
--end

View File

@@ -10,7 +10,7 @@ TRAIN_SYSTEM.DontAccelerateSimulation = true
function TRAIN_SYSTEM:Initialize()
self.X2 = {
[2] = 0,
[3] = 0, --overheat protection simulation
[3] = 0,
[4] = 0,
[5] = 0, -- Out only
[6] = 0,
@@ -50,21 +50,26 @@ end
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
-- X2_1 now indicates that primary converter is operating
self.X2_1 = (Train.Electric.Aux750V > 550 and 1 or 0) * Train.KPP.Value * (1-Train.RZP.Value)
if Train.Electric.Aux750V >= 550 then
self.VoltageOut = self.X2_1*(self.OutputVoltage + (Train.Electric.Aux750V - 550)*8/425)
else
self.VoltageOut = math.max(0,self.X2_1*(Train.Electric.Aux750V - 300)*76/300)
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
Train.RZP:TriggerInput("Close",1)
--print("self.Icosume = "..self.Icosume, "Train.Electric.Aux750V = "..Train.Electric.Aux750V, "self.Iout = "..self.Iout)
--print("Train.Battery.eds_eq = "..Train.Battery.eds_eq, "self.VoltageOut = "..self.VoltageOut)
self.X2_1 = 0
XT3_1 = 0
end
-- Check if enable signal is present
self.Active = XT3_1>0 and 1 or 0
self.X2_2 = Train.Electric.Aux750V*self.Active
self.X6_2 = self.Active
--self.VoltageOut = self.X2_1*((self.OutputVoltage - self.car_control_load*self.IResistance) + (Train.Electric.Aux750V - 600)*2/375)
self.VoltageOut = self.X2_1*(self.OutputVoltage + (Train.Electric.Aux750V - 600)*8/375)
self.X2_2 = Train.Electric.Aux750V*self.Active -- radio, asnp etc.
self.X6_2 = Train.KVP.Value--self.Active -- mainlights
end

View File

@@ -76,7 +76,7 @@ local relay_types = {
hasCoil = true,
},
["R-52B"] = {
hasCoil = true,
--hasCoil = true,
},
["RPUZ-114-T-UHLZA"] = {
hasCoil = true,

View File

@@ -16,7 +16,7 @@ function TRAIN_SYSTEM:Initialize()
-- Нулевое реле (НР)
-- Does not use any power source defined, as the operation is calculated from bus voltage
self.Train:LoadSystem("NR","Relay","R3150", { power_source = "None", coil_res = 690,pickup_current = 0.03, hasCoil = true })
self.Train:LoadSystem("NR","Relay","R3150", { power_source = "None" })--, coil_res = 690,pickup_current = 0.03, hasCoil = true })
-- Реле системы управления
self.Train:LoadSystem("RSU","Relay","R3100", {coil_res = 275,pickup_current = 0.03, hasCoil = true})
self.Train:LoadSystem("RU","Relay","R3100")

View File

@@ -10,14 +10,14 @@ function TRAIN_SYSTEM:Initialize(parameters)
-- Реле дверей (РД)
self.Train:LoadSystem("RD","Relay","REV-821",{ close_time = 0.1, coil_res = 448, pickup_current = 0.022 })
-- Реле включения освещения (РВО)
self.Train:LoadSystem("RVO","Relay","REV-814T",{ open_time = 4.0, coil_res = 21, pickup_current = 0.042 })
self.Train:LoadSystem("RVO","Relay","REV-814T",{ open_time = 4.5, coil_res = 21, pickup_current = 0.042 })
-- Реле времени торможения (РВ3)
self.Train:LoadSystem("RV3","Relay","REV-813T",{ open_time = 2.3, coil_res = 244, pickup_current = 0.032 })
-- Реле тока (РТ2)
self.Train:LoadSystem("RT2","Relay","REV-830",{ trigger_level = 130 }) -- A
self.Train:LoadSystem("RT2r","Relay","",{ close_time = 0, open_time = 0.6}) --UNREALISTIC Repeater for RT2 for MSK trains
-- Реле контроля тормозного тока (РКТТ)
self.Train:LoadSystem("RKTT","Relay","R-52B", { coil_res = 129, pickup_current = 0.018 })
self.Train:LoadSystem("RKTT","Relay","R-52B" --[[{ coil_res = 129, pickup_current = 0.018 }]])
self.Train.RKTTsh = 1
end