/[ascend]/trunk/models/johnpye/iapws95.a4c
ViewVC logotype

Diff of /trunk/models/johnpye/iapws95.a4c

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

revision 107 by johnpye, Mon Dec 12 14:18:25 2005 UTC revision 108 by johnpye, Tue Dec 13 05:53:20 2005 UTC
# Line 66  MODEL thermo_state; Line 66  MODEL thermo_state;
66      w IS_A speed;      w IS_A speed;
67  END thermo_state;  END thermo_state;
68            
69  MODEL iapws95 REFINES thermo_state;  MODEL iapws95_1phase REFINES thermo_state;
70    
71      delta IS_A positive_variable;      delta IS_A positive_variable;
72      tau IS_A positive_variable;      tau IS_A positive_variable;
# Line 497  METHOD values; Line 497  METHOD values;
497      rho := 838.025 {kg/m^3};      rho := 838.025 {kg/m^3};
498  END values;  END values;
499    
500  END iapws95;  END iapws95_1phase;
501    
502  MODEL iapws_saturation_curves;  MODEL iapws_sat_curves;
503    
504      rhof IS_A mass_density;      rhof IS_A mass_density;
505      rhog IS_A mass_density;      rhog IS_A mass_density;
# Line 510  MODEL iapws_saturation_curves; Line 510  MODEL iapws_saturation_curves;
510      rhoc :== 322 {kg/m^3};      rhoc :== 322 {kg/m^3};
511      Tc :== 647.096 {K};      Tc :== 647.096 {K};
512    
513      tau IS_A positive_variable;      tau IS_A factor;
514    
515      tau = 1 - T/Tc;      tau = 1 - T/Tc;
516    
# Line 568  METHOD test_3; Line 568  METHOD test_3;
568      T := 647.096 {K};      T := 647.096 {K};
569  END test_3;  END test_3;
570    
571  END iapws_saturation_curves;  END iapws_sat_curves;
572    
573  MODEL iapws95_sat REFINES thermo_state;  MODEL iapws95_2phase REFINES thermo_state;
574      Sf IS_A iapws95;      Sf IS_A iapws95_1phase;
575      Sg IS_A iapws95;      Sg IS_A iapws95_1phase;
576      sat IS_A iapws_saturation_curves;      sat IS_A iapws_sat_curves;
577      sat.rhof, Sf.rho ARE_THE_SAME;      sat.rhof, Sf.rho ARE_THE_SAME;
578      sat.rhog, Sg.rho ARE_THE_SAME;      sat.rhog, Sg.rho ARE_THE_SAME;
579      Sf.T, Sg.T, sat.T ARE_THE_SAME;      Sf.T, Sg.T, sat.T ARE_THE_SAME;
# Line 582  MODEL iapws95_sat REFINES thermo_state; Line 582  MODEL iapws95_sat REFINES thermo_state;
582      T, Sf.T ARE_THE_SAME;      T, Sf.T ARE_THE_SAME;
583      p, Sf.p ARE_THE_SAME;      p, Sf.p ARE_THE_SAME;
584    
585      x IS_A factor;      x IS_A fraction;
586    
587      rhog*rhof = rho*rhog + rho*(rhof - rhog) *x;      rhog*rhof = rho*rhog + rho*(rhof - rhog) *x;
588    
# Line 611  METHOD values; Line 611  METHOD values;
611      x := 0.5;      x := 0.5;
612  END values;  END values;
613            
614  END iapws95_sat;          END iapws95_2phase;    
615    
616    MODEL iapws95 REFINES thermo_state;
617        S1 IS_A iapws95_1phase;
618        S2 IS_A iapws95_2phase;
619        sat IS_A iapws_sat_curves;
620    
621        T, sat.T, S1.T, S2.T ARE_THE_SAME;
622        rho, S1.rho, S2.rho ARE_THE_SAME;
623        h, S1.h, S2.h ARE_THE_SAME;
624        u, S1.u, S2.u ARE_THE_SAME;
625        p, S1.p, S2.p ARE_THE_SAME;
626        s, S1.s, S2.s ARE_THE_SAME;
627        cp, S1.cp, S2.cp ARE_THE_SAME;
628        cv, S1.cv, S2.cv ARE_THE_SAME;
629        w, S1.w, S2.w ARE_THE_SAME;
630    
631        CONDITIONAL
632            sub_test: rho >= sat.rhof;
633            super_test: rho <= sat.rhog;
634            sat1_test: rho < sat.rhof;
635            sat2_test: rho > sat.rhog;
636        END CONDITIONAL;
637    
638        issat IS_A boolean_var;
639        saturation_expr: issat == SATISFIED(sat1_test);
640        issub IS_A boolean_var;
641        subcooled_expr: issub == SATISFIED(sub_test);
642        issuper IS_A boolean_var;
643        superheated_expr: issuper == SATISFIED(super_test);
644        
645        saturation_when: WHEN (issat)
646            CASE TRUE:
647                USE S2;
648            CASE FALSE:
649                USE S1;
650        END WHEN;
651    
652    METHODS
653    METHOD default_self;
654        RUN ClearAll;
655        RUN specify;
656        RUN values;
657    END default_self;
658    
659    METHOD specify;
660        T.fixed := TRUE;
661        rho.fixed := TRUE;
662    END specify;
663    
664    METHOD values;
665        (* fixed vars *)
666        T := 300 {K};
667        rho := 100 {kg/m^3};
668        (* initial values *)
669        issat := TRUE;
670        issuper := FALSE;
671        issub := FALSE;
672        p := 1 {atm};
673        h := 400 {kJ/kg};
674    END values;
675    
676    END iapws95;

Legend:
Removed from v.107  
changed lines
  Added in v.108

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