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

# Get/Set default COP for district cooling via openstudio SDK

Is it possible to get/set the default district cooling COP via the openstudio SDK? I read a post from a few years back where it was suggested to 'inject' an IDF file via an energy plus measure. Is this still the case?

And as a follow up, is it possible to get the data for Site and Source Summary? Looking at the OpenstudioResults measure it seems that the way to do this is with a query to the sql output file directly.

query = "SELECT Value FROM tabulardatawithstrings WHERE ReportName='#{report_name}' and TableName='#{table_name}' and RowName= '#{row}' and ColumnName= '#{header}'"

edit retag close merge delete

Sort by » oldest newest most voted

No, the DistrictCooling (and DistrictHeating) objects don't have fields for efficiency, so you could post-process the energy use to account for that. See the add Efficiency field to DistrictCooling and DistrictHeating EnergyPlus feature request and give it a thumbs up if you agree.

The EnvironmentalImpactFactors class is wrapped in OpenStudio so you could try using that in an OpenStudio Measure.

more

I'll add that while each District object does not have an efficiency or COP field, there are inputs for the EnvironmentalImpactFactors object that sets this. EnergyPlus uses this for a site-to-source conversion, so it should NOT affect the District energy use on-site within the building.

( 2022-11-13 08:42:36 -0600 )edit

Yeah Michael Witte mentioned that in the issue I linked above, which I haven't used. Reading the docs it appears that it converted DH to natural gas and DC to electricity, which doesn't work for LEED projects.

( 2022-11-13 11:01:11 -0600 )edit
1

Thanks both. That's exactly what I need. I wanted a way to set the COP via a measure. In this way I can just extend my existing code. And I just realised that Site and Source Summary can be extracted from here!

( 2022-11-13 11:26:00 -0600 )edit

@Mortar IO great, report back with your results.

( 2022-11-13 12:54:49 -0600 )edit

(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', 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,
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.

more