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

AllSummaryAndSizingPeriod Measure

asked 2024-07-26 20:40:15 -0500

updated 2024-07-29 07:37:48 -0500

I am trying to create a measure that allows me to get the AllSummaryAndSizingPeriod report instead of the AllSummary report.

The measure ran with out errors but I can not get the report.

class AddAllSummaryAndSizingPeriod < OpenStudio::Measure::ModelMeasure
  def name
    return "Agregar AllSummaryAndSizingPeriod"
  end

  def arguments(model)
    args = OpenStudio::Measure::OSArgumentVector.new
    return args
  end

  def run(model, runner, user_arguments)
    super(model, runner, user_arguments)
    model = runner.lastOpenStudioModel
    if model.empty?
      runner.registerError("No model found.")
      return false
    end
    model = model.get
    output_table = OpenStudio::IdfObject.load("Output:Table:SummaryReports,AllSummaryAndSizingPeriod;").get
    model.addObject(output_table)
    return true
  end
end
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2024-07-28 09:11:34 -0500

updated 2024-07-30 06:35:36 -0500

Can you try the following:

output_tables = model.getOutputTableSummaryReports
output_tables.addSummaryReport("AllSummaryAndSizingPeriod")

These standard output table reports have been mapped in the OpenStudio SDK since v3.0.0 (2020) - no longer any need to call IDF objects. Tested - works.

image description


EDIT: This seems odd:

def run(model, runner, user_arguments)
    super(model, runner, user_arguments)
    model = runner.lastOpenStudioModel

The run call has "model" as an argument - what one expects for a ModelMeasure (see here). Yet the runner.lastOpenStudioModel call (what one evokes with a recently ran simulation for a ReportingMeasure) ends up overwriting "model". Hence the measure is modifying the wrong model, I think (not tested). So a first move IMO would be to delete (or comment out):

model = runner.lastOpenStudioModel

There may be other bits to fix, such as a missing new.registerWithApplication call.

edit flag offensive delete link more

Comments

1

Thanks, Denis. I couldn't get it to work. I am not an expert at scripting. Thanks anyway!

obuchely's avatar obuchely  ( 2024-07-29 09:20:31 -0500 )edit

@obuchely, I edited my answer. I hadn't paid attention to the other items in the measure - mea culpa.

Denis Bourgeois's avatar Denis Bourgeois  ( 2024-07-30 06:33:32 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 2024-07-26 20:40:15 -0500

Seen: 192 times

Last updated: Jul 30