Coverage for steam_pysigma\data\DataRoxieParser.py: 100%

210 statements  

« prev     ^ index     » next       coverage.py v7.4.3, created at 2024-12-16 17:09 +0100

1# STEAM PySigma is a python wrapper of STEAM-SIGMA written in Java. 

2# Copyright (C) 2023, CERN, Switzerland. All rights reserved. 

3# 

4# This program is free software: you can redistribute it and/or modify 

5# it under the terms of the GNU General Public License as published by 

6# the Free Software Foundation, version 3 of the License. 

7# 

8# This program is distributed in the hope that it will be useful, 

9# but WITHOUT ANY WARRANTY; without even the implied warranty of 

10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

11# GNU General Public License for more details. 

12# 

13# You should have received a copy of the GNU General Public License 

14# along with this program. If not, see <https://www.gnu.org/licenses/>. 

15 

16from pydantic import BaseModel 

17from typing import Dict, List, Optional 

18 

19 

20class Coord(BaseModel): 

21 """ 

22 Class for coordinates 

23 """ 

24 x: Optional[float] = None 

25 y: Optional[float] = None 

26 z: Optional[float] = None 

27 

28 

29class Roll(BaseModel): 

30 """ 

31 Class for roll2 transformation 

32 """ 

33 coor: Coord = Coord() 

34 alph: Optional[float] = None 

35 

36 

37class HyperHole(BaseModel): 

38 """ 

39 Class for hyper holes 

40 """ 

41 areas: List[str] = [] 

42 

43 

44class HyperArea(BaseModel): 

45 """ 

46 Class for hyper areas 

47 """ 

48 material: Optional[str] = None 

49 lines: List[str] = [] 

50 

51 

52class HyperLine(BaseModel): 

53 """ 

54 Class for hyper lines: lines, arcs, elliptic arcs, circles 

55 """ 

56 type: Optional[str] = None 

57 kp1: Optional[str] = None 

58 kp2: Optional[str] = None 

59 kp3: Optional[str] = None 

60 arg1: Optional[float] = None 

61 arg2: Optional[float] = None 

62 elements: Optional[int] = None 

63 

64 

65class CondPar(BaseModel): 

66 """ 

67 Class for conductor parameters 

68 """ 

69 wInsulNarrow: Optional[float] = None 

70 wInsulWide: Optional[float] = None 

71 dFilament: Optional[float] = None 

72 dstrand: Optional[float] = None 

73 fracCu: Optional[float] = None 

74 fracSc: Optional[float] = None 

75 RRR: Optional[float] = None 

76 TupRRR: Optional[float] = None 

77 Top: Optional[float] = None 

78 Rc: Optional[float] = None 

79 Ra: Optional[float] = None 

80 fRhoEff: Optional[float] = None 

81 lTp: Optional[float] = None 

82 wBare: Optional[float] = None 

83 hInBare: Optional[float] = None 

84 hOutBare: Optional[float] = None 

85 noOfStrands: Optional[int] = None 

86 noOfStrandsPerLayer: Optional[int] = None 

87 noOfLayers: Optional[int] = None 

88 lTpStrand: Optional[float] = None 

89 wCore: Optional[float] = None 

90 hCore: Optional[float] = None 

91 thetaTpStrand: Optional[float] = None 

92 degradation: Optional[float] = None 

93 C1: Optional[float] = None 

94 C2: Optional[float] = None 

95 fracHe: Optional[float] = None 

96 fracFillInnerVoids: Optional[float] = None 

97 fracFillOuterVoids: Optional[float] = None 

98 

99 

100class ConductorRoxie(BaseModel): 

101 """ 

102 Class for conductor type 

103 """ 

104 conductorType: Optional[int] = None 

105 cableGeom: Optional[str] = None 

106 strand: Optional[str] = None 

107 filament: Optional[str] = None 

108 insul: Optional[str] = None 

109 trans: Optional[str] = None 

110 quenchMat: Optional[str] = None 

111 T_0: Optional[float] = None 

112 comment: Optional[str] = None 

113 parameters: CondPar = CondPar() 

114 

115 

116class Cable(BaseModel): 

