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

Revision history [back]

(Rather than creating a new question I think it is better to continue here for future reference.)

I managed to change the COP with a measure, but it does not seem to have an impact on Total Source Energy as I would expect. My guess is that Total Source Energy is using the Site=>Source Conversion Factor directly and maybe these are hardcoded. They clearly use the default COP because 1/3*3.167 == 1.056.

In any case the measure that I used is the following.

# define the arguments that the user will input
def arguments(model)
    args = OpenStudio::Measure::OSArgumentVector.new

    # make an argument for reduction percentage
    cop_percentage_reduction = OpenStudio::Measure::OSArgument.makeDoubleArgument('cop_percentage_reduction', true)
    cop_percentage_reduction.setDisplayName('COP Percentage Reduction')
    cop_percentage_reduction.setDefaultValue(30.0)
    cop_percentage_reduction.setUnits('%')
    args << cop_percentage_reduction

    return args
end

# define what happens when the measure is run
def run(model, runner, user_arguments)
    super(model, runner, user_arguments)

    # use the built-in error checking
    if !runner.validateUserArguments(arguments(model), user_arguments)
        return false
    end

    # assign the user inputs to variables
    cop_percentage_reduction = runner.getDoubleArgumentValue('cop_percentage_reduction', user_arguments)

    # report initial condition of model
    default_district_cooling_cop = model.getEnvironmentalImpactFactors.districtCoolingCOP
    runner.registerInitialCondition("The initial COP is #{default_district_cooling_cop}")

    # update the cop
    new_district_cooling_cop = (1.0 - cop_percentage_reduction / 100.0) * default_district_cooling_cop
    model.getEnvironmentalImpactFactors.setDistrictCoolingCOP(new_district_cooling_cop)

    # report final condition of model
    runner.registerFinalCondition("The final COP is #{new_district_cooling_cop}")

    return true

It does what it is supposed to do as proven by this object in in.osm, but as I said before, it does not seem to have an impact.

OS:EnvironmentalImpactFactors,
  {afc10e04-f75d-468e-ad6a-1e1da289ed66}, !- Handle
  0.3,                                    !- District Heating Efficiency
  2.7,                                    !- District Cooling COP {W/W}
  0.25,                                   !- Steam Conversion Efficiency
  80.7272,                                !- Total Carbon Equivalent Emission Factor From N2O {kg/kg}
  6.2727,                                 !- Total Carbon Equivalent Emission Factor From CH4 {kg/kg}
  0.2727;                                 !- Total Carbon Equivalent Emission Factor From CO2 {kg/kg}

It does not really matter for my code as I just wanted to make this change with a measure so that it works with the existing UI, but it would be interesting to understand if I am doing something wrong.

(Rather than creating a new question I think it is better to continue here for future reference.)

I managed to change the COP with a measure, but it does not seem to have an impact on Total Source Energy as I would expect. My guess is that Total Source Energy is using the Site=>Source Conversion Factor directly and maybe these are hardcoded. They clearly use the default COP because 1/3*3.167 == 1.056.

In any case the measure that I used is the following.

