First time here? Check out the Help page!

Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question
3

How can I import a weatherFile by c# into OpenStudio model? [closed]

asked 9 years ago

gg_student's avatar

updated 5 years ago

I use the c# API to generate a OpenStudio Model. I can add constructions, thermalZones, SchedulSets. Now I try to set the weather File. But I only found a method to get the Weatherfile.

OpenStudio.Model model = new Model;
model.getWeatherFile();

Is there an opportunity to set the Weather File?

Thanks for your help!!

Preview: (hide)

Closed for the following reason the question is answered, right answer was accepted by gg_student
close date 2015-12-09 03:36:35.137984

Comments

I haven't worked with the C# bindings yet, but generally there are field getters and setters for the model object and I imagine for C# it would look something like model.setWeatherFile(WeatherFile weatherFile) where you pass an instance of a WeatherFile.

pflaumingo's avatar pflaumingo  ( 9 years ago )

yes, this is the way it should be work. I use the set-methodes to add construction, material etc. but the model.setWeatherFile -method doesn´t exist. There is the get Method but not the set. The same problem ist to create a schedule. There is no set Methode.

gg_student's avatar gg_student  ( 9 years ago )

Looking through the documentation it looks like a WeatherFile is a unique object without a public constructor (a singleton?) and thus when you call model.getWeatherFile() you are both instantiating a weather file and returning a reference to it.

pflaumingo's avatar pflaumingo  ( 9 years ago )

1 Answer

Sort by » oldest newest most voted
2

answered 9 years ago

pflaumingo's avatar

The WeatherFile object appears to be a singleton and has a static member used to instantiate an object. You do this by calling the .setWeatherFile method on the WeatherFile class itself passing in the model and an EpwFile instance - WeatherFile.setWeatherFile(Model model, EpwFile epwFile) works.

Preview: (hide)
link

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 9 years ago

Seen: 241 times

Last updated: Nov 11 '15