I'm able to create a ShadingSurfaceGroup using the 1.14.0 API. It looks like you're forgetting the .new
method which takes a model object as the argument.
# OpenStudio Ruby Bindings
require 'openstudio'
# create model
model = OpenStudio::Model::Model.new
# create shading surface group
ssg = OpenStudio::Model::ShadingSurfaceGroup.new(model)
# print to screen
puts model
.
OS:Version,
{14d449ea-4980-4b2b-9a87-ed83cacecc47}, !- Handle
1.14.0; !- Version Identifier
OS:ShadingSurfaceGroup,
{6f4c00a8-2aea-44d5-9752-daa71fa82220}, !- Handle
Shading Surface Group 1, !- Name
Building; !- Shading Surface Type
DL is deprecated, please use Fiddle
If you create a ShadingSurface in the OpenStudio SketchUp Plugin using the New Shading Surface Group button it will also add a ShadingSurfaceGroup to the model. The ShadingSurface is translated to an EnergyPlus Shading:Building:Detailed object.
# OpenStudio Ruby Bindings
require 'openstudio'
# directory
dir = 'C:\Users\Matt\Documents\TOOLBOX\OpenStudio'
# files and paths
osm = 'OSplugin_1.14.0_shading'
osm_path = File.join(dir, osm + '.osm')
# get model
model = OpenStudio::Model::Model.load(osm_path).get
# print to screen
puts "\n", 'OPENSTUDIO OBJECTS'
puts model.getShadingSurfaceGroups
puts model.getShadingSurfaces
# forward translate to IDF
forward_translator = OpenStudio::EnergyPlus::ForwardTranslator.new
idf = forward_translator.translateModel(model)
# save IDF
idf_path = File.join("#{__FILE__}/ShadingSurfaceGroup.idf")
idf.save(idf_path, true)
# get workspace and shading surface
workspace = OpenStudio::Workspace.load(idf_path).get
ep_ss = workspace.getObjectByTypeAndName('Shading_Building_Detailed'.to_IddObjectType, 'Shading Surface 1').get
# print to screen
puts "\n", 'ENERGYPLUS OBJECTS'
puts ep_ss
.
OPENSTUDIO OBJECTS
OS:ShadingSurfaceGroup,
{fd7b1c49-c4cd-4507-95d4-eba000509200}, !- Handle
Shading Surface Group 1, !- Name
Building, !- Shading Surface Type
, !- Space Name
, !- Direction of Relative North {deg}
0, !- X Origin {m}
0, !- Y Origin {m}
3.048, !- Z Origin {m}
; !- Shaded Object Name
OS:ShadingSurface,
{cec21c5d-182c-462d-ad9e-deb697a9d0a0}, !- Handle
Shading Surface 1, !- Name
, !- Construction Name
{fd7b1c49-c4cd-4507-95d4-eba000509200}, !- Shading Surface Group Name
, !- Transmittance Schedule Name
, !- Number of Vertices
3.048, -1.08807845866769, 0, !- X,Y,Z Vertex 1 {m}
3.048, 0, 0, !- X,Y,Z Vertex 2 {m}
0, 0, 0, !- X,Y,Z Vertex 3 {m}
0, -1.08807845866769, 0; !- X,Y,Z Vertex 4 {m}
ENERGYPLUS OBJECTS
Shading:Building:Detailed,
Shading Surface 1, !- Name
, !- Transmittance Schedule Name
, !- Number of Vertices
3.048, -1.08807845866769, 3.048, !- X,Y,Z Vertex 1 {m}
3.048, 0, 3.048, !- X,Y,Z Vertex 2 {m}
0, 0, 3.048, !- X,Y,Z Vertex 3 {m}
0, -1.08807845866769, 3.048; !- X,Y,Z Vertex 4 {m}