@@ -23,27 +23,156 @@ public class StreamResponse {
23
23
public Double massflowGas ;
24
24
public Double massflowOil ;
25
25
public Double massflowAqueous ;
26
- public HashMap <String , Value > data = new HashMap <String , Value >();
26
+ public HashMap <String , HashMap <String , Value >> properties =
27
+ new HashMap <String , HashMap <String , Value >>();
28
+ public HashMap <String , HashMap <String , Value >> conditions =
29
+ new HashMap <String , HashMap <String , Value >>();
30
+ public HashMap <String , HashMap <String , Value >> composition =
31
+ new HashMap <String , HashMap <String , Value >>();
27
32
28
33
/**
29
34
* <p>
30
35
* Constructor for StreamResponse.
31
36
* </p>
32
37
*
33
- * @param inputStream a
34
- * {@link neqsim.processSimulation.processEquipment.stream.StreamInterface}
35
- * object
38
+ * @param inputStream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface}
39
+ * object
36
40
*/
37
41
public StreamResponse (StreamInterface inputStream ) {
38
42
39
43
name = inputStream .getName ();
40
44
41
- data .put ("temperature" ,
42
- new Value (Double .toString (inputStream .getTemperature (neqsim .util .unit .Units .getSymbol ("temperature" ))),
45
+ HashMap <String , Value > newdata = new HashMap <String , Value >();
46
+ newdata .put ("temperature" ,
47
+ new Value (
48
+ Double .toString (
49
+ inputStream .getTemperature (neqsim .util .unit .Units .getSymbol ("temperature" ))),
43
50
neqsim .util .unit .Units .getSymbol ("temperature" )));
44
- data .put ("pressure" ,
45
- new Value (Double .toString (inputStream .getPressure (neqsim .util .unit .Units .getSymbol ("pressure" ))),
51
+ newdata .put ("pressure" ,
52
+ new Value (
53
+ Double .toString (inputStream .getPressure (neqsim .util .unit .Units .getSymbol ("pressure" ))),
46
54
neqsim .util .unit .Units .getSymbol ("pressure" )));
55
+ newdata .put ("molar flow" ,
56
+ new Value (
57
+ Double
58
+ .toString (inputStream .getFlowRate (neqsim .util .unit .Units .getSymbol ("molar flow" ))),
59
+ neqsim .util .unit .Units .getSymbol ("molar flow" )));
60
+ newdata .put ("mass flow" ,
61
+ new Value (
62
+ Double .toString (inputStream .getFlowRate (neqsim .util .unit .Units .getSymbol ("mass flow" ))),
63
+ neqsim .util .unit .Units .getSymbol ("mass flow" )));
64
+ newdata .put ("fluid model" , new Value (inputStream .getFluid ().getModelName (), "" ));
65
+ newdata .put ("enthalpy" ,
66
+ new Value (
67
+ Double .toString (
68
+ inputStream .getFluid ().getEnthalpy (neqsim .util .unit .Units .getSymbol ("enthalpy" ))),
69
+ neqsim .util .unit .Units .getSymbol ("enthalpy" )));
70
+ conditions .put (name , newdata );
71
+
72
+ for (int i = 0 ; i < inputStream .getFluid ().getNumberOfPhases (); i ++) {
73
+ String name = inputStream .getFluid ().getPhase (i ).getPhaseTypeName ();
74
+ newdata = new HashMap <String , Value >();
75
+ newdata .put ("temperature" ,
76
+ new Value (
77
+ Double .toString (inputStream .getFluid ().getPhase (name )
78
+ .getTemperature (neqsim .util .unit .Units .getSymbol ("temperature" ))),
79
+ neqsim .util .unit .Units .getSymbol ("temperature" )));
80
+ newdata .put ("pressure" ,
81
+ new Value (
82
+ Double .toString (inputStream .getFluid ().getPhase (name )
83
+ .getPressure (neqsim .util .unit .Units .getSymbol ("pressure" ))),
84
+ neqsim .util .unit .Units .getSymbol ("pressure" )));
85
+ newdata .put ("molar flow" ,
86
+ new Value (
87
+ Double .toString (inputStream .getFluid ().getPhase (name )
88
+ .getFlowRate (neqsim .util .unit .Units .getSymbol ("molar flow" ))),
89
+ neqsim .util .unit .Units .getSymbol ("molar flow" )));
90
+ newdata .put ("mass flow" ,
91
+ new Value (
92
+ Double .toString (inputStream .getFluid ().getPhase (name )
93
+ .getFlowRate (neqsim .util .unit .Units .getSymbol ("mass flow" ))),
94
+ neqsim .util .unit .Units .getSymbol ("mass flow" )));
95
+ newdata .put ("fluid model" , new Value (inputStream .getFluid ().getModelName (), "" ));
96
+ newdata .put ("enthalpy" ,
97
+ new Value (
98
+ Double .toString (inputStream .getFluid ().getPhase (name )
99
+ .getEnthalpy (neqsim .util .unit .Units .getSymbol ("enthalpy" ))),
100
+ neqsim .util .unit .Units .getSymbol ("enthalpy" )));
101
+ conditions .put (name , newdata );
102
+ }
103
+
104
+
105
+ newdata = new HashMap <String , Value >();
106
+ for (int i = 0 ; i < inputStream .getFluid ().getNumberOfComponents (); i ++) {
107
+ newdata .put (inputStream .getFluid ().getComponent (i ).getComponentName (), new Value (
108
+ Double .toString (inputStream .getFluid ().getComponent (i ).getz ()), "mole fraction" ));
109
+ }
110
+ composition .put (name , newdata );
111
+ for (int j = 0 ; j < inputStream .getFluid ().getNumberOfPhases (); j ++) {
112
+ newdata = new HashMap <String , Value >();
113
+ for (int i = 0 ; i < inputStream .getFluid ().getNumberOfComponents (); i ++) {
114
+ newdata .put (inputStream .getFluid ().getPhase (j ).getComponent (i ).getComponentName (),
115
+ new Value (Double .toString (inputStream .getFluid ().getPhase (j ).getComponent (i ).getx ()),
116
+ "mole fraction" ));
117
+ newdata .put (inputStream .getFluid ().getPhase (j ).getComponent (i ).getComponentName (),
118
+ new Value (Double .toString (inputStream .getFluid ().getPhase (j ).getWtFrac (i )),
119
+ "weight fraction" ));
120
+ composition .put (inputStream .getFluid ().getPhase (j ).getPhaseTypeName (), newdata );
121
+
122
+ }
123
+ }
124
+
125
+
126
+
127
+ newdata = new HashMap <String , Value >();
128
+
129
+ newdata .put ("density" ,
130
+ new Value (
131
+ Double .toString (
132
+ inputStream .getFluid ().getDensity (neqsim .util .unit .Units .getSymbol ("density" ))),
133
+ neqsim .util .unit .Units .getSymbol ("density" )));
134
+
135
+ newdata .put ("molar mass" , new Value (
136
+ Double .toString (
137
+ inputStream .getFluid ().getMolarMass (neqsim .util .unit .Units .getSymbol ("Molar Mass" ))),
138
+ neqsim .util .unit .Units .getSymbol ("Molar Mass" )));
139
+ properties .put (inputStream .getName (), newdata );
140
+
141
+ newdata .put ("flow rate" , new Value (
142
+ Double .toString (
143
+ inputStream .getFluid ().getFlowRate (neqsim .util .unit .Units .getSymbol ("volume flow" ))),
144
+ neqsim .util .unit .Units .getSymbol ("volume flow" )));
145
+ properties .put (inputStream .getName (), newdata );
146
+
147
+
148
+ properties .put (inputStream .getName (), newdata );
149
+
150
+ newdata = new HashMap <String , Value >();
151
+ for (
152
+
153
+ int i = 0 ; i < inputStream .getFluid ().getNumberOfPhases (); i ++) {
154
+ String name = inputStream .getFluid ().getPhase (i ).getPhaseTypeName ();
155
+ newdata .put ("density" ,
156
+ new Value (
157
+ Double .toString (inputStream .getFluid ().getPhase (name )
158
+ .getDensity (neqsim .util .unit .Units .getSymbol ("density" ))),
159
+ neqsim .util .unit .Units .getSymbol ("density" )));
160
+
161
+ newdata .put ("molar mass" ,
162
+ new Value (
163
+ Double .toString (inputStream .getFluid ().getPhase (name )
164
+ .getMolarMass (neqsim .util .unit .Units .getSymbol ("Molar Mass" ))),
165
+ neqsim .util .unit .Units .getSymbol ("Molar Mass" )));
166
+
167
+ newdata .put ("flow rate" ,
168
+ new Value (
169
+ Double .toString (inputStream .getFluid ().getPhase (name )
170
+ .getFlowRate (neqsim .util .unit .Units .getSymbol ("volume flow" ))),
171
+ neqsim .util .unit .Units .getSymbol ("volume flow" )));
172
+ properties .put (inputStream .getName (), newdata );
173
+
174
+ properties .put (name , newdata );
175
+ }
47
176
48
177
fluid = new Fluid (inputStream .getFluid ());
49
178
temperature = inputStream .getTemperature ("C" );
@@ -53,7 +182,9 @@ public StreamResponse(StreamInterface inputStream) {
53
182
massflow = inputStream .getFluid ().getFlowRate ("kg/hr" );
54
183
volumeFlow = inputStream .getFluid ().getFlowRate ("m3/hr" );
55
184
56
- if (inputStream .getFluid ().hasPhaseType ("gas" )) {
185
+ if (inputStream .getFluid ().hasPhaseType ("gas" ))
186
+
187
+ {
57
188
massflowGas = inputStream .getFluid ().getPhase ("gas" ).getFlowRate ("kg/hr" );
58
189
} else {
59
190
massflowGas = 0.0 ;
@@ -75,6 +206,5 @@ public StreamResponse(StreamInterface inputStream) {
75
206
* print.
76
207
* </p>
77
208
*/
78
- public void print () {
79
- }
209
+ public void print () {}
80
210
}
0 commit comments