Skip to content

Commit

Permalink
found error in GroovyTest (wrong data)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonHuette committed Feb 7, 2024
1 parent 993b0fd commit 8e8549e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 27 deletions.
31 changes: 8 additions & 23 deletions src/main/scala/edu/ie3/simona/model/participant/PvModel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -542,27 +542,15 @@ final case class PvModel private (
private def calcEpsilon(eDifH: Irradiation, eBeamH: Irradiation, thetaZ: Angle): Double = {
val thetaZInRad = thetaZ.toRadians

((eDifH + eBeamH / cos(thetaZInRad)) / eDifH +
(5.535d * 1.0e-6) * pow(
thetaZ.toDegrees,
3
)) / (1d + (5.535d * 1.0e-6) * pow(
thetaZ.toDegrees,
3
))
((eDifH + eBeamH / cos(thetaZInRad)) / eDifH +(5.535d * 1.0e-6) * pow(thetaZ.toDegrees, 3)) /
(1d + (5.535d * 1.0e-6) * pow(thetaZ.toDegrees,3))
}

private def calcEpsilonOld(eDifH: Irradiation, eBeamH: Irradiation, thetaZ: Angle): Double = {
val thetaZInRad = thetaZ.toRadians

((eDifH + eBeamH) / eDifH +
(5.535d * 1.0e-6) * pow(
thetaZ.toRadians,
3
)) / (1d + (5.535d * 1.0e-6) * pow(
thetaZ.toRadians,
3
))
((eDifH + eBeamH) / eDifH +(5.535d * 1.0e-6) * pow(thetaZ.toRadians, 3)) /
(1d + (5.535d * 1.0e-6) * pow(thetaZ.toRadians, 3))
}

private def firstFraction(eDifH: Irradiation, eBeamH: Irradiation, thetaZ: Angle): Double = {
Expand Down Expand Up @@ -593,12 +581,12 @@ final case class PvModel private (

if (eDifH.value.doubleValue > 0) {
// if we have diffuse radiation on horizontal surface we have to check if we have another epsilon due to clouds get the epsilon
var epsilon = ((eDifH + eBeamH) / eDifH +
var epsilon = ((eDifH + eBeamH / cos(thetaZInRad)) / eDifH +
(5.535d * 1.0e-6) * pow(
thetaZ.toRadians,
thetaZ.toDegrees,
3
)) / (1d + (5.535d * 1.0e-6) * pow(
thetaZ.toRadians,
thetaZ.toDegrees,
3
))

Expand Down Expand Up @@ -635,10 +623,7 @@ final case class PvModel private (

// calculate the f_ij components based on the epsilon bin
val f11 = -0.0161 * pow(x, 3) + 0.1840 * pow(x, 2) - 0.3806 * x + 0.2324
val f12 = 0.0134 * pow(x, 4) - 0.1938 * pow(x, 3) + 0.8410 * pow(
x,
2
) - 1.4018 * x + 1.3579
val f12 = 0.0134 * pow(x, 4) - 0.1938 * pow(x, 3) + 0.8410 * pow(x, 2) - 1.4018 * x + 1.3579
val f13 = 0.0032 * pow(x, 3) - 0.0280 * pow(x, 2) - 0.0056 * x - 0.0385
val f21 = -0.0048 * pow(x, 3) + 0.0536 * pow(x, 2) - 0.1049 * x + 0.0034
val f22 = 0.0012 * pow(x, 3) - 0.0067 * pow(x, 2) + 0.0091 * x - 0.0269
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,9 @@ class PvModelTest extends Specification {
// 0.244 MJ/m^2 = 67.777778 Wh/m^2
//Beam Radiation on horizontal surface
Irradiation eBeamH = Sq.create(67.777778d, WattHoursPerSquareMeter$.MODULE$)
// 0.769 MJ/m^2 = 213,61111 Wh/m^2
// 0.796 MJ/m^2 = 221,111288 Wh/m^2
//Diffuse beam Radiation on horizontal surface
Irradiation eDifH = Sq.create(213.61111d, WattHoursPerSquareMeter$.MODULE$)
Irradiation eDifH = Sq.create(221.111288d, WattHoursPerSquareMeter$.MODULE$)
//Incidence Angle
Angle thetaG = Sq.create(Math.toRadians(thetaGIn), Radians$.MODULE$)
//Zenith Angle
Expand All @@ -490,7 +490,7 @@ class PvModelTest extends Specification {
"- should calculate the beam diffusion"
// == 0,7792781569074354 MJ/m^2
def epsilon = pvModel.calcEpsilon(eDifH, eBeamH, thetaZ)
def epsilon = pvModel.calcEpsilon(eDifH, eBeamH, thetaZ) // epsilon(Duffie) = 1,28451252
def epsilonOld = pvModel.calcEpsilonOld(eDifH, eBeamH, thetaZ)
def firstFraction = pvModel.firstFraction(eDifH, eBeamH, thetaZ)
Expand All @@ -499,7 +499,7 @@ class PvModelTest extends Specification {
where: "the following parameters are given"
thetaGIn | thetaZIn | slope | airMass | I0 || eDifSSol
37.0 | 62.2 | 60 | 2.13873080095658d | 1399.0077631849722d || 216.46615469650982d
37.0 | 62.2 | 60 | 2.144d | 1395.8445d || 220.83351d
}
def "Calculate the ground reflection eRefS"() {
Expand Down

0 comments on commit 8e8549e

Please sign in to comment.