1 /*
2 This unit takes more than two input streams and merge them in one
3 output stream. The pressure must be specified by the user, and the
4 temperature of the output stream is computed.
5 
6 Structure in the .process file:
7 mix {name} {pressure} {nb_in} {indexes of input streams} {index of output stream}
8 
9 How to use:
10    1- Call the constructor: mix1 = new mix(nb_in, list1_in, out);
11    2- Set the operating pressure : mix1->set(P);
12    3- Set the name of the unit: mix1->set(name);
13    4- Solve: bool=mix1->solve();
14 */
15 #ifndef MIX_H
16 #define MIX_H
17 
18 #include "stream.hpp"
19 #include "bissection.hpp"
20 using namespace std;
21 
22 class mix {
23  private:
24   int i, j;
25   bool success;
26   bissection<mix> *solver;
27   string name;
28   int nb_in;			//number of input streams
29   stream **in;		//list pointers to input streams
30   stream *out;		//pointer to output stream
31   // double min, max;
32 
33  public:
34   double P, T;			//pressure (given) and temperature (unknown)
mix()35   mix(){P=0.0;}
36   mix(int, stream**, stream*);		//defines the connectivities of this unit
~mix()37   ~mix(){delete solver;}
set(double p)38   void set(double p) {P=p;}
set(const string & n)39   void set ( const string & n ) { name = n; }
40   double f(double); //returns the function to the solver
41   bool solve();     //finds the temperature and computes mass balance
42   void write();
43 };
44 #endif
45