Parent Directory | Revision Log

Revision **1475** -
(**show annotations**)
(**download**)
(**as text**)

*Mon Jun 4 15:13:28 2007 UTC*
(13 years, 4 months ago)
by *kchittur*

File MIME type: text/x-python

File size: 1324 byte(s)

File MIME type: text/x-python

File size: 1324 byte(s)

1 | import extpy |

2 | |

3 | try: |

4 | from pylab import * |

5 | except: |

6 | pass |

7 | |

8 | from solverreporter import * |

9 | |

10 | def zplot(self): |

11 | |

12 | browser = extpy.getbrowser() |

13 | ioff() |

14 | figure() |

15 | # |

16 | # I have chosen three temperatures |

17 | # |

18 | for T in [190,210,230,250,270,290,310,330,350,370]: |

19 | self.T.setRealValue(T) |

20 | # |

21 | # collect the data for plotting in two sets of arrays (one for X, one for Y) |

22 | # I have two sets here - one for P versus y and other for P versus x |

23 | # |

24 | XX1 = [] |

25 | PP1 = [] |

26 | # |

27 | # change x1 from 0 to 1.0 |

28 | # there has to be a space between "in" and "[" |

29 | # |

30 | |

31 | for P in [10,15,20,25,30,40,50,60,70,80,100,120,140,150,170,190]: |

32 | self.P.setRealValueWithUnits(P,"bar") |

33 | # |

34 | # send the pair of values T x1 to the solver |

35 | # and append the Pressure and y1 (from the solver) to the arrays |

36 | # the x's are also appended |

37 | try: |

38 | browser.sim.solve(browser.solver,SimpleSolverReporter(browser,message="T = %f, P = %f" % (T,P))) |

39 | XX1.append(float(self.Pr)) |

40 | PP1.append(float(self.Z)) |

41 | except: |

42 | browser.reporter.reportError('Failed to solve for P = %f' % P) |

43 | continue |

44 | ## plot the data |

45 | |

46 | plot(XX1,PP1) |

47 | |

48 | hold(1) |

49 | |

50 | ## legend() |

51 | ion() |

52 | show() |

53 | |

54 | extpy.registermethod(zplot) |

55 | #the above method can be called using "EXTERNAL vleplot(self)" in ASCEND. |

56 | # if you want to see the azeotrope clearly, restrict the calculation to one |

57 | # temperature |

john.pye@anu.edu.au | ViewVC Help |

Powered by ViewVC 1.1.22 |