.
This commit is contained in:
parent
e38de82efb
commit
7eec32ad38
@ -326,7 +326,12 @@ local function calculateFieldInput()
|
|||||||
|
|
||||||
local drainRate = reactorInfo.fieldDrainRate
|
local drainRate = reactorInfo.fieldDrainRate
|
||||||
local currentStrength = reactorInfo.fieldStrength / reactorInfo.maxFieldStrength
|
local currentStrength = reactorInfo.fieldStrength / reactorInfo.maxFieldStrength
|
||||||
|
|
||||||
|
-- Use charge target during warmup/charging, operational target when running
|
||||||
local targetStrength = CONFIG.target_field_strength
|
local targetStrength = CONFIG.target_field_strength
|
||||||
|
if state == STATES.CHARGING or state == STATES.WARMING_UP then
|
||||||
|
targetStrength = CONFIG.charge_field_target
|
||||||
|
end
|
||||||
|
|
||||||
-- Base input = drain rate to maintain current level
|
-- Base input = drain rate to maintain current level
|
||||||
local baseInput = drainRate
|
local baseInput = drainRate
|
||||||
@ -339,8 +344,8 @@ local function calculateFieldInput()
|
|||||||
local totalInput = baseInput + correction
|
local totalInput = baseInput + correction
|
||||||
|
|
||||||
-- SAFETY: Never return less than the drain rate (would cause field to drop)
|
-- SAFETY: Never return less than the drain rate (would cause field to drop)
|
||||||
-- Add 10% safety margin
|
-- Add 10% safety margin, but ensure minimum of 1M RF/t during warmup when drain is 0
|
||||||
local minimumInput = drainRate * 1.1
|
local minimumInput = math.max(drainRate * 1.1, 1000000)
|
||||||
|
|
||||||
return math.max(minimumInput, math.floor(totalInput))
|
return math.max(minimumInput, math.floor(totalInput))
|
||||||
end
|
end
|
||||||
@ -567,7 +572,13 @@ local function controlReactor()
|
|||||||
|
|
||||||
elseif state == STATES.WARMING_UP then
|
elseif state == STATES.WARMING_UP then
|
||||||
-- WARMING UP: Maintain field, slowly ramp output
|
-- WARMING UP: Maintain field, slowly ramp output
|
||||||
|
local maxField = reactorInfo.maxFieldStrength or 0
|
||||||
|
if maxField > 0 then
|
||||||
inputRate = calculateFieldInput()
|
inputRate = calculateFieldInput()
|
||||||
|
else
|
||||||
|
-- maxFieldStrength not available yet - use emergency input
|
||||||
|
inputRate = CONFIG.emergency_field_input
|
||||||
|
end
|
||||||
outputRate = calculateOutputRate()
|
outputRate = calculateOutputRate()
|
||||||
|
|
||||||
elseif state == STATES.RUNNING then
|
elseif state == STATES.RUNNING then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user