117 """ 

118 Class for cable parameters 

119 """ 

120 height: Optional[float] = None 

121 width_i: Optional[float] = None 

122 width_o: Optional[float] = None 

123 ns: Optional[float] = None 

124 transp: Optional[float] = None 

125 degrd: Optional[float] = None 

126 comment: Optional[str] = None 

127 

128 

129class Quench(BaseModel): 

130 """ 

131 Class for quench parameters 

132 """ 

133 SCHeatCapa: Optional[float] = None 

134 CuHeatCapa: Optional[float] = None 

135 CuThermCond: Optional[float] = None 

136 CuElecRes: Optional[float] = None 

137 InsHeatCapa: Optional[float] = None 

138 InsThermCond: Optional[float] = None 

139 FillHeatCapa: Optional[float] = None 

140 He: Optional[float] = None 

141 comment: Optional[str] = None 

142 

143 

144class Transient(BaseModel): 

145 """ 

146 Class for transient parameters 

147 """ 

148 Rc: Optional[float] = None 

149 Ra: Optional[float] = None 

150 filTwistp: Optional[float] = None 

151 filR0: Optional[float] = None 

152 fil_dRdB: Optional[float] = None 

153 strandfillFac: Optional[float] = None 

154 comment: Optional[str] = None 

155 

156 

157class Strand(BaseModel): 

158 """ 

159 Class for strand parameters 

160 """ 

161 diam: Optional[float] = None 

162 cu_sc: Optional[float] = None 

163 RRR: Optional[float] = None 

164 Tref: Optional[float] = None 

165 Bref: Optional[float] = None 

166 Jc_BrTr: Optional[float] = None 

167 dJc_dB: Optional[float] = None 

168 comment: Optional[str] = None 

169 

170 

171class Filament(BaseModel): 

172 """ 

173 Class for filament parameters 

174 """ 

175 fildiao: Optional[float] = None 

176 fildiai: Optional[float] = None 

177 Jc_fit: Optional[str] = None 

178 fit: Optional[str] = None 

179 comment: Optional[str] = None 

180 

181 

182class Insulation(BaseModel): 

183 """ 

184 Class for insulation parameters 

185 """ 

186 radial: Optional[float] = None 

187 azimut: Optional[float] = None 

188 comment: Optional[str] = None 

189 

190 

191class Block(BaseModel): 

192 """ 

193 Class for block list 

194 """ 

195 type: Optional[int] = None 

196 nco: Optional[int] = None 

197 radius: Optional[float] = None 

198 phi: Optional[float] = None 

199 alpha: Optional[float] = None 

200 current: Optional[float] = None 

201 condname: Optional[str] = None 

202 n1: Optional[int] = None 

203 n2: Optional[int] = None 

204 imag: Optional[int] = None 

205 turn: Optional[float] = None 

206 coil: Optional[int] = None 

207 pole: Optional[int] = None 

208 layer: Optional[int] = None 

209 winding: Optional[int] = None 

210 shift2: Coord = Coord() 

211 roll2: Roll = Roll() 

212 

213 

214class Group(BaseModel): 

215 """ 

216 Class for group list 

217 """ 

218 symm: Optional[int] = None 

219 typexy: Optional[int] = None 

220 blocks: List[int] = [] # map 

221 

222 

223class Trans(BaseModel): 

224 """ 

225 Class for transformation list 

226 """ 

227 x: Optional[float] = None 

228 y: Optional[float] = None 

229 alph: Optional[float] = None 

230 bet: Optional[float] = None 

231 string: Optional[str] = None 

232 act: Optional[int] = None 

233 bcs: List[int] = [] # map 

234 

235 

236class Iron(BaseModel): 

237 """ 

238 Class for the iron yoke data 

239 """ 

240 key_points: Dict[str, Coord] = {} 

241 hyper_lines: Dict[str, HyperLine] = {} 

242 hyper_areas: Dict[str, HyperArea] = {} 

243 hyper_holes: Dict[int, HyperHole] = {} 

244 

245 

246class Cadata(BaseModel): 

247 """ 

248 Class for the conductor data 

249 """ 