# define the arguments that the user will input
def arguments(model)
    args = OpenStudio::Measure::OSArgumentVector.new

    # make an argument for reduction percentage
    cop_percentage_reduction cop_percentage_increase = OpenStudio::Measure::OSArgument.makeDoubleArgument('cop_percentage_reduction', OpenStudio::Measure::OSArgument.makeDoubleArgument('cop_percentage_increase, true)
    cop_percentage_reduction.setDisplayName('COP cop_percentage_increase.setDisplayName('COP Percentage Reduction')
    cop_percentage_reduction.setDefaultValue(30.0)
    cop_percentage_reduction.setUnits('%')
cop_percentage_increase.setDefaultValue(30.0)
    cop_percentage_increase.setUnits('%')
    args << cop_percentage_reduction
cop_percentage_increase

    return args
end

# define what happens when the measure is run
def run(model, runner, user_arguments)
    super(model, runner, user_arguments)

    # use the built-in error checking
    if !runner.validateUserArguments(arguments(model), user_arguments)
        return false
    end

    # assign the user inputs to variables
    cop_percentage_reduction cop_percentage_increase = runner.getDoubleArgumentValue('cop_percentage_reduction', runner.getDoubleArgumentValue('cop_percentage_increase', user_arguments)

    # report initial condition of model
    default_district_cooling_cop = model.getEnvironmentalImpactFactors.districtCoolingCOP
    runner.registerInitialCondition("The initial COP is #{default_district_cooling_cop}")

    # update the cop
    new_district_cooling_cop = (1.0 - cop_percentage_reduction + cop_percentage_increase / 100.0) * default_district_cooling_cop
    model.getEnvironmentalImpactFactors.setDistrictCoolingCOP(new_district_cooling_cop)

    # report final condition of model
    runner.registerFinalCondition("The final COP is #{new_district_cooling_cop}")

    return true

It does what it is supposed to do as proven by this object in in.osm, but as I said before, it does not seem to have an impact.

OS:EnvironmentalImpactFactors,
  {afc10e04-f75d-468e-ad6a-1e1da289ed66}, !- Handle
  0.3,                                    !- District Heating Efficiency
  2.7, 3.9,                                    !- District Cooling COP {W/W}
  0.25,                                   !- Steam Conversion Efficiency
  80.7272,                                !- Total Carbon Equivalent Emission Factor From N2O {kg/kg}
  6.2727,                                 !- Total Carbon Equivalent Emission Factor From CH4 {kg/kg}
  0.2727;                                 !- Total Carbon Equivalent Emission Factor From CO2 {kg/kg}

It does not really matter for my code as I just wanted to make this change with a measure so that it works with the existing UI, but it would be interesting to understand if I am doing something wrong.

(Rather than creating a new question I think it is better to continue here for future reference.)

I managed to change the COP with a measure, but it does not seem to have an impact on Total Source Energy as I would expect. My guess is that Total Source Energy is using the Site=>Source Conversion Factor directly and maybe these are hardcoded. They clearly use the default COP because 1/3*3.167 == 1.056.

In any case the measure that I used is the following.

# define the arguments that the user will input
def arguments(model)
    args = OpenStudio::Measure::OSArgumentVector.new

    # make an argument for reduction percentage
    cop_percentage_increase = OpenStudio::Measure::OSArgument.makeDoubleArgument('cop_percentage_increase, OpenStudio::Measure::OSArgument.makeDoubleArgument('cop_percentage_increase', true)
    cop_percentage_increase.setDisplayName('COP Percentage Reduction')
    cop_percentage_increase.setDefaultValue(30.0)
    cop_percentage_increase.setUnits('%')
    args << cop_percentage_increase

    return args
end

# define what happens when the measure is run
def run(model, runner, user_arguments)
    super(model, runner, user_arguments)

    # use the built-in error checking
    if !runner.validateUserArguments(arguments(model), user_arguments)
        return false
    end

    # assign the user inputs to variables
    cop_percentage_increase = runner.getDoubleArgumentValue('cop_percentage_increase', user_arguments)

    # report initial condition of model
    default_district_cooling_cop = model.getEnvironmentalImpactFactors.districtCoolingCOP
    runner.registerInitialCondition("The initial COP is #{default_district_cooling_cop}")

    # update the cop
    new_district_cooling_cop = (1.0 + cop_percentage_increase / 100.0) * default_district_cooling_cop
    model.getEnvironmentalImpactFactors.setDistrictCoolingCOP(new_district_cooling_cop)

    # report final condition of model
    runner.registerFinalCondition("The final COP is #{new_district_cooling_cop}")

    return true

It does what it is supposed to do as proven by this object in in.osm, but as I said before, it does not seem to have an impact.

OS:EnvironmentalImpactFactors,
  {afc10e04-f75d-468e-ad6a-1e1da289ed66}, !- Handle
  0.3,                                    !- District Heating Efficiency
  3.9,                                    !- District Cooling COP {W/W}
  0.25,                                   !- Steam Conversion Efficiency
  80.7272,                                !- Total Carbon Equivalent Emission Factor From N2O {kg/kg}
  6.2727,                                 !- Total Carbon Equivalent Emission Factor From CH4 {kg/kg}
  0.2727;                                 !- Total Carbon Equivalent Emission Factor From CO2 {kg/kg}

It does not really matter for my code as I just wanted to make this change with a measure so that it works with the existing UI, but it would be interesting to understand if I am doing something wrong.