Class: SetLifecycleCostParameters
- Inherits:
-
OpenStudio::Measure::ModelMeasure
- Object
- OpenStudio::Measure::ModelMeasure
- SetLifecycleCostParameters
- Defined in:
- lib/measures/SetLifecycleCostParameters/measure.rb
Overview
start the measure
Instance Method Summary collapse
-
#arguments(model) ⇒ Object
define the arguments that the user will input.
-
#name ⇒ Object
define the name that a user will see, this method may be deprecated as the display name in PAT comes from the name field in measure.xml.
-
#run(model, runner, user_arguments) ⇒ Object
define what happens when the measure is run.
Instance Method Details
#arguments(model) ⇒ Object
define the arguments that the user will input
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/measures/SetLifecycleCostParameters/measure.rb', line 21 def arguments(model) args = OpenStudio::Measure::OSArgumentVector.new # make an argument for your name study_period = OpenStudio::Measure::OSArgument.makeIntegerArgument('study_period', true) study_period.setDisplayName('Set the Length of the Study Period (years).') study_period.setDefaultValue(25) args << study_period return args end |
#name ⇒ Object
define the name that a user will see, this method may be deprecated as the display name in PAT comes from the name field in measure.xml
16 17 18 |
# File 'lib/measures/SetLifecycleCostParameters/measure.rb', line 16 def name return 'SetLifecycleCostParameters' end |
#run(model, runner, user_arguments) ⇒ Object
define what happens when the measure is run
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/measures/SetLifecycleCostParameters/measure.rb', line 34 def run(model, runner, user_arguments) super(model, runner, user_arguments) # use the built-in error checking if !runner.validateUserArguments(arguments(model), user_arguments) return false end # assign the user inputs to variables study_period = runner.getIntegerArgumentValue('study_period', user_arguments) # check the user_name for reasonableness if study_period < 1 runner.registerError('Length of the Study Period needs to be an integer greater than 0.') return false end # get lifecycle object lifeCycleCostParameters = model.getLifeCycleCostParameters # reporting initial condition of model starting_spaces = model.getSpaces runner.registerInitialCondition("Initial Lifecycle Analysis Type is #{lifeCycleCostParameters.analysisType}. Initial Analysis Length is #{lifeCycleCostParameters.lengthOfStudyPeriodInYears}.") # this will eventually be in the GUI, but just adding to measure for now lifeCycleCostParameters.setAnalysisType('FEMP') lifeCycleCostParameters.setLengthOfStudyPeriodInYears(study_period) # reporting final condition of model finishing_spaces = model.getSpaces runner.registerFinalCondition("Final Lifecycle Analysis Type is #{lifeCycleCostParameters.analysisType}. Final Analysis Length is #{lifeCycleCostParameters.lengthOfStudyPeriodInYears}.") return true end |