/[ascend]/trunk/models/johnpye/fprops/rankine_fprops.a4c
ViewVC logotype

Diff of /trunk/models/johnpye/fprops/rankine_fprops.a4c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2300 by jpye, Fri Aug 20 05:47:43 2010 UTC revision 2301 by jpye, Sat Aug 21 13:28:35 2010 UTC
# Line 617  METHOD cycle_plot; Line 617  METHOD cycle_plot;
617  END cycle_plot;  END cycle_plot;
618  END rankine_common;  END rankine_common;
619    
620    
621  MODEL rankine_water REFINES rankine_common;  MODEL rankine_water REFINES rankine_common;
622      cd.component :== 'water';      cd.component :== 'water';
623  METHODS  METHODS
624  (* first test case: just some plausible values *)  (* first test case: just some plausible values *)
625  METHOD specify_1;  METHOD on_load;
626      RUN ClearAll;      RUN ClearAll;
627      FIX PU.inlet.p;      RUN default_self;
628      FIX PU.inlet.h;      FIX BO.eta; BO.eta := 1.0;
629      FIX PU.outlet.p;      FIX TU.eta; TU.eta := 0.85;
630      FIX BO.outlet.h;      FIX PU.eta; PU.eta := 0.8;
631      FIX TU.eta;      FIX Wdot; Wdot := 100 {MW};
632      FIX PU.eta;  (*  FIX CO.outlet.p; CO.outlet.p := 10 {kPa};*)
633      FIX BO.eta;      FIX CO.outlet.T; CO.outlet.T := 40 {K} + 273.15 {K};
634      FIX mdot;      FIX CO.outlet.x; CO.outlet.x := 1e-6;
635  END specify_1;      FIX PU.outlet.p; PU.outlet.p := 150 {bar};
636  METHOD values_1;      PU.outlet.p.upper_bound := 150 {bar};
637      PU.inlet.p := 1 {bar};      FIX BO.outlet.T; BO.outlet.T := 580 {K} + 273.15 {K};
638      PU.inlet.h := 104.9 {kJ/kg};  
639      PU.outlet.p := 250 {bar};      SOLVER QRSlv;
640      BO.outlet.h := 3772 {kJ/kg};      OPTION convopt 'RELNOM_SCALE';
641      TU.eta := 0.85;      OPTION iterationlimit 200;
642      PU.eta := 0.65;  END on_load;
643      BO.eta := 0.9;  METHOD set_x_limit;
644      mdot := 900 {t/d};        FREE PU.outlet.p;
645  END values_1;      PU.outlet.p.upper_bound := 150 {bar};
646        FIX TU.outlet.x; TU.outlet.x := 0.9;
647    END set_x_limit;
648  (*  (*
649      second test case: numbers from Example 2.1, K Weston, 'Energy Conversion',      second test case: numbers from Example 2.1, K Weston, 'Energy Conversion',
650      1992, http://www.personal.utulsa.edu/~kenneth-weston/      1992, http://www.personal.utulsa.edu/~kenneth-weston/
# Line 667  METHOD values; Line 670  METHOD values;
670      BO.eta := 1.0;      BO.eta := 1.0;
671      mdot := 900 {t/d};      mdot := 900 {t/d};
672  END values;  END values;
673    (*
674  METHOD on_load;  METHOD on_load;
675      RUN default_self;      RUN default_self;
676      RUN specify;      RUN specify;
# Line 676  METHOD on_load; Line 680  METHOD on_load;
680      OPTION convopt 'RELNOM_SCALE';      OPTION convopt 'RELNOM_SCALE';
681      OPTION iterationlimit 200;      OPTION iterationlimit 200;
682  END on_load;  END on_load;
683    *)
684  METHOD self_test;  METHOD self_test;
685      (* check the results against those from K Weston's book *)      (* check the results against those from K Weston's book *)
686      (* note that we have NOT neglected pump work in this case! *)      (* note that we have NOT neglected pump work in this case! *)
# Line 689  METHOD default_self; Line 694  METHOD default_self;
694      BO.outlet.h := 3000 {kJ/kg}; (* guess *)      BO.outlet.h := 3000 {kJ/kg}; (* guess *)
695      TU.outlet.h := 3000 {kJ/kg}; (* guess *)      TU.outlet.h := 3000 {kJ/kg}; (* guess *)
696      CO.outlet.h := 200 {kJ/kg};      CO.outlet.h := 200 {kJ/kg};
697        CO.outlet.p := 10 {kPa};
698  END default_self;  END default_self;
699  END rankine_water;  END rankine_water;
700    
701  MODEL rankine_co2 REFINES rankine_common;  MODEL rankine_co2 REFINES rankine_common;
702      cd.component :== 'carbondioxide';      cd.component :== 'carbondioxide';
703  METHODS  METHODS
704    METHOD on_load_1;
705        RUN ClearAll;
706        RUN default_self;
707        FIX BO.eta; BO.eta := 1.0;
708        FIX TU.eta; TU.eta := 0.85;
709        FIX PU.eta; PU.eta := 0.8;
710        FIX Wdot; Wdot := 100 {MW};
711        FIX CO.outlet.T; CO.outlet.T := 40 {K} + 273.15 {K};
712        FIX CO.outlet.p; CO.outlet.p := 80 {bar};
713        FIX PU.outlet.p; PU.outlet.p := 150 {bar};
714        FIX BO.outlet.T; BO.outlet.T := 580 {K} + 273.15 {K};
715    
716        SOLVER QRSlv;
717        OPTION convopt 'RELNOM_SCALE';
718        OPTION iterationlimit 200;
719    END on_load_1;
720  METHOD on_load;  METHOD on_load;
721      RUN ClearAll;      RUN ClearAll;
722      RUN default_self;      RUN default_self;
723      FIX BO.eta; BO.eta := 1.0;      FIX BO.eta; BO.eta := 1.0;
724      FIX TU.eta; TU.eta := 1.0;      FIX TU.eta; TU.eta := 0.85;
725      FIX PU.eta; PU.eta := 1.0;      FIX PU.eta; PU.eta := 0.8;
726      FIX Wdot; Wdot := 100 {MW};      FIX Wdot; Wdot := 100 {MW};
727      FIX CO.outlet.p; CO.outlet.p := 5.2 {bar};      FIX CO.outlet.T; CO.outlet.T := 10 {K} + 273.15 {K};
728      FIX CO.outlet.x; CO.outlet.x := 1e-6;      FIX CO.outlet.x; CO.outlet.x := 1e-6;
729      FIX PU.outlet.p; PU.outlet.p := 150 {bar};      FIX PU.outlet.p; PU.outlet.p := 150 {bar};
730      FIX BO.outlet.T; BO.outlet.T := 580 {K} + 273.15 {K};      FIX BO.outlet.T; BO.outlet.T := 580 {K} + 273.15 {K};
# Line 716  METHOD default_self; Line 738  METHOD default_self;
738      BO.outlet.h := 350 {kJ/kg}; (* guess *)      BO.outlet.h := 350 {kJ/kg}; (* guess *)
739      TU.outlet.h := 1000 {kJ/kg}; (* guess *)      TU.outlet.h := 1000 {kJ/kg}; (* guess *)
740      CO.outlet.h := 350 {kJ/kg};      CO.outlet.h := 350 {kJ/kg};
741        CO.outlet.p := 60 {bar};
742        CO.outlet.p.lower_bound := 5.2 {bar};
743  END default_self;  END default_self;
744  END rankine_co2;  END rankine_co2;
745    
# Line 726  METHOD on_load; Line 750  METHOD on_load;
750      RUN ClearAll;      RUN ClearAll;
751      RUN default_self;      RUN default_self;
752      FIX BO.eta; BO.eta := 1.0;      FIX BO.eta; BO.eta := 1.0;
753      FIX TU.eta; TU.eta := 1.0;      FIX TU.eta; TU.eta := 0.85;
754      FIX PU.eta; PU.eta := 1.0;      FIX PU.eta; PU.eta := 0.8;
755      FIX Wdot; Wdot := 100 {MW};      FIX Wdot; Wdot := 100 {MW};
756      FIX CO.outlet.p; CO.outlet.p := 10 {bar};      FIX CO.outlet.T; CO.outlet.T := 40 {K} + 273.15 {K};
757      FIX CO.outlet.h; CO.outlet.h := 500 {kJ/kg}; (*temporary *)      FIX CO.outlet.x; CO.outlet.x := 1e-6;
758      FIX PU.outlet.p; PU.outlet.p := 150 {bar};      FIX PU.outlet.p; PU.outlet.p := 150 {bar};
759      FIX BO.outlet.T; BO.outlet.T := 300 {K} + 273.15 {K};      FIX BO.outlet.T; BO.outlet.T := 580 {K} + 273.15 {K};
760    
761      SOLVER QRSlv;      SOLVER QRSlv;
762      OPTION convopt 'RELNOM_SCALE';      OPTION convopt 'RELNOM_SCALE';
# Line 747  METHOD default_self; Line 771  METHOD default_self;
771      PU.inlet.h := 400 {kJ/kg};      PU.inlet.h := 400 {kJ/kg};
772      BO.outlet.h := 400 {kJ/kg};      BO.outlet.h := 400 {kJ/kg};
773      CO.outlet.h := 400 {kJ/kg};      CO.outlet.h := 400 {kJ/kg};
774        CO.outlet.p := 10 {kPa};
775  END default_self;  END default_self;
776  END rankine_toluene;  END rankine_toluene;
777    
778    
779    
780    MODEL rankine_ammonia REFINES rankine_common;
781        cd.component :== 'ammonia';
782    METHODS
783    METHOD on_load;
784        RUN ClearAll;
785        RUN default_self;
786        FIX BO.eta; BO.eta := 1.0;
787        FIX TU.eta; TU.eta := 0.85;
788        FIX PU.eta; PU.eta := 0.8;
789        FIX Wdot; Wdot := 100 {MW};
790        FIX CO.outlet.T; CO.outlet.T := 40 {K} + 273.15 {K};
791        FIX CO.outlet.x; CO.outlet.x := 1e-6;
792        FIX PU.outlet.p; PU.outlet.p := 150 {bar};
793        FIX BO.outlet.T; BO.outlet.T := 580 {K} + 273.15 {K};
794    
795        SOLVER QRSlv;
796        OPTION convopt 'RELNOM_SCALE';
797        OPTION iterationlimit 200;
798    
799        FREE CO.outlet.h;
800        FIX CO.outlet.x; CO.outlet.x := 1e-6;
801    
802    END on_load;
803    METHOD default_self;
804        RUN rankine_common::default_self;
805        PU.inlet.h := 400 {kJ/kg};
806        BO.outlet.h := 400 {kJ/kg};
807        CO.outlet.h := 400 {kJ/kg};
808        CO.outlet.p := 10 {kPa};
809    END default_self;
810    END rankine_ammonia;
811    
812    
813    
814  (*------------------------------------------------------------------------------  (*------------------------------------------------------------------------------
815    REHEAT RANKINE CYCLE    REHEAT RANKINE CYCLE
816  *)  *)
# Line 842  METHOD default_self; Line 901  METHOD default_self;
901  END default_self;  END default_self;
902  END rankine_reheat_water;  END rankine_reheat_water;
903    
   
 (*------------------------------------------------------------------------------  
   REGENERATIVE RANKINE CYCLE  
 *)  
 (*  
     Add a boiler feedwater heater and two-stage turbine.  
 *)  
 MODEL rankine_regen;  
   
     BO IS_A boiler_simple;  
     TU1 IS_A turbine_simple;  
     BL IS_A tee; (* bleed *)  
     TU2 IS_A turbine_simple;  
     CO IS_A condenser_simple;  
     HE IS_A heater_open;  
     PU1 IS_A pump_simple;  
     PU2 IS_A pump_simple;  
   
     BO.cd.component :== 'water';  
   
     (* main loop *)  
     BO.outlet, TU1.inlet ARE_THE_SAME;  
     TU1.outlet, BL.inlet ARE_THE_SAME;  
     BL.outlet, TU2.inlet ARE_THE_SAME;  
     TU2.outlet, CO.inlet ARE_THE_SAME;  
     CO.outlet, PU1.inlet ARE_THE_SAME;  
     PU1.outlet, HE.inlet ARE_THE_SAME;  
     HE.outlet, PU2.inlet ARE_THE_SAME;  
     PU2.outlet, BO.inlet ARE_THE_SAME;  
   
     (* bleed stream *)  
     BL.outlet_branch, HE.inlet_heat ARE_THE_SAME;  
     phi ALIASES BL.phi;  
     p_bleed ALIASES TU1.outlet.p;  
   
     p_bleed_ratio IS_A fraction;  
     p_bleed_ratio * (TU1.inlet.p - TU2.outlet.p) = (TU1.outlet.p - TU2.outlet.p);  
       
     mdot ALIASES BO.mdot;  
   
     T_H ALIASES BO.outlet.T;  
     T_C ALIASES CO.outlet.T;  
   
     eta IS_A fraction;  
     eta_eq:eta * (BO.Qdot_fuel) = TU1.Wdot + TU2.Wdot + PU1.Wdot + PU2.Wdot;  
   
     Wdot_TU1 ALIASES TU1.Wdot;  
     Wdot_TU2 ALIASES TU2.Wdot;  
     Wdot_PU1 ALIASES PU1.Wdot;  
     Wdot_PU2 ALIASES PU2.Wdot;  
     Qdot_fuel ALIASES BO.Qdot_fuel;  
   
     eta_carnot IS_A fraction;  
     eta_carnot_eq: eta_carnot = 1 - T_C / T_H;  
   
     (* some checking output... *)  
   
     phi_weston IS_A fraction;  
     phi_weston_eq:phi_weston * (TU1.outlet.h - PU1.outlet.h) = (PU2.inlet.h - PU1.outlet.h);  
     phi_eq:phi_weston = phi;  
   
     w_net IS_A positive_specific_work;  
     w_net_eq: TU1.mdot * w_net = TU1.mdot * (TU1.inlet.h - TU1.outlet.h) + TU2.mdot * (TU2.inlet.h - TU2.outlet.h);  
   
     q_a IS_A specific_energy;  
     q_a_eq: q_a = TU1.inlet.h - PU2.outlet.h;  
   
     Wdot IS_A energy_rate;  
     Wdot_eq: Wdot = TU1.Wdot + TU2.Wdot + PU1.Wdot + PU2.Wdot;  
   
     cons_en: HE.inlet.mdot * HE.inlet.h + HE.inlet_heat.mdot * HE.inlet_heat.h = HE.outlet.mdot * HE.outlet.h;  
   
 METHODS  
 METHOD default_self;  
     RUN BO.default_self;  
     RUN TU1.default_self;  
     RUN TU2.default_self;  
     RUN CO.default_self;  
     RUN PU1.default_self;  
     RUN PU2.default_self;  
     BO.outlet.h := 4000 {kJ/kg};  
     p_bleed := 37 {bar};  
     TU1.outlet.h := 2300 {kJ/kg};  
     BL.cons_mass.included := FALSE;  
     (*HE.cons_mass.included := FALSE;*)  
     HE.cons_en.included := FALSE;  
     cons_en.included := FALSE;  
     HE.inlet.v := 100 {m^3/kg};  
     HE.inlet.p.nominal := 40 {bar};  
     HE.inlet.v.nominal := 1 {L/kg};  
     HE.inlet.h.nominal := 100 {kJ/kg};  
 END default_self;  
 METHOD on_load;  
     RUN moran_ex_8_5;  
 (*  
     This model needs to be solved using QRSlv with convopt set to 'RELNOMSCALE'.  
 *)  
     SOLVER QRSlv;  
     OPTION convopt 'RELNOM_SCALE';  
     OPTION iterationlimit 400;  
 END on_load;  
 METHOD moran_ex_8_5;  
     RUN default_self;  
     (*  
         This is Example 8.5 from Moran and Shapiro, 'Fundamentals of  
         Engineering Thermodynamics', 4th Ed.  
     *)  
     RUN ClearAll;  
     (* component efficiencies *)  
     FIX BO.eta;  BO.eta := 1.0;  
     FIX TU1.eta; TU1.eta := 0.85;  
     FIX TU2.eta; TU2.eta := 0.85;  
     FIX PU1.eta; PU1.eta := 1.0;  
     FIX PU2.eta; PU2.eta := 1.0;  
     (* turbine conditions *)  
     FIX TU1.inlet.p; TU1.inlet.p := 8. {MPa};  
     FIX TU1.inlet.T; TU1.inlet.T := 480 {K} + 273.15 {K};  
     FIX TU1.outlet.p; TU1.outlet.p := 0.7 {MPa};  
     FIX TU2.outlet.p; TU2.outlet.p := 0.008 {MPa};  
     (* heater conditions *)  
     (* FIX HE.outlet.p; HE.outlet.p := 0.7 {MPa}; *)  
     FIX CO.outlet.x; CO.outlet.x := 0.0001;  
     FIX HE.outlet.x; HE.outlet.x := 0.0001;  
     FIX Wdot; Wdot := 100 {MW};  
 END moran_ex_8_5;    
 METHOD self_test;  
     (* solution values to the Moran & Shapiro example 8.5 problem *)  
     ASSERT abs(eta - 0.369) < 0.001;  
     ASSERT abs((TU1.Wdot+TU2.Wdot)/mdot - 984.4{kJ/kg}) < 1 {kJ/kg};  
     ASSERT abs(mdot - 3.69e5 {kg/h}) < 0.05e5 {kg/h};  
     ASSERT abs(CO.inlet.h - 2249.3 {kJ/kg}) < 1.0 {kJ/kg};  
 END self_test;  
 METHOD weston_ex_2_6;  
     (*  
         The scenario here is example 2.6 from K Weston (op. cit.), p. 55.  
     *)  
     RUN ClearAll;  
   
     (* all ideal components *)  
     FIX BO.eta;  BO.eta := 1.0;  
     FIX TU1.eta; TU1.eta := 1.0;  
     FIX TU2.eta; TU2.eta := 1.0;  
     FIX PU1.eta; PU1.eta := 1.0;  
     FIX PU2.eta; PU2.eta := 1.0;  
   
     (* mass flow rate is arbitrary *)  
     FIX mdot;  
     mdot := 10 {kg/s};  
       
     (* max pressure constraint *)  
     FIX PU2.outlet.p;  
     PU2.outlet.p := 2000 {psi};  
     PU2.outlet.h := 1400 {btu/lbm}; (* guess *)  
   
     (* boiler max temp *)  
     FIX BO.outlet.T;  
     BO.outlet.T := 1460 {R};  
     BO.outlet.h := 1400 {btu/lbm}; (* guess *)  
   
     (* intermediate temperature setting *)  
     FIX TU1.outlet.p;  
     TU1.outlet.p := 200 {psi};  
     (* FIX TU1.outlet.T;  
     TU1.outlet.T := 860 {R}; (* 400 °F *)  
     TU1.outlet.h := 3000 {kJ/kg}; (* guess *) *)  
   
     (* minimum pressure constraint *)  
     FIX CO.outlet.p;  
     CO.outlet.p := 1 {psi};  
   
     (* condenser outlet is saturated liquid *)  
     FIX CO.outlet.h;  
     CO.outlet.h := 69.73 {btu/lbm};  
   
     (* remove the redundant balance equations *)  
     HE.cons_mass.included := TRUE;  
     HE.cons_en.included := TRUE;  
     BL.cons_mass.included := FALSE;  
     phi_weston_eq.included := TRUE;  
     phi_eq.included := FALSE;  
     cons_en.included := FALSE;  
   
     (* fix the bleed ratio *)  
     FIX BL.phi;  
     BL.phi := 0.251;  
   
     (* FIX BL.outlet.h;  
     BL.outlet.h := 355.5 {btu/lbm}; *)  
   
 (**  
     these values seem to be from another problem, need to check which ...  
     ASSERT abs(TU1.inlet.s - 1.5603 {btu/lbm/R}) < 0.01 {btu/lbm/R};  
     ASSERT abs(TU1.outlet.s - 1.5603 {btu/lbm/R}) < 0.01 {btu/lbm/R};  
     ASSERT abs(TU2.outlet.s - 1.5603 {btu/lbm/R}) < 0.01 {btu/lbm/R};  
     ASSERT abs(PU1.inlet.s - 0.1326 {btu/lbm/R}) < 0.001 {btu/lbm/R};  
     ASSERT abs(PU1.outlet.s - 0.1326 {btu/lbm/R}) < 0.002 {btu/lbm/R};  
     ASSERT abs(PU2.inlet.s - 0.5438 {btu/lbm/R}) < 0.002 {btu/lbm/R};  
     ASSERT abs(PU2.outlet.s - 0.5438 {btu/lbm/R}) < 0.002 {btu/lbm/R};  
   
     ASSERT abs(TU1.inlet.h - 1474.1 {btu/lbm}) < 1.5 {btu/lbm};  
     ASSERT abs(TU1.outlet.h - 1210.0 {btu/lbm}) < 1.5 {btu/lbm};  
     ASSERT abs(TU2.outlet.h - 871.0 {btu/lbm}) < 1.5 {btu/lbm};  
     ASSERT abs(PU1.inlet.h - 69.73 {btu/lbm}) < 0.001 {btu/lbm};  
     ASSERT abs(PU1.outlet.h - 69.73 {btu/lbm}) < 1.0 {btu/lbm};  
     ASSERT abs(PU2.inlet.h - 355.5 {btu/lbm}) < 1.5 {btu/lbm};  
     ASSERT abs(PU2.outlet.h - 355.5 {btu/lbm}) < 8 {btu/lbm};  
   
     ASSERT abs(w_net - 518.1 {btu/lbm}) < 0.3 {btu/lbm};  
   
     ASSERT abs(w_net * mdot - (TU1.Wdot + TU2.Wdot)) < 1 {W};  
   
     ASSERT abs(q_a - 1118.6 {btu/lbm}) < 7 {btu/lbm};  
   
     ASSERT abs(eta - 0.463) < 0.003;  
   
     ASSERT abs(phi - 0.251) < 0.001;  
 *)    
 END weston_ex_2_6;  
 END rankine_regen;  
   

Legend:
Removed from v.2300  
changed lines
  Added in v.2301

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22