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

PAT 2.1 - design alternative names to datapoint IDs?

asked 2017-06-16 10:39:50 -0500

pajordan gravatar image

updated 2017-08-20 14:55:27 -0500

In PAT 2.1 on the Design Alternatives tab you can assign each alternative a Name that the software then appears to assign a Datapoint ID to for storing results - how can I keep track of which Datapoint ID is mapped to each Design Alternative Name?

The Datapoint IDs are long alphanumeric strings (like ebb2458a-bda2-483d-a295-e3f9d8a7926c); when browsing through the results directory (in localResults) there will be a folder named with the Datapoint ID for each alternative - other then referring back to the PAT Design Alternatives tab and looking up which Datapoint ID goes with each Name is there an easier way to track which results directory is for which alternative?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-06-20 10:29:22 -0500

updated 2017-06-20 10:30:09 -0500

@pajordan that is a good question. For many users, if your files are named "report.html" you can just access the files from the PAT GUI and avoid manually going through the "localResutls" folder, but there are certainly use cases for needing to directly access those files. For now I just use a stand alone ruby script that I run after the analysis has finished, that copes a specific file I need to a common location. It copies a renamed copy of file using argument or output value or values. In this case I had a single runner.registerValue I know as unique, but you could concatenate a combination of arguments and outputs. This can be used for manual or algorithmic workflow.

# require fileutils and openstudio
require 'fileutils'
require 'openstudio'

# source and target directories
project_directory = "0525_Reopt_test"
target_directory = "reopt_csv_files"

# loop through resoruce files
results_directories = Dir.glob("#{project_directory}/LocalResults/*")
results_directories.each do |results_directory|

    idf_building_name = nil

    # create an instance of a runner with OSW
    osw_path ="#{File.dirname(__FILE__)}/#{results_directory}/out.osw")
    osw = OpenStudio::WorkflowJSON.load(osw_path).get
    runner =

    # 2.x methods (currently not setup for measure display name but snake_case arg names)
    runner.workflow.workflowSteps.each do |step|
      if step.to_MeasureStep.is_initialized
        measure_step = step.to_MeasureStep.get

        measure_name = measure_step.measureDirName
          measure_name = # this is instance name in PAT
        if measure_step.result.is_initialized
          result = measure_step.result.get
          result.stepValues.each do |arg|
            next if not == "some_argument_or_register_value_from_osw"
            value = arg.valueAsVariant.to_s
            new_name = value
            puts "#{measure_name}: #{} = #{value}"
          #puts "No result for #{measure_name}"
        #puts "This step is not a measure"

    # copy and rename file
    orig_file = "#{File.dirname(__FILE__)}/#{results_directory}/hourly_consumption_by_fuel_to_csv_report.csv"
    copy_file = "#{target_directory}/#{new_name}.csv"
    if File.file?(orig_file)
        puts "Creating #{copy_file}"
        FileUtils.cp(orig_file, copy_file)


The code above uses the OSW to get information used to rename the file. You could also open up the OSM file and rename based on characteristics of the model that you know are unique. I'm not sure if the OSW has access to the design alternative name, but I can look into that.

edit flag offensive delete link more

Your Answer

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

Add Answer


Question Tools

1 follower


Asked: 2017-06-16 10:39:50 -0500

Seen: 58 times

Last updated: Jun 20 '17