dragonfly-schema 1.12.1-v10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/helpers/class-validator.ts +94 -0
  2. package/index.ts +1 -0
  3. package/models/Building.ts +98 -0
  4. package/models/BuildingEnergyPropertiesAbridged.ts +65 -0
  5. package/models/BuildingPropertiesAbridged.ts +73 -0
  6. package/models/BuildingRadiancePropertiesAbridged.ts +63 -0
  7. package/models/ContextShade.ts +83 -0
  8. package/models/ContextShadeEnergyPropertiesAbridged.ts +74 -0
  9. package/models/ContextShadePropertiesAbridged.ts +73 -0
  10. package/models/ContextShadeRadiancePropertiesAbridged.ts +63 -0
  11. package/models/DetailedSkylights.ts +73 -0
  12. package/models/DetailedWindows.ts +73 -0
  13. package/models/ExteriorApertureGridParameter.ts +74 -0
  14. package/models/ExteriorApertureType.ts +8 -0
  15. package/models/ExteriorFaceGridParameter.ts +82 -0
  16. package/models/ExteriorFaceType.ts +9 -0
  17. package/models/ExtrudedBorder.ts +63 -0
  18. package/models/GriddedSkylightArea.ts +71 -0
  19. package/models/GriddedSkylightRatio.ts +71 -0
  20. package/models/LouversByCount.ts +63 -0
  21. package/models/LouversByDistance.ts +63 -0
  22. package/models/Model.ts +125 -0
  23. package/models/ModelEnergyProperties.ts +606 -0
  24. package/models/ModelProperties.ts +73 -0
  25. package/models/ModelRadianceProperties.ts +253 -0
  26. package/models/Overhang.ts +73 -0
  27. package/models/RectangularWindows.ts +89 -0
  28. package/models/RepeatingWindowRatio.ts +94 -0
  29. package/models/RoofSpecification.ts +67 -0
  30. package/models/Room2D.ts +166 -0
  31. package/models/Room2DEnergyPropertiesAbridged.ts +123 -0
  32. package/models/Room2DPropertiesAbridged.ts +73 -0
  33. package/models/Room2DRadiancePropertiesAbridged.ts +74 -0
  34. package/models/RoomGridParameter.ts +72 -0
  35. package/models/RoomRadialGridParameter.ts +80 -0
  36. package/models/SimpleWindowArea.ts +71 -0
  37. package/models/SimpleWindowRatio.ts +71 -0
  38. package/models/SingleWindow.ts +78 -0
  39. package/models/Story.ts +111 -0
  40. package/models/StoryEnergyPropertiesAbridged.ts +65 -0
  41. package/models/StoryPropertiesAbridged.ts +73 -0
  42. package/models/StoryRadiancePropertiesAbridged.ts +63 -0
  43. package/models/_GridParameterBase.ts +71 -0
  44. package/models/_LouversBase.ts +99 -0
  45. package/models/_OpenAPIGenBaseModel.ts +38 -0
  46. package/models/_WindowParameterBase.ts +62 -0
  47. package/models/index.ts +46 -0
  48. package/package.json +28 -0
  49. package/tsconfig.json +32 -0
  50. package/vite.config.ts +14 -0
