Skip to content
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

Open
mostaphaRoudsari opened this issue Feb 25, 2015 · 53 comments
Open

Add OpenStudio 3Phase DL + energy simulation #290

mostaphaRoudsari opened this issue Feb 25, 2015 · 53 comments

Comments

@mostaphaRoudsari
Copy link
Member

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.

@rpg777
Copy link

rpg777 commented Feb 25, 2015

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!!

@ljbrackney
Copy link

Go Mo! Go!

@mostaphaRoudsari
Copy link
Member Author

Haha! I wish github had a like button. :) 👍

@mostaphaRoudsari
Copy link
Member Author

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

@mostaphaRoudsari
Copy link
Member Author

Starting runManager makes Rhino crash and gives me this error. I checked and Qt libraries are under OpenStudio folder.

image

image

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

@mostaphaRoudsari
Copy link
Member Author

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!]

@mostaphaRoudsari
Copy link
Member Author

Also tried to update to OpenStudio 1.9.2 and it's still the same.

OpenStudio.RunManager() is enough to get the error.

@macumber
Copy link

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

@mostaphaRoudsari
Copy link
Member Author

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

@mostaphaRoudsari
Copy link
Member Author

@macumber two updates:

  1. I think I hit the wall again with this old issue that we had about Ruleset in C# bindings. I can't get the arguments. I believe this is also what stopped @axelstudios and @kbenne from developing a similar code 2 years ago at the hackathon. We actually still have the code here. I don't remember the details of what was the conclusion on this.
  2. I assumed that I can pass empty arguments and default will be set so I moved on but then OpenStudio.BCLMeasure.radianceMeasure() crashes Rhino. Boom!

Any ideas for either of this? :|

@macumber
Copy link

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?

@macumber
Copy link

Are you saying that just calling OpenStudio.BCLMeasure.radianceMeasure() causes the crash? Or is it when you try to run the workflow? If it is the first option, then the issue is something to do with calling getApplicationRunDirectory from within Rhino

https://github.com/NREL/OpenStudio/blob/develop/openstudiocore/src/utilities/bcl/BCLMeasure.cpp#L389

https://github.com/NREL/OpenStudio/blob/develop/openstudiocore/src/utilities/core/ApplicationPathHelpers.cxx.in#L133

@mostaphaRoudsari
Copy link
Member Author

yes. Just

import OpenStudio
OpenStudio.BCLMeasure.radianceMeasure()

crashes Rhino. I'm trying to find the crash log.

@mostaphaRoudsari
Copy link
Member Author

I also tried to use the path OpenStudio.BCLMeasure("pathToMeasure") but then it gives me an error that the ruby file is not a measure!

@macumber
Copy link

The OpenStudio.BCLMeasure("pathToMeasure") method takes the path to the directory containing the measure, not the path to the ruby file, have you tried that? For the radianceMeasure method to work you would have to have the radiance measure in the same location relative to the openstudio_utilities.dll as it is in the OpenStudio installer. Are you using the complete OpenStudio installer?

@mostaphaRoudsari
Copy link
Member Author

Yes. I do have the full installation. Let me try the path. Thanks for the after midnight live support! :)

@macumber
Copy link

It's only 11 here :-)

@mostaphaRoudsari
Copy link
Member Author

I think your guess is right! Here is the dump file summary:

image

I'm checking the other solution now.

@mostaphaRoudsari
Copy link
Member Author

Good news! OpenStudio.BCLMeasure(OpenStudio.Path(r"C:\Program Files\OpenStudio 1.9.2\share\openstudio-1.9.2\pat\Measures\RadianceMeasure")) works fine!

@mostaphaRoudsari
Copy link
Member Author

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!"

@macumber
Copy link

If you are not seeing anything happening in your out dir then I would suspect this line rm.setPaused(True), that is pausing RunManager you need to call rm.setPaused(False) to unpause it and start the run.

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

@rpg777
Copy link

rpg777 commented Oct 30, 2015

I'm sorry, wasn't rm.setPaused(False) (like, totally,) the obvious way to say "run"? =) Waiting with baited breath here, to find out how you make out!

@mostaphaRoudsari
Copy link
Member Author

