Missing OS:Version IdfObject from Cloned OS Model
Loaded OSM file using CSharp binding (V3.2.0), read each of the IdfObject and added them to IdfObjectVector (myNewObjVec). Then added the myNewObjVec into another instance of OpenStudio.Model(osNewModel) and saved the new model to a file. See the pseudo code below:
osNewModel.addObjects(myNewObjVec,true);
OpenStudio.Path p = OpenStudio.OpenStudioUtilitiesCore.toPath(newfname);
osNewModel.save(p, true);
The new OSM file was created correctly but the OS:Version IdfObject is missing from the new OSM file. As an alternative I created OS:Version IdfObject on the fly and tried to add it but did not work.
What am I missing?
How did you create
osNewModel
? How are you trying to find theOS:Version
object? Did you open the OSM file in a text editor and look for it?The OS model was created as follows:
I clone each of Idfobjects from the OS model and add them into myNewObjVec. osNewModel.addObjects(myNewObjVec,true); The new OSM doesn't run because the OS:Version object is missing.
I could not open the new OSM file created in OpenStudio because of missing Version object and I confirmed this by text compare. I was able to run the new model by adding
OS:Version
object manually.That is odd, I don't see similar behavior in the Ruby bindings. Creating a new model should create a version object, https://github.com/NREL/OpenStudio/bl.... Perhaps this is a bug in the C# bindings? You could file it as an issue on the OpenStudio SDK GitHub repo.
Thanks. Posted new OpenStudio issue #4433