using Content.Shared.Atmos; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Server._NF.Manufacturing.Components; /// /// An entity with this will produce some amount of gas over time if supplied with power. /// Gas is output at a regular frequency, and the amount of gas spawned scales with the amount of power given. /// At high power input, gas returns diminish logarithmically. /// Expected to be used with a GasCanister that can contain the mixture. /// [RegisterComponent, AutoGenerateComponentPause] public sealed partial class GasSpawnPowerConsumerComponent : Component { #region Generation Params /// /// The name of the power node to be connected/disconnected. /// [DataField] public string PowerNodeName = "input"; /// /// The period between depositing money into a sector account. /// Also the T in Tk*a^(log10(x/T)-R) for rate calculation /// [DataField] public TimeSpan SpawnCheckPeriod = TimeSpan.FromSeconds(4); /// /// The next time this power plant is selling accumulated power. /// Should not be changedduring runtime, will cause errors in deposit amounts. /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField] public TimeSpan NextSpawnCheck; /// /// The total energy accumulated, in watts. /// [DataField] public float AccumulatedEnergy; /// /// The energy accumulated this spawn check, in watts. /// [DataField] public float AccumulatedSpawnCheckEnergy; /// /// The total amount of energy required to spawn one mole of gas. /// [DataField] public float EnergyPerMole = 200_000; /// /// The total mixture to spawn per unit of energy. /// [DataField] public GasMixture SpawnMixture { get; set; } = new(); #endregion Generation Params #region Linear Rates /// /// The number of moles of gas to spawn per joule of power. /// [DataField] public float LinearRate = 0.0000005f; // 1 mol/200 kW /// /// The maximum value (inclusive) of the linear mode per deposit, in watts /// [DataField] public float LinearMaxValue = 1_000_000; // 1 MW (5 mol/s) #endregion Linear Rates // Logarithmic fields: at very high levels of power generation, incremental gains decrease logarithmically to prevent runaway cash generation #region Logarithmic Rates /// /// The base on power the logarithmic mode: a in Tk*a^(log10(x/T)-R) /// [DataField] public float LogarithmRateBase = 2.5f; /// /// The coefficient of the logarithmic mode: k in Tk*a^(log10(x/T)-R) /// Note: should be set to LinearRate*LinearMaxValue for a continuous function. /// [DataField] public float LogarithmCoefficient = 1_000_000f; /// /// The exponential subtrahend of the logarithmic mode: R in Tk*a^(log10(x/T)-R) /// Note: should be set to log10(LinearMaxValue) for a continuous function. /// [DataField] public float LogarithmSubtrahend = 6.0f; // log10(1_000_000) #endregion Logarithmic Rates /// /// The maximum number of moles of gas to spawn, per second. /// [DataField] public float MaximumMolesPerSecond = 150.0f; // ~1.859 GW /// /// The minimum requestable power. /// [DataField] public float MinimumRequestablePower = 500; // 500 W /// /// The maximum requestable power. /// [DataField] public float MaximumRequestablePower = 100_000_000_000; // 100 GW }