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

Scripting PAT project

asked 2017-06-21 05:30:46 -0500

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

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 flag offensive close merge delete



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/ 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.

ljbrackney's avatar ljbrackney  ( 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.

Julien Marrec's avatar Julien Marrec  ( 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)

Julien Marrec's avatar Julien Marrec  ( 2017-06-21 09:05:45 -0500 )edit

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.

ljbrackney's avatar ljbrackney  ( 2017-06-21 09:11:28 -0500 )edit

@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.

David Goldwasser's avatar David Goldwasser  ( 2017-06-21 09:35:20 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-06-23 19:24:36 -0500

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.

edit flag offensive delete link more


I'm accepting this answer to mark the thread as (currently) resolved. In the hope that you'll edit your answer soon with the link to the new documentation!

Julien Marrec's avatar Julien Marrec  ( 2017-06-27 02:39:55 -0500 )edit

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?

love123's avatar love123  ( 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.

mikesweeney's avatar mikesweeney  ( 2022-01-18 09:43:34 -0500 )edit
Julien Marrec's avatar Julien Marrec  ( 2022-01-21 08:03:40 -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

Question Tools



Asked: 2017-06-21 05:30:46 -0500

Seen: 262 times

Last updated: Jun 23 '17