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

# Scripting PAT project

I have a fair amount of Measures each with several measure options, and therefore do not wish to create the various design alternatives by hand as it would be too tedious. I wish to compute the different permutations based on some inner logic like "Measure A" and "Measure B" are actually alternatives for the same Energy Efficiency Measure (EEM) so they should be treated as such.

Now that PAT 2.x has be revamped and seems to use a JSON format, can I script it? I guess I need to modify pat.json, but I'm wondering if I can specifically use OpenStudio's API for this or if I need to just treat the JSON file like any other?

If I have to change the JSON itself, how can I set some parameters such as hashKey for designAlternatives etc.?

edit retag close merge delete

1

pat.json stores the state of the PAT UI. The analysis JSON that PAT authors for use by the OpenStudio Meta CLI will show up as YourProjectName.json (an OSA) along w/ YourProjectName.zip. If you open the developer console in PAT, you'll see the Meta CLI invoked with those as arguments.

Question: In your proposed example, are Measures A and B mutually exclusive of one another? Depending upon what you're trying to achieve, it's possible you could set up a design of experiments with pivot variables in your OSA.

( 2017-06-21 08:42:49 -0500 )edit

In my example Measure A and Measure B are mutually exclusive yes (eg: Measure A is a measure that insulate the roof of an unfinished attic, and measure B is another type of measure that will insulate the floor of the unfinished attic, but I don't want to do both). I also have cases where Measure C and measure D must be used in conjuction (eg: one measure to change the R-value of a wall, another to reduce the infiltration) meaning either an option of C and an option of D is used, or none of the two. You cannot have one option of C and none of D.

( 2017-06-21 09:04:01 -0500 )edit

I was currently looking at the "algorithmic" option of PAT to see if that could suits my needs, but I'm not sure which algorithm to select to begin with. (I also have other doubt about whether it's usable the first time around... when you're not sure how to set it up, and if you do it correctly you still need to look at the results before you shut down the paid instances of EC2 that are running. It's scary for the lambda user that I am)

( 2017-06-21 09:05:45 -0500 )edit
1

I can think of a couple ways to construct the kind of analysis you describe in algorithmic mode. The diagonal algorithm or as I mentioned above DOE w/ pivots could be made to work. If you're wanting to experiment with the algorithms while not incurring EC2 costs, you might consider standing up a local instance of OpenStudio-Server. I think several folks have had success following the docker-based provisioning instructions in that repo.

( 2017-06-21 09:11:28 -0500 )edit
1

@Julien Marrec, not a complete answer, but for measure that need to be used in conjunction, I have an idea. Lets say anytime measure E is used, you also want to run measure E2, E3, and E4. But E2-4 never run if "E" isn't run.

In 2.x a measure has access to information about upstream measures. You can have a simple if statement in E2-4 that looks to see if a measure named "E" is in the workflow, if it is not found then the measure returns true with Not Applicable. Then put E-2 in the workflow for all datapoints, and it will know when to run or not.

( 2017-06-21 09:35:20 -0500 )edit

Sort by » oldest newest most voted

Changing the pat json outside of the app is not currently supported, improved documentation necessary to do this correctly is in the works. Another option might be to generate a bunch of osw files (using whatever logic you want), run each with a cli call, then loop over the results.

more

( 2017-06-27 02:39:55 -0500 )edit
1

Hi, has the documentation to modify the PAT.json outside of the PAT GUI been created yet and if yes where can I find the information?

( 2020-12-15 22:00:09 -0500 )edit

Also interested in this; has there been any update on manual PAT.json editing? I'm trying to simulate a few hundred permutations, which will be cumbersome to do manually. It seems like scripting in the SDK is the best way to do this at the moment.

( 2022-01-18 09:43:34 -0500 )edit
1
( 2022-01-21 08:03:40 -0500 )edit