In t egr a ting Block Diagr am Models in EE S

22.033 Nuclear Syste m s Design Pr oject Ty r e l l Armen t

2 December 2011

Thr e e Divisions

• Functions

• Subpr ogr a ms

• Modules

Functions

• Similar to the thermodynamic functions in fo r m a t

• Ther e ca n only be one v ariable on the le ft ‐ hand side of the equa tion inside the function

A=B X +C (OK)

A ‐ C=B X (NO T OK)

• Only re t u r n s one output

Function F orma t

• FUNCTION fun_name(input_1,input_2,input_3) mus t appear at the to p of the function file

• File mus t end with “END”

• Sa v e the file as a .LIB file

• Use := inside the function ins t ead of =

• To use this function, yo u mus t load it, using the “Load Libr ary ” co m m a n d under the file menu

• In yo u r main script, yo u use these functions the same way as yo u wo u l d an y of the thermo pr operty function, i.e.

X=m y_fun(input_1,input_2,input_3)

Function Ex ample

FUNC TION PSI( T , P, V, Z)

{$PSI This function ret u r n s the specific a v ailability of ste a m in Bt u / l b m a s a function of T [F], P [p sia], V [ft/ sec] and Z [ft]}

h := En thalpy(St e am, T= T , P=P) s := En tr opy(St eam, T= T , P=P)

PSI := (h ‐ 38.05) ‐ 530 * (s 0.0745) + V^2/(2 * 32.17 * 778) + Z/ 778 END

Subpr ogr ams

• Re t u r n as man y outputs as yo u wa nt

• E qua tions do not need to be solv ed e x plicitly

A=B X +C (OK)

A ‐ C=B X (ALSO OK)

• Runs OUT SIDE the main script

• EAC H subpr ogr a m ca n be up to 6000 lines long

Modules

• Same as Subpr ogr a ms in almos t eve r y sense ex c e p t fa s t e r

• Modules ar e run INSIDE the main c ode

• The TO T A L number of lines of c ode (main script + all modules) is limit ed to 6000

Subpr ogr am/Module F orma t

• SUBPR OGRAM SP_e x(input_1,input_2 : output_1,output_2) mus t appear at the to p of the file

• It is possible to not specif y which va r i a b l e s ar e inputs and outputs by using a co m m a ins t ead of a co l o n .

• File mus t end with “END”

• Sa v e file as .LIB and load this libr a ry the same way yo u wo u l d a function

• Yo u ca n writ e all of yo u r subpr ogr a ms/modules at the to p of the main script, then ca l l them la t e r in the pr ogr a m, but fo r yo u r purposes it wo u l d be cleaner to writ e them in separ a t e files.

Subpr ogr am/Module Ex ample

MODULE T es tMe(A , B, X, Y)

X^2+Y^3=A SQR T(X/(Y^2+1))=B

END

CALL T e s tMe(77,1.234,X1 , Y1) CALL T e s tMe(88,2.345,X2 , Y2)

K eep in Mind…

• Mak e sur e tha t yo u r Function/Subpr ogr a ms/Modules ar e all in the same units

• When alt ering yo u r co d e s to be used as subpr ogr a ms/modules, mak e sur e tha t yo u c o mmen t out the har d inputs tha t yo u we r e using. Ther e mus t be enough unknowns to ma t ch the number of equa tions, otherwise the sy s t e m is ov er ‐ c o ns tr ained and EE S will re t u r n ga r b a g e va l u e s !

Block Diagr am In t egr a tion Ex ample

• BW R Rankine cy cle c ooled by a ca s ca d i n g air c onditioning sy s t e m using R134a

• Plan t c onsumes 150 MW fo r oper a tions

• Electricity pr oduced by turbines is exa c t l y c onsumed by the AC sy s t e m c ompr essor s and the par asitic load of the plan t

• Ultima t e hea t sink is under the ocean, and utiliz es na tur a l co n v e c t i o n to c ool the AC c ondenser

BW R Rankine Cy cle

Condenser

E v apor a t or

Condenser

E v apor a t or

Condenser

E v apor a t or

Casc ading AC Syste m

Compr e ssor

Compr e ssor

St a t ion Pa ra s i t i c Load (150 MW)

T2

T1

Compressor Compressor

Steam Separator

Rx

Condenser

E v apor a t or

Condenser

E v apor a t or

OFWH

Condenser

E v apor a t or

Pump 2

Pump 1

MIT OpenCourseWare http://ocw.mit.edu

2 2.033 / 22.33 Nuclear Systems Design Project

Fall 2011

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms .