@@ -270,6 +270,53 @@ void testpropertyFlashOnlineSingle() {
270
270
Assertions .assertEquals (len , s .fluidProperties .length );
271
271
}
272
272
273
+ @ Test
274
+ void testpropertyFlashOnlineTooFewInputComponents () {
275
+ String [] components = {"nitrogen" , "oxygen" };
276
+ double [] fractions = {0.79 , 0.21 };
277
+ int len = 10 ;
278
+ List <List <Double >> onlineFractions = createDummyRequest (fractions , len );
279
+
280
+ Double [] pressure = {1.0 , 1.5 , 2.0 , 2.5 , 3.0 , 4.0 , 4.0 , 3.5 , 3.0 , 2.5 };
281
+ Double [] temperature = {301.0 , 301.5 , 302.0 , 302.5 , 303.0 , 304.0 , 304.0 , 303.5 , 303.0 , 302.5 };
282
+
283
+ SystemInterface fluid = new SystemSrkEos (298 , 1.0 );
284
+ // Add extra component C1
285
+ fluid .addComponent ("C1" );
286
+ fluid .addComponents (components );
287
+ // Add extra component iC4
288
+ fluid .addComponent ("iC4" );
289
+
290
+ ThermodynamicOperations ops = new ThermodynamicOperations (fluid );
291
+ CalculationResult s = ops .propertyFlash (Arrays .asList (pressure ), Arrays .asList (temperature ), 1 ,
292
+ Arrays .asList (components ), onlineFractions );
293
+ Assertions .assertEquals (len , s .fluidProperties .length );
294
+ Assertions .assertNull (s .calculationError [0 ]);
295
+ }
296
+
297
+ @ Test
298
+ void testPropertyFlashTooManyInputComponents () {
299
+ int len = 10 ;
300
+ String [] components_too_many = {"nitrogen" , "oxygen" , "water" };
301
+ double [] fractions_to_many = {0.79 , 0.21 , 0.01 };
302
+
303
+ Double [] pressure = {1.0 , 1.5 , 2.0 , 2.5 , 3.0 , 4.0 , 4.0 , 3.5 , 3.0 , 2.5 };
304
+ Double [] temperature = {301.0 , 301.5 , 302.0 , 302.5 , 303.0 , 304.0 , 304.0 , 303.5 , 303.0 , 302.5 };
305
+
306
+ List <List <Double >> onlineFractions_too_many = createDummyRequest (fractions_to_many , len );
307
+ SystemInterface fluid = new SystemSrkEos (298 , 1.0 );
308
+
309
+ // Add only two components to fluid
310
+ String [] components = {"nitrogen" , "oxygen" };
311
+ fluid .addComponents (components );
312
+ ThermodynamicOperations ops = new ThermodynamicOperations (fluid );
313
+ CalculationResult s = ops .propertyFlash (Arrays .asList (pressure ), Arrays .asList (temperature ), 1 ,
314
+ Arrays .asList (components_too_many ), onlineFractions_too_many );
315
+ Assertions .assertEquals (len , s .fluidProperties .length );
316
+ Assertions .assertEquals ("Input component list does not match fluid component list." ,
317
+ s .calculationError [0 ]);
318
+ }
319
+
273
320
@ Disabled
274
321
@ Test
275
322
@ SuppressWarnings ("unchecked" )
0 commit comments