home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 15 / CD_ASCQ_15_070894.iso / vrac / simplant.zip / HEATBAL.BAS < prev    next >
BASIC Source File  |  1994-04-28  |  14KB  |  499 lines

  1. 'Pilgrim Station Heat Balance
  2. 'Copyright (c) by Michael Krabach 4-15-94
  3. 'adapted from HP-41CX Rev. 5-11-86 for Seabrook recirc analysys,
  4. 'to Turbo Basic, Rev. 3-9-90, for Seabrook Station
  5. 'latest full BECo Rev. 5-7-92,
  6. 'adapted to interactive screen mode, rev$
  7. 'Written in PowerBASIC 3.00c
  8.  
  9. rev$="4-28-94"
  10.  
  11. '=======================================================================
  12. GOSUB resetup
  13.  
  14. 'For Pilgrim Station Condenser
  15. WALLCF=0.0734    'table III Ecolaire, for 0.875" 22 B.W.G.
  16. MATCF=0.87        'table IV Ecolaire, for titanium, 22 B.W.G., H.E.I. adden. 1
  17. TUBLEN=49.77    'effective tube length, ft
  18. PASSES=1        'condenser passes
  19. GFACTOR=1.642    'gpm per tube at 1 fps, table II Ecolaire, 0.875" 22 B.W.G.
  20. CONDAREA=400000    'condenser surface area, ft2
  21. OD=0.875        'tube O.D., inches
  22. DELTAHG=0
  23.  
  24. 'data for % change in heat rate vs back pressure curve set
  25.  
  26. c0a = -8.3613146D+01  'coefs for polynominal for D0 coef
  27. c0b =  4.2258261D+02  'from file c40.dat
  28. c0c = -6.2279685D+02
  29. c0d =  2.8301935D+02
  30.  
  31. c1a =  1.2337307D+02  'coefs for polynominal for D1 coef
  32. c1b = -7.6742144D+02  'from file c41.dat
  33. c1c =  1.2307937D+03
  34. c1d = -5.8365612D+02
  35.  
  36. c2a = -6.7923989D+01  'coefs for polynominal for D2 coef
  37. c2b =  5.0484591D+02  'from file c42.dat
  38. c2c = -8.6175149D+02
  39. c2d =  4.2120656D+02
  40.  
  41. c3a =  1.7896337D+01 'coefs for polynominal for D3 coef
  42. c3b = -1.4379201D+02 'from file c43.dat
  43. c3c =  2.5402242D+02
  44. c3d = -1.2652886D+02
  45.  
  46. c4a = -1.6290343D+00 'coefs for polynominal for D4 coef
  47. c4b =  1.4379191D+01 'from file c44.dat
  48. c4c = -2.6255110D+01
  49. c4d =  1.3307604D+01
  50.  
  51. MWA =  -3.7452028D+01   'coefs for MWE vs PWR polynominial
  52. MWB =   7.4155719D+02   'from file coefmwe.dat
  53. MWC =  -4.1531061D+01
  54. MWD =  -7.2597340D+00
  55.  
  56. HRA =  1.6103994D+04  'coefs for heat rate vs PWR polynominal
  57. HRB = -1.9264316D+04  'from file coefhr.dat
  58. HRC =  2.1079914D+04
  59. HRD = -7.9905870D+03
  60.  
  61. STMA =  -1.1905400D+00 'coefs for steam flow vs PWR polynominal
  62. STMB =   7.5600916D+06 'from file coefflo.dat
  63. STMC =  -1.2378775D+01
  64. STMD =   5.1537091D+00
  65.  
  66. '=======================================================================
  67.  
  68. KEY 15, CHR$(&h08, &h02, &h70)        'alt plus !1 KEY
  69. KEY 16, CHR$(&H08, &H23, &H70)        'alt plus H KEY
  70. KEY 17, CHR$(&H08, &H2d, &H70)        'alt plus X KEY
  71. KEY 18, CHR$(&H08, &H2e, &H70)        'alt plus C KEY
  72. KEY 19, CHR$(&H08, &H03, &H70)        'alt plus @2 KEY
  73. KEY 20, CHR$(&H08, &H04, &H70)        'alt plus #3 KEY
  74. KEY 21, CHR$(&H08, &H24, &H70)        'alt plus J KEY
  75. KEY 22, CHR$(&H08, &H13, &H70)        'alt plus #3 KEY
  76. KEY 23, CHR$(&H08, &H05, &H70)        'alt plus $4 KEY
  77. KEY 24, CHR$(&H08, &H06, &H70)        'alt plus %5 KEY
  78.  
  79. ON KEY (1) GOSUB powerdown
  80. ON KEY (2) GOSUB powerup
  81. ON KEY (3) GOSUB circdown
  82. ON KEY (4) GOSUB circup
  83. ON KEY (5) GOSUB oceandown
  84. ON KEY (6) GOSUB oceanup
  85. ON KEY (7) GOSUB cleandec
  86. ON KEY (8) GOSUB cleaninc
  87. ON KEY (9) GOSUB bwashdec
  88. ON KEY (10) GOSUB bwashinc
  89. ON KEY (15) GOSUB freeze
  90. ON KEY (16) GOSUB help
  91. ON KEY (17) GOSUB shutdown
  92. ON KEY (18) GOSUB resetup
  93. ON KEY (19) GOSUB decdev
  94. ON KEY (20) GOSUB incdev
  95. ON KEY (21) GOSUB help2
  96. ON KEY (22) GOSUB resetscrn
  97. ON KEY (23) GOSUB lossvacuum
  98. ON KEY (24) GOSUB gainvacuum
  99.  
  100. KEY (1) ON
  101. KEY (2) ON
  102. KEY (3) ON
  103. KEY (4) ON
  104. KEY (5) ON
  105. KEY (6) ON
  106. KEY (7) ON
  107. KEY (8) ON
  108. KEY (9) ON
  109. KEY (10) ON
  110. KEY (15) ON
  111. KEY (16) ON
  112. KEY (17) ON
  113. KEY (18) ON
  114. KEY (19) ON
  115. KEY (20) ON
  116. KEY (21) ON
  117. KEY (22) ON
  118. KEY (23) ON
  119. KEY (24) ON
  120.  
  121. '=======================================================================
  122.  
  123. progloop:
  124.  
  125. ON ERROR GOTO finish
  126. TIN=OCEAN    'also as condenser inlet temp.
  127.  
  128. LBL4:    'calc constants for exhaust correction factor coeff.
  129. D0=((c0d*PWR+c0c)*PWR+c0b)*PWR+c0a
  130. D1=((c1d*PWR+c1c)*PWR+c1b)*PWR+c1a
  131. D2=((c2d*PWR+c2c)*PWR+c2b)*PWR+c2a
  132. D3=((c3d*PWR+c3c)*PWR+c3b)*PWR+c3a
  133. D4=((c4d*PWR+c4c)*PWR+c4b)*PWR+c4a
  134.  
  135. LBL5:    'heat rate, btu/kwhr, for UE&C heat balances at specific power level
  136. HRATE=(((HRD)*PWR+HRC)*PWR+HRB)*PWR+HRA
  137. NEFF=3415/HRATE            'plant efficiency
  138.  
  139. 'turbine output, MWE at %pwr at condenser design pressure.
  140. MWE=(((MWD)*PWR+MWC)*PWR+MWB)*PWR+MWA
  141. MWT=MWE/NEFF            'plant thermal output
  142. HRR=(MWT-MWE)*3415E3        'heat rejection rate, btu/hr
  143.  
  144. LBL6:
  145. 'inlet circ water correction factor from Ecolaire Table V, H.E.I. adden. 1
  146. ICWCF=((((1.3986E-8)*TIN-4.036519E-6)*TIN+3.476689E-4)*TIN-2.511266E-3)*TIN+0.511212
  147.  
  148. K=WALLCF*MATCF*ICWCF*CLEAN*SQR(TUBLEN*PASSES*GFACTOR*CONDAREA*12/(3.14159*OD*GPM))
  149. R=1-1/EXP(K)
  150.  
  151. LBL7:
  152. TRISE=HRR/(GPM*489.8)    'delta temp = temp rise, H.E.I. Standards
  153. ITD=TRISE/R
  154. TTD=ITD-TRISE
  155. IF TTD<=5 THEN ITD=TRISE+5
  156. 'locate 1,1:print using "##.#";ttd
  157.  
  158. LBL8:            'for saturated steam
  159. TSS=ITD+TIN        'saturated steam temperature
  160. TSS=TSS+DEV     'correction for hotwell deviation above Tsat.
  161.  
  162. 'from regression of the steam tables, pressure in inches mercury.
  163. HG=((((2.0247669E-8)*TSS-2.54974E-6)*TSS+0.00031099)*TSS-0.008568)*TSS+0.20557
  164. HG=hg+deltahg        'a manual variation in vacuum
  165.  
  166. 'percent increase in heat rate, from GE curves
  167. PERHRR=(((D4*HG+D3)*HG+D2)*HG+D1)*HG+D0   'percent increase in heat rate
  168. PERLOAD=-PERHRR*100/(100+PERHRR)        'percent load change
  169. NEFF=3415/(HRATE*(1+PERHRR/100))        'at inlet water temp
  170. TSTMWT=(MWE+MWE*PERLOAD/100)/NEFF        'trial thermal output at inlet water temp
  171. TSTHRR=(TSTMWT-(MWE+MWE*PERLOAD/100))*3415E3    'trial btu/hr rejected at Tin.
  172.  
  173. PERCHG=100*(TSTHRR-HRR)/HRR
  174.  
  175. HRR=TSTHRR    'save TSTHRR as HRR for next iteration if necessary.
  176. IF ABS(PERCHG)>.1 THEN LBL7    'if difference not small enough, repeat loop
  177. TSTDT=HRR/(489.8*GPM)        'for Tin
  178. TOUT=TIN+TSTDT
  179.  
  180. LBL9:
  181. QRECIRC=(GPM+SWGPM)*BWASH
  182. QOUT=GPM+SWGPM-QRECIRC    'amount of water discharged out tunnel
  183. TMIX=(GPM*TOUT+SWGPM*(SWDT+OCEAN))/(GPM+SWGPM)    'mixed temp leaving
  184. TSTTIN=(QRECIRC*TMIX+(GPM-QRECIRC)*OCEAN)/GPM
  185. PERCHG=100*(TSTTIN-TIN)/TIN
  186. TIN=TSTTIN
  187. IF ABS(PERCHG)>.1 THEN LBL6
  188.  
  189. DTOCEAN=TMIX-OCEAN
  190.  
  191. LBL9A:
  192. MWE=MWE*(1+PERLOAD/100)
  193. valueday = (mwe)*mwhrcost*24
  194. valuechg = (mwe-basemwe)*mwhrcost*24
  195. IF flag1=0 THEN GOSUB freeze
  196. HRR=3415/NEFF
  197.  
  198. STM=(((STMD)*PWR+STMC)*PWR+STMB)*PWR+STMA
  199. 'SV=((((((16.037)*HG-252.96)*HG+1588.3)*HG-5077.6)*HG+8786.5)*HG-8102.03)*HG+3677.4
  200. 'CVEL=SQR(SV*32.17*144*1.329*HG/2.036)
  201.  
  202. IF HG<2.5 THEN hgflag=0        'condenser normal operation
  203. IF HG>2.5 THEN hgflag=1        'above recommemded limit
  204. IF HG>3.81 THEN hgflag=2    'condenser high pressure alarm at 26" vac
  205. IF HG>7 THEN hgflag=3       'reactor scram at 23" vac
  206. IF (tout>=75 AND tstdt>=30) OR (tout<75 AND tstdt>=32) THEN    dtflag=1 ELSE dtflag=0     'NPDES DT limit
  207. IF tout>102 THEN toutflag=1 ELSE toutflag=0        'NPDES temperature limit
  208.  
  209. LOCATE 1,5
  210.     COLOR 13: PRINT "=======  PILGRIM NUCLEAR POWER STATION STEAM SYSTEM SIMULATOR  ======= ";
  211. LOCATE 3,7
  212.     COLOR 10: PRINT "------ INPUT DATA ------"
  213. LOCATE 3,45
  214.     PRINT "------ OUTPUT DATA -------"
  215.  
  216. COLOR 7
  217. LOCATE 5,5
  218.     PRINT "Reactor power level (.%) ";:COLOR 10:PRINT USING "#.###";pwr
  219. LOCATE 6,8
  220.     COLOR 10: PRINT "F1 ";
  221.     COLOR 7: PRINT "-0.1%   ";
  222.     COLOR 10: PRINT "F2 ";
  223.     COLOR 7: PRINT "+0.1%";
  224.  
  225. LOCATE 8,5
  226.     PRINT "Circ Pumps flow (gpm)  ";:COLOR 10:PRINT USING "###,###";gpm
  227. LOCATE 9,8
  228.     COLOR 10: PRINT "F3 ";
  229.     COLOR 7: PRINT "-1%     ";
  230.     COLOR 10: PRINT "F4 ";
  231.     COLOR 7: PRINT "+1%";
  232.  
  233. LOCATE 11,5
  234.     PRINT "Ocean intake water (F)   ";:COLOR 10:PRINT USING "###.#";ocean
  235. LOCATE 12,8
  236.     COLOR 10: PRINT "F5 ";
  237.     COLOR 7: PRINT "-0.5 F  ";
  238.     COLOR 10: PRINT "F6 ";
  239.     COLOR 7: PRINT "+0.5 F";
  240.  
  241. LOCATE 14,5
  242.     PRINT "Cond. cleanliness (.%)    ";:COLOR 10:PRINT USING "#.##";clean
  243. LOCATE 15,8
  244.     COLOR 10: PRINT "F7 ";
  245.     COLOR 7: PRINT "-0.1    ";
  246.     COLOR 10: PRINT "F8 ";
  247.     COLOR 7: PRINT "+0.1";
  248.  
  249. LOCATE 17,5
  250.     PRINT "Pump recirculation (.%)   ";:COLOR 10:PRINT USING "#.##";bwash
  251. LOCATE 18,8
  252.     COLOR 10: PRINT "F9 ";
  253.     COLOR 7: PRINT "-0.01   ";
  254.     COLOR 10: PRINT "F10 ";
  255.     COLOR 7: PRINT "+0.01";
  256.  
  257. LOCATE 20,7
  258.     COLOR 10: PRINT "Alt-H,J  ";
  259.     COLOR 7: PRINT "Help files";
  260. LOCATE 21,7
  261.     COLOR 10: PRINT "Alt-1   ";
  262.     COLOR 7: PRINT "Zero gain/loss $ ";
  263. LOCATE 22,7
  264.     COLOR 10: PRINT "Alt-C   ";
  265.     COLOR 7: PRINT "Reset design parameters";
  266. LOCATE 23,7
  267.     COLOR 10: PRINT "Alt-X   ";
  268.     COLOR 7: PRINT "Exit ";
  269.  
  270. LOCATE 5,40
  271.     PRINT "Steam Plant:"
  272. LOCATE 6,45
  273. IF hgflag=3 THEN        'for plant scram
  274.     mwe=0
  275.     hrr=0
  276. END IF
  277.     PRINT "Gross MWE            ";USING "#####,.##";mwe
  278. LOCATE 7,45
  279.     PRINT "Gross HR (btu/kwhr)  ";USING "#####,.##";hrr
  280. LOCATE 8,45
  281.     PRINT "Steam flow (lbm/hr)  ";USING "########,";stm
  282.  
  283. LOCATE 10,40
  284.     PRINT "Condenser:"
  285. LOCATE 11,45
  286.     PRINT "Backpressure (in.Hg)     ";
  287. IF hgflag=1 THEN COLOR 14
  288. IF hgflag=2 THEN COLOR 12
  289. IF hgflag=3 THEN COLOR 28
  290.     PRINT USING "##.##";hg
  291. COLOR 7
  292. LOCATE 12,45
  293.     PRINT "Delta temp F             ";
  294. IF dtflag=1 THEN COLOR 14 ELSE COLOR 7
  295.     PRINT USING "##.##";tstdt
  296. COLOR 7
  297. LOCATE 13,45
  298.     PRINT "Temp out F              ";
  299. IF toutflag=1 THEN COLOR 14 ELSE COLOR 7
  300. PRINT USING "###.##";tout
  301. COLOR 7
  302. LOCATE 14,45
  303.     PRINT "Hotwell dev F           ";USING "##.#";dev
  304.  
  305. LOCATE 16,40
  306.     PRINT "Ocean:"
  307. LOCATE 17,45
  308.     PRINT "Delta temp F            ";USING "###.##";dtocean
  309. LOCATE 18,45
  310.     PRINT "Discharge (gpm)       ";USING "#######,";qout
  311.  
  312. LOCATE 20,40
  313.     PRINT "Value of power per day     ";USING "$######,";valueday
  314. LOCATE 21,40
  315.     PRINT "Gain or loss per day      ";USING "$#######,";valuechg
  316. LOCATE 22,40
  317. IF hgflag=0 THEN COLOR 7: PRINT  "                                     ";
  318. IF hgflag=1 THEN COLOR 14: PRINT "Recommemded condenser in.Hg exceeded.";
  319. IF hgflag=2 THEN COLOR 12: PRINT "Condenser high back pressure alarm.  ";
  320. IF hgflag=3 THEN COLOR 28: PRINT "Reactor SCRAM on condenser pressure. ";
  321. LOCATE 23,40
  322. IF dtflag=0 THEN COLOR 7: PRINT  "                                     ";
  323. IF dtflag=1 THEN COLOR 14: PRINT "NPDES condenser delta temp' exceeded.";
  324. LOCATE 24,40
  325. IF toutflag=0 THEN COLOR 7: PRINT  "                                     ";
  326. IF toutflag=1 THEN COLOR 14: PRINT "NPDES discharge temp' limit exceeded.";
  327. GOTO progloop
  328.  
  329. circup:
  330. gpm=gpm*1.01
  331. RETURN
  332.  
  333. circdown:
  334. gpm=gpm*0.99
  335. RETURN
  336.  
  337. oceanup:
  338. ocean=ocean+0.5
  339. IF ocean > 100 THEN ocean=100
  340. RETURN
  341.  
  342. oceandown:
  343. ocean=ocean-0.5
  344. IF ocean < 29 THEN ocean=29
  345. RETURN
  346.  
  347. powerup:
  348. pwr=pwr+0.001
  349. IF pwr > 1.05 THEN pwr=1.05
  350. RETURN
  351.  
  352. powerdown:
  353. pwr=pwr-0.001
  354. IF pwr < .25 THEN pwr=0.25
  355. RETURN
  356.  
  357. cleaninc:
  358. clean=clean+0.01
  359. IF clean > 1 THEN clean=1
  360. RETURN
  361.  
  362. cleandec:
  363. clean=clean-0.01
  364. IF clean < 0.4 THEN clean=0.4
  365. RETURN
  366.  
  367. bwashinc:
  368. bwash=bwash+0.01
  369. IF bwash > 1 THEN bwash=1
  370. RETURN
  371.  
  372. bwashdec:
  373. bwash=bwash-0.01
  374. IF bwash <= 0 THEN bwash=0.00001
  375. RETURN
  376.  
  377. incdev:
  378. dev=dev+0.1
  379. RETURN
  380.  
  381. decdev:
  382. dev=dev-0.1
  383. IF dev < 0 THEN dev=0
  384. RETURN
  385.  
  386. lossvacuum:
  387. deltahg=deltahg+0.01
  388. RETURN
  389.  
  390. gainvacuum:
  391. deltahg=deltahg-0.01
  392. IF deltahg < 0 then deltahg=0
  393. RETURN
  394.  
  395. resetup:
  396. PWR=1.0
  397. GPM=311000
  398. DTACTUAL=0
  399. BWASH=0.00001
  400. CLEAN=.95
  401. OCEAN=48
  402. OCEANDT=0
  403. SWGPM=10323    'service water nominal pumping flow
  404. SWDT=16        'service water nomional delta temp
  405. DEV=1.5      'deviation from condenser saturated temp
  406. DELTAHG=0    'normal tight condenser
  407. mwhrcost=54    'cost of power $/mwhr
  408. basemwe=0
  409. flag1=0
  410. hgflag=0    'describes backpressure effect on plant
  411. CLS
  412. RETURN
  413.  
  414. freeze:
  415. basemwe=mwe
  416. flag1=1
  417. LOCATE 20,70: PRINT "        ";
  418. CLS
  419. RETURN
  420.  
  421. shutdown:
  422. COLOR 10
  423. LOCATE 25,1
  424.     PRINT "Program ended.";
  425. LOCATE 25,56
  426.     PRINT "(c) M H Krabach, " rev$;
  427. STOP
  428.  
  429. help:
  430. SCREEN 0,0,2,2        'active page 2 and show visual page 2
  431. CLS
  432. LOCATE 2,27
  433.     COLOR 10:PRINT "BRIEF DOCUMENTATION"
  434. PRINT ""
  435. COLOR 7
  436. PRINT "This program is a compact computer model of the Boston Edison Pilgrim"_
  437. "Nuclear Station located on Massachusetts Bay in Plymouth MA.  It can be"_
  438. "used to view the effect of various environmental parameters on the"_
  439. "operation of the plant.  An example would be showing what the effect"_
  440. "of an increasing inlet ocean water temperature would be on the efficiency"_
  441. "of the plant and the dollar value of that change.  This model is based on"_
  442. "actual plant design specifications for the secondary steam plant and the"_
  443. "condenser system.  This model has the ability to couple the results of"_
  444. "the original General Electric heat balances for the Steam System with"_
  445. "industry HEI Standards for condenser performance.  Normally these two"_
  446. "calculations are presented separately.  Combining them gives a better"_
  447. "indication of the plant operation.  Several assumptions are also used:"_
  448. "The service water pumps are operating at 10,323 gpm and with a delta"_
  449. "temperature of 16.0 F. The condenser hotwell is assumed to operate at"_
  450. "1.5 F above the saturated steam temperature. The two circulating water"_
  451. "pumps normally operate between high tide (340,000 gpm) and low tide"_
  452. "(320,000 gpm).  Any user variation outside this range would not be possible"_
  453. "in actual operation, although 1 pump operation would be about 170,000 gpm."_
  454. "The cost (or loss) of power is $54/MWH.  For further information, contact;"_
  455. "Michael Krabach, 747 Nate Whipple Hwy, Cumberland, RI 02864."
  456. COLOR 10
  457. LOCATE 25,50
  458.     PRINT "Space key to return to program";
  459. GOTO waitabit
  460. RETURN
  461.  
  462.  
  463. help2:
  464. SCREEN 0,0,3,3        'active page 2 and show visual page 2
  465. CLS
  466. LOCATE 2,25
  467.     COLOR 10:PRINT "ADDITIONAL DOCUMENTATION"
  468. PRINT ""
  469. COLOR 7
  470. PRINT "Here are a few operational parameters that you can play with in addition "_
  471. "to the input variables as defined by the function keys."_
  472. "                                                             "_
  473. "Alt-2 and Alt-3 (top numeric row) will increase or decrease the hotwell"_
  474. "temperature deviation from the saturation temperature."_
  475. "                                                             "_
  476. "A leak in the condenser can be simulated with a loss of vacuum with Alt-4."_
  477. "Alt-5 will increase the vacuum, but only to its nominal value."_
  478. "                                                             "_
  479. "If misplaced characters appear on the screen, refresh the screen with Alt-R."
  480. COLOR 10
  481. LOCATE 25,50
  482.     PRINT "Space key to return to program";
  483. GOTO waitabit
  484. RETURN
  485.  
  486. waitabit:
  487. a$=INKEY$: IF a$="" THEN waitabit
  488. SCREEN 0,0,0,0        'restore the main program screen
  489. CLS
  490. RETURN
  491.  
  492. finish:
  493. locate 24,1
  494.     print "Unable to compute!"
  495. goto shutdown
  496.  
  497. resetscrn:
  498. cls
  499. RETURN