# How to extract surface heat capacity (J/K.m²) from a model

Hello, I can't manage to extract the thermal capacity of my building (J/K or J/K.m²) although this value seems to be quite fundamental in the framework of dynamic study. I have tried to extract it by an Openstudio measurement with this code (sorry i can't put picture because not enough karma) :

def run(model, runner, user_arguments) super(model, runner, user_arguments)

  thermalmass = 0

# report initial condition of model
runner.registerInitialCondition("Depart  #{thermalmass} J/K.")

# calcul
model_surfaces = model.getPlanarSurfaces

model_surfaces.each do |surface|
if not surface.heatCapacity.empty?
thermalmass += surface.heatCapacity.get
end
end
puts thermalmass

# report final condition of model
runner.registerFinalCondition("thermal mass finale = #{thermalmass} J/K.")

return true


end

, but I can't get this value, this is always 0. If you have an idea of how I could get this value or any other tips, I would be very grateful.

edit retag close merge delete

I am also interested in this question! Also just to be clear, is the thermal mass in J/K or J/Km^2. Because there seems to be some ambiguity here. I am also getting 0 J/m^2K for all surfaces.

( 2021-05-04 12:51:25 -0500 )edit

This is the script I tried to use instead to get the thermal mass, looping through the base constructions instead of the planar surfaces. For each base construction, the code finds all the planar surfaces that use that base construction and calculates the sum of their net area (parent - subsurface). Then, it multiplies the base construction's heat capacity [J/m^2*K] by the surfaces sum net area to calculate thermal mass in [J/K], and adds it to the building total, which is preallocated to be 0 J/K before the .each loop starts.

( 2021-05-06 10:03:28 -0500 )edit

building_thermal_mass = 0 model_construction_bases = model.getConstructionBases model_construction_bases.each do |base_construction| base_construction_surfaces_area = base_construction.getNetArea() if not base_construction.heatCapacity.empty? base_construction_heat_capacity = base_construction.heatCapacity.get #J/m^2K total_heat_capacity_for_base_construction = base_construction_surfaces_areabase_construction_heat_capacity #J/K building_thermal_mass += total_heat_capacity_for_base_construction #J/K end

( 2021-05-06 10:08:57 -0500 )edit

I think there also may be an issue due to .heatCapacity.get only working for LayeredConstructions of StandardOpaqueMaterials. Maybe that is why the model is returning 0 for both this method and the one in the original post?

( 2021-05-06 10:10:33 -0500 )edit