-
Notifications
You must be signed in to change notification settings - Fork 230
Expand file tree
/
Copy pathMakeModelObjects.rb
More file actions
141 lines (125 loc) · 9.49 KB
/
MakeModelObjects.rb
File metadata and controls
141 lines (125 loc) · 9.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
require 'fileutils'
if not ARGV[0]
raise "Need to specify output directory"
end
outDir = ARGV[0].gsub("\\", "/")
logDir = outDir + "/logs"
puts outDir
FileUtils::rm_rf(outDir) if File::exists?(outDir)
FileUtils::mkdir_p(outDir)
FileUtils::mkdir_p(logDir)
objects = []
# idd name, class name, baseclass name
# objects << ["OS:Meter", "Meter", "ModelObject"]
# objects << ["OS:Schedule:Constant", "ScheduleConstant", "Schedule"]
# objects << ["OS:Schedule:Ruleset", "ScheduleRuleset", "Schedule"]
# objects << ["OS:Schedule:Rule", "ScheduleRule", "ParentObject"]
# objects << ["OS:ConvergenceLimits", "ConvergenceLimits", "ModelObject"]
# objects << ["OS:HeatBalanceAlgorithm", "HeatBalanceAlgorithm", "ModelObject"]
# objects << ["OS:RunPeriod", "RunPeriod", "ParentObject"]
# objects << ["OS:RunPeriodControl:DaylightSavingTime", "DaylightSavingTime", "ModelObject"]
# objects << ["OS:RunPeriodControl:SpecialDays", "RunPeriodControlSpecialDays", "ModelObject"]
# objects << ["OS:ShadowCalculation", "ShadowCalculation", "ModelObject"]
# objects << ["OS:SimulationControl", "SimulationControl", "ParentObject"]
# objects << ["OS:Sizing:Parameters", "SizingParameters", "ModelObject"]
# objects << ["OS:SurfaceConvectionAlgorithm:Inside", "InsideSurfaceConvectionAlgorithm", "ModelObject"]
# objects << ["OS:SurfaceConvectionAlgorithm:Outside", "OutsideSurfaceConvectionAlgorithm", "ModelObject"]
# objects << ["OS:Timestep", "Timestep", "ModelObject"]
# objects << ["OS:YearDescription", "YearDescription", "ModelObject"]
# objects << ["OS:ZoneAirContaminantBalance", "ZoneAirContaminantBalance", "ModelObject"]
# objects << ["OS:ZoneAirHeatBalanceAlgorithm", "ZoneAirHeatBalanceAlgorithm", "ModelObject"]
# objects << ["OS:ZoneCapacitanceMultiplier:ResearchSpecial", "ZoneCapacitanceMultiplierResearchSpecial", "ModelObject"]
# objects << ["OS:Schedule:Day", "ScheduleDay", "ResourceObject"]
# objects << ["OS:Schedule:Week", "ScheduleWeek", "ResourceObject"]
# objects << ["OS:Schedule:Year", "ScheduleYear", "Schedule"]
# objects << ["OS:Site", "Site", "ParentObject"]
# objects << ["OS:Site:GroundTemperature:BuildingSurface", "SiteGroundTemperatureBuildingSurface", "ModelObject"]
# objects << ["OS:Site:WaterMainsTemperature", "SiteWaterMainsTemperature", "ModelObject"]
# objects << ["OS:WeatherFile", "WeatherFile", "ModelObject"]
# objects << ["OS:BuildingStory", "BuildingStory", "ResourceObject"]
# objects << ["OS:DefaultConstructionSet", "DefaultConstructionSet", "ResourceObject"]
# objects << ["OS:DefaultScheduleSet", "DefaultScheduleSet", "ResourceObject"]
# objects << ["OS:DefaultSubSurfaceConstructions", "DefaultSubSurfaceConstructions", "ResourceObject"]
# objects << ["OS:DefaultSurfaceConstructions", "DefaultSurfaceConstructions", "ResourceObject"]
# objects << ["OS:ElectricEquipment:Definition", "ElectricEquipmentDefinition", "SpaceLoadDefinition"]
# objects << ["OS:GasEquipment:Definition", "GasEquipmentDefinition", "SpaceLoadDefinition"]
# objects << ["OS:HotWaterEquipment:Definition", "HotWaterEquipmentDefinition", "SpaceLoadDefinition"]
# objects << ["OS:InternalMass:Definition", "InternalMassDefinition", "SpaceLoadDefinition"]
# objects << ["OS:Lights:Definition", "LightsDefinition", "SpaceLoadDefinition"]
# objects << ["OS:Luminaire:Definition", "LuminaireDefinition", "SpaceLoadDefinition"]
# objects << ["OS:People:Definition", "PeopleDefinition", "SpaceLoadDefinition"]
# objects << ["OS:Rendering:Color", "RenderingColor", "ResourceObject"]
# objects << ["OS:SpaceType", "SpaceType", "ResourceObject"]
# objects << ["OS:Building", "Building", "ParentObject"]
# objects << ["OS:Daylighting:Control", "DaylightingControl", "SpaceItem"]
# objects << ["OS:DaylightingDevice:Shelf", "DaylightingDeviceShelf", "SpaceItem"]
# objects << ["OS:ElectricEquipment", "ElectricEquipment", "SpaceLoadInstance"]
# objects << ["OS:Facility", "Facility", "ParentObject"]
# objects << ["OS:GasEquipment", "GasEquipment", "SpaceLoadInstance"]
# objects << ["OS:HotWaterEquipment", "HotWaterEquipment", "SpaceLoadInstance"]
# objects << ["OS:IlluminanceMap", "IlluminanceMap", "SpaceItem"]
# objects << ["OS:InteriorPartitionSurfaceGroup", "InteriorPartitionSurfaceGroup", "PlanarSurfaceGroup"]
# objects << ["OS:InteriorPartitionSurface", "InteriorPartitionSurface", "PlanarSurface"]
# objects << ["OS:InternalMass", "InternalMass", "SpaceLoadInstance"]
# objects << ["OS:LightingSimulationZone", "LightingSimulationZone", "ModelObject"]
# objects << ["OS:Lights", "Lights", "SpaceLoadInstance"]
# objects << ["OS:Luminaire", "Luminaire", "SpaceLoadInstance"]
# objects << ["OS:People", "People", "SpaceLoadInstance"]
# objects << ["OS:ShadingSurfaceGroup", "ShadingSurfaceGroup", "PlanarSurfaceGroup"]
# objects << ["OS:ShadingSurface", "ShadingSurface", "PlanarSurface"]
# objects << ["OS:Space", "Space", "PlanarSurfaceGroup"]
# objects << ["OS:Surface", "Surface", "PlanarSurface"]
# objects << ["OS:SubSurface", "SubSurface", "PlanarSurface"]
# objects << ["OS:SpaceInfiltration:DesignFlowRate", "SpaceInfiltrationDesignFlowRate", "SpaceLoad"]
#objects << ["OS:SpaceVentilation:DesignFlowRate", "SpaceVentilationDesignFlowRate", "SpaceLoad"]
# objects << ["OS:LightingDesignDay", "LightingDesignDay", "ModelObject"]
# objects << ["OS:LightingSimulationControl", "LightingSimulationControl", "ModelObject"]
# objects << ["OS:EnergyManagementSystem:Sensor", "EnergyManagementSystemSensor", "ModelObject"]
# objects << ["OS:EnergyManagementSystem:Actuator", "EnergyManagementSystemActuator", "ModelObject"]
# objects << ["OS:EnergyManagementSystem:ProgramCallingManager", "EnergyManagementSystemProgramCallingManager", "ModelObject"]
# objects << ["OS:EnergyManagementSystem:Program", "EnergyManagementSystemProgram", "ModelObject"]
# objects << ["OS:EnergyManagementSystem:GlobalVariable", "EnergyManagementSystemGlobalVariable", "ModelObject"]
#objects << ["OS:EnergyManagementSystem:Subroutine", "EnergyManagementSystemSubroutine", "ModelObject"]
#objects << ["OS:EnergyManagementSystem:OutputVariable", "EnergyManagementSystemOutputVariable", "ModelObject"]
#objects << ["OS:EnergyManagementSystem:MeteredOutputVariable", "EnergyManagementSystemMeteredOutputVariable", "ModelObject"]
#objects << ["OS:EnergyManagementSystem:TrendVariable", "EnergyManagementSystemTrendVariable", "ModelObject"]
#objects << ["OS:EnergyManagementSystem:InternalVariable", "EnergyManagementSystemInternalVariable", "ModelObject"]
#objects << ["OS:EnergyManagementSystem:CurveOrTableIndexVariable", "EnergyManagementSystemCurveOrTableIndexVariable", "ModelObject"]
#objects << ["OS:EnergyManagementSystem:ConstructionIndexVariable", "EnergyManagementSystemConstructionIndexVariable", "ModelObject"]
#objects << ["OS:Output:EnergyManagementSystem", "OutputEnergyManagementSystem", "ModelObject"]
#objects << ["OS:ExternalInterface", "ExternalInterface", "ModelObject"]
#objects << ["OS:ExternalInterface:Schedule", "ExternalInterfaceSchedule", "ModelObject"]
#objects << ["OS:ExternalInterface:Variable", "ExternalInterfaceVariable", "ModelObject"]
#objects << ["OS:ExternalInterface:Actuator", "ExternalInterfaceActuator", "ModelObject"]
#objects << ["OS:ExternalInterface:FunctionalMockupUnitImport", "ExternalInterfaceFunctionalMockupUnitImport", "ModelObject"]
#objects << ["OS:ExternalInterface:FunctionalMockupUnitImport:From:Variable", "ExternalInterfaceFunctionalMockupUnitImportFromVariable", "ModelObject"]
#objects << ["OS:ExternalInterface:FunctionalMockupUnitImport:To:Schedule", "ExternalInterfaceFunctionalMockupUnitImportToSchedule", "ModelObject"]
#objects << ["OS:ExternalInterface:FunctionalMockupUnitImport:To:Actuator", "ExternalInterfaceFunctionalMockupUnitImportToActuator", "ModelObject"]
#objects << ["OS:ExternalInterface:FunctionalMockupUnitImport:To:Variable", "ExternalInterfaceFunctionalMockupUnitImportToVariable", "ModelObject"]
#objects << ["OS:ExternalInterface:FunctionalMockupUnitExport:From:Variable", "ExternalInterfaceFunctionalMockupUnitExportFromVariable", "ModelObject"]
#objects << ["OS:ExternalInterface:FunctionalMockupUnitExport:To:Schedule", "ExternalInterfaceFunctionalMockupUnitExportToSchedule", "ModelObject"]
#objects << ["OS:ExternalInterface:FunctionalMockupUnitExport:To:Actuator", "ExternalInterfaceFunctionalMockupUnitExportToActuator", "ModelObject"]
#objects << ["OS:ExternalInterface:FunctionalMockupUnitExport:To:Variable", "ExternalInterfaceFunctionalMockupUnitExportToVariable", "ModelObject"]
#objects << ["OS:PlantComponent:UserDefined", "PlantComponentUserDefined", "ModelObject"]
#objects << ["OS:ElectricLoadCenter:Transformer", "ElectricLoadCenterTransformer", "ParentObject"]
#objects << ["OS:ElectricLoadCenter:Transformer", "ElectricLoadCenterTransformer", "ModelObject"]
objects << ["OS:Construction:AirBoundary", "ConstructionAirBoundary", "ConstructionBase"]
includePath = nil
if /mswin/.match(RUBY_PLATFORM) || /mingw/.match(RUBY_PLATFORM)
#includePath = "../../build/OSCore-prefix/src/OSCore-build/ruby/Debug"
#includePath = "../../build/OSCore-prefix/src/OSCore-build/ruby/Release"
#includePath = "../../build/Products/ruby/Debug"
includePath = "../../build-release/Products/ruby/Release"
else
includePath = "../../build/OSCore-prefix/src/OSCore-build/ruby"
end
failed_objects = []
objects.each do |object|
command = "ruby -I #{includePath} GenerateClass.rb -s 'model' -c '#{object[1]}' -b '#{object[2]}' -o #{outDir} -p --no-qobject -i '#{object[0].gsub(':','_')}' > #{outDir}/logs/#{object[0].gsub(':','_')}.log 2>&1 "
puts command
result = system(command)
failed_objects << object if not result
end
failed_objects.each do |object|
puts "Failed to make class for IddObject #{object[0]}"
end