=). 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:
Actually I noticed that line last night/morning and I commented it out but it didn't make a difference. Now I realize that I need to start it since I set it to false in the initialization line rm = OpenStudio.RunManager(rmDBPath, True, True, False, False)

Setting `rm.setPaused(False)`` creates the folder and copies the files

image

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:
Unable to find required file while creating LocalProcess: C:/Program Files/OpenStudio 1.9.2/CSharp/Ruby/openstudio/runmanager/rubyscripts/UserScriptAdapter.rb: C:/ladybug/ostest/0-UserScript/in.rb basepath:

and here is the path inside the created param.json file:

image

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

image

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:

Errors and Warnings:
Process exited with a non-zero exit code of: 1

I think we are making progress :)

@mostaphaRoudsari
Copy link
Member Author

One more thing to add. Once the script is executed, Ruby interpreter starts working and EnergyPlus goes after that. No Radiance.

@chriswmackey
Copy link
Member

@mostpharoudsari and @macumber ,

I just wanted to say that you gentlemen are epic. The suspense of this issue has been thrilling. Keep kicking ass!

mostaphaRoudsari added a commit that referenced this issue Oct 31, 2015
@mostaphaRoudsari
Copy link
Member Author

@macumber I think I won the hackathon :). Click on the image to watch the video.

image
Now let's see if I can use this data to set measure arguments!

@macumber
Copy link

winner

This is awesome :-) I've always envisioned having a line represent the OpenStudio model (I guess it could be the model in memory or a path) and then stringing the OpenStudio model into the measure and having it come out so you could chain it into another measure. Is that even possible?

@mostaphaRoudsari
Copy link
Member Author

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.

image

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!

@mostaphaRoudsari
Copy link
Member Author

Path looks fine! Now I have no idea why it goes wrong.
image

@macumber
Copy link

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.

@mostaphaRoudsari
Copy link
Member Author

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

radiancemeasureerrors

@rpg777
Copy link

rpg777 commented Nov 2, 2015

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.

@macumber
Copy link

macumber commented Nov 2, 2015

@kbenne @henryHorsey @axelstudios @nllong this is a good example for who wants a better interface to OpenStudio measures and also it's just cool :-)

@mostaphaRoudsari
Copy link
Member Author

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 Process exited with a non-zero exit code.. In both cases the it fails in the first step to create the .oct file. I believe there is something as simple as looking to the wrong path causing all this. I'm teaching a workshop on Friday and I'm hoping to be able to show off the OpenStudio workflow once they go through the painful process of Daysim > EnergyPlus. Let's make this happen :)

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.

@rpg777
Copy link

rpg777 commented Nov 3, 2015

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

@mostaphaRoudsari
Copy link
Member Author

@rpg777, I was not using the latest measure from develop folder so I updated and tried again.

The error is an easy one > unknown type "BSDF" I'm sure that I have the latest version of Radiance installed so this should not happen. Right? Any thoughts?

In case you still need the files you can download it from here.

Here is the is the error report:

DL is deprecated, please use Fiddle

oconv: fatal - (materials\materials.rad): unknown type "BSDF"

oconv: fatal - (materials\materials.rad): unknown type "BSDF"

rcontrib: fatal - (model_WG0.oct): truncated octree

oconv: fatal - (model_dc.oct): truncated octree

rcontrib: fatal - (!oconv -f -i model_dc.oct skies\dc_sky.rad): not an octree

rfluxmtx: warning - ignoring output file in sender ('output/dc/WG1.vmx')

rfluxmtx: opening pipe to: rcontrib -fo+ -ab 2 -ad 512 -as 256 -dj 1 -dp 1 -dt 0 -dc 1 -lw 0.001 -n 3 -fda -c 10000 -bn 1 -b "if(-Dx*0-Dy*0-Dz*1,0,-1)" -m groundglow -f reinhartb.cal -p MF=1,rNx=0,rNy=0,rNz=-1,Ux=0,Uy=1,Uz=0,RHS=+1 -bn Nrbins -b rbin -m skyglow -y 145 "!oconv -f -i model_dc.oct skies\dc_sky.rad"

rfluxmtx: sampling 145 directions

oconv: fatal - (model_dc.oct): truncated octree

rcontrib: fatal - (!oconv -f -i model_dc.oct skies\dc_sky.rad): not an octree

rfluxmtx: warning - ignoring output file in sender ('output/dc/WG2.vmx')

rfluxmtx: opening pipe to: rcontrib -fo+ -ab 2 -ad 512 -as 256 -dj 1 -dp 1 -dt 0 -dc 1 -lw 0.001 -n 3 -fda -c 10000 -bn 1 -b "if(-Dx*0-Dy*0-Dz*1,0,-1)" -m groundglow -f reinhartb.cal -p MF=1,rNx=0,rNy=0,rNz=-1,Ux=0,Uy=1,Uz=0,RHS=+1 -bn Nrbins -b rbin -m skyglow -y 145 "!oconv -f -i model_dc.oct skies\dc_sky.rad"

rfluxmtx: sampling 145 directions



materials\materials_vmx.rad







scene\shades\WG1_SHADE.rad







scene\shades\WG2_SHADE.rad





oconv: fatal - (materials\materials.rad): unknown type "BSDF"

oconv: fatal - (model_vmx.oct): truncated octree

rcontrib: fatal - (!oconv -f -i model_vmx.oct receivers_vmx.rad): not an octree

rfluxmtx: running: rcontrib -fo+ -ab 6 -ad 4050 -as 256 -dj 1 -dp 1 -dt 0 -dc 1 -lw 0.001 -n 3 -ds .15 -I -y 45 -faa -c 1 -o output/dc/WG1.vmx -f klems_full.cal -p RHS=+1 -bn Nkbins -b kbin(0,1,0,0,0,1) -m WG1_SHADE -o output/dc/WG2.vmx -p RHS=+1 -bn Nkbins -b kbin(-1,0,0,0,0,1) -m WG2_SHADE "!oconv -f -i model_vmx.oct receivers_vmx.rad"

oconv: fatal - (materials\materials.rad): unknown type "BSDF"

rcontrib: fatal - (model_wc.oct): truncated octree

system - cannot open file 'C:\Program Files\OpenStudio 1.9.2\share\openstudio-1.9.2\pat\Measures\RadianceMeasure\tests\Radiance_Daylighting_Measure\0-UserScript\radiance\output\dc\WG0.vmx': No such file or directory

<stdin>: cannot load matrix

rmtxop: operation failed on '-'

fatal - unexpected EOF in header

<stdin>: cannot load matrix

rmtxop: operation failed on '-'

fatal - unexpected EOF in header

<stdin>: cannot load matrix

rmtxop: operation failed on '-'

fatal - unexpected EOF in header

<stdin>: cannot load matrix

rmtxop: operation failed on '-'

fatal - unexpected EOF in header

<stdin>: cannot load matrix

rmtxop: operation failed on '-'

system - cannot open file 'output\dc\window_controls.vmx': No such file or directory

<stdin>: cannot load matrix

rmtxop: operation failed on '-'

C:/Program Files/OpenStudio 1.9.2/share/openstudio-1.9.2/pat/Measures/RadianceMeasure/tests/Radiance_Daylighting_Measure/0-UserScript/user_script.rb:630:in `initialize': No such file or directory -  (Errno::ENOENT)

    from C:/Program Files/OpenStudio 1.9.2/share/openstudio-1.9.2/pat/Measures/RadianceMeasure/tests/Radiance_Daylighting_Measure/0-UserScript/user_script.rb:630:in `open'

    from C:/Program Files/OpenStudio 1.9.2/share/openstudio-1.9.2/pat/Measures/RadianceMeasure/tests/Radiance_Daylighting_Measure/0-UserScript/user_script.rb:630:in `block in runSimulation'

    from C:/Program Files/OpenStudio 1.9.2/share/openstudio-1.9.2/pat/Measures/RadianceMeasure/tests/Radiance_Daylighting_Measure/0-UserScript/user_script.rb:589:in `each'

    from C:/Program Files/OpenStudio 1.9.2/share/openstudio-1.9.2/pat/Measures/RadianceMeasure/tests/Radiance_Daylighting_Measure/0-UserScript/user_script.rb:589:in `runSimulation'

    from C:/Program Files/OpenStudio 1.9.2/share/openstudio-1.9.2/pat/Measures/RadianceMeasure/tests/Radiance_Daylighting_Measure/0-UserScript/user_script.rb:1872:in `run'

    from in.rb:355:in `<main>'

QWaitCondition: Destroyed while threads are still waiting

QWaitCondition: Destroyed while threads are still waiting

@rpg777
Copy link

rpg777 commented Nov 3, 2015

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:

if adddaylight == 1

    map = OpenStudio::Model::IlluminanceMap.new(model)
    map.setTransformation(maptranslation)
    map.setSpace(space)
    map.setXLength(xlen)
    map.setYLength(ylen)
    map.setNumberofXGridPoints(xdivs)
    map.setNumberofYGridPoints(ydivs)
    map.setName(space.name.get)

    dc = OpenStudio::Model::DaylightingControl.new(model)
    dc.setSpace(space)
    dc.setTransformation(dctranslation)
    dc.setIlluminanceSetpoint(dcsetpoint)
    dc.setPhiRotationAroundZAxis(dcrotationz)
    dc.setName(space.name.get)

    if glorigin
        gl = OpenStudio::Model::GlareSensor.new(model)
        gl.setSpace(space)
        gl.setTransformation(gltranslation)
        gl.setName(space.name.get)
        gl.setNumberofGlareViewVectors(8)
        gl.setPhiRotationAroundZAxis(glrotationz)
    end

    thermalZone = space.thermalZone.get
    thermalZone.setPrimaryDaylightingControl(dc)
    thermalZone.setIlluminanceMap(map)

end

@rpg777
Copy link

rpg777 commented Nov 3, 2015

Yeah, so ah, our measure does not deal with "switchable glazing" correctly. We need to fix that ASAP. In the meantime can you try using the alternate option for shade controls, using the material option rather than the switchable glazing option? Create a new shading control in the plugin and pick one of the standard material types in that menu (blind, shade, or daylight redirecting device).
screen shot 2015-11-03 at 11 01 45 am

@mostaphaRoudsari
Copy link
Member Author

@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 switchable glazing why everything is fine if I run very similar commands from a batch file?

image

@rpg777
Copy link

rpg777 commented Nov 3, 2015

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.

@mostaphaRoudsari
Copy link
Member Author

Well... The screenshot is from SkectchUp plugin! It's not the main issue here though :)

@rpg777
Copy link

rpg777 commented Nov 3, 2015

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

@macumber
Copy link

macumber commented Nov 4, 2015

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
wrote:

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


Reply to this email directly or view it on GitHub
#290 (comment)
.

@macumber
Copy link

macumber commented Nov 4, 2015

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:

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

wrote:

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


Reply to this email directly or view it on GitHub
#290 (comment)
.

@mostaphaRoudsari
Copy link
Member Author

Thanks @macumber. No I didn't know about the first links. Made the changes and @rpg777 guess was right. _It runs with no errors!_ 🎉 🎈

image

We need to get over 5 more steps before closing this:

  1. Measure looks into the wrong folder for Ruby files. The temporary fix for this was to copy Ruby folder under CSharp folder. @macumber is it a general issues with measures or just the Daylight measure? Is it going to be fixed soon or we should just copy the files first time user runs the analysis.
  2. Fix daylight measure to work for switchable glazing. I leave this for @rpg777
  3. Add test grid to HBZones using API. We have an open issue for it here: Adding sensors and illuminance map with OpenStudioAPI #402 @rpg777 and I will solve it soon.
  4. Add shading controls to HBZones using API. There is an example for that ("C:\Program Files\OpenStudio 1.9.2\CSharp\Ruby\openstudio\sketchup_plugin\user_scripts\Alter or Add Model Elements\Add_Shading_Controls.rb")
  5. Visualize the results back to Rhino/Grasshopper. This is the easiest part once we get steps 1-4 to work, and we have already built-in functionalities that can handle this.

@chriswmackey
Copy link
Member

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.

@macumber
Copy link

macumber commented Jul 6, 2016

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

@mostaphaRoudsari
Copy link
Member Author

@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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants