Module: OpenStudio
- Defined in:
- lib/openstudio/helpers/safe_load.rb,
lib/openstudio/recommendation_engine/version.rb,
lib/openstudio/recommendation_engine/recommendation_engine.rb
Overview
Copyright © 2008-2013, Alliance for Sustainable Energy.
All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Defined Under Namespace
Modules: RecommendationEngine
Class Method Summary collapse
Class Method Details
.safe_load_model(model_path_string) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/openstudio/helpers/safe_load.rb', line 22 def safe_load_model(model_path_string) model_path = OpenStudio::Path.new(model_path_string) if OpenStudio::exists(model_path) versionTranslator = OpenStudio::OSVersion::VersionTranslator.new model = versionTranslator.loadModel(model_path) if model.empty? puts "Version translation failed for #{model_path_string}" exit else model = model.get end else raise "#{model_path_string} couldn't be found" end return model end |