1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
double calculateCoefficient(double paper, double lowMid, double highMid, double solid, double referenceLowMid, double referenceHighMid, double coefficientArray[])
{
double k1;
double k2;
paper = round(paper, 3);
lowMid = round(lowMid, 3);
highMid = round(highMid, 3);
solid = round(solid, 3);
referenceLowMid = round(referenceLowMid, 3);
referenceHighMid = round(referenceHighMid, 3);
while(true)
{
k1 = getConstant1(paper, lowMid, highMid, solid, referenceLowMid, referenceHighMid);
k2 = getConstant2(k1, paper, lowMid, highMid, solid, referenceLowMid, referenceHighMid);
coefficientArray[0] = -(k1 - 2 * k2) / 100;
coefficientArray[1] = k1 - k2 + (solid - paper) / 100;
coefficientArray[2] = paper;
coefficientArray[3] = -(k1 + 2 * k2) / 100;
coefficientArray[4] = k1 + 3 * k2 + (solid - paper) / 100;
coefficientArray[5] = paper - 100 * k2;
double testReferenceHigh = round(calculateValueFromCoefficient(coefficientArray[0], coefficientArray[1], coefficientArray[2], coefficientArray[3], coefficientArray[4], coefficientArray[5], referenceHighMid), 3);
if(testReferenceHigh < highMid)
{
referenceHighMid += 0.001;
}
else
{
break;
}
}
//Passes back to the coefficientArray.
return 0;
}
|