designix 0.5.11 → 0.5.13

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 (238) hide show
  1. package/dist/index.d.ts +59 -0
  2. package/dist/index.js +5669 -0
  3. package/package.json +7 -1
  4. package/.eslintignore +0 -17
  5. package/.eslintrc.cjs +0 -24
  6. package/.prettierignore +0 -15
  7. package/.prettierrc +0 -8
  8. package/export_svg/base.svg +0 -1
  9. package/export_svg/base_cut.svg +0 -1
  10. package/export_svg/base_hollow.svg +0 -1
  11. package/export_svg/base_top.svg +0 -1
  12. package/export_svg/calculation_of_initAngle2.svg +0 -1
  13. package/export_svg/circles.svg +0 -1
  14. package/export_svg/circles_amplitude-offset.svg +0 -1
  15. package/export_svg/circles_amplitude-scale.svg +0 -1
  16. package/export_svg/circles_angle.svg +0 -1
  17. package/export_svg/default_param_blank.svg +0 -1
  18. package/export_svg/dummy_pole_static.svg +0 -1
  19. package/export_svg/dummy_pole_static_face.svg +0 -1
  20. package/export_svg/gear_addendeum_dedendum_sizes.svg +0 -9
  21. package/export_svg/gear_addendum_and_dedendum.svg +0 -1
  22. package/export_svg/gear_adherence_replaced_by_teeth.svg +0 -1
  23. package/export_svg/gear_base_circle_for_involute.svg +0 -2
  24. package/export_svg/gear_base_left_circle_for_involute.svg +0 -2
  25. package/export_svg/gear_base_right_circle_for_involute.svg +0 -2
  26. package/export_svg/gear_inter_axis_maximum_distance.svg +0 -1
  27. package/export_svg/gear_inter_axis_minimum_distance.svg +0 -1
  28. package/export_svg/gear_large_base_radius.svg +0 -5
  29. package/export_svg/gear_module_and_tooth_thickness.svg +0 -3
  30. package/export_svg/gear_optimum_base_radius.svg +0 -5
  31. package/export_svg/gear_optimum_base_radius_with_longer_inter_axis.svg +0 -5
  32. package/export_svg/gear_right_left_base_circles.svg +0 -1
  33. package/export_svg/gear_small_base_radius.svg +0 -5
  34. package/export_svg/gear_wheel_circles.svg +0 -2
  35. package/export_svg/gears.svg +0 -71
  36. package/export_svg/gears_motion_transmission_via_adherence.svg +0 -1
  37. package/export_svg/heliostat.svg +0 -1
  38. package/export_svg/heliostat2_face_sizing.svg +0 -1
  39. package/export_svg/heliostat2_side_sizing.svg +0 -1
  40. package/export_svg/heliostat_face_sizing.svg +0 -1
  41. package/export_svg/heliostat_overview.svg +0 -1
  42. package/export_svg/heliostat_side.svg +0 -1
  43. package/export_svg/heliostat_side_sizing.svg +0 -1
  44. package/export_svg/involute_of_circle.svg +0 -19
  45. package/export_svg/involute_of_circle_R0.svg +0 -1
  46. package/export_svg/involute_of_circle_Ri1_u0.svg +0 -1
  47. package/export_svg/involute_of_circle_Ri2_u2.svg +0 -1
  48. package/export_svg/left_side_angle_kitchen.svg +0 -1
  49. package/export_svg/negative_involute_of_circle_R0.svg +0 -1
  50. package/export_svg/point_c_position_and_speed_negative.svg +0 -1
  51. package/export_svg/point_c_position_and_speed_positive.svg +0 -1
  52. package/export_svg/pole_rotor.svg +0 -1
  53. package/export_svg/pole_rotor_cut.svg +0 -1
  54. package/export_svg/pole_rotor_ends.svg +0 -1
  55. package/export_svg/pole_stator.svg +0 -3
  56. package/export_svg/pole_stator_E2.svg +0 -3
  57. package/export_svg/pole_stator_bottom.svg +0 -1
  58. package/export_svg/pole_stator_cut.svg +0 -1
  59. package/export_svg/pole_stator_face.svg +0 -1
  60. package/export_svg/pole_stator_right.svg +0 -1
  61. package/export_svg/rake.svg +0 -1
  62. package/export_svg/rake_door.svg +0 -1
  63. package/export_svg/rake_face.svg +0 -1
  64. package/export_svg/rake_side.svg +0 -1
  65. package/export_svg/rake_side_stopper.svg +0 -1
  66. package/export_svg/rake_top.svg +0 -1
  67. package/export_svg/rake_top_stopper.svg +0 -1
  68. package/export_svg/rectangle.svg +0 -1
  69. package/export_svg/rectangle_height.svg +0 -1
  70. package/export_svg/rectangle_width.svg +0 -1
  71. package/export_svg/right_side_angle_kitchen.svg +0 -1
  72. package/export_svg/rod.svg +0 -1
  73. package/export_svg/rod_cut.svg +0 -1
  74. package/export_svg/rod_plate.svg +0 -1
  75. package/export_svg/rod_top.svg +0 -1
  76. package/export_svg/spider.svg +0 -1
  77. package/export_svg/spider_lateral.svg +0 -1
  78. package/export_svg/spider_profile.svg +0 -1
  79. package/export_svg/surface.svg +0 -3
  80. package/export_svg/surface_crenel.svg +0 -1
  81. package/export_svg/surface_extremities.svg +0 -2
  82. package/export_svg/surface_lz.svg +0 -1
  83. package/export_svg/surface_main.svg +0 -1
  84. package/export_svg/surface_power.svg +0 -2
  85. package/export_svg/surface_space_evolution.svg +0 -1
  86. package/export_svg/surface_space_shape.svg +0 -1
  87. package/export_svg/swing.svg +0 -1
  88. package/export_svg/swing_face.svg +0 -1
  89. package/export_svg/swing_side.svg +0 -1
  90. package/export_svg/swing_top.svg +0 -1
  91. package/export_svg/swing_with_rod.svg +0 -1
  92. package/export_svg/trapeze.svg +0 -1
  93. package/export_svg/trapeze_rod.svg +0 -1
  94. package/export_svg/trapeze_side.svg +0 -1
  95. package/export_svg/trapeze_top.svg +0 -1
  96. package/export_svg/verify_contour_1.svg +0 -1
  97. package/export_svg/verify_contour_1_l1.svg +0 -1
  98. package/export_svg/verify_contour_1_r1.svg +0 -1
  99. package/export_svg/verify_line.svg +0 -1
  100. package/export_svg/verify_line_2_l1cx.svg +0 -1
  101. package/export_svg/verify_line_p1x.svg +0 -1
  102. package/export_svg/verify_point.svg +0 -1
  103. package/export_svg/verify_point_p1x.svg +0 -1
  104. package/export_svg/verify_vector_p1x.svg +0 -1
  105. package/src/dummy/circles.ts +0 -65
  106. package/src/dummy/pole_static.ts +0 -86
  107. package/src/dummy/rectangle.ts +0 -55
  108. package/src/dummy/svg/circles.svg +0 -288
  109. package/src/dummy/svg/circles_amplitude-offset.svg +0 -109
  110. package/src/dummy/svg/circles_amplitude-scale.svg +0 -122
  111. package/src/dummy/svg/circles_angle.svg +0 -110
  112. package/src/dummy/svg/dummy_pole_static.svg +0 -192
  113. package/src/dummy/svg/dummy_pole_static_face.svg +0 -176
  114. package/src/dummy/svg/rectangle.svg +0 -131
  115. package/src/dummy/svg/rectangle_height.svg +0 -82
  116. package/src/dummy/svg/rectangle_width.svg +0 -81
  117. package/src/gears/gearWheelProfile.test.ts +0 -25
  118. package/src/gears/gearWheelProfile.ts +0 -753
  119. package/src/gears/gear_wheel_wheel.ts +0 -335
  120. package/src/gears/involute.test.ts +0 -21
  121. package/src/gears/involute.ts +0 -113
  122. package/src/gears/simplified_gear_wheel.ts +0 -242
  123. package/src/gears/svg/calculation_of_initAngle2.svg +0 -376
  124. package/src/gears/svg/gear_addendeum_dedendum_sizes.svg +0 -471
  125. package/src/gears/svg/gear_addendum_and_dedendum.svg +0 -269
  126. package/src/gears/svg/gear_adherence_replaced_by_teeth.svg +0 -168
  127. package/src/gears/svg/gear_base_circle_for_involute.svg +0 -376
  128. package/src/gears/svg/gear_base_left_circle_for_involute.svg +0 -556
  129. package/src/gears/svg/gear_base_right_circle_for_involute.svg +0 -516
  130. package/src/gears/svg/gear_inter_axis_maximum_distance.svg +0 -218
  131. package/src/gears/svg/gear_inter_axis_minimum_distance.svg +0 -218
  132. package/src/gears/svg/gear_large_base_radius.svg +0 -199
  133. package/src/gears/svg/gear_module_and_tooth_thickness.svg +0 -319
  134. package/src/gears/svg/gear_optimum_base_radius.svg +0 -232
  135. package/src/gears/svg/gear_optimum_base_radius_with_longer_inter_axis.svg +0 -344
  136. package/src/gears/svg/gear_right_left_base_circles.svg +0 -295
  137. package/src/gears/svg/gear_small_base_radius.svg +0 -163
  138. package/src/gears/svg/gear_wheel_circles.svg +0 -348
  139. package/src/gears/svg/gears.svg +0 -4726
  140. package/src/gears/svg/gears_motion_transmission_via_adherence.svg +0 -178
  141. package/src/gears/svg/involute_of_circle.svg +0 -2745
  142. package/src/gears/svg/involute_of_circle_R0.svg +0 -334
  143. package/src/gears/svg/involute_of_circle_Ri1_u0.svg +0 -297
  144. package/src/gears/svg/involute_of_circle_Ri2_u2.svg +0 -386
  145. package/src/gears/svg/left_side_angle_kitchen.svg +0 -207
  146. package/src/gears/svg/negative_involute_of_circle_R0.svg +0 -381
  147. package/src/gears/svg/point_c_position_and_speed_negative.svg +0 -343
  148. package/src/gears/svg/point_c_position_and_speed_positive.svg +0 -339
  149. package/src/gears/svg/right_side_angle_kitchen.svg +0 -201
  150. package/src/gears/wheelElements.test.ts +0 -13
  151. package/src/gears/wheelElements.ts +0 -176
  152. package/src/geometrix_verification/svg/verify_contour_1.svg +0 -320
  153. package/src/geometrix_verification/svg/verify_contour_1_l1.svg +0 -102
  154. package/src/geometrix_verification/svg/verify_contour_1_r1.svg +0 -170
  155. package/src/geometrix_verification/svg/verify_line.svg +0 -845
  156. package/src/geometrix_verification/svg/verify_line_2_l1cx.svg +0 -274
  157. package/src/geometrix_verification/svg/verify_line_p1x.svg +0 -261
  158. package/src/geometrix_verification/svg/verify_point.svg +0 -350
  159. package/src/geometrix_verification/svg/verify_point_p1x.svg +0 -258
  160. package/src/geometrix_verification/svg/verify_vector_p1x.svg +0 -282
  161. package/src/geometrix_verification/verify_contour_1.ts +0 -94
  162. package/src/geometrix_verification/verify_contour_2.ts +0 -267
  163. package/src/geometrix_verification/verify_contour_3.ts +0 -409
  164. package/src/geometrix_verification/verify_contour_4.ts +0 -91
  165. package/src/geometrix_verification/verify_exports_1.ts +0 -95
  166. package/src/geometrix_verification/verify_line.ts +0 -76
  167. package/src/geometrix_verification/verify_line_2.ts +0 -76
  168. package/src/geometrix_verification/verify_line_3.ts +0 -64
  169. package/src/geometrix_verification/verify_point.ts +0 -62
  170. package/src/geometrix_verification/verify_point_2.ts +0 -66
  171. package/src/geometrix_verification/verify_vector.ts +0 -70
  172. package/src/heliostat/base.ts +0 -254
  173. package/src/heliostat/heliostat.ts +0 -317
  174. package/src/heliostat/heliostat_2.ts +0 -284
  175. package/src/heliostat/pole_rotor.ts +0 -165
  176. package/src/heliostat/pole_static.ts +0 -275
  177. package/src/heliostat/rake.ts +0 -486
  178. package/src/heliostat/rake_stopper.ts +0 -409
  179. package/src/heliostat/rod.ts +0 -200
  180. package/src/heliostat/spider.ts +0 -238
  181. package/src/heliostat/surface.ts +0 -320
  182. package/src/heliostat/svg/base.svg +0 -1367
  183. package/src/heliostat/svg/base_cut.svg +0 -459
  184. package/src/heliostat/svg/base_hollow.svg +0 -469
  185. package/src/heliostat/svg/base_top.svg +0 -338
  186. package/src/heliostat/svg/heliostat.svg +0 -8013
  187. package/src/heliostat/svg/heliostat2_face_sizing.svg +0 -1386
  188. package/src/heliostat/svg/heliostat2_side_sizing.svg +0 -984
  189. package/src/heliostat/svg/heliostat_face_sizing.svg +0 -1448
  190. package/src/heliostat/svg/heliostat_overview.svg +0 -1552
  191. package/src/heliostat/svg/heliostat_side.svg +0 -1470
  192. package/src/heliostat/svg/heliostat_side_sizing.svg +0 -1128
  193. package/src/heliostat/svg/pole_rotor.svg +0 -592
  194. package/src/heliostat/svg/pole_rotor_cut.svg +0 -287
  195. package/src/heliostat/svg/pole_rotor_ends.svg +0 -336
  196. package/src/heliostat/svg/pole_stator.svg +0 -1945
  197. package/src/heliostat/svg/pole_stator_E2.svg +0 -410
  198. package/src/heliostat/svg/pole_stator_bottom.svg +0 -330
  199. package/src/heliostat/svg/pole_stator_cut.svg +0 -465
  200. package/src/heliostat/svg/pole_stator_face.svg +0 -457
  201. package/src/heliostat/svg/pole_stator_right.svg +0 -357
  202. package/src/heliostat/svg/rake.svg +0 -4691
  203. package/src/heliostat/svg/rake_door.svg +0 -617
  204. package/src/heliostat/svg/rake_face.svg +0 -1211
  205. package/src/heliostat/svg/rake_side.svg +0 -809
  206. package/src/heliostat/svg/rake_side_stopper.svg +0 -596
  207. package/src/heliostat/svg/rake_top.svg +0 -514
  208. package/src/heliostat/svg/rake_top_stopper.svg +0 -565
  209. package/src/heliostat/svg/rod.svg +0 -1314
  210. package/src/heliostat/svg/rod_cut.svg +0 -265
  211. package/src/heliostat/svg/rod_plate.svg +0 -409
  212. package/src/heliostat/svg/rod_top.svg +0 -577
  213. package/src/heliostat/svg/spider.svg +0 -693
  214. package/src/heliostat/svg/spider_lateral.svg +0 -222
  215. package/src/heliostat/svg/spider_profile.svg +0 -429
  216. package/src/heliostat/svg/surface.svg +0 -3577
  217. package/src/heliostat/svg/surface_crenel.svg +0 -1335
  218. package/src/heliostat/svg/surface_extremities.svg +0 -510
  219. package/src/heliostat/svg/surface_lz.svg +0 -182
  220. package/src/heliostat/svg/surface_main.svg +0 -366
  221. package/src/heliostat/svg/surface_power.svg +0 -331
  222. package/src/heliostat/svg/surface_space_evolution.svg +0 -210
  223. package/src/heliostat/svg/surface_space_shape.svg +0 -98
  224. package/src/heliostat/svg/swing.svg +0 -3310
  225. package/src/heliostat/svg/swing_face.svg +0 -902
  226. package/src/heliostat/svg/swing_side.svg +0 -574
  227. package/src/heliostat/svg/swing_top.svg +0 -923
  228. package/src/heliostat/svg/swing_with_rod.svg +0 -547
  229. package/src/heliostat/svg/trapeze.svg +0 -1711
  230. package/src/heliostat/svg/trapeze_rod.svg +0 -122
  231. package/src/heliostat/svg/trapeze_side.svg +0 -361
  232. package/src/heliostat/svg/trapeze_top.svg +0 -1057
  233. package/src/heliostat/swing.ts +0 -246
  234. package/src/heliostat/trapeze.ts +0 -510
  235. package/src/index.ts +0 -33
  236. package/src/svg/default_param_blank.svg +0 -40
  237. package/tsconfig.json +0 -13
  238. package/vitest.config.ts +0 -7
