Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OS Measure - report autosized capacity for CoilHeatingGas object?

I am using the following code below in a measure to find the capacity of a CoilHeatingGas object. It works for hard coded capacities. However, when the value is autosized, it fails to find the value. I use exactly the same code for CoilHeatingElectric and it works fine with autosized values. Am I missing something or is there a bug in the current OS code for gas coils?

if coil.to_CoilHeatingGas.is_initialized
    chg = coil.to_CoilHeatingGas.get
    runner.registerInfo("CoilHeatingGas found = #{chg}.")
    # Get the capacity
    capacity_w = nil

    if chg.nominalCapacity.is_initialized
        capacity_w = chg.nominalCapacity.get
    elsif chg.autosizedNominalCapacity.is_initialized
        runner.registerInfo("CoilHeatingGas has autosized capacity.")
        capacity_w = chg.autosizedNominalCapacity.get
    else
        runner.registerError("For #{coil.name} capacity is not available.")
    end
    runner.registerInfo("CoilHeatingGas capacity found = #{capacity_w}.")


if coil.to_CoilHeatingElectric.is_initialized
    che = coil.to_CoilHeatingElectric.get
    runner.registerInfo("CoilHeatingElectric found = #{che}.")
    # Get the capacity
    capacity_w = nil
    if che.nominalCapacity.is_initialized
      capacity_w = che.nominalCapacity.get
    elsif che.autosizedNominalCapacity.is_initialized
      capacity_w = che.autosizedNominalCapacity.get
    else
      OpenStudio::logFree(OpenStudio::Warn, 'openstudio.standards.BoilerHotWater', "For #{che.name} capacity is not available.")
    end
    runner.registerInfo("CoilHeatingElectric capacity = #{capacity_w}.")

OS Measure - report autosized capacity for CoilHeatingGas object?

I am using the following code below in a measure to find the capacity of a CoilHeatingGas object. It works for hard coded capacities. However, when the value is autosized, it fails to find the value. I use exactly the same code for CoilHeatingElectric and it works fine with autosized values. Am I missing something or know when it gets to chg.autosizedNominalCapacity.get, the returned error is there a bug in the current OS code for gas coils?"For Coil Heating Gas 4 capacity is not available"

if coil.to_CoilHeatingGas.is_initialized
    chg = coil.to_CoilHeatingGas.get
    runner.registerInfo("CoilHeatingGas found = #{chg}.")
    # Get the capacity
    capacity_w = nil

    if chg.nominalCapacity.is_initialized
        capacity_w = chg.nominalCapacity.get
    elsif chg.autosizedNominalCapacity.is_initialized
        runner.registerInfo("CoilHeatingGas has autosized capacity.")
        capacity_w = chg.autosizedNominalCapacity.get
    else
        runner.registerError("For #{coil.name} capacity is not available.")
    end
    runner.registerInfo("CoilHeatingGas capacity found = #{capacity_w}.")


if coil.to_CoilHeatingElectric.is_initialized
    che = coil.to_CoilHeatingElectric.get
    runner.registerInfo("CoilHeatingElectric found = #{che}.")
    # Get the capacity
    capacity_w = nil
    if che.nominalCapacity.is_initialized
      capacity_w = che.nominalCapacity.get
    elsif che.autosizedNominalCapacity.is_initialized
      capacity_w = che.autosizedNominalCapacity.get
    else
      OpenStudio::logFree(OpenStudio::Warn, 'openstudio.standards.BoilerHotWater', "For #{che.name} capacity is not available.")
    end
    runner.registerInfo("CoilHeatingElectric capacity = #{capacity_w}.")

Additionally, @jmarrec was gracious enough to help. When he ran the model through the <companion_folder>/run/ directory it can find the autosized capacity. These are the results.

[1] run(main)> m = osload('in.osm')

[2] run(main)> sql = OpenStudio::SqlFile.new()

[2] run(main)> sqlFile = OpenStudio::SqlFile.new('eplusout.sql')

