3

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

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

gg_student's avatar
289
gg_student
asked 2015-11-10 02:45:01 -0500
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2020-01-20 13:38:16 -0500
edit flag offensive 0 remove flag reopen merge delete

Closed for the following reason "the question is answered, right answer was accepted" by gg_student 2015-12-09 03:36:35 -0500

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 (2015-11-10 13:21:11 -0500) 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's avatar gg_student (2015-11-11 01:55:10 -0500) 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's avatar pflaumingo (2015-11-11 11:15:18 -0500) edit
add a comment see more comments

1 Answer

2

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.

pflaumingo's avatar
1.9k
pflaumingo
answered 2015-11-11 16:30:29 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments