# Moles calculation
#
#   moles = 1000 / (8.31446261 * 293.15 / volume)
#
#   More practically:
#
#   moles = volume * 0.41027581
#
#   Yes, you do need all those digits or your pressure wont end up exactly 1000
#
#
# The number 1000 comes from the default MaxReleasePressure for a GasCanister,
# which is 10 * Atmospherics.OneAtmosphere, rounded down.
#
# 8.31446261 is the universal gas constant
#
# 293.15 is our default atmospheric temperature
#

# If you change the mole amounts, you can calculate the new gas supply times with:
# minutes = (moles / outputPressure) * 325

- type: entity
  id: OxygenTankFilled
  parent: OxygenTank
  suffix: Filled
  components:
  - type: GasTank
    releasePressure: 21.3
    air:
      # 31 minutes
      volume: 5
      moles:
        Oxygen: 2.051379050 # oxygen
      temperature: 293.15

- type: entity
  id: EmergencyOxygenTankFilled
  parent: EmergencyOxygenTank
  suffix: Filled
  components:
  - type: GasTank
    releasePressure: 21.3
    air:
      # 4 minutes
      volume: 0.66
      moles:
        Oxygen: 0.270782035 # oxygen
      temperature: 293.15

- type: entity
  id: EmergencyNitrogenTankFilled
  parent: EmergencyNitrogenTank
  suffix: Filled
  components:
  - type: GasTank
    releasePressure: 21.3
    air:
      # 4 minutes
      volume: 0.66
      moles:
        Nitrogen: 0.270782035 # nitrogen
      temperature: 293.15


- type: entity
  id: ExtendedEmergencyOxygenTankFilled
  parent: ExtendedEmergencyOxygenTank
  suffix: Filled
  components:
  - type: GasTank
    releasePressure: 21.3
    air:
      # 9 minutes
      volume: 1.5
      moles:
        Oxygen: 0.615413715 # oxygen
      temperature: 293.15

- type: entity
  id: ExtendedEmergencyNitrogenTankFilled
  parent: ExtendedEmergencyNitrogenTank
  suffix: Filled
  components:
  - type: GasTank
    releasePressure: 21.3
    air:
      # 9 minutes
      volume: 1.5
      moles:
        Nitrogen: 0.615413715 # nitrogen
      temperature: 293.15


- type: entity
  id: DoubleEmergencyOxygenTankFilled
  parent: DoubleEmergencyOxygenTank
  suffix: Filled
  components:
  - type: GasTank
    releasePressure: 21.3
    air:
      # 15 minutes
      volume: 2.5
      moles:
        Oxygen: 1.025689525 # oxygen
      temperature: 293.15

- type: entity
  id: DoubleEmergencyNitrogenTankFilled
  parent: DoubleEmergencyNitrogenTank
  suffix: Filled
  components:
  - type: GasTank
    releasePressure: 21.3
    air:
      # 15 minutes
      volume: 2.5
      moles:
        Nitrogen: 1.025689525 # nitrogen
      temperature: 293.15

- type: entity
  id: EmergencyFunnyOxygenTankFilled
  parent: EmergencyFunnyOxygenTank
  suffix: Filled
  components:
  - type: GasTank
    releasePressure: 22.4
    air:
      # 4 minutes
      volume: 0.66
      moles:
        Oxygen: 0.270782035 # 95% oxygen
        NitrousOxide: 0.014251686 # 5% N2O
        # 0.285033721       total
      temperature: 293.15

- type: entity
  id: AirTankFilled
  parent: AirTank
  suffix: Filled
  components:
  - type: GasTank
    releasePressure: 101.3
    air:
      # 6 minutes due to output pressure
      volume: 5
      moles:
        Oxygen: 0.451303391 # 22% oxygen
        Nitrogen: 1.600075659 # 78% nitrogen
        # 2.051379050       total
      temperature: 293.15

- type: entity
  id: NitrogenTankFilled
  parent: NitrogenTank
  suffix: Filled
  name: nitrogen tank
  components:
  - type: GasTank
    air:
      # 31 minutes
      volume: 5
      moles:
        Nitrogen: 2.051379050 # nitrogen
      temperature: 293.15

- type: entity
  id: NitrousOxideTankFilled
  parent: NitrousOxideTank
  suffix: Filled
  name: nitrous oxide tank
  components:
  - type: GasTank
    #      0.21  | % oxygen in normal atmosphere
    #  /   0.7   | % oxygen in this mixture
    #  * 101.325 | one atmosphere
    # __________
    #    30.3975   optimal output pressure
    releasePressure: 30.4
    air:
      # only 22 minutes due to pressure
      volume: 5
      moles:
        Oxygen: 1.435965335 # 70% oxygen
        NitrousOxide: 0.615413715 # 30% N2O
        # 2.051379050       total
      temperature: 293.15

- type: entity
  id: PlasmaTankFilled
  parent: PlasmaTank
  name: plasma tank
  suffix: Filled
  components:
  - type: GasTank
    releasePressure: 101.3
    air:
      # 6 minutes of agony
      volume: 5
      moles:
        Plasma: 2.051379050
      temperature: 293.15

- type: entity
  parent: AirTank
  id: MaxCap # As of currently writing, tanks have an explosion intensity of about 125, which is about as powerful as an explosive grenade.
  suffix: DEBUG, Max Cap
  components:
  - type: GasTank
    air:
      volume: 5
      moles:
        Oxygen: 1.0 # If trit fire burn ratio is ever changed, this value will need to be adjusted.
        Tritium: 0.5
      temperature: 373.149

- type: entity
  parent: EmergencyOxygenTank
  id: MaxCapSmall # As of currently writing, mini tanks have an explosion intensity of about 40.
  suffix: DEBUG, Max Cap
  components:
  - type: GasTank
    air:
      volume: 0.66
      moles:
        Oxygen: 0.1 # If trit fire burn ratio is ever changed, this value will need to be adjusted.
        Tritium: 0.05
        Plasma: 0.06 # High mass to slow flow rate
      temperature: 373.149

- type: entity
  parent: ExtendedEmergencyOxygenTank
  id: MaxCapSmallEx # As of currently writing, extended tanks currently have an explosive intensity of about 65
  suffix: DEBUG, Max Cap
  components:
  - type: GasTank
    air:
      volume: 1.5
      moles:
        Oxygen: 0.41027581
        Tritium: 0.205137905
      temperature: 373.149

- type: entity
  parent: DoubleEmergencyOxygenTank
  id: MaxCapSmallDouble # As of currently writing, extended tanks currently have an explosive intensity of about 85
  suffix: DEBUG, Max Cap
  components:
  - type: GasTank
    air:
      volume: 2.5
      moles:
        Oxygen:  0.68379301666
        Tritium: 0.34189650833
      temperature: 373.149

- type: entity
  parent: AirTank
  id: MaxCapSilly
  name: max cap
  suffix: DEBUG, Max Cap, Impossible
  components:
  - type: GasTank
    air:
      volume: 5
      moles:
        Oxygen: 6
        Tritium: 3
      temperature: 373.149

- type: entity
  parent: AirTank
  id: MaxCapBluespace
  name: max cap
  suffix: DEBUG, Max Cap, Canister
  components:
  - type: Explosive
    maxIntensity: 200
  - type: GasTank
    safetyPressure: 5066.25
    overpressure: 15198.75
    air:
      volume: 1500
      moles:
        Oxygen: 1400
        Tritium: 700
      temperature: 373.149