[3] run(main)> m.setSqlFile(sqlFile)

[4] run(main)> coil = m.getCoilHeatingGass[0]

[5] run(main)> puts coil

OS:Coil:Heating:Gas, {871a33d0-6913-4883-9486-ccdfa3d5f11a}, !- Handle Coil Heating Gas 4, !- Name {13af84d4-14b4-44cd-8194-59dbf9daecee}, !- Availability Schedule Name 0.8, !- Gas Burner Efficiency Autosize, !- Nominal Capacity {W} , !- Air Inlet Node Name , !- Air Outlet Node Name , !- Temperature Setpoint Node Name 0, !- Parasitic Electric Load {W} , !- Part Load Fraction Correlation Curve Name 0; !- Parasitic Gas Load {W}

=> nil

[6] run(main)> coil.autosizedNominalCapacity.get => 11200.713297285292

OS Measure - report autosized capacity for CoilHeatingGas object?

I am using the following code below in a measure to find the capacity of a CoilHeatingGas object. It works for hard coded capacities. However, when the value is autosized, it fails to find the value. I use exactly the same code for CoilHeatingElectric and it works fine with autosized values. I know when it gets to chg.autosizedNominalCapacity.get, the returned error is "For Coil Heating Gas 4 capacity is not available"

if coil.to_CoilHeatingGas.is_initialized
    chg = coil.to_CoilHeatingGas.get
    runner.registerInfo("CoilHeatingGas found = #{chg}.")
    # Get the capacity
    capacity_w = nil

    if chg.nominalCapacity.is_initialized
        capacity_w = chg.nominalCapacity.get
    elsif chg.autosizedNominalCapacity.is_initialized
        runner.registerInfo("CoilHeatingGas has autosized capacity.")
        capacity_w = chg.autosizedNominalCapacity.get
    else
        runner.registerError("For #{coil.name} capacity is not available.")
    end
    runner.registerInfo("CoilHeatingGas capacity found = #{capacity_w}.")


if coil.to_CoilHeatingElectric.is_initialized
    che = coil.to_CoilHeatingElectric.get
    runner.registerInfo("CoilHeatingElectric found = #{che}.")
    # Get the capacity
    capacity_w = nil
    if che.nominalCapacity.is_initialized
      capacity_w = che.nominalCapacity.get
    elsif che.autosizedNominalCapacity.is_initialized
      capacity_w = che.autosizedNominalCapacity.get
    else
      OpenStudio::logFree(OpenStudio::Warn, 'openstudio.standards.BoilerHotWater', "For #{che.name} capacity is not available.")
    end
    runner.registerInfo("CoilHeatingElectric capacity = #{capacity_w}.")

Additionally, @jmarrec was gracious enough to help. When he ran the model through the <companion_folder>/run/ directory it can find the autosized capacity. These are the results.

[1] run(main)> m = osload('in.osm')

[2] run(main)> sql = OpenStudio::SqlFile.new()

[2] run(main)> sqlFile = OpenStudio::SqlFile.new('eplusout.sql')

[3] run(main)> m.setSqlFile(sqlFile)

[4] run(main)> coil = m.getCoilHeatingGass[0]

[5] run(main)> puts coil

OS:Coil:Heating:Gas, {871a33d0-6913-4883-9486-ccdfa3d5f11a}, !- Handle Coil Heating Gas 4, !- Name {13af84d4-14b4-44cd-8194-59dbf9daecee}, !- Availability Schedule Name 0.8, !- Gas Burner Efficiency Autosize, !- Nominal Capacity {W} , !- Air Inlet Node Name , !- Air Outlet Node Name , !- Temperature Setpoint Node Name 0, !- Parasitic Electric Load {W} , !- Part Load Fraction Correlation Curve Name 0; !- Parasitic Gas Load {W}

=> nil

[6] run(main)> coil.autosizedNominalCapacity.get => 11200.713297285292