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 2015-11-10 02:45:01 -0600

gg_student gravatar image

updated 2015-11-10 06:43:37 -0600

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!!

edit retag flag offensive reopen merge delete

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 gravatar imagepflaumingo ( 2015-11-10 13:21:11 -0600 )edit

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 gravatar imagegg_student ( 2015-11-11 01:55:10 -0600 )edit

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 gravatar imagepflaumingo ( 2015-11-11 11:15:18 -0600 )edit

1 Answer

Sort by » oldest newest most voted
2

answered 2015-11-11 16:30:29 -0600

pflaumingo gravatar image

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.

edit flag offensive delete link more

 

Question Tools

1 follower

Stats

Asked: 2015-11-10 02:45:01 -0600

Seen: 108 times

Last updated: Nov 11 '15