@@ -46,9 +46,11 @@ public class CompressorChart implements CompressorChartInterface, java.io.Serial
46
46
PolynomialFunction fanLawCorrectionFunc = null ;
47
47
double [] speed ;
48
48
double [][] flow ;
49
+ double [][] flowPolytropicEfficiency ;
49
50
double [][] head ;
50
51
double [][] polytropicEfficiency ;
51
52
double [][] redflow ;
53
+ double [][] redflowPolytropicEfficiency ;
52
54
double [][] redhead ;
53
55
double [][] redpolytropicEfficiency ;
54
56
@@ -62,7 +64,16 @@ public CompressorChart() {}
62
64
/** {@inheritDoc} */
63
65
@ Override
64
66
public void addCurve (double speed , double [] flow , double [] head , double [] polytropicEfficiency ) {
65
- CompressorCurve curve = new CompressorCurve (speed , flow , head , polytropicEfficiency );
67
+ CompressorCurve curve = new CompressorCurve (speed , flow , head , flow , polytropicEfficiency );
68
+ chartValues .add (curve );
69
+ }
70
+
71
+ /** {@inheritDoc} */
72
+ @ Override
73
+ public void addCurve (double speed , double [] flow , double [] head ,
74
+ double [] flowPolytropicEfficiency , double [] polytropicEfficiency ) {
75
+ CompressorCurve curve =
76
+ new CompressorCurve (speed , flow , head , flowPolytropicEfficiency , polytropicEfficiency );
66
77
chartValues .add (curve );
67
78
}
68
79
@@ -80,21 +91,48 @@ public void addCurve(double speed, double[] flow, double[] head, double[] polytr
80
91
@ Override
81
92
public void setCurves (double [] chartConditions , double [] speed , double [][] flow , double [][] head ,
82
93
double [][] polyEff ) {
94
+ this .setCurves (chartConditions , speed , flow , head , flow , polyEff );
95
+ }
96
+
97
+ /**
98
+ * {@inheritDoc}
99
+ *
100
+ * This method initializes the compressor performance curves, including speed, flow, head, and
101
+ * polytropic efficiency.
102
+ *
103
+ * <p>
104
+ * The method takes chart conditions and initializes internal variables for different performance
105
+ * parameters based on input arrays for speed, flow, head, and polytropic efficiency. It also
106
+ * normalizes these parameters by calculating reduced values based on speed.
107
+ */
108
+ @ Override
109
+ public void setCurves (double [] chartConditions , double [] speed , double [][] flow , double [][] head ,
110
+ double [][] flowPolyEff , double [][] polyEff ) {
83
111
this .speed = speed ;
84
112
this .head = head ;
85
113
this .polytropicEfficiency = polyEff ;
86
114
this .flow = flow ;
115
+ this .flowPolytropicEfficiency = flowPolyEff ;
87
116
88
117
// Dynamically initialize arrays based on the maximum length of flow, head, and polyEff
89
118
int maxLength = 0 ;
90
119
for (double [] f : flow ) {
91
- if (f .length > maxLength )
120
+ if (f .length > maxLength ) {
92
121
maxLength = f .length ;
122
+ }
123
+ }
124
+
125
+ int maxLengthPolyEff = 0 ;
126
+ for (double [] f : flowPolytropicEfficiency ) {
127
+ if (f .length > maxLengthPolyEff ) {
128
+ maxLengthPolyEff = f .length ;
129
+ }
93
130
}
94
131
95
132
this .redhead = new double [head .length ][maxLength ];
96
133
this .redpolytropicEfficiency = new double [polyEff .length ][maxLength ];
97
134
this .redflow = new double [flow .length ][maxLength ];
135
+ this .redflowPolytropicEfficiency = new double [polyEff .length ][maxLength ];
98
136
99
137
for (int i = 0 ; i < speed .length ; i ++) {
100
138
if (speed [i ] > maxSpeedCurve ) {
@@ -103,25 +141,31 @@ public void setCurves(double[] chartConditions, double[] speed, double[][] flow,
103
141
if (speed [i ] < minSpeedCurve ) {
104
142
minSpeedCurve = speed [i ];
105
143
}
106
- CompressorCurve curve = new CompressorCurve (speed [i ], flow [i ], head [i ], polyEff [i ]);
144
+ CompressorCurve curve =
145
+ new CompressorCurve (speed [i ], flow [i ], head [i ], flowPolyEff [i ], polyEff [i ]);
107
146
chartValues .add (curve );
108
147
109
148
for (int j = 0 ; j < flow [i ].length ; j ++) { // Handle differing lengths for each speed
110
149
redflow [i ][j ] = flow [i ][j ] / speed [i ];
111
- redpolytropicEfficiency [i ][j ] = polyEff [i ][j ];
112
150
redhead [i ][j ] = head [i ][j ] / speed [i ] / speed [i ];
113
151
reducedHeadFitter .add (redflow [i ][j ], redhead [i ][j ]);
114
- reducedPolytropicEfficiencyFitter .add (redflow [i ][j ], redpolytropicEfficiency [i ][j ]);
115
152
double flowFanLaw = flow [i ][j ] * speed [i ] / speed [0 ];
116
153
// TODO: MLLU: not correct. speed[0] should be the requested speed
117
154
fanLawCorrectionFitter .add (speed [i ] / speed [0 ], flow [i ][j ] / flowFanLaw );
118
155
}
119
156
157
+ for (int j = 0 ; j < flowPolytropicEfficiency [i ].length ; j ++) { // Handle differing lengths for
158
+ // each speed
159
+ redflowPolytropicEfficiency [i ][j ] = flowPolyEff [i ][j ] / speed [i ];
160
+ redpolytropicEfficiency [i ][j ] = polyEff [i ][j ];
161
+ reducedPolytropicEfficiencyFitter .add (redflowPolytropicEfficiency [i ][j ],
162
+ redpolytropicEfficiency [i ][j ]);
163
+ }
164
+
120
165
// Fill remaining slots with default values (e.g., 0) if arrays are shorter
121
- for (int j = flow [i ].length ; j < maxLength ; j ++) {
122
- redflow [i ][j ] = 0 ;
166
+ for (int j = flowPolytropicEfficiency [i ].length ; j < maxLengthPolyEff ; j ++) {
167
+ redflowPolytropicEfficiency [i ][j ] = 0 ;
123
168
redpolytropicEfficiency [i ][j ] = 0 ;
124
- redhead [i ][j ] = 0 ;
125
169
}
126
170
}
127
171
0 commit comments