@@ -0,0 +1,166 @@
1
+ import { IsArray, IsDefined, IsNumber, IsInstance, ValidateNested, IsString, IsOptional, Matches, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator';
2
+ import { Type, plainToClass, instanceToPlain } from 'class-transformer';
3
+ import { IsNestedNumberArray } from "./../helpers/class-validator";
4
+ import { Adiabatic } from "honeybee-schema";
5
+ import { DetailedSkylights } from "./DetailedSkylights";
6
+ import { DetailedWindows } from "./DetailedWindows";
7
+ import { ExtrudedBorder } from "./ExtrudedBorder";
8
+ import { GriddedSkylightArea } from "./GriddedSkylightArea";
9
+ import { GriddedSkylightRatio } from "./GriddedSkylightRatio";
10
+ import { Ground } from "honeybee-schema";
11
+ import { IDdBaseModel } from "honeybee-schema";
12
+ import { LouversByCount } from "./LouversByCount";
13
+ import { LouversByDistance } from "./LouversByDistance";
14
+ import { OtherSideTemperature } from "honeybee-schema";
15
+ import { Outdoors } from "honeybee-schema";
16
+ import { Overhang } from "./Overhang";
17
+ import { RectangularWindows } from "./RectangularWindows";
18
+ import { RepeatingWindowRatio } from "./RepeatingWindowRatio";
19
+ import { Room2DPropertiesAbridged } from "./Room2DPropertiesAbridged";
20
+ import { SimpleWindowArea } from "./SimpleWindowArea";
21
+ import { SimpleWindowRatio } from "./SimpleWindowRatio";
22
+ import { SingleWindow } from "./SingleWindow";
23
+ import { Surface } from "honeybee-schema";
24
+
25
+ /** Base class for all objects requiring a identifiers acceptable for all engines. */
26
+ export class Room2D extends IDdBaseModel {
27
+ @IsArray()
28
+ @IsNestedNumberArray()
29
+ @IsDefined()
30
+ /** A list of 2D points representing the outer boundary vertices of the Room2D. The list should include at least 3 points and each point should be a list of 2 (x, y) values. */
31
+ floor_boundary!: number [] [];
32
+
33
+ @IsNumber()
34
+ @IsDefined()
35
+ /** A number to indicate the height of the floor plane in the Z axis. */
36
+ floor_height!: number;
37
+
38
+ @IsNumber()
39
+ @IsDefined()
40
+ /** A number for the distance between the floor and the ceiling. */
41
+ floor_to_ceiling_height!: number;
42
+
43
+ @IsInstance(Room2DPropertiesAbridged)
44
+ @Type(() => Room2DPropertiesAbridged)
45
+ @ValidateNested()
46
+ @IsDefined()
47
+ /** Extension properties for particular simulation engines (Radiance, EnergyPlus). */
48
+ properties!: Room2DPropertiesAbridged;
49
+
50
+ @IsString()
51
+ @IsOptional()
52
+ @Matches(/^Room2D$/)
53
+ type?: string;
54
+
55
+ @IsArray()
56
+ @IsNestedNumberArray()
57
+ @IsOptional()
58
+ /** Optional list of lists with one list for each hole in the floor plate. Each hole should be a list of at least 2 points and each point a list of 2 (x, y) values. If None, it will be assumed that there are no holes in the floor plate. */
59
+ floor_holes?: number [] [] [];
60
+
61
+ @IsBoolean()
62
+ @IsOptional()
63
+ /** A boolean noting whether this Room2D has its floor in contact with the ground. */
64
+ is_ground_contact?: boolean;
65
+
66
+ @IsBoolean()
67
+ @IsOptional()
68
+ /** A boolean noting whether this Room2D has its ceiling exposed to the outdoors. */
69
+ is_top_exposed?: boolean;
70
+
71
+ @IsArray()
72
+ @IsOptional()
73
+ /** A list of boundary conditions that match the number of segments in the input floor_geometry + floor_holes. These will be used to assign boundary conditions to each of the walls of the Room in the resulting model. Their order should align with the order of segments in the floor_boundary and then with each hole segment. If None, all boundary conditions will be Outdoors or Ground depending on whether ceiling height of the room is at or below 0 (the assumed ground plane). */
74
+ boundary_conditions?: (Ground | Outdoors | Surface | Adiabatic | OtherSideTemperature) [];
75
+
76
+ @IsArray()
77
+ @IsOptional()
78
+ /** A list of WindowParameter objects that dictate how the window geometries will be generated for each of the walls. If None, no windows will exist over the entire Room2D. */
79
+ window_parameters?: (SingleWindow | SimpleWindowArea | SimpleWindowRatio | RepeatingWindowRatio | RectangularWindows | DetailedWindows) [];
80
+
81
+ @IsArray()
82
+ @IsOptional()
83
+ /** A list of ShadingParameter objects that dictate how the shade geometries will be generated for each of the walls. If None, no shades will exist over the entire Room2D. */
84
+ shading_parameters?: (ExtrudedBorder | Overhang | LouversByDistance | LouversByCount) [];
85
+
86
+ @IsArray()
87
+ @IsBoolean({ each: true })
88
+ @IsOptional()
89
+ /** A list of booleans for whether each wall has an air boundary type. False values indicate a standard opaque type while True values indicate an AirBoundary type. All walls will be False by default. Note that any walls with a True air boundary must have a Surface boundary condition without any windows. */
90
+ air_boundaries?: boolean [];
91
+
92
+ @IsOptional()
93
+ /** A SkylightParameter object describing how to generate skylights. If None, no skylights will exist on the Room2D. */
94
+ skylight_parameters?: (GriddedSkylightArea | GriddedSkylightRatio | DetailedSkylights);
95
+
96
+
97
+ constructor() {
98
+ super();
99
+ this.type = "Room2D";
100
+ this.is_ground_contact = false;
101
+ this.is_top_exposed = false;
102
+ }
103
+
104
+
105
+ override init(_data?: any) {
106
+ super.init(_data);
107
+ if (_data) {
108
+ const obj = plainToClass(Room2D, _data);
109
+ this.floor_boundary = obj.floor_boundary;
110
+ this.floor_height = obj.floor_height;
111
+ this.floor_to_ceiling_height = obj.floor_to_ceiling_height;
112
+ this.properties = obj.properties;
113
+ this.type = obj.type;
114
+ this.floor_holes = obj.floor_holes;
115
+ this.is_ground_contact = obj.is_ground_contact;
116
+ this.is_top_exposed = obj.is_top_exposed;
117
+ this.boundary_conditions = obj.boundary_conditions;
118
+ this.window_parameters = obj.window_parameters;
119
+ this.shading_parameters = obj.shading_parameters;
120
+ this.air_boundaries = obj.air_boundaries;
121
+ this.skylight_parameters = obj.skylight_parameters;
122
+ }
123
+ }
124
+
125
+
126
+ static override fromJS(data: any): Room2D {
127
+ data = typeof data === 'object' ? data : {};
128
+
129
+ let result = new Room2D();
130
+ result.init(data);
131
+ return result;
132
+ }
133
+
134
+ override toJSON(data?: any) {
135
+ data = typeof data === 'object' ? data : {};
136
+ for (var property in this) {
137
+ if (this.hasOwnProperty(property))
138
+ data[property] = this[property];
139
+ }
140
+
141
+ data["floor_boundary"] = this.floor_boundary;
142
+ data["floor_height"] = this.floor_height;
143
+ data["floor_to_ceiling_height"] = this.floor_to_ceiling_height;
144
+ data["properties"] = this.properties;
145
+ data["type"] = this.type;
146
+ data["floor_holes"] = this.floor_holes;
147
+ data["is_ground_contact"] = this.is_ground_contact;
148
+ data["is_top_exposed"] = this.is_top_exposed;
149
+ data["boundary_conditions"] = this.boundary_conditions;
150
+ data["window_parameters"] = this.window_parameters;
151
+ data["shading_parameters"] = this.shading_parameters;
152
+ data["air_boundaries"] = this.air_boundaries;
153
+ data["skylight_parameters"] = this.skylight_parameters;
154
+ data = super.toJSON(data);
155
+ return instanceToPlain(data);
156
+ }
157
+
158
+ async validate(): Promise<boolean> {
159
+ const errors = await validate(this);
160
+ if (errors.length > 0){
161
+ const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; ');
162
+ throw new Error(`Validation failed: ${errorMessages}`);
163
+ }
164
+ return true;
165
+ }
166
+ }
@@ -0,0 +1,123 @@
1
+ import { IsString, IsOptional, Matches, MinLength, MaxLength, IsInstance, ValidateNested, IsArray, validate, ValidationError as TsValidationError } from 'class-validator';
2
+ import { Type, plainToClass, instanceToPlain } from 'class-transformer';
3
+ import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";
4
+ import { ProcessAbridged } from "honeybee-schema";
5
+ import { VentilationControlAbridged } from "honeybee-schema";
6
+ import { VentilationOpening } from "honeybee-schema";
7
+
8
+ /** Base class for all objects that are not extensible with additional keys.\n\nThis effectively includes all objects except for the Properties classes\nthat are assigned to geometry objects. */
9
+ export class Room2DEnergyPropertiesAbridged extends _OpenAPIGenBaseModel {
10
+ @IsString()
11
+ @IsOptional()
12
+ @Matches(/^Room2DEnergyPropertiesAbridged$/)
13
+ type?: string;
14
+
15
+ @IsString()
16
+ @IsOptional()
17
+ @MinLength(1)
18
+ @MaxLength(100)
19
+ /** Name of a ConstructionSet to specify all constructions for the Room2D. If None, the Room2D will use the Story or Building construction_set or the Model global_construction_set. Any ConstructionSet assigned here will override those assigned to these objects. */
20
+ construction_set?: string;
21
+
22
+ @IsString()
23
+ @IsOptional()
24
+ @MinLength(1)
25
+ @MaxLength(100)
26
+ /** Name of a ProgramType to specify all schedules and loads for the Room2D. If None, the Room2D will have no loads or setpoints. */
27
+ program_type?: string;
28
+
29
+ @IsString()
30
+ @IsOptional()
31
+ @MinLength(1)
32
+ @MaxLength(100)
33
+ /** An optional identifier of a HVAC system (such as an IdealAirSystem) that specifies how the Room2D is conditioned. If None, it will be assumed that the Room2D is not conditioned. */
34
+ hvac?: string;
35
+
36
+ @IsString()
37
+ @IsOptional()
38
+ @MinLength(1)
39
+ @MaxLength(100)
40
+ /** An optional identifier of a Service Hot Water (SHW) system that specifies how the hot water load of the Room is met. If None, the hot water load will be met with a generic system that only measures thermal loadand does not account for system efficiencies. */
41
+ shw?: string;
42
+
43
+ @IsInstance(VentilationControlAbridged)
44
+ @Type(() => VentilationControlAbridged)
45
+ @ValidateNested()
46
+ @IsOptional()
47
+ /** An optional VentilationControl object to dictate the opening of windows. If None, the windows will never open. */
48
+ window_vent_control?: VentilationControlAbridged;
49
+
50
+ @IsInstance(VentilationOpening)
51
+ @Type(() => VentilationOpening)
52
+ @ValidateNested()
53
+ @IsOptional()
54
+ /** An optional VentilationOpening to specify the operable portion of all windows of the Room2D. If None, the windows will never open. */
55
+ window_vent_opening?: VentilationOpening;
56
+
57
+ @IsArray()
58
+ @IsInstance(ProcessAbridged, { each: true })
59
+ @Type(() => ProcessAbridged)
60
+ @ValidateNested({ each: true })
61
+ @IsOptional()
62
+ /** An optional list of Process objects for process loads within the room. These can represent wood burning fireplaces, kilns, manufacturing equipment, and various industrial processes. They can also be used to represent certain pieces of equipment to be separated from the other end uses, such as MRI machines, theatrical lighting, and elevators. */
63
+ process_loads?: ProcessAbridged [];
64
+
65
+
66
+ constructor() {
67
+ super();
68
+ this.type = "Room2DEnergyPropertiesAbridged";
69
+ }
70
+
71
+
72
+ override init(_data?: any) {
73
+ super.init(_data);
74
+ if (_data) {
75
+ const obj = plainToClass(Room2DEnergyPropertiesAbridged, _data);
76
+ this.type = obj.type;
77
+ this.construction_set = obj.construction_set;
78
+ this.program_type = obj.program_type;
79
+ this.hvac = obj.hvac;
80
+ this.shw = obj.shw;
81
+ this.window_vent_control = obj.window_vent_control;
82
+ this.window_vent_opening = obj.window_vent_opening;
83
+ this.process_loads = obj.process_loads;
84
+ }
85
+ }
86
+
87
+
88
+ static override fromJS(data: any): Room2DEnergyPropertiesAbridged {
89
+ data = typeof data === 'object' ? data : {};
90
+
91
+ let result = new Room2DEnergyPropertiesAbridged();
92
+ result.init(data);
93
+ return result;
94
+ }
95
+
96
+ override toJSON(data?: any) {
97
+ data = typeof data === 'object' ? data : {};
98
+ for (var property in this) {
99
+ if (this.hasOwnProperty(property))
100
+ data[property] = this[property];
101
+ }
102
+
103
+ data["type"] = this.type;
104
+ data["construction_set"] = this.construction_set;
105
+ data["program_type"] = this.program_type;
106
+ data["hvac"] = this.hvac;
107
+ data["shw"] = this.shw;
108
+ data["window_vent_control"] = this.window_vent_control;
109
+ data["window_vent_opening"] = this.window_vent_opening;
110
+ data["process_loads"] = this.process_loads;
111
+ data = super.toJSON(data);
112
+ return instanceToPlain(data);
113
+ }
114
+
115
+ async validate(): Promise<boolean> {
116
+ const errors = await validate(this);
117
+ if (errors.length > 0){
118
+ const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; ');
119
+ throw new Error(`Validation failed: ${errorMessages}`);
120
+ }
121
+ return true;
122
+ }
123
+ }
@@ -0,0 +1,73 @@
1
+ import { IsString, IsOptional, Matches, IsInstance, ValidateNested, validate, ValidationError as TsValidationError } from 'class-validator';
2
+ import { Type, plainToClass, instanceToPlain } from 'class-transformer';
3
+ import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";
4
+ import { Room2DEnergyPropertiesAbridged } from "./Room2DEnergyPropertiesAbridged";
5
+ import { Room2DRadiancePropertiesAbridged } from "./Room2DRadiancePropertiesAbridged";
6
+
7
+ export class Room2DPropertiesAbridged extends _OpenAPIGenBaseModel {
8
+ @IsString()
9
+ @IsOptional()
10
+ @Matches(/^Room2DPropertiesAbridged$/)
11
+ type?: string;
12
+
13
+ @IsInstance(Room2DEnergyPropertiesAbridged)
14
+ @Type(() => Room2DEnergyPropertiesAbridged)
15
+ @ValidateNested()
16
+ @IsOptional()
17
+ energy?: Room2DEnergyPropertiesAbridged;
18
+
19
+ @IsInstance(Room2DRadiancePropertiesAbridged)
20
+ @Type(() => Room2DRadiancePropertiesAbridged)
21
+ @ValidateNested()
22
+ @IsOptional()
23
+ radiance?: Room2DRadiancePropertiesAbridged;
24
+
25
+
26
+ constructor() {
27
+ super();
28
+ this.type = "Room2DPropertiesAbridged";
29
+ }
30
+
31
+
32
+ override init(_data?: any) {
33
+ super.init(_data);
34
+ if (_data) {
35
+ const obj = plainToClass(Room2DPropertiesAbridged, _data);
36
+ this.type = obj.type;
37
+ this.energy = obj.energy;
38
+ this.radiance = obj.radiance;
39
+ }
40
+ }
41
+
42
+
43
+ static override fromJS(data: any): Room2DPropertiesAbridged {
44
+ data = typeof data === 'object' ? data : {};
45
+
46
+ let result = new Room2DPropertiesAbridged();
47
+ result.init(data);
48
+ return result;
49
+ }
50
+
51
+ override toJSON(data?: any) {
52
+ data = typeof data === 'object' ? data : {};
53
+ for (var property in this) {
54
+ if (this.hasOwnProperty(property))
55
+ data[property] = this[property];
56
+ }
57
+
58
+ data["type"] = this.type;
59
+ data["energy"] = this.energy;
60
+ data["radiance"] = this.radiance;
61
+ data = super.toJSON(data);
62
+ return instanceToPlain(data);
63
+ }
64
+
65
+ async validate(): Promise<boolean> {
66
+ const errors = await validate(this);
67
+ if (errors.length > 0){
68
+ const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; ');
69
+ throw new Error(`Validation failed: ${errorMessages}`);
70
+ }
71
+ return true;
72
+ }
73
+ }
@@ -0,0 +1,74 @@
1
+ import { IsString, IsOptional, Matches, IsArray, validate, ValidationError as TsValidationError } from 'class-validator';
2
+ import { Type, plainToClass, instanceToPlain } from 'class-transformer';
3
+ import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";
4
+ import { ExteriorApertureGridParameter } from "./ExteriorApertureGridParameter";
5
+ import { ExteriorFaceGridParameter } from "./ExteriorFaceGridParameter";
6
+ import { RoomGridParameter } from "./RoomGridParameter";
7
+ import { RoomRadialGridParameter } from "./RoomRadialGridParameter";
8
+
9
+ /** Base class for all objects that are not extensible with additional keys.\n\nThis effectively includes all objects except for the Properties classes\nthat are assigned to geometry objects. */
10
+ export class Room2DRadiancePropertiesAbridged extends _OpenAPIGenBaseModel {
11
+ @IsString()
12
+ @IsOptional()
13
+ @Matches(/^Room2DRadiancePropertiesAbridged$/)
14
+ type?: string;
15
+
16
+ @IsString()
17
+ @IsOptional()
18
+ /** Identifier of a ModifierSet to specify all modifiers for the Room2D. If None, the Room2D will use the Story or Building modifier_set or the Model global_modifier_set. Any ModifierSet assigned here will override those assigned to the parent objects. */
19
+ modifier_set?: string;
20
+
21
+ @IsArray()
22
+ @IsOptional()
23
+ /** An optional list of GridParameter objects to describe how sensor grids should be generated for the Room2D. */
24
+ grid_parameters?: (RoomGridParameter | RoomRadialGridParameter | ExteriorFaceGridParameter | ExteriorApertureGridParameter) [];
25
+
26
+
27
+ constructor() {
28
+ super();
29
+ this.type = "Room2DRadiancePropertiesAbridged";
30
+ }
31
+
32
+
33
+ override init(_data?: any) {
34
+ super.init(_data);
35
+ if (_data) {
36
+ const obj = plainToClass(Room2DRadiancePropertiesAbridged, _data);
37
+ this.type = obj.type;
38
+ this.modifier_set = obj.modifier_set;
39
+ this.grid_parameters = obj.grid_parameters;
40
+ }
41
+ }
42
+
43
+
44
+ static override fromJS(data: any): Room2DRadiancePropertiesAbridged {
45
+ data = typeof data === 'object' ? data : {};
46
+
47
+ let result = new Room2DRadiancePropertiesAbridged();
48
+ result.init(data);
49
+ return result;
50
+ }
51
+
52
+ override toJSON(data?: any) {
53
+ data = typeof data === 'object' ? data : {};
54
+ for (var property in this) {
55
+ if (this.hasOwnProperty(property))
56
+ data[property] = this[property];
57
+ }
58
+
59
+ data["type"] = this.type;
60
+ data["modifier_set"] = this.modifier_set;
61
+ data["grid_parameters"] = this.grid_parameters;
62
+ data = super.toJSON(data);
63
+ return instanceToPlain(data);
64
+ }
65
+
66
+ async validate(): Promise<boolean> {
67
+ const errors = await validate(this);
68
+ if (errors.length > 0){
69
+ const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; ');
70
+ throw new Error(`Validation failed: ${errorMessages}`);
71
+ }
72
+ return true;
73
+ }
74
+ }
@@ -0,0 +1,72 @@
1
+ import { IsString, IsOptional, Matches, IsNumber, validate, ValidationError as TsValidationError } from 'class-validator';
2
+ import { Type, plainToClass, instanceToPlain } from 'class-transformer';
3
+ import { _GridParameterBase } from "./_GridParameterBase";
4
+
5
+ /** Instructions for a SensorGrid generated from a Room2D's floors. */
6
+ export class RoomGridParameter extends _GridParameterBase {
7
+ @IsString()
8
+ @IsOptional()
9
+ @Matches(/^RoomGridParameter$/)
10
+ type?: string;
11
+
12
+ @IsNumber()
13
+ @IsOptional()
14
+ /** A number for how far to offset the grid from the Room2D floors. (Default: 1.0, suitable for Models in Meters). */
15
+ offset?: number;
16
+
17
+ @IsNumber()
18
+ @IsOptional()
19
+ /** A number for the distance at which sensors close to walls should be removed. Note that this option has no effect unless the value is more than half of the dimension. */
20
+ wall_offset?: number;
21
+
22
+
23
+ constructor() {
24
+ super();
25
+ this.type = "RoomGridParameter";
26
+ this.offset = 1;
27
+ this.wall_offset = 0;
28
+ }
29
+
30
+
31
+ override init(_data?: any) {
32
+ super.init(_data);
33
+ if (_data) {
34
+ const obj = plainToClass(RoomGridParameter, _data);
35
+ this.type = obj.type;
36
+ this.offset = obj.offset;
37
+ this.wall_offset = obj.wall_offset;
38
+ }
39
+ }
40
+
41
+
42
+ static override fromJS(data: any): RoomGridParameter {
43
+ data = typeof data === 'object' ? data : {};
44
+
45
+ let result = new RoomGridParameter();
46
+ result.init(data);
47
+ return result;
48
+ }
49
+
50
+ override toJSON(data?: any) {
51
+ data = typeof data === 'object' ? data : {};
52
+ for (var property in this) {
53
+ if (this.hasOwnProperty(property))
54
+ data[property] = this[property];
55
+ }
56
+
57
+ data["type"] = this.type;
58
+ data["offset"] = this.offset;
59
+ data["wall_offset"] = this.wall_offset;
60
+ data = super.toJSON(data);
61
+ return instanceToPlain(data);
62
+ }
63
+
64
+ async validate(): Promise<boolean> {
65
+ const errors = await validate(this);
66
+ if (errors.length > 0){
67
+ const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; ');
68
+ throw new Error(`Validation failed: ${errorMessages}`);
69
+ }
70
+ return true;
71
+ }
72
+ }
@@ -0,0 +1,80 @@
1
+ import { IsInt, IsOptional, IsArray, IsNumber, IsString, Matches, validate, ValidationError as TsValidationError } from 'class-validator';
2
+ import { Type, plainToClass, instanceToPlain } from 'class-transformer';
3
+ import { Autocalculate } from "honeybee-schema";
4
+ import { RoomGridParameter } from "./RoomGridParameter";
5
+
6
+ /** Instructions for a SensorGrid of radial directions around positions from floors.\n\nThis type of sensor grid is particularly helpful for studies of multiple\nview directions, such as imageless glare studies. */
7
+ export class RoomRadialGridParameter extends RoomGridParameter {
8
+ @IsInt()
9
+ @IsOptional()
10
+ /** A positive integer for the number of radial directions to be generated around each position. */
11
+ dir_count?: number;
12
+
13
+ @IsArray()
14
+ @IsNumber({},{ each: true })
15
+ @IsOptional()
16
+ /** A vector as 3 (x, y, z) values to set the start direction of the generated directions. This can be used to orient the resulting sensors to specific parts of the scene. It can also change the elevation of the resulting directions since this start vector will always be rotated in the XY plane to generate the resulting directions. */
17
+ start_vector?: number [];
18
+
19
+ @IsOptional()
20
+ /** An optional number to override the radius of the meshes generated around each sensor. If Autocalculate, it will be equal to 45 percent of the grid dimension. */
21
+ mesh_radius?: (Autocalculate | number);
22
+
23
+ @IsString()
24
+ @IsOptional()
25
+ @Matches(/^RoomRadialGridParameter$/)
26
+ type?: string;
27
+
28
+
29
+ constructor() {
30
+ super();
31
+ this.dir_count = 8;
32
+ this.mesh_radius = new Autocalculate();
33
+ this.type = "RoomRadialGridParameter";
34
+ }
35
+
36
+
37
+ override init(_data?: any) {
38
+ super.init(_data);
39
+ if (_data) {
40
+ const obj = plainToClass(RoomRadialGridParameter, _data);
41
+ this.dir_count = obj.dir_count;
42
+ this.start_vector = obj.start_vector;
43
+ this.mesh_radius = obj.mesh_radius;
44
+ this.type = obj.type;
45
+ }
46
+ }
47
+
48
+
49
+ static override fromJS(data: any): RoomRadialGridParameter {
50
+ data = typeof data === 'object' ? data : {};
51
+
52
+ let result = new RoomRadialGridParameter();
53
+ result.init(data);
54
+ return result;
55
+ }
56
+
57
+ override toJSON(data?: any) {
58
+ data = typeof data === 'object' ? data : {};
59
+ for (var property in this) {
60
+ if (this.hasOwnProperty(property))
61
+ data[property] = this[property];
62
+ }
63
+
64
+ data["dir_count"] = this.dir_count;
65
+ data["start_vector"] = this.start_vector;
66
+ data["mesh_radius"] = this.mesh_radius;
67
+ data["type"] = this.type;
68
+ data = super.toJSON(data);
69
+ return instanceToPlain(data);
70
+ }
71
+
72
+ async validate(): Promise<boolean> {
73
+ const errors = await validate(this);
74
+ if (errors.length > 0){
75
+ const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; ');
76
+ throw new Error(`Validation failed: ${errorMessages}`);
77
+ }
78
+ return true;
79
+ }
80
+ }
@@ -0,0 +1,71 @@
1
+ import { IsNumber, IsDefined, IsString, IsOptional, Matches, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator';
2
+ import { Type, plainToClass, instanceToPlain } from 'class-transformer';
3
+ import { _WindowParameterBase } from "./_WindowParameterBase";
4
+
5
+ /** A single window defined by an absolute area. */
6
+ export class SimpleWindowArea extends _WindowParameterBase {
7
+ @IsNumber()
8
+ @IsDefined()
9
+ /** A number for the window area in current model units. If this area is larger than the area of the Wall that it is appliedto, the window will fill the parent Wall at a 99 percent ratio. */
10
+ window_area!: number;
11
+
12
+ @IsString()
13
+ @IsOptional()
14
+ @Matches(/^SimpleWindowArea$/)
15
+ type?: string;
16
+
17
+ @IsBoolean()
18
+ @IsOptional()
19
+ /** Boolean to note whether rectangular portions of base Face should be extracted before scaling them to create apertures. For pentagonal gabled geometries, this results in one rectangle and one triangle, which can often look more realistic and is a better input for engines like EnergyPlus that cannot model windows with more than 4 vertices. However, if a single pentagonal window is desired for such a gabled shape, this input can be set to False to produce such a result. */
20
+ rect_split?: boolean;
21
+
22
+
23
+ constructor() {
24
+ super();
25
+ this.type = "SimpleWindowArea";
26
+ this.rect_split = true;
27
+ }
28
+
29
+
30
+ override init(_data?: any) {
31
+ super.init(_data);
32
+ if (_data) {
33
+ const obj = plainToClass(SimpleWindowArea, _data);
34
+ this.window_area = obj.window_area;
35
+ this.type = obj.type;
36
+ this.rect_split = obj.rect_split;
37
+ }
38
+ }
39
+
40
+
41
+ static override fromJS(data: any): SimpleWindowArea {
42
+ data = typeof data === 'object' ? data : {};
43
+
44
+ let result = new SimpleWindowArea();
45
+ result.init(data);
46
+ return result;
47
+ }
48
+
49
+ override toJSON(data?: any) {
50
+ data = typeof data === 'object' ? data : {};
51
+ for (var property in this) {
52
+ if (this.hasOwnProperty(property))
53
+ data[property] = this[property];
54
+ }
55
+
56
+ data["window_area"] = this.window_area;
57
+ data["type"] = this.type;
58
+ data["rect_split"] = this.rect_split;
59
+ data = super.toJSON(data);
60
+ return instanceToPlain(data);
61
+ }
62
+
63
+ async validate(): Promise<boolean> {
64
+ const errors = await validate(this);
65
+ if (errors.length > 0){
66
+ const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; ');
67
+ throw new Error(`Validation failed: ${errorMessages}`);
68
+ }
69
+ return true;
70
+ }
71
+ }