How to use openstudio - 10 common examples

To help you get started, we’ve selected a few openstudio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NREL / OpenStudio / python / testpath.py View on Github external
import openstudio

print openstudio.toString(openstudio.runmanager.RunManager().dbPath())

# workspace test
workspace = openstudio.Workspace()
zone = workspace.addObject(openstudio.IdfObject(openstudio.IddObjectType("Zone")))
zone = zone.get()
zone.setName("New Zone")

for obj in workspace.objects():
  print obj

# model test
model = openstudio.model.Model()
space = openstudio.model.Space(model)
space.setName("New Space")

for s in openstudio.model.getSpaces(model):
  print s
github NREL / OpenStudio / python / testpath.py View on Github external
import openstudio

print openstudio.toString(openstudio.runmanager.RunManager().dbPath())

# workspace test
workspace = openstudio.Workspace()
zone = workspace.addObject(openstudio.IdfObject(openstudio.IddObjectType("Zone")))
zone = zone.get()
zone.setName("New Zone")

for obj in workspace.objects():
  print obj

# model test
model = openstudio.model.Model()
space = openstudio.model.Space(model)
space.setName("New Space")

for s in openstudio.model.getSpaces(model):
  print s
github NREL / OpenStudio / python / testpath.py View on Github external
import openstudio

print openstudio.toString(openstudio.runmanager.RunManager().dbPath())

# workspace test
workspace = openstudio.Workspace()
zone = workspace.addObject(openstudio.IdfObject(openstudio.IddObjectType("Zone")))
zone = zone.get()
zone.setName("New Zone")

for obj in workspace.objects():
  print obj

# model test
model = openstudio.model.Model()
space = openstudio.model.Space(model)
space.setName("New Space")

for s in openstudio.model.getSpaces(model):
  print s
github NREL / OpenStudio / python / testpath.py View on Github external
import openstudio

print openstudio.toString(openstudio.runmanager.RunManager().dbPath())

# workspace test
workspace = openstudio.Workspace()
zone = workspace.addObject(openstudio.IdfObject(openstudio.IddObjectType("Zone")))
zone = zone.get()
zone.setName("New Zone")

for obj in workspace.objects():
  print obj

# model test
model = openstudio.model.Model()
space = openstudio.model.Space(model)
space.setName("New Space")

for s in openstudio.model.getSpaces(model):
  print s
github NREL / OpenStudio / python / testpath.py View on Github external
# workspace test
workspace = openstudio.Workspace()
zone = workspace.addObject(openstudio.IdfObject(openstudio.IddObjectType("Zone")))
zone = zone.get()
zone.setName("New Zone")

for obj in workspace.objects():
  print obj

# model test
model = openstudio.model.Model()
space = openstudio.model.Space(model)
space.setName("New Space")

for s in openstudio.model.getSpaces(model):
  print s
github NREL / OpenStudio / python / testpath.py View on Github external
import openstudio

print openstudio.toString(openstudio.runmanager.RunManager().dbPath())

# workspace test
workspace = openstudio.Workspace()
zone = workspace.addObject(openstudio.IdfObject(openstudio.IddObjectType("Zone")))
zone = zone.get()
zone.setName("New Zone")

for obj in workspace.objects():
  print obj

# model test
model = openstudio.model.Model()
space = openstudio.model.Space(model)
space.setName("New Space")

for s in openstudio.model.getSpaces(model):
github NREL / OpenStudio-workflow-gem / spec / files / python_measure / measures / PythonMeasure / measure.py View on Github external
def arguments(self, model: typing.Optional[openstudio.model.Model]=None):
        """
        define what happens when the measure is run
        """
        args = openstudio.measure.OSArgumentVector()

        example_arg = openstudio.measure.OSArgument.makeStringArgument('space_name', True)
        example_arg.setDisplayName('New space name')
        example_arg.setDescription('This name will be used as the name of the new space.')
        example_arg.setDefaultValue('default_space_name')
        args.append(example_arg)

        return args
github NREL / OpenStudio-workflow-gem / spec / files / python_measure / measures / PythonMeasure / measure.py View on Github external
def arguments(self, model: typing.Optional[openstudio.model.Model]=None):
        """
        define what happens when the measure is run
        """
        args = openstudio.measure.OSArgumentVector()

        example_arg = openstudio.measure.OSArgument.makeStringArgument('space_name', True)
        example_arg.setDisplayName('New space name')
        example_arg.setDescription('This name will be used as the name of the new space.')
        example_arg.setDefaultValue('default_space_name')
        args.append(example_arg)

        return args
github NREL / OpenStudio-workflow-gem / spec / files / python_measure / measures / PythonMeasure / measure.py View on Github external
import openstudio
import typing

class PythonMeasureName(openstudio.measure.PythonMeasure):

    def name(self):
        """
        Return the human readable name.
        Measure name should be the title case of the class name.
        """
        return "PythonMeasureName"

    def description(self):
        """
        human readable description
        """
        return "DESCRIPTION_TEXT"

    def modeler_description(self):
        """
github NREL / OpenStudio-workflow-gem / spec / files / python_measure / measures / PythonMeasure / measure.py View on Github external
runner.registerError('Empty space name was entered.')
            return False

        print("Hello x3")
        # report initial condition of model
        spaces = model.getSpaces()
        n_ori = len(spaces)
        #n_ori = 0
        print("Hello x4")
        print(f"The building started with {n_ori} spaces.")
        runner.registerInitialCondition(
            f"The building started with {n_ori} spaces."
        )
        print("Hello x5")
        # add a new space to the model
        new_space = openstudio.model.Space(model)
        print("Hello x6")
        new_space.setName(space_name)
        print("Hello x7")
        # echo the new space's name back to the user
        runner.registerInfo(f"Space {new_space.nameString()} was added.")
        print("Hello x8")
        # report final condition of model
        #runner.registerFinalCondition(f"The building finished with {len(model.getSpaces())} spaces.")
        runner.registerFinalCondition("the measure ended")
        print("end of measure")
        #print(f"runner.workflow(): {runner.workflow()}")
        print(openstudio.openStudioLongVersion())
        return True