@@ -1,238 +0,0 @@
1
- // spider.ts
2
-
3
- import type {
4
- tContour,
5
- tParamDef,
6
- tParamVal,
7
- tGeom,
8
- tExtrude,
9
- tPageDef
10
- //tSubInst
11
- //tSubDesign
12
- } from 'geometrix';
13
- import {
14
- contour,
15
- contourCircle,
16
- figure,
17
- //degToRad,
18
- radToDeg,
19
- ffix,
20
- pNumber,
21
- //pCheckbox,
22
- //pDropdown,
23
- initGeom,
24
- EExtrude,
25
- EBVolume
26
- } from 'geometrix';
27
-
28
- const pDef: tParamDef = {
29
- partName: 'spider',
30
- params: [
31
- //pNumber(name, unit, init, min, max, step)
32
- pNumber('D1', 'mm', 100, 10, 400, 1),
33
- pNumber('L1', 'mm', 400, 100, 1000, 10),
34
- pNumber('L2', 'mm', 400, 100, 1000, 10),
35
- pNumber('L3', 'mm', 100, 10, 400, 1),
36
- pNumber('L4', 'mm', 3000, 500, 8000, 10),
37
- pNumber('L5', 'mm', 2000, 100, 8000, 10),
38
- pNumber('L6', 'mm', 30, 1, 100, 1),
39
- pNumber('E1', 'mm', 3, 1, 80, 1),
40
- pNumber('E2', 'mm', 50, 1, 200, 1),
41
- pNumber('E3', 'mm', 3, 1, 80, 1),
42
- pNumber('R2', 'mm', 100, 0, 400, 10),
43
- pNumber('N1', '', 6, 1, 20, 1)
44
- ],
45
- paramSvg: {
46
- D1: 'spider_profile.svg',
47
- L1: 'spider_profile.svg',
48
- L2: 'spider_profile.svg',
49
- L3: 'spider_profile.svg',
50
- L4: 'spider_profile.svg',
51
- L5: 'spider_lateral.svg',
52
- L6: 'spider_lateral.svg',
53
- E1: 'spider_profile.svg',
54
- E2: 'spider_profile.svg',
55
- E3: 'spider_profile.svg',
56
- R2: 'spider_profile.svg',
57
- N1: 'spider_lateral.svg'
58
- },
59
- sim: {
60
- tMax: 360,
61
- tStep: 0.5,
62
- tUpdate: 500 // every 0.5 second
63
- }
64
- };
65
-
66
- type tCtr1 = (sx: number, sy: number, sl: number) => tContour;
67
- type tCtr2 = (width: number, height: number, xpos: number, ypos: number) => tContour;
68
-
69
- function pGeom(t: number, param: tParamVal): tGeom {
70
- let ctrSquare: tCtr1;
71
- let ctrRect: tCtr2;
72
- const rGeome = initGeom(pDef.partName);
73
- const figLegs = figure();
74
- const figTube = figure();
75
- const figBody = figure();
76
- rGeome.logstr += `${rGeome.partName} simTime: ${t}\n`;
77
- try {
78
- const R1 = param.D1 / 2;
79
- if (param.D1 < param.E2) {
80
- throw `err476: D1 ${param.D1} smaller then E2 ${param.E2}`;
81
- }
82
- const legE2 = param.E2 / 2;
83
- const legStartY = Math.sqrt(R1 ** 2 - legE2 ** 2);
84
- const legL2 = param.L1 + param.L2 * Math.sqrt(2);
85
- const legL3 = param.L2 + param.L1 * Math.sqrt(2);
86
- const legL4 = param.L4 - legL3;
87
- if (legL4 < param.R2) {
88
- throw `err984: L4 ${param.L4} too small compare to R2 ${param.R2}`;
89
- }
90
- const legL4x = legL4 * Math.cos(Math.PI / 4);
91
- const legL4y = legL4 * Math.sin(Math.PI / 4);
92
- const E2x = param.E2 * Math.cos(Math.PI / 4);
93
- const E2y = param.E2 * Math.sin(Math.PI / 4);
94
- const elbowx = param.E2 * Math.tan(Math.PI / 8);
95
- if (R1 < param.E1) {
96
- throw `err092: D1 ${param.D1} too small compare to E1 ${param.E1}`;
97
- }
98
- if (param.L3 < param.E2) {
99
- throw `err994: L3 ${param.L3} smaller than E2 ${param.E2}`;
100
- }
101
- if (param.L3 < 2 * param.E3) {
102
- throw `err997: L3 ${param.L3} too small compare to E3 ${param.E3}`;
103
- }
104
- const squareD = ((param.L3 - param.E2) / 2) * Math.cos(Math.PI / 4);
105
- const squareX = legL2 + legL4x + squareD;
106
- const squareY = -param.L1 - legL4y + squareD;
107
- const squareY2 = squareY - param.E3 * Math.sqrt(2);
108
- if (param.L5 < param.N1 * param.L6) {
109
- throw `err110: L5 ${param.L5} too small compare to N1 ${param.N1} and L6 ${param.L6}`;
110
- }
111
- let legStep = 1;
112
- if (param.N1 > 1) {
113
- legStep = (param.L5 - param.L6) / (param.N1 - 1);
114
- }
115
- const legPos = [...Array(param.N1).keys()].map((i) => i * legStep);
116
- ctrSquare = function (sx: number, sy: number, sl: number): tContour {
117
- const rCtr = contour(sx, sy)
118
- .addSegStrokeA(sx + sl * Math.cos(Math.PI / 4), sy - sl * Math.sin(Math.PI / 4))
119
- .addSegStrokeA(sx, sy - 2 * sl * Math.sin(Math.PI / 4))
120
- .addSegStrokeA(sx - sl * Math.cos(Math.PI / 4), sy - sl * Math.sin(Math.PI / 4))
121
- .closeSegStroke();
122
- return rCtr;
123
- };
124
- ctrRect = function (width: number, height: number, xpos: number, ypos: number): tContour {
125
- const rCtr = contour(xpos, ypos)
126
- .addSegStrokeA(xpos + width, ypos)
127
- .addSegStrokeA(xpos + width, ypos + height)
128
- .addSegStrokeA(xpos, ypos + height)
129
- .closeSegStroke();
130
- return rCtr;
131
- };
132
- const posAngle = (Math.sin((2 * Math.PI * t) / pDef.sim.tMax) * Math.PI) / 2;
133
- rGeome.logstr += `spide leg number: ${param.N1}\n`;
134
- rGeome.logstr += `spide position angle: ${ffix(radToDeg(posAngle))} degree\n`;
135
- // figLegs
136
- const ctrLeg = contour(legE2, -legStartY)
137
- .addCornerRounded(param.R2)
138
- .addSegStrokeA(legE2, -param.L1)
139
- .addCornerRounded(param.R2)
140
- .addSegStrokeA(legL2, -param.L1)
141
- .addCornerRounded(param.R2 + param.E2)
142
- .addSegStrokeA(legL2 + legL4x, -param.L1 - legL4y)
143
- .addSegStrokeA(legL2 + legL4x - E2x, -param.L1 - legL4y - E2y)
144
- .addSegStrokeA(legL2 - elbowx, -param.L1 - param.E2)
145
- .addCornerRounded(param.R2)
146
- .addSegStrokeA(-legL2 + elbowx, -param.L1 - param.E2)
147
- .addCornerRounded(param.R2)
148
- .addSegStrokeA(-legL2 - legL4x + E2x, -param.L1 - legL4y - E2y)
149
- .addSegStrokeA(-legL2 - legL4x, -param.L1 - legL4y)
150
- .addSegStrokeA(-legL2, -param.L1)
151
- .addCornerRounded(param.R2 + param.E2)
152
- .addSegStrokeA(-legE2, -param.L1)
153
- .addCornerRounded(param.R2)
154
- .addSegStrokeA(-legE2, -legStartY)
155
- .addCornerRounded(param.R2)
156
- .closeSegArc(R1, true, false);
157
- figLegs.addMain(ctrLeg);
158
- figLegs.addMain(contourCircle(0, 0, R1 - param.E1));
159
- figLegs.addSecond(ctrSquare(squareX, squareY, param.L3));
160
- figLegs.addSecond(ctrSquare(squareX, squareY2, param.L3 - 2 * param.E3));
161
- figLegs.addSecond(ctrSquare(-squareX, squareY, param.L3));
162
- figLegs.addSecond(ctrSquare(-squareX, squareY2, param.L3 - 2 * param.E3));
163
- // figTube
164
- figTube.addMain(contourCircle(0, 0, R1));
165
- figTube.addMain(contourCircle(0, 0, R1 - param.E1));
166
- figTube.addMain(ctrSquare(squareX, squareY, param.L3));
167
- figTube.addMain(ctrSquare(squareX, squareY2, param.L3 - 2 * param.E3));
168
- figTube.addMain(ctrSquare(-squareX, squareY, param.L3));
169
- figTube.addMain(ctrSquare(-squareX, squareY2, param.L3 - 2 * param.E3));
170
- figTube.addSecond(ctrLeg);
171
- // figBody
172
- figBody.addSecond(ctrRect(param.L5, param.D1, 0, -param.D1 / 2));
173
- figBody.addSecond(ctrRect(param.L5, param.L3, 0, -param.L4 - param.L3));
174
- for (const posx of legPos) {
175
- figBody.addSecond(ctrRect(param.L6, param.L4, posx, -param.L4));
176
- }
177
- // final figure list
178
- rGeome.fig = {
179
- faceLegs: figLegs.rotate(0, 0, posAngle),
180
- faceTube: figTube.rotate(0, 0, posAngle),
181
- faceBody: figBody
182
- };
183
- const designName = rGeome.partName;
184
- const preExtrude = legPos.map((posX, idx) => {
185
- const rElem: tExtrude = {
186
- outName: `subpax_${designName}_leg_${idx}`,
187
- face: `${designName}_faceLegs`,
188
- extrudeMethod: EExtrude.eLinearOrtho,
189
- length: param.L6,
190
- rotate: [0, 0, 0],
191
- translate: [0, 0, posX]
192
- };
193
- return rElem;
194
- });
195
- const legList = legPos.map((elem, idx) => {
196
- const subElem = `subpax_${designName}_leg_${idx}`;
197
- return subElem;
198
- });
199
- rGeome.vol = {
200
- extrudes: [
201
- {
202
- outName: `subpax_${designName}_tube`,
203
- face: `${designName}_faceTube`,
204
- extrudeMethod: EExtrude.eLinearOrtho,
205
- length: param.L5,
206
- rotate: [0, 0, 0],
207
- translate: [0, 0, 0]
208
- },
209
- ...preExtrude
210
- ],
211
- volumes: [
212
- {
213
- outName: `pax_${designName}`,
214
- boolMethod: EBVolume.eUnion,
215
- inList: [`subpax_${designName}_tube`, ...legList]
216
- }
217
- ]
218
- };
219
- // sub-design
220
- rGeome.sub = {};
221
- // finalize
222
- rGeome.logstr += 'heliostat-spider draw successfully!\n';
223
- rGeome.calcErr = false;
224
- } catch (emsg) {
225
- rGeome.logstr += emsg as string;
226
- console.log(emsg as string);
227
- }
228
- return rGeome;
229
- }
230
-
231
- const spiderDef: tPageDef = {
232
- pTitle: 'Heliostat spider',
233
- pDescription: 'The spider part for the control of the inclination of the heliostat',
234
- pDef: pDef,
235
- pGeom: pGeom
236
- };
237
-
238
- export { spiderDef };
@@ -1,320 +0,0 @@
1
- // surface.ts
2
-
3
- import type {
4
- tContour,
5
- tParamDef,
6
- tParamVal,
7
- tGeom,
8
- tExtrude,
9
- tPageDef
10
- //tSubInst
11
- //tSubDesign
12
- } from 'geometrix';
13
- import {
14
- contour,
15
- //contourCircle,
16
- figure,
17
- //degToRad,
18
- //radToDeg,
19
- ffix,
20
- pNumber,
21
- pCheckbox,
22
- pDropdown,
23
- initGeom,
24
- EExtrude,
25
- EBVolume
26
- } from 'geometrix';
27
-
28
- const pDef: tParamDef = {
29
- partName: 'surface',
30
- params: [
31
- //pNumber(name, unit, init, min, max, step)
32
- pNumber('LH', 'mm', 1600, 100, 4000, 1),
33
- pNumber('LV', 'mm', 1000, 100, 4000, 1),
34
- pNumber('LZ', 'mm', 40, 0, 100, 1),
35
- pNumber('nx', '', 9, 1, 40, 1),
36
- pNumber('ny', '', 9, 1, 40, 1),
37
- pDropdown('main_direction', ['horizontal', 'vertical']),
38
- pCheckbox('crenel', false),
39
- pNumber('first_row', '', 9, 1, 40, 1),
40
- pNumber('second_row', '', 9, 1, 40, 1),
41
- pNumber('EH', 'mm', 10, 0, 1000, 1),
42
- pCheckbox('EH_gradient', false),
43
- pNumber('EH_sup', 'mm', 500, 0, 1000, 1),
44
- pNumber('EH_cycle', '', 1, 0, 3, 0.05),
45
- pNumber('EH_start', '', 0, 0, 1, 0.05),
46
- pDropdown('EH_shape', ['sinusoid', 'triangle', 'sawUp', 'sawDown']),
47
- pNumber('EV', 'mm', 10, 0, 1000, 1),
48
- pCheckbox('EV_gradient', false),
49
- pNumber('EV_sup', 'mm', 500, 0, 1000, 1),
50
- pNumber('EV_cycle', '', 1, 0, 3, 0.05),
51
- pNumber('EV_start', '', 0, 0, 1, 0.05),
52
- pDropdown('EV_shape', ['sinusoid', 'triangle', 'sawUp', 'sawDown']),
53
- pNumber('power_efficiency', '%', 16, 0, 100, 0.1),
54
- pNumber('solar_power', 'W/m2', 816, 100, 2000, 1) // 1361*0.6=816 W/m2
55
- ],
56
- paramSvg: {
57
- LH: 'surface_main.svg',
58
- LV: 'surface_main.svg',
59
- LZ: 'surface_lz.svg',
60
- nx: 'surface_main.svg',
61
- ny: 'surface_main.svg',
62
- main_direction: 'surface_crenel.svg',
63
- crenel: 'surface_crenel.svg',
64
- first_row: 'surface_extremities.svg',
65
- second_row: 'surface_extremities.svg',
66
- EH: 'surface_main.svg',
67
- EH_gradient: 'surface_space_evolution.svg',
68
- EH_sup: 'surface_space_evolution.svg',
69
- EH_cycle: 'surface_space_evolution.svg',
70
- EH_start: 'surface_space_evolution.svg',
71
- EH_shape: 'surface_space_shape.svg',
72
- EV: 'surface_main.svg',
73
- EV_gradient: 'surface_space_evolution.svg',
74
- EV_sup: 'surface_space_evolution.svg',
75
- EV_cycle: 'surface_space_evolution.svg',
76
- EV_start: 'surface_space_evolution.svg',
77
- EV_shape: 'surface_space_shape.svg',
78
- power_efficiency: 'surface_power.svg',
79
- solar_power: 'surface_power.svg'
80
- },
81
- sim: {
82
- tMax: 180,
83
- tStep: 0.5,
84
- tUpdate: 500 // every 0.5 second
85
- }
86
- };
87
-
88
- // (px, py) coordinates of bottom-left of the panel in mm
89
- type tCtr1 = (px: number, py: number) => tContour;
90
- type tPositions = [number, number][];
91
-
92
- function pGeom(t: number, param: tParamVal): tGeom {
93
- let ctrPanelProfile: tCtr1;
94
- const rGeome = initGeom(pDef.partName);
95
- const figSurface = figure();
96
- const figOnePanel = figure();
97
- rGeome.logstr += `${rGeome.partName} simTime: ${t}\n`;
98
- try {
99
- const panel_surface = (param.LH * param.LV) / 10 ** 6;
100
- const panel_power = (param.solar_power * panel_surface * param.power_efficiency) / 100;
101
- rGeome.logstr += `panel surface: ${ffix(panel_surface)} m2\n`;
102
- rGeome.logstr += `panel power: ${ffix(panel_power)} W\n`;
103
- const max_panel_nb = param.nx * param.ny;
104
- rGeome.logstr += `max panel number: ${max_panel_nb}\n`;
105
- rGeome.logstr += `max panel surface: ${ffix(max_panel_nb * panel_surface)} m2\n`;
106
- rGeome.logstr += `max panel power: ${ffix(max_panel_nb * panel_power)} W\n`;
107
- const lenMain = param.main_direction === 1 ? param.ny : param.nx;
108
- const lenLateral = param.main_direction === 1 ? param.nx : param.ny;
109
- const EMain = param.main_direction === 1 ? param.EV : param.EH;
110
- const EMainGradient = param.main_direction === 1 ? param.EV_gradient : param.EH_gradient;
111
- const EMainSup = param.main_direction === 1 ? param.EV_sup : param.EH_sup;
112
- const EMainCycle = param.main_direction === 1 ? param.EV_cycle : param.EH_cycle;
113
- const EMainStart = param.main_direction === 1 ? param.EV_start : param.EH_start;
114
- const EMainShape = param.main_direction === 1 ? param.EV_shape : param.EH_shape;
115
- const ELateral = param.main_direction === 0 ? param.EV : param.EH;
116
- const ELateralGradient = param.main_direction === 0 ? param.EV_gradient : param.EH_gradient;
117
- const ELateralSup = param.main_direction === 0 ? param.EV_sup : param.EH_sup;
118
- const ELateralCycle = param.main_direction === 0 ? param.EV_cycle : param.EH_cycle;
119
- const ELateralStart = param.main_direction === 0 ? param.EV_start : param.EH_start;
120
- const ELateralShape = param.main_direction === 0 ? param.EV_shape : param.EH_shape;
121
- const lenRow: number[] = [];
122
- for (let i = 0; i < lenMain; i++) {
123
- const iEven = (i + 1) % 2; // 0 or 1
124
- const elemNb = param.crenel ? lenLateral - iEven : lenLateral;
125
- lenRow.push(elemNb);
126
- }
127
- lenRow[0] = param.first_row;
128
- lenRow[lenRow.length - 1] = param.first_row;
129
- if (lenMain > 2) {
130
- lenRow[1] = param.second_row;
131
- lenRow[lenRow.length - 2] = param.second_row;
132
- }
133
- let panelNb = 0;
134
- lenRow.forEach((oneRow) => {
135
- panelNb += oneRow;
136
- });
137
- rGeome.logstr += `actual panel number: ${panelNb} (${ffix(
138
- (100 * panelNb) / max_panel_nb
139
- )} %)\n`;
140
- rGeome.logstr += `actual panel surface: ${ffix(panelNb * panel_surface)} m2\n`;
141
- rGeome.logstr += `actual panel power: ${ffix(panelNb * panel_power)} W\n`;
142
- const eMain: number[] = [];
143
- for (let i = 0; i < lenMain - 1; i++) {
144
- let eSpace = EMain;
145
- if (EMainGradient === 1) {
146
- const gapNb = lenMain > 2 ? lenMain - 2 : 1; // -2 to get a complete cycle
147
- const phase = (EMainStart + (i * EMainCycle) / gapNb) % 1;
148
- switch (EMainShape) {
149
- case 0: // sinusoid
150
- eSpace += (EMainSup * (1 - Math.cos(phase * 2 * Math.PI))) / 2;
151
- break;
152
- case 1: // triangle
153
- eSpace += EMainSup * (1 - 2 * Math.abs(phase - 0.5));
154
- break;
155
- case 2: // sawUp
156
- eSpace += EMainSup * phase;
157
- break;
158
- case 3: // sawDown
159
- eSpace += EMainSup * (1 - phase);
160
- break;
161
- default:
162
- eSpace += EMainSup;
163
- }
164
- }
165
- eMain.push(eSpace);
166
- }
167
- let eMainTotal = 0;
168
- const eMainCumul: number[] = [];
169
- eMainCumul.push(0);
170
- eMain.forEach((eSpace) => {
171
- eMainTotal += eSpace;
172
- eMainCumul.push(eMainTotal);
173
- });
174
- const eLateral: number[] = [];
175
- for (let i = 0; i < lenLateral - 1; i++) {
176
- let eSpace = ELateral;
177
- if (ELateralGradient === 1) {
178
- const gapNb = lenLateral > 2 ? lenLateral - 2 : 1; // -2 to get a complete cycle
179
- const phase = (ELateralStart + (i * ELateralCycle) / gapNb) % 1;
180
- switch (ELateralShape) {
181
- case 0: // sinusoid
182
- eSpace += (ELateralSup * (1 - Math.cos(phase * 2 * Math.PI))) / 2;
183
- break;
184
- case 1: // triangle
185
- eSpace += ELateralSup * (1 - 2 * Math.abs(phase - 0.5));
186
- break;
187
- case 2: // sawUp
188
- eSpace += ELateralSup * phase;
189
- break;
190
- case 3: // sawDown
191
- eSpace += ELateralSup * (1 - phase);
192
- break;
193
- default:
194
- eSpace += ELateralSup;
195
- }
196
- }
197
- eLateral.push(eSpace);
198
- }
199
- let eLateralTotal = 0;
200
- const eLateralCumul: number[] = [];
201
- eLateralCumul.push(0);
202
- eLateral.forEach((eSpace) => {
203
- eLateralTotal += eSpace;
204
- eLateralCumul.push(eLateralTotal);
205
- });
206
- let gLenHorizontal = 0; // mm
207
- let gLenVertical = 0; // mm
208
- if (param.main_direction === 0) {
209
- // horizontal
210
- gLenHorizontal = lenMain * param.LH + eMainTotal;
211
- gLenVertical = lenLateral * param.LV + eLateralTotal;
212
- } else {
213
- // vertical
214
- gLenHorizontal = lenLateral * param.LH + eLateralTotal;
215
- gLenVertical = lenMain * param.LV + eMainTotal;
216
- }
217
- const gArea = (gLenHorizontal * gLenVertical) / 10 ** 6; // m2
218
- rGeome.logstr += `global horizontal width: ${ffix(gLenHorizontal / 1000)} m\n`;
219
- rGeome.logstr += `global vertical height: ${ffix(gLenVertical / 1000)} m\n`;
220
- rGeome.logstr += `global area: ${ffix(gArea)} m2\n`;
221
- rGeome.logstr += `area efficiency: ${ffix((100 * panelNb * panel_surface) / gArea)} %\n`;
222
- const ox = -gLenHorizontal / 2;
223
- const oy = -gLenVertical / 2;
224
- ctrPanelProfile = function (px: number, py: number): tContour {
225
- const rPanelProfile = contour(px, py)
226
- .addSegStrokeA(px + param.LH, py)
227
- .addSegStrokeA(px + param.LH, py + param.LV)
228
- .addSegStrokeA(px, py + param.LV)
229
- .closeSegStroke();
230
- return rPanelProfile;
231
- };
232
- // figSurface
233
- const panelPositions: tPositions = [];
234
- lenRow.forEach((oneRow, rowIdx) => {
235
- const half = (lenLateral - oneRow) % 2;
236
- const offset = Math.floor((lenLateral - oneRow) / 2);
237
- for (let pIdx = 0; pIdx < oneRow; pIdx++) {
238
- let dx = 0;
239
- let dy = 0;
240
- if (param.main_direction === 0) {
241
- // horizontal
242
- dx = ox + rowIdx * param.LH + eMainCumul[rowIdx];
243
- dy = oy + (offset + pIdx) * param.LV + eLateralCumul[offset + pIdx];
244
- if (half === 1) {
245
- dy +=
246
- (param.LV +
247
- eLateralCumul[offset + pIdx + 1] -
248
- eLateralCumul[offset + pIdx]) /
249
- 2;
250
- }
251
- } else {
252
- // vertical
253
- dy = oy + rowIdx * param.LV + eMainCumul[rowIdx];
254
- dx = ox + (offset + pIdx) * param.LH + eLateralCumul[offset + pIdx];
255
- if (half === 1) {
256
- dx +=
257
- (param.LH +
258
- eLateralCumul[offset + pIdx + 1] -
259
- eLateralCumul[offset + pIdx]) /
260
- 2;
261
- }
262
- }
263
- panelPositions.push([dx, dy]);
264
- }
265
- });
266
- for (const pos of panelPositions) {
267
- figSurface.addMain(ctrPanelProfile(pos[0], pos[1]));
268
- }
269
- // figOnePanel
270
- figOnePanel.addMain(ctrPanelProfile(0, 0));
271
- // final figure list
272
- rGeome.fig = {
273
- faceSurface: figSurface,
274
- faceOnePanel: figOnePanel
275
- };
276
- const designName = rGeome.partName;
277
- rGeome.vol = {
278
- extrudes: panelPositions.map((elem, idx) => {
279
- const rElem: tExtrude = {
280
- outName: `subpax_${designName}_panel_${idx}`,
281
- face: `${designName}_faceOnePanel`,
282
- extrudeMethod: EExtrude.eLinearOrtho,
283
- length: param.LZ,
284
- rotate: [0, 0, 0],
285
- translate: [elem[0], elem[1], 0]
286
- };
287
- return rElem;
288
- }),
289
- volumes: [
290
- {
291
- outName: `pax_${designName}`,
292
- //boolMethod: EBVolume.eIdentity,
293
- boolMethod: EBVolume.eUnion,
294
- inList: panelPositions.map((elem, idx) => {
295
- const subElem = `subpax_${designName}_panel_${idx}`;
296
- return subElem;
297
- })
298
- }
299
- ]
300
- };
301
- // sub-design
302
- rGeome.sub = {};
303
- // finalize
304
- rGeome.logstr += 'panel-surface draw successfully!\n';
305
- rGeome.calcErr = false;
306
- } catch (emsg) {
307
- rGeome.logstr += emsg as string;
308
- console.log(emsg as string);
309
- }
310
- return rGeome;
311
- }
312
-
313
- const surfaceDef: tPageDef = {
314
- pTitle: 'Heliostat panel-surface',
315
- pDescription: 'The surface collecting the solar power',
316
- pDef: pDef,
317
- pGeom: pGeom
318
- };
319
-
320
- export { surfaceDef };