Skip to content
Snippets Groups Projects
Commit a1340aa4 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Improved single sine wave function to handle cutoff value problems

parent 961155a6
No related branches found
No related tags found
No related merge requests found
......@@ -132,7 +132,7 @@ public class NonLinearCurves {
Double theta_2 = Math.asin((Tu - m) / alpha);
// Case 5: Tmin above Tl and Tmax above Tu
if(Tmin >= Tl && Tu != null && Tmax >= Tu)
if(Tmin > Tl && Tu != null && Tmax > Tu)
{
return (1/Math.PI) * (
(m-Tl)*(theta_2 + Math.PI/2)
......
......@@ -190,6 +190,14 @@ public class NonLinearCurvesTest extends TestCase {
result = instance.calculateSingleSineWaveWithCutoff(tMin, tMax, thresholdLower, thresholdUpper);
assertEquals(expectedResult, result,0.1);
tMax = 32.0;
tMin = 20.0;
thresholdUpper = 31.1;
thresholdLower = 20.0;
expectedResult = 5.894588543400416;
result = instance.calculateSingleSineWaveWithCutoff(tMin, tMax, thresholdLower, thresholdUpper);
assertEquals(expectedResult, result,0.1);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment