-
Notifications
You must be signed in to change notification settings - Fork 145
-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add OpenStudio 3Phase DL + energy simulation #290
Comments
Me too, Mo! There is much to be done, but a major foundation has been laid with last week's commits. We have some bug fixing and documenting to do, but once 1.7.0 is released we are looking to build on this. Onward!! |
Go Mo! Go! |
Haha! I wish github had a like button. :) 👍 |
Here is the code how to integrate Radiance measure into the process in Ruby: require 'openstudio'
# adapted from RunManagerWatcher_Test
# https://github.com/NREL/OpenStudio/blob/bf5f68c76b79a69deaff25aae05cbb8a798b31b1/openstudiocore/ruby/openstudio/runmanager/test/RunManagerWatcher_Test.rb#L54
# set up paths
rmDBPath = './run.db'
osmPath = './in.osm'
epwPath = 'C:/EnergyPlusV8-3-0/WeatherData/USA_CO_Golden-NREL.724666_TMY3.epw'
epPath = 'C:/EnergyPlusV8-3-0/'
radPath = 'C:/Program Files (x86)/Radiance/bin'
rubyPath = OpenStudio::getOpenStudioEmbeddedRubyPath() / OpenStudio::Path.new('bin')
outDir = './run/'
# create test model
epw = OpenStudio::EpwFile.new(epwPath)
model = OpenStudio::Model::exampleModel()
OpenStudio::Model::WeatherFile.setWeatherFile(model, epw)
model.save(osmPath, true)
# make run manager workflow
wf = OpenStudio::Runmanager::Workflow.new()
# arguments to the measure, leaving empty will just use defaults
args = OpenStudio::Ruleset::OSArgumentVector.new()
# make a ruby job to run the measure
measure = OpenStudio::BCLMeasure::radianceMeasure() # this method is not available until 1.9.0
rjb = OpenStudio::Runmanager::RubyJobBuilder.new(measure, args)
rjb.setIncludeDir(OpenStudio::getOpenStudioRubyIncludePath())
wf.addJob(rjb.toWorkItem())
# add energyplus jobs
wf.addJob(OpenStudio::Runmanager::JobType.new("ModelToIdf"))
wf.addJob(OpenStudio::Runmanager::JobType.new("EnergyPlus"))
# set up tool info to pass to run manager
tools = OpenStudio::Runmanager::ConfigOptions::makeTools(epPath, OpenStudio::Path.new(), radPath, rubyPath, OpenStudio::Path.new())
# add tools to workflow, has to happen after jobs are added
wf.add(tools)
wf.addParam(OpenStudio::Runmanager::JobParam.new("flatoutdir"))
# turn the workflow definition into a specific instance
jobtree = wf.create(outDir, osmPath, epwPath)
# make a run manager
rm = OpenStudio::Runmanager::RunManager.new(rmDBPath, true, true)
# run the job tree
rm.enqueue(jobtree, true)
rm.setPaused(false)
# wait until done
rm.waitForFinished()
jobErrors = jobtree.errors()
print "Errors and Warnings:"
jobErrors.errors().each do |msg|
puts msg
end
if jobErrors.succeeded()
puts "Yay!"
else
puts "Boo!"
end |
Starting runManager makes Rhino crash and gives me this error. I checked and Qt libraries are under OpenStudio folder. @macumber any idea why this is happening? I'm going to load the libraries from OpenStudio installation and see if it's making any difference. |
Changing the library path didn't help. The same error happens. @macumber do I need to install Qt separately? I just uninstalled it a couple of weeks ago assuming it is already shipped with OpenStudio. [sad face!] |
Also tried to update to OpenStudio 1.9.2 and it's still the same.
|
Two ideas, first is that Qt plugins must be located in the right directory relative to the Qt dlls, the windows plugin is located at C:\Program Files\OpenStudio 1.9.0\bin\platforms in our installer. More info about Qt plugins is at http://doc.qt.io/qt-5/deployment-plugins.html. Second is that RunManager can be initialized without the GUI system by setting the 2nd and 3rd arguments to false, see here https://github.com/NREL/OpenStudio/blob/v1.4.2/openstudiocore/src/runmanager/lib/RunManager.hpp#L83 |
Thanks @macumber! Running with no GUI works for now. I can initiate a run manager. Let's see if I can get the whole process to work. 🌔 |
@macumber two updates:
Any ideas for either of this? :| |
On item 1 you are correct, we are working on a solution to this but don't have anything good right now. On item 2 you are also correct, you should be able to just use the defaults. Do you get any information after the crash? Any log messages? Can you point me to the code where you are assembling the RunManager workflow? |
Are you saying that just calling https://github.com/NREL/OpenStudio/blob/develop/openstudiocore/src/utilities/bcl/BCLMeasure.cpp#L389 |
yes. Just import OpenStudio
OpenStudio.BCLMeasure.radianceMeasure() crashes Rhino. I'm trying to find the crash log. |
I also tried to use the path |
The |
Yes. I do have the full installation. Let me try the path. Thanks for the after midnight live support! :) |
It's only 11 here :-) |
Good news! |
This code doesn't give an error but also doesn't generate any meaningful results. Only run.db file is generated. I can't see EnergyPlus or Radiance running in processes. There should be a better way to get the report of what's really happening once RunManager is running. Thanks @macumber for your help so far. We should be pretty close I assume. import os
import scriptcontext as sc
#openStudioLibFolder = "C:\\Users\\" + os.getenv("USERNAME") + "\\Dropbox\\ladybug\\honeybee\\openStudio\\CSharp64bits"
openStudioLibFolder = r"C:\Program Files\OpenStudio 1.9.2\CSharp\openstudio"
# openstudio is there
# I need to add a function to check the version and compare with available version
openStudioIsReady = True
import clr
clr.AddReferenceToFileAndPath(openStudioLibFolder+"\\openStudio.dll")
import sys
if openStudioLibFolder not in sys.path:
sys.path.append(openStudioLibFolder)
import OpenStudio
rmDBPath = OpenStudio.Path('C:/ladybug/run2.db')
osmPath = OpenStudio.Path(r'c:\ladybug\unnamed\OpenStudio\unnamed.osm')
epwPath = OpenStudio.Path('C:/EnergyPlusV8-3-0/WeatherData/USA_CO_Golden-NREL.724666_TMY3.epw')
epPath = OpenStudio.Path('C:/EnergyPlusV8-3-0/')
radPath = OpenStudio.Path('C:/Radiance/bin')
rubyPath = OpenStudio.Path(r'C:\Program Files\OpenStudio 1.9.2\ruby-install\ruby\bin')
outDir = OpenStudio.Path('C:/ladybug/osmtest/')
wf = OpenStudio.Workflow()
measure = OpenStudio.BCLMeasure(OpenStudio.Path(r"C:\Program Files\OpenStudio 1.9.2\share\openstudio-1.9.2\pat\Measures\RadianceMeasure"))
args = OpenStudio.OSArgumentVector()
rjb = OpenStudio.RubyJobBuilder(measure, args)
rjb.setIncludeDir(OpenStudio.Path(rubyPath))
wf.addJob(rjb.toWorkItem())
# add energyplus jobs
wf.addJob(OpenStudio.JobType("ModelToIdf"))
wf.addJob(OpenStudio.JobType("EnergyPlus"))
# set up tool info to pass to run manager
tools = OpenStudio.ConfigOptions.makeTools(epPath, OpenStudio.Path(), radPath, rubyPath, OpenStudio.Path())
# add tools to workflow, has to happen after jobs are added
wf.add(tools)
wf.addParam(OpenStudio.JobParam("flatoutdir"))
# turn the workflow definition into a specific instance
jobtree = wf.create(outDir, osmPath, epwPath)
# make a run manager
rm = OpenStudio.RunManager(rmDBPath, True, True, False, False)
# run the job tree
rm.enqueue(jobtree, True)
rm.setPaused(True)
# wait until done
rm.waitForFinished()
jobErrors = jobtree.errors()
print "Errors and Warnings:"
for msg in jobErrors.errors():
print msg
if jobErrors.succeeded():
print "Yay!"
else:
print "Boo!" |
If you are not seeing anything happening in your out dir then I would suspect this line The other thing I would mention is that EnergyPlus and Radiance are shipped with OpenStudio, you should use the versions that are bundled with OpenStudio for any OpenStudio runs. Final thing is that you might want to add the ExpandObjects and EnergyPlusPreProcess to your workflow, the workflow that OpenStudio uses is here: https://github.com/NREL/OpenStudio/blob/develop/openstudiocore/src/runmanager/lib/Workflow.cpp#L822 |
I'm sorry, wasn't |
=). I started to work on some other stuff this morning but then you guys made it very hard to concentrate! ;P Here is the update: Setting `rm.setPaused(False)`` creates the folder and copies the files But then look like RunManager is looking for the ruby folder under CSharp directory instead of the root. Where can I change that? Here is the error: and here is the path inside the created Too keep the party going I copied the Ruby folder under the CSharp folder so RunManager can find it and here we go! It runs the analysis and create the folders... But radiance folder is empty! It might be because I don't have any light sensor in my model (or is it?). Regardless of that where is the .rad file itself? and here is the new error from RunManager:
I think we are making progress :) |
One more thing to add. Once the script is executed, Ruby interpreter starts working and EnergyPlus goes after that. No Radiance. |
@mostpharoudsari and @macumber , I just wanted to say that you gentlemen are epic. The suspense of this issue has been thrilling. Keep kicking ass! |
See here (#290) and here: https://www.youtube.com/watch?v=DHs-inRuHwc
@macumber I think I won the hackathon :). Click on the image to watch the video.
|
Thanks! and yes that's exactly how it will be working (that's how honeybee works in general). To me it's always like how javascript objects are and let you chain multiple changes together. I need to have a more solid import from OpenStudio to be able to show the changes in the model in each step similar to what we do with Honeybee. I also have an update on Radiance side. I copied all the lines into a batch file and started testing the process! It is still running but except a couple of warning it works fine. I suspect the issue is that the path to Radiance folder was set wrong in OpenStudio app. Now that you're shipping EnergyPlus and Radiance with OpenStudio why does it still searches for EP and Radiance path? I will report back the final results of daylighting model. Now I think there is something wrong with RunManager that I couldn't run the analysis since the path was set right in the script. I'll keep you posted! |
I think I will have to try to get my environment set up to help on this. This year we will be replacing RunManager with something that should make all this easier to do (and no more scanning for stuff we install). However, we will have to keep you in the loop to make sure that it actually does make things easier and not worse. |
@macumber sounds great to me! I'm happy that the current workflow is almost working. There is still minor bugs here an there but that should be fine. As a side note it should be hard to write something that is harder to figure out than runmanager! ;) @rpg777 please see the warnings and errors from running the batch file here: |
Wow @macumber and @mostaphaRoudsari, you guys have been busy! Sorry I'm just tuning back in here. I have good news but you may want to kill me for not sharing this sooner. That last error you're seeing, about the "unexpected EOF", is most likely being caused by (fixed) bug in Radiance, simple as that. You need to be using NREL binaries vintage 5.0.a.5 https://github.com/NREL/Radiance/releases/tag/5.0.a.5 or newer, or if you're rolling your own, anything based on code after this commit: NREL/Radiance@f9e6adb The warning(s) about "ignoring output files in sender" can be ignored. |
@kbenne @henryHorsey @axelstudios @nllong this is a good example for who wants a better interface to OpenStudio measures and also it's just cool :-) |
Hi @rpg777. Thank you for your input. We're 33% there. The only place that I was using an older version of Radiance was the batch file. Updating the Radiance did the job. For the other two cases, running from inside Grasshopper and OpenStudio the analysis fails. 1 works out of 3 = 33.33333334% Any idea what might be the reason? How can I get a better report from run manager than Failed or Also a suggestion about .ill files. Any chance that you can make them look the same as Daysim's .ill files? If that's too much work this is also fine we can check the header and understand if it's an OpenStudio/Radiance .ill file or the one from Daysim. Cheers. |
@mostaphaRoudsari, can you point me to an archive of the failed jobs and I can dig around? Running locally, the stderr and stdout logs that end up in the radiance run directory are generally the best places to look for clues. We may still have some Windows/unix path issue going on here, but this crap all works even on Windows with the latest version of the measure (which I ASSume you are using, and is what is on develop right now). Yes, let's make this happen!! We are close it seems. As for the .ill files, let's how far off the two formats are. We have some post processing crap that expects the current format, but if it's not drastically different, I'd say that aligning the formats would be a Good Thing[TM]. I didn't even know Daysim called its output *.ill too. Random coincidence! |
@rpg777, I was not using the latest measure from develop folder so I updated and tried again. The error is an easy one > In case you still need the files you can download it from here. Here is the is the error report:
|
Hey Mo, here's a little ditty from the IDEAkit project, that adds an illuminance map, primary daylighting control, and glare sensor to specific spaces. Gives you an idea of the API calls you need to use to get 'em in there and wired up correctly so the Radiance measure can do its thing. What's missing here is some logic[TM] to get the origin, extents and dimensions of the map and other point details, but I know you can sort that out. =) (You can get or derive those bits from other model objects.) Bear in mind we also plan to add support for the STADIC dxgridmaker utility, which will allow you to generate the illuminance map points automatically from your model geometry. But this code here will work for you right now:
|
@rpg777, I can't create a new shading control for some reason! The button is disabled and then I can't changed the shading type! That is also disabled. Do you want to send me an updated model? One more question. If this is an issue with |
Yeah, you need to create and modify these things in the SketchUp plugin, not the app. And I do not know the answer to your other question. I will look into this. |
Well... The screenshot is from SkectchUp plugin! It's not the main issue here though :) |
You're right, of course. Sorry, what I mean to say is that you need to use the "Set Shading Controls" user script in the plugin, you cannot use the inspector. I haven't had a chance to look at your model yet so I don't have any other info for you just yet... |
Hey Mo, have you seen this tutorial on shading controls in OS? http://nrel.github.io/OpenStudio-user-documentation/tutorials/tutorial_shadingcontrols/ Also this radiance one: On Tue, Nov 3, 2015 at 2:22 PM, Rob Guglielmetti notifications@github.com
|
D'oh. this radiance one: http://nrel.github.io/OpenStudio-user-documentation/tutorials/radiance_tutorial/ On Wed, Nov 4, 2015 at 12:00 PM, Dan Macumber macumber@alum.mit.edu wrote:
|
Thanks @macumber. No I didn't know about the first links. Made the changes and @rpg777 guess was right. _It runs with no errors!_ 🎉 🎈 We need to get over 5 more steps before closing this:
|
Since OpenStudio measures aren't critical to say that we have full support for the OpenStudio exporter, I am taking this issue off the milestone for the time being. |
@chriswmackey @mostaphaRoudsari are you both familiar with the OpenStudio CLI that is being developed for OpenStudio 2.0? We are starting to post alpha builds, let us know if you are interested in trying it out, just ping us on Slack. |
@macumber I talked to Kyle about it. I think we need to pick between using the API and CLI and since we're heavily dependent on the API in the process using CLI will be a separate way that we need to debug and maintain. IMO we need to pick one out of the two and make it work but I can be wrong. There are some major decisions that we need to make about the integration of the new development to OpenStudio. We are half way there to get the HBZones from Revit but haven't made the decision on the best approach to convert it to an OpenStudio model. I will open a separate discussion once we let the butterfly fly for free! swoosh swoosh :) |
Once version 1.7 is out we can get this started.
@rpg777 there is so much that can be done here, in particular for visualization. I'm freaking excited about this.
The text was updated successfully, but these errors were encountered: