Class ConverterStateGetter

java.lang.Object
org.kigalisim.engine.state.ConverterStateGetter
All Implemented Interfaces:
StateGetter

public class ConverterStateGetter extends Object implements StateGetter
Class providing state information needed for unit conversions.

Interfaces with the engine to retrieve information about current substance consumption, volumes, populations, time elapsed, and other metrics needed to convert between different unit types in the model. This may be required to perform certain unit conversions like from number of units of equipment to tCO2e (relies on charge levels).

  • Constructor Details

    • ConverterStateGetter

      public ConverterStateGetter(Engine engine)
      Create a new converter state getter.
      Parameters:
      engine - The engine instance to query for state information
  • Method Details

    • getSubstanceConsumption

      public EngineNumber getSubstanceConsumption()
      Get the consumption ratio per unit volume of substance.
      Specified by:
      getSubstanceConsumption in interface StateGetter
      Returns:
      The consumption per volume ratio in tCO2e/kg or tCO2e/mt
      Throws:
      RuntimeException - If consumption or volume units are not as expected
    • getEnergyIntensity

      public EngineNumber getEnergyIntensity()
      Get the energy consumption intensity per unit volume.
      Specified by:
      getEnergyIntensity in interface StateGetter
      Returns:
      The energy intensity as a ratio (e.g., kwh/mt or kwh/kg)
      Throws:
      RuntimeException - If consumption or volume units are not as expected
    • getAmortizedUnitVolume

      public EngineNumber getAmortizedUnitVolume()
      Get the amortized initial charge volume per unit for sales.
      Specified by:
      getAmortizedUnitVolume in interface StateGetter
      Returns:
      The amortized initial charge volume in kg or mt per unit
    • getPopulation

      public EngineNumber getPopulation()
      Get the current equipment population.
      Specified by:
      getPopulation in interface StateGetter
      Returns:
      The equipment count in units
    • getYearsElapsed

      public EngineNumber getYearsElapsed()
      Get number of years in the simulation since the last step.
      Specified by:
      getYearsElapsed in interface StateGetter
      Returns:
      The elapsed time in years since the last step
    • getGhgConsumption

      public EngineNumber getGhgConsumption()
      Get the total ghg consumption for the current state.
      Specified by:
      getGhgConsumption in interface StateGetter
      Returns:
      The consumption value in tCO2e
    • getEnergyConsumption

      public EngineNumber getEnergyConsumption()
      Get the total energy consumption for the current state.
      Specified by:
      getEnergyConsumption in interface StateGetter
      Returns:
      The consumption value in kwh
    • getVolume

      public EngineNumber getVolume()
      Get the total volume from sales for the current state.
      Specified by:
      getVolume in interface StateGetter
      Returns:
      The volume in kg or mt
    • getAmortizedUnitConsumption

      public EngineNumber getAmortizedUnitConsumption()
      Get the consumption ratio per unit of population.
      Specified by:
      getAmortizedUnitConsumption in interface StateGetter
      Returns:
      The consumption per unit ratio in tCO2e/unit
      Throws:
      RuntimeException - If population or volume units are not as expected
    • getPopulationChange

      public EngineNumber getPopulationChange(UnitConverter unitConverter)
      Calculate the change in population between prior and current equipment.
      Specified by:
      getPopulationChange in interface StateGetter
      Parameters:
      unitConverter - Converter for ensuring consistent units
      Returns:
      The population change in units
    • getPriorVolume

      public EngineNumber getPriorVolume()
      Get the prior year volume from sales stream.
      Specified by:
      getPriorVolume in interface StateGetter
      Returns:
      The prior year volume with units like "kg" or "mt", or current year if no prior
    • getPriorGhgConsumption

      public EngineNumber getPriorGhgConsumption()
      Get the prior year GHG consumption.
      Specified by:
      getPriorGhgConsumption in interface StateGetter
      Returns:
      The prior year GHG consumption with units like "tCO2e", or current year if no prior
    • getPriorPopulation

      public EngineNumber getPriorPopulation()
      Get the prior year population.
      Specified by:
      getPriorPopulation in interface StateGetter
      Returns:
      The prior year population with units like "units", or current year if no prior
    • getPriorYearsElapsed

      public EngineNumber getPriorYearsElapsed()
      Get the prior years elapsed (max of getYearsElapsed - 1 and 0).
      Specified by:
      getPriorYearsElapsed in interface StateGetter
      Returns:
      The prior years elapsed with units like "year"