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

Implemented rechargeable battery and imitation of control circuit's current. Randomized initial battery voltage and relays trigger level

This commit is contained in:
Moon Horse
2023-05-02 02:22:30 +03:00
parent d17cb74904
commit 0027160c2d
15 changed files with 156 additions and 73 deletions

View File

@@ -5,6 +5,7 @@
-- Contains proprietary code. See license.txt for additional information.
--------------------------------------------------------------------------------
Metrostroi.DefineSystem("BPSN")
TRAIN_SYSTEM.DontAccelerateSimulation = true
function TRAIN_SYSTEM:Initialize()
self.X2 = {
@@ -19,6 +20,11 @@ function TRAIN_SYSTEM:Initialize()
self.X6_2 = 0
self.X2_1 = 0
self.OutputVoltage = math.random(78,82) -- volts
self.IResistance = 0.05--1.33 --Ohm
self.car_control_load= 0 --Amp
self.VoltageOut = 0
self.Active = 0
self.Train:LoadSystem("ConverterProtection","Relay","Switch", {bass = true})
end
@@ -54,4 +60,6 @@ function TRAIN_SYSTEM:Think()
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)
end