mirror of
https://github.com/metrostroi-repo/MetrostroiAddon.git
synced 2026-05-02 00:42:29 +00:00
release branch init
This commit is contained in:
@@ -108,15 +108,16 @@ function TRAIN_SYSTEM:Think(dT)
|
||||
else
|
||||
self.T = self.T+(T*(0.95+math.random()*0.1)-self.T)*dT*1.5
|
||||
end
|
||||
--if I > T then print(self.RNState,self.RVState,I,T,self.PrepareElectric) end
|
||||
|
||||
self:SolveRV(Train,self.T,dT,I,self.State < 0,self.State == 1 and Train.Electric.BlockRV)
|
||||
self:SolveRN(Train,self.T,dT,I,self.State < 0,self.State == 1 and T <= 150)
|
||||
self:SolveRV(Train,self.T,dT,I,self.State < 0)
|
||||
self:SolveRN(Train,self.T,dT,I,self.State < 0)
|
||||
end
|
||||
|
||||
|
||||
--BPTI
|
||||
--------------------------------------------------------------------------------
|
||||
function TRAIN_SYSTEM:SolveRN(Train,T,dT,I,brake,start)
|
||||
function TRAIN_SYSTEM:SolveRN(Train,T,dT,I,brake)
|
||||
-- General state
|
||||
local Active = self.RN > 0--and T > 0
|
||||
--local I = math.abs(Electric.I13 + Electric.I24)/2
|
||||
@@ -136,9 +137,9 @@ function TRAIN_SYSTEM:SolveRN(Train,T,dT,I,brake,start)
|
||||
if T == 0 then
|
||||
self.RNState = math.max(0,self.RNState-5*dT*sign)
|
||||
elseif I > T then
|
||||
self.RNState = math.max(0,math.min(start and 0.1 or 1,self.RNState-dC*1/rnd*dT*sign))
|
||||
self.RNState = math.max(0,math.min(1,self.RNState-dC*1/rnd*dT*sign))
|
||||
else
|
||||
self.RNState = math.max(0,math.min(start and 0.1 or 1,self.RNState+dC*1/rnd*dT*sign))
|
||||
self.RNState = math.max(0,math.min(1,self.RNState+dC*1/rnd*dT*sign))
|
||||
end
|
||||
if (not brake and self.RNState == 1 or brake and self.RNState == 0) and self.RN > 0 and not self.RV then
|
||||
self.RV = true
|
||||
@@ -147,9 +148,9 @@ function TRAIN_SYSTEM:SolveRN(Train,T,dT,I,brake,start)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TRAIN_SYSTEM:SolveRV(Train,T,dT,I,brake,block)
|
||||
function TRAIN_SYSTEM:SolveRV(Train,T,dT,I,brake)
|
||||
-- General state
|
||||
local Active = self.RV and (not block or self.RVState > 0)
|
||||
local Active = self.RV
|
||||
--local I = math.abs(Electric.I13 + Electric.I24)/2
|
||||
self.RNPrevCurrent = Current
|
||||
|
||||
@@ -168,7 +169,7 @@ function TRAIN_SYSTEM:SolveRV(Train,T,dT,I,brake,block)
|
||||
|
||||
local dC = math.min(math.abs(T-I), 300)
|
||||
if not self.PrepareElectric then
|
||||
if T == 0 or block then
|
||||
if T == 0 then
|
||||
self.RVState = math.max(0,self.RVState-5*dT*sign)
|
||||
elseif brake and I<T or not brake and I > T then
|
||||
self.RVState = math.max(0,math.min(1,self.RVState-dC*1/rnd*dT*sign))
|
||||
@@ -216,6 +217,10 @@ function TRAIN_SYSTEM:SolveRV(Train,T,dT,I,brake,block)
|
||||
self.RNState = brake and 0.01 or 0.99
|
||||
end
|
||||
end
|
||||
--[[
|
||||
if Train:EntIndex() == 1275 and iter%4 == 0 then
|
||||
print(Format("[%04d]RV:% 3.01f/% 3.01f A % 3d%% %.2f+%.2f=%.2f % 3d km\\h F=%.02f",Train:EntIndex(),Current,T,self.RVState*100,A,B,C,Train.Speed,TargetField))
|
||||
end]]
|
||||
end
|
||||
-- Set resistance
|
||||
self.RVResistance = Resistance + 1e9 * (Active and 0 or 1)
|
||||
|
||||
Reference in New Issue
Block a user