250 insul: Dict[str, Insulation] = {} 

251 filament: Dict[str, Filament] = {} 

252 strand: Dict[str, Strand] = {} 

253 transient: Dict[str, Transient] = {} 

254 quench: Dict[str, Quench] = {} 

255 cable: Dict[str, Cable] = {} 

256 conductor: Dict[str, ConductorRoxie] = {} 

257 

258 

259class Coil(BaseModel): 

260 """ 

261 Class for the coil data 

262 """ 

263 blocks: Dict[str, Block] = {} 

264 groups: Dict[str, Group] = {} 

265 transs: Dict[str, Trans] = {} 

266 

267 

268class StrandGroup(BaseModel): 

269 """ 

270 Class for strand group 

271 """ 

272 strand_positions: Dict[int, Coord] = {} 

273 

274 

275class Corner(BaseModel): 

276 """ 

277 Class for corner positions 

278 """ 

279 iH: Coord = Coord() # inner left 

280 iL: Coord = Coord() # inner right 

281 oH: Coord = Coord() # outer left 

282 oL: Coord = Coord() # outer right 

283 

284 

285class HalfTurnCorner(BaseModel): 

286 """ 

287 Class for corner type 

288 """ 

289 insulated: Corner = Corner() 

290 bare: Corner = Corner() 

291 

292 

293class HalfTurn(BaseModel): 

294 """ 

295 Class for half-turn data 

296 """ 

297 corners: HalfTurnCorner = HalfTurnCorner() 

298 strand_groups: Dict[int, StrandGroup] = {} 

299 

300 

301class Order(BaseModel): 

302 """ 

303 Class for electrical order (block location) 

304 """ 

305 coil: Optional[int] = None 

306 pole: Optional[int] = None 

307 layer: Optional[int] = None 

308 winding: Optional[int] = None 

309 block: Optional[int] = None 

310 

311 

312class CenterShift(BaseModel): 

313 """ 

314 Class for bore center shift 

315 """ 

316 inner: Coord = Coord() 

317 outer: Coord = Coord() 

318 

319 

320class Wedge(BaseModel): 

321 """ 

322 Class for wedge positions 

323 """ 

324 corners: Corner = Corner() 

325 corners_ins: Corner = Corner() 

326 corrected_center: CenterShift = CenterShift() 

327 corrected_center_ins: CenterShift = CenterShift() 

328 order_l: Order = Order() 

329 order_h: Order = Order() 

330 

331 

332class BlockData(BaseModel): 

333 """ 

334 Class for block data 

335 """ 

336 block_corners: Corner = Corner() 

337 block_corners_ins: Corner = Corner() 

338 current_sign: Optional[int] = None 

339 half_turns: Dict[int, HalfTurn] = {} 

340 

341 

342class WindingData(BaseModel): 

343 """ 

344 Class for winding data 

345 """ 

346 blocks: Dict[int, BlockData] = {} 

347 conductor_name: Optional[str] = None 

348 conductors_number: Optional[int] = None 

349 

350 

351class Winding(BaseModel): 

352 """ 

353 Class for windings 

354 """ 

355 windings: Dict[int, WindingData] = {} 

356 

357 

358class Layer(BaseModel): 

359 """ 

360 Class for winding layers 

361 """ 

362 layers: Dict[int, Winding] = {} 

363 

364 

365class Pole(BaseModel): 

366 """ 

367 Class for poles 

368 """ 

369 poles: Dict[int, Layer] = {} 

370 bore_center: Coord = Coord() 

371 

372 

373class CoilData(BaseModel): 

374 """ 

375 Class for coils 

376 """ 

377 coils: Dict[int, Pole] = {} 

378 physical_order: List[Order] = [] 

379 

380 

381class RoxieRawData(BaseModel): 

382 """ 

383 Class for the raw data 

384 """ 

385 cadata: Cadata = Cadata() 

386 coil: Coil = Coil() 

387 

388 

389class RoxieData(BaseModel): 

390 """ 

391 Class for the roxie parser 

392 """ 

393 iron: Iron = Iron() 

394 coil: CoilData = CoilData() 

395 wedges: Dict[int, Wedge] = {}