bem_parameters.tcl 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799
  1. #----------------------------------------------*-TCL-*------------
  2. #
  3. # bem_parameters.tcl
  4. #
  5. # Copyright 2002-2004 Mayo Foundation. All Rights Reserved.
  6. # $Id: bem_parameters.tcl,v 1.4 2004/06/03 14:19:29 techenti Exp $
  7. #
  8. #----------------------------------------------*-TCL-*------------
  9. package provide bem 1.0
  10. #--------------------------------------------------------------------------
  11. # Routine to parse the <node>.swept_results file and write the file
  12. # <node>_swept_result.csv. This file contains the comma-separated data
  13. # - one line of data for each simulation run.
  14. #--------------------------------------------------------------------------
  15. proc ::bem::bemWriteSweptParameterFile { filetype } {
  16. set doOnce 1
  17. #-----------------------------------------------------------
  18. # Get the default units for the geometries.
  19. #-----------------------------------------------------------
  20. set defUnits $::Stackup::defaultLengthUnits
  21. #-----------------------------------------------------------
  22. # Open <node>.swept_result as the input file.
  23. #-----------------------------------------------------------
  24. set filename [format {%s.%s} $::gui::_nodename $filetype]
  25. if { ! [file exists $filename] } {
  26. ::gui::guiPopupWarning "$filename doesn't exist!"
  27. return
  28. }
  29. set fp [open $filename r]
  30. #-----------------------------------------------------------
  31. # Open <node>_swept_result.csv as the output file.
  32. #-----------------------------------------------------------
  33. set filename [format {%s_%s.csv} $::gui::_nodename $filetype]
  34. set outf [open $filename w]
  35. while { 1 } {
  36. #-------------------------------------------------------
  37. # Process the results of a simulation run -- unitl EOF
  38. #-------------------------------------------------------
  39. if { [eof $fp] } {
  40. close $fp
  41. close $outf
  42. return $filename
  43. }
  44. #-------------------------------------------------------
  45. # Initialize the variables that contain the new-file
  46. # information
  47. # data : will contain the comma-separated data values
  48. # header1: will contain the comma-separated data identifiers
  49. # header2: will contain the comma-separated data units
  50. #-------------------------------------------------------
  51. set data ""
  52. set header1 ""
  53. set header2 ""
  54. while { 1 } {
  55. set line [gets $fp]
  56. if { [eof $fp] } {
  57. close $fp
  58. close $outf
  59. return $filename
  60. }
  61. #---------------------------------------------------
  62. # Break out of this loop when read the "Node =" record
  63. #---------------------------------------------------
  64. if { ([string first "ode =" $line] > -1) || \
  65. ([string first "ile =" $line] > -1) } {
  66. break
  67. }
  68. set indx [string first ":" $line]
  69. if { $indx < 0 } {
  70. continue
  71. }
  72. scan $line {%s %s} itm nme
  73. #---------------------------------------------------
  74. # Is this a Dielectric?
  75. #---------------------------------------------------
  76. if { [string compare $nme "DielectricLayer"] == 0 } {
  77. set line [gets $fp]
  78. #-----------------------------------------------
  79. #
  80. # Thickness
  81. #-----------------------------------------------
  82. set indx1 [string first "thickness" $line]
  83. set line [string range $line [expr {$indx1 + 13}] \
  84. [string length $line]]
  85. scan $line { %f } thck
  86. set line [gets $fp]
  87. #-----------------------------------------------
  88. #
  89. # Permittivity
  90. #-----------------------------------------------
  91. set indx1 [string first "permittivity" $line]
  92. set line [string range $line [expr {$indx1 + 13}] \
  93. [string length $line]]
  94. scan $line { %f } permit
  95. set line [gets $fp]
  96. #-----------------------------------------------
  97. #
  98. # Permeability
  99. #-----------------------------------------------
  100. set indx1 [string first "permeability" $line]
  101. set line [string range $line [expr {$indx1 + 13}] \
  102. [string length $line]]
  103. scan $line { %f } permea
  104. set line [gets $fp]
  105. #-----------------------------------------------
  106. #
  107. # LossTangent
  108. #-----------------------------------------------
  109. set indx1 [string first "lossTangent" $line]
  110. set line [string range $line [expr {$indx1 + 13}] \
  111. [string length $line]]
  112. scan $line {%s} lssTngt
  113. append header1 $itm
  114. append header1 "T,"
  115. append header2 "$defUnits,"
  116. append data "$thck,"
  117. append header1 $itm
  118. append header1 "Pi,"
  119. append header2 ","
  120. append data "$permit,"
  121. append header1 $itm
  122. append header1 "Pe,"
  123. append header2 ","
  124. append data "$permea,"
  125. append header1 $itm
  126. append header1 "LT,"
  127. append header2 ","
  128. append data "$lssTngt,"
  129. }
  130. #---------------------------------------------------
  131. # Is this a Rectangular conductor?
  132. #---------------------------------------------------
  133. if { [string compare $nme "RectangleConductors"] == 0 } {
  134. set line [gets $fp]
  135. #-----------------------------------------------
  136. #
  137. # Height
  138. #-----------------------------------------------
  139. set indx1 [string first "height" $line]
  140. set line [string range $line [expr {$indx1 + 13}] \
  141. [string length $line]]
  142. scan $line { %f } hght
  143. set line [gets $fp]
  144. #-----------------------------------------------
  145. #
  146. # Width
  147. #-----------------------------------------------
  148. set indx1 [string first "width" $line]
  149. set line [string range $line [expr {$indx1 + 13}] \
  150. [string length $line]]
  151. scan $line { %f } wdth
  152. set line [gets $fp]
  153. #-----------------------------------------------
  154. #
  155. # Conductivity
  156. #-----------------------------------------------
  157. set indx1 [string first "conductivity" $line]
  158. set line [string range $line [expr {$indx1 + 13}] \
  159. [string length $line]]
  160. scan $line { %f } cndt
  161. set line [gets $fp]
  162. #-----------------------------------------------
  163. #
  164. # Number
  165. #-----------------------------------------------
  166. set indx1 [string first "number" $line]
  167. set line [string range $line [expr {$indx1 + 13}] \
  168. [string length $line]]
  169. scan $line {%d} number
  170. set line [gets $fp]
  171. #-----------------------------------------------
  172. #
  173. # Pitch
  174. #-----------------------------------------------
  175. set indx1 [string first "pitch" $line]
  176. set line [string range $line [expr {$indx1 + 13}] \
  177. [string length $line]]
  178. scan $line { %f } ptch
  179. set line [gets $fp]
  180. #-----------------------------------------------
  181. #
  182. # X-offset
  183. #-----------------------------------------------
  184. set indx1 [string first "x-offset" $line]
  185. set line [string range $line [expr {$indx1 + 13}] \
  186. [string length $line]]
  187. scan $line { %f } xoff
  188. set line [gets $fp]
  189. #-----------------------------------------------
  190. #
  191. # Y-offset
  192. #-----------------------------------------------
  193. set indx1 [string first "y-offset" $line]
  194. set line [string range $line [expr {$indx1 + 13}] \
  195. [string length $line]]
  196. scan $line { %f } yoff
  197. append header1 $itm
  198. append header1 "W,"
  199. append header2 "$defUnits,"
  200. append data "$wdth,"
  201. append header1 $itm
  202. append header1 "H,"
  203. append header2 "$defUnits,"
  204. append data "$hght,"
  205. append header1 $itm
  206. append header1 "C,"
  207. append header2 "siemens/meter,"
  208. append data "$cndt,"
  209. append header1 $itm
  210. append header1 "N,"
  211. append header2 ","
  212. append data "$number,"
  213. append header1 $itm
  214. append header1 "P,"
  215. append header2 "$defUnits,"
  216. append data "$ptch,"
  217. append header1 $itm
  218. append header1 "X,"
  219. append header2 "$defUnits,"
  220. append data "$xoff,"
  221. append header1 $itm
  222. append header1 "Y,"
  223. append header2 "$defUnits,"
  224. append data "$yoff,"
  225. }
  226. #---------------------------------------------------
  227. # Is this a Trapezoidal conductor?
  228. #---------------------------------------------------
  229. if { [string compare $nme "TrapezoidConductors"] == 0 } {
  230. set line [gets $fp]
  231. #-----------------------------------------------
  232. #
  233. # Height
  234. #-----------------------------------------------
  235. set indx1 [string first "height" $line]
  236. set line [string range $line [expr {$indx1 + 13}] \
  237. [string length $line]]
  238. scan $line { %f } hght
  239. set line [gets $fp]
  240. #-----------------------------------------------
  241. #
  242. # TopWidth
  243. #-----------------------------------------------
  244. set indx1 [string first "topWidth" $line]
  245. set line [string range $line [expr {$indx1 + 13}] \
  246. [string length $line]]
  247. scan $line { %f } tpwdth
  248. set line [gets $fp]
  249. #-----------------------------------------------
  250. #
  251. # BotWidth
  252. #-----------------------------------------------
  253. set indx1 [string first "botWidth" $line]
  254. set line [string range $line [expr {$indx1 + 13}] \
  255. [string length $line]]
  256. scan $line { %f } btwdth
  257. set line [gets $fp]
  258. #-----------------------------------------------
  259. #
  260. # Conductivity
  261. #-----------------------------------------------
  262. set indx1 [string first "conductivity" $line]
  263. set line [string range $line [expr {$indx1 + 13}] \
  264. [string length $line]]
  265. scan $line { %f } cndt
  266. set line [gets $fp]
  267. #-----------------------------------------------
  268. #
  269. # Number
  270. #-----------------------------------------------
  271. set indx1 [string first "number" $line]
  272. set line [string range $line [expr {$indx1 + 13}] \
  273. [string length $line]]
  274. scan $line {%d} number
  275. set line [gets $fp]
  276. #-----------------------------------------------
  277. #
  278. # Pitch
  279. #-----------------------------------------------
  280. set indx1 [string first "pitch" $line]
  281. set line [string range $line [expr {$indx1 + 13}] \
  282. [string length $line]]
  283. scan $line { %f } ptch
  284. set line [gets $fp]
  285. #-----------------------------------------------
  286. #
  287. # X-offset
  288. #-----------------------------------------------
  289. set indx1 [string first "x-offset" $line]
  290. set line [string range $line [expr {$indx1 + 13}] \
  291. [string length $line]]
  292. scan $line { %f } xoff
  293. set line [gets $fp]
  294. #-----------------------------------------------
  295. #
  296. # Y-offset
  297. #-----------------------------------------------
  298. set indx1 [string first "y-offset" $line]
  299. set line [string range $line [expr {$indx1 + 13}] \
  300. [string length $line]]
  301. scan $line { %f } yoff
  302. append header1 $itm
  303. append header1 "Tw,"
  304. append header2 "$defUnits,"
  305. append data "$tpwdth,"
  306. append header1 $itm
  307. append header1 "Bw,"
  308. append header2 "$defUnits,"
  309. append data "$btwdth,"
  310. append header1 $itm
  311. append header1 "H,"
  312. append header2 "$defUnits,"
  313. append data "$hght,"
  314. append header1 $itm
  315. append header1 "C,"
  316. append header2 "siemens/meter,"
  317. append data "$cndt,"
  318. append header1 $itm
  319. append header1 "N,"
  320. append header2 ","
  321. append data "$number,"
  322. append header1 $itm
  323. append header1 "P,"
  324. append header2 "$defUnits,"
  325. append data "$ptch,"
  326. append header1 $itm
  327. append header1 "X,"
  328. append header2 "$defUnits,"
  329. append data "$xoff,"
  330. append header1 $itm
  331. append header1 "Y,"
  332. append header2 "$defUnits,"
  333. append data "$yoff,"
  334. }
  335. #---------------------------------------------------
  336. # Is this a circular conductor?
  337. #---------------------------------------------------
  338. if { [string compare $nme "CircleConductors"] == 0 } {
  339. set line [gets $fp]
  340. #-----------------------------------------------
  341. #
  342. # Diameter
  343. #-----------------------------------------------
  344. set indx1 [string first "diameter" $line]
  345. set line [string range $line [expr {$indx1 + 13}] \
  346. [string length $line]]
  347. scan $line { %f } dmtr
  348. set line [gets $fp]
  349. #-----------------------------------------------
  350. #
  351. # Conductivity
  352. #-----------------------------------------------
  353. set indx1 [string first "conductivity" $line]
  354. set line [string range $line [expr {$indx1 + 13}] \
  355. [string length $line]]
  356. scan $line { %f } cndt
  357. set line [gets $fp]
  358. #-----------------------------------------------
  359. #
  360. # Number
  361. #-----------------------------------------------
  362. set indx1 [string first "number" $line]
  363. set line [string range $line [expr {$indx1 + 13}] \
  364. [string length $line]]
  365. scan $line {%d} number
  366. set line [gets $fp]
  367. #-----------------------------------------------
  368. #
  369. # Pitch
  370. #-----------------------------------------------
  371. set indx1 [string first "pitch" $line]
  372. set line [string range $line [expr {$indx1 + 13}] \
  373. [string length $line]]
  374. scan $line { %f } ptch
  375. set line [gets $fp]
  376. #-----------------------------------------------
  377. #
  378. # X-offset
  379. #-----------------------------------------------
  380. set indx1 [string first "x-offset" $line]
  381. set line [string range $line [expr {$indx1 + 13}] \
  382. [string length $line]]
  383. scan $line { %f } xoff
  384. set line [gets $fp]
  385. #-----------------------------------------------
  386. #
  387. # Y-offset
  388. #-----------------------------------------------
  389. set indx1 [string first "y-offset" $line]
  390. set line [string range $line [expr {$indx1 + 13}] \
  391. [string length $line]]
  392. scan $line { %f } yoff
  393. append header1 $itm
  394. append header1 "D,"
  395. append header2 "$defUnits,"
  396. append data "$dmtr,"
  397. append header1 $itm
  398. append header1 "C,"
  399. append header2 "siemens/meter,"
  400. append data "$cndt,"
  401. append header1 $itm
  402. append header1 "N,"
  403. append header2 "$defUnits,"
  404. append data "$number,"
  405. append header1 $itm
  406. append header1 "P,"
  407. append header2 "$defUnits,"
  408. append data "$ptch,"
  409. append header1 $itm
  410. append header1 "X,"
  411. append header2 "$defUnits,"
  412. append data "$xoff,"
  413. append header1 $itm
  414. append header1 "Y,"
  415. append header2 "$defUnits,"
  416. append data "$yoff,"
  417. }
  418. }
  419. #-------------------------------------------------------
  420. # Read until get the "Coupling Length =" record.
  421. #-------------------------------------------------------
  422. while { [string first "pling Length" $line] < 0 } {
  423. set line [gets $fp]
  424. }
  425. #-------------------------------------------------------
  426. # Coupling length
  427. #-------------------------------------------------------
  428. scan $line {%*s %*s = %f %s } cplgt unts
  429. append header1 "CL,"
  430. append header2 "$unts,"
  431. append data "$cplgt,"
  432. #-------------------------------------------------------
  433. # Risetime
  434. #-------------------------------------------------------
  435. set line [gets $fp]
  436. scan $line {%*s %*s = %f %s } rtme unts
  437. append header1 "RT,"
  438. append header2 "$unts,"
  439. append data "$rtme,"
  440. #-------------------------------------------------------
  441. # cseg
  442. #-------------------------------------------------------
  443. set line [gets $fp]
  444. scan $line {%*s %*s %*s %*s = %d} cseg
  445. append header1 "cseg,"
  446. append header2 ","
  447. append data "$cseg,"
  448. #-------------------------------------------------------
  449. # dseg
  450. #-------------------------------------------------------
  451. set line [gets $fp]
  452. scan $line {%*s %*s %*s %*s = %d} dseg
  453. append header1 "dseg,"
  454. append header2 ","
  455. append data "$dseg,"
  456. #-------------------------------------------------------
  457. # Read until get the "Mutual and Self Electrostatic Induction"
  458. # record
  459. #-------------------------------------------------------
  460. while { [string first "Electrostatic Induc" $line] < 0 } {
  461. set line [gets $fp]
  462. }
  463. #-------------------------------------------------------
  464. # Skip the two header records
  465. #-------------------------------------------------------
  466. set line [gets $fp]
  467. set line [gets $fp]
  468. while { [string length $line] > 1 } {
  469. scan $line {%*s %s %*c %s %*s %f } v1 v2 b
  470. set lgt [expr { [string length $v1] - 1 }]
  471. set c1 [string range $v1 2 $lgt]
  472. set lgt [expr { [string length $v2] - 1 }]
  473. set c2 [string range $v2 2 $lgt]
  474. append header1 "B$c1$c2,"
  475. append header2 "Farads/Meter,"
  476. append data "$b,"
  477. set line [gets $fp]
  478. }
  479. #-------------------------------------------------------
  480. # Skip the headers for the "Mutual and Self Inductance"
  481. # records
  482. #-------------------------------------------------------
  483. set line [gets $fp]
  484. set line [gets $fp]
  485. set line [gets $fp]
  486. while { ([string length $line] > 1) && \
  487. ([string first "try Ratio" $line] < 1) } {
  488. scan $line {%*s %s %*c %s %*s %f} v1 v2 b
  489. set lgt [expr { [string length $v1] - 1 }]
  490. set c1 [string range $v1 2 $lgt]
  491. set lgt [expr { [string length $v2] - 1 }]
  492. set c2 [string range $v2 2 $lgt]
  493. append header1 "L$c1$c2,"
  494. append header2 "Henrys/Meter,"
  495. append data "$b,"
  496. set line [gets $fp]
  497. }
  498. #-------------------------------------------------------
  499. # Read until get the "Characteristic Impedance" record
  500. #-------------------------------------------------------
  501. while { [string first "ic Imped" $line] < 0 } {
  502. set line [gets $fp]
  503. }
  504. set line [gets $fp]
  505. while { [string length $line] > 1 } {
  506. scan $line {%*s %*s %*s %s %f} v1 b
  507. set lgt [expr { [string length $v1] - 2 }]
  508. set c1 [string range $v1 2 $lgt]
  509. append header1 "I$c1,"
  510. append header2 "Ohms,"
  511. append data "$b,"
  512. set line [gets $fp]
  513. }
  514. #-------------------------------------------------------
  515. # Check if there are Odd/Even impedance values.
  516. #-------------------------------------------------------
  517. set line [gets $fp]
  518. if { [string first "Odd/Even" $line] > 0 } {
  519. set line [gets $fp]
  520. scan $line {%*s %f} b
  521. append header1 "Odd$c1,"
  522. append header2 ","
  523. append data "$b,"
  524. set line [gets $fp]
  525. scan $line {%*s %f} b
  526. append header1 "Even$c1,"
  527. append header2 ","
  528. append data "$b,"
  529. set line [gets $fp]
  530. set line [gets $fp]
  531. }
  532. #-------------------------------------------------------
  533. # Read the "Effective Dielectric Constant" records
  534. #-------------------------------------------------------
  535. set line [gets $fp]
  536. while { [string length $line] > 1 } {
  537. scan $line {%*s %*s %*s %s %f} v1 b
  538. set lgt [expr { [string length $v1] - 2 }]
  539. set c1 [string range $v1 2 $lgt]
  540. append header1 "DC$c1,"
  541. append header2 ","
  542. append data "$b,"
  543. set line [gets $fp]
  544. }
  545. #-------------------------------------------------------
  546. # Read the "Propagation Velocity" records
  547. #-------------------------------------------------------
  548. set line [gets $fp]
  549. set line [gets $fp]
  550. while { [string length $line] > 1 } {
  551. scan $line {%*s %*s %*s %s %f} v1 b
  552. set lgt [expr { [string length $v1] - 2 }]
  553. set c1 [string range $v1 2 $lgt]
  554. append header1 "PV$c1,"
  555. append header2 "meters/second,"
  556. append data "$b,"
  557. set line [gets $fp]
  558. }
  559. #-------------------------------------------------------
  560. # Check if there are Odd/Even propagation velocity values.
  561. #-------------------------------------------------------
  562. set line [gets $fp]
  563. if { [string first "Odd/Even" $line] > 0 } {
  564. set line [gets $fp]
  565. scan $line {%*s %f} b
  566. append header1 "PVOdd$c1,"
  567. append header2 ","
  568. append data "$b,"
  569. set line [gets $fp]
  570. scan $line {%*s %f} b
  571. append header1 "PVEven$c1,"
  572. append header2 ","
  573. append data "$b,"
  574. set line [gets $fp]
  575. set line [gets $fp]
  576. }
  577. #-------------------------------------------------------
  578. # Read the "Propagation Delay" records
  579. #-------------------------------------------------------
  580. set line [gets $fp]
  581. while { [string length $line] > 1 } {
  582. scan $line {%*s %*s %*s %s %f} v1 b
  583. set lgt [expr { [string length $v1] - 2 }]
  584. set c1 [string range $v1 2 $lgt]
  585. append header1 "PD$c1,"
  586. append header2 "seconds/meter,"
  587. append data "$b,"
  588. set line [gets $fp]
  589. }
  590. #-------------------------------------------------------
  591. # Check if there are Odd/Even propagation delay values.
  592. #-------------------------------------------------------
  593. set line [gets $fp]
  594. if { [string first "Odd/Even" $line] > 0 } {
  595. set line [gets $fp]
  596. scan $line {%*s %f} b
  597. append header1 "PDOdd$c1,"
  598. append header2 ","
  599. append data "$b,"
  600. set line [gets $fp]
  601. scan $line {%*s %f} b
  602. append header1 "PDEven$c1,"
  603. append header2 ","
  604. append data "$b,"
  605. set line [gets $fp]
  606. set line [gets $fp]
  607. }
  608. #-------------------------------------------------------
  609. # Read the "Rdc" records
  610. #-------------------------------------------------------
  611. set line [gets $fp]
  612. set line [gets $fp]
  613. while { [string length $line] > 1 } {
  614. scan $line {%*s %s %*c %s %*s %f} v1 v2 b
  615. set lgt [expr { [string length $v1] - 1 }]
  616. set c1 [string range $v1 2 $lgt]
  617. set lgt [expr { [string length $v2] - 1 }]
  618. set c2 [string range $v2 2 $lgt]
  619. append header1 "Rdc$c1$c2,"
  620. append header2 "Ohms/Meter,"
  621. append data "$b,"
  622. set line [gets $fp]
  623. }
  624. #-------------------------------------------------------
  625. # Read the FXT records
  626. #-------------------------------------------------------
  627. set line [gets $fp]
  628. set line [gets $fp]
  629. set line [gets $fp]
  630. while { [string length $line] > 1 } {
  631. scan $line {%*s %s %*c %s %*s %*s = %f} v1 v2 b
  632. set lgt [expr { [string length $v1] - 1 }]
  633. set c1 [string range $v1 2 $lgt]
  634. set lgt [expr { [string length $v2] - 1 }]
  635. set c2 [string range $v2 2 $lgt]
  636. append header1 "FXT$c1$c2,"
  637. append header2 "dB,"
  638. append data "$b,"
  639. set line [gets $fp]
  640. }
  641. #-------------------------------------------------------
  642. # Read the BXT records
  643. #-------------------------------------------------------
  644. set line [gets $fp]
  645. set line [gets $fp]
  646. set line [gets $fp]
  647. set frst 1
  648. while { [string length $line] > 1 } {
  649. if { $frst } {
  650. set frst 0
  651. } else {
  652. append header1 ","
  653. append header2 ","
  654. append data ","
  655. }
  656. scan $line {%*s %s %*c %s %*s %*s = %f} v1 v2 b
  657. set lgt [expr { [string length $v1] - 1 }]
  658. set c1 [string range $v1 2 $lgt]
  659. set lgt [expr { [string length $v2] - 1 }]
  660. set c2 [string range $v2 2 $lgt]
  661. append header1 "BXT$c1$c2"
  662. append header2 "dB"
  663. append data $b
  664. set line [gets $fp]
  665. }
  666. if { $doOnce } {
  667. puts $outf $header1
  668. puts $outf $header2
  669. set doOnce 0
  670. }
  671. puts $outf $data
  672. }
  673. close $outf
  674. close $fp
  675. return $filename
  676. }