Commit 2b6e8436 authored by Gerrit Erichsen's avatar Gerrit Erichsen
Browse files

Changed assignment of dependencies according to MA Reimer, as this may have...

Changed assignment of dependencies according to MA Reimer, as this may have cause problems with low number of turbines in a grid. Fit for testing..
parent 3b20b091
......@@ -616,7 +616,7 @@ Wind::Wind(string name, double installedPower, double hubHeight, double rotorDia
if (m_gridToTurbineIdMap[yNewId][xNewId] >= 0
&& m_gridToTurbineIdMap[yNewId][xNewId] != j)
{
dummyVector[j] = m_gridToTurbineIdMap[yNewId][xNewId];
dummyVector[m_gridToTurbineIdMap[yNewId][xNewId]] = j;
notTooLongAndNothingFound = false;
}
}
......@@ -631,6 +631,9 @@ Wind::Wind(string name, double installedPower, double hubHeight, double rotorDia
vector<pair<double, double>> dummyMinWind;
vector<pair<double, double>> dummyMaxWind;
// ge - keep in mind the grid orientation .--> x
// |
// y v
for (int i = 0; i < (int)windDirections.size(); i++)
{
for (int j = 0; j < m_turbineGrid.size(); j++)
......@@ -673,7 +676,7 @@ Wind::Wind(string name, double installedPower, double hubHeight, double rotorDia
dummyMaxWind.clear();
}
// wake dependences ---------------------------------------------------------------------------
// wake dependencies --------------------------------------------------------------------------
bool turbinesNotInEveryCell = true;
int counter = 0;
for (int i = 0; i < m_nCellsRow && turbinesNotInEveryCell; i++)
......@@ -691,7 +694,7 @@ Wind::Wind(string name, double installedPower, double hubHeight, double rotorDia
counter = counter - 1;
}
}
//define dependences from wake borders --------------------------------------------------------
//define dependencies from wake borders -------------------------------------------------------
for (size_t i = 0; i < windDirections.size() && turbinesNotInEveryCell ; i++)
{
for (size_t j = 0; j < m_turbineGrid.size(); j++)
......@@ -699,25 +702,27 @@ Wind::Wind(string name, double installedPower, double hubHeight, double rotorDia
if (m_turbineDependencies[i][j] < 0)
{
bool withinBorders = true;
bool noNewDependencesfound = true;
bool noNewDependenciesfound = true;
for (int k = 0; k < maxDistanceSteps && withinBorders && noNewDependencesfound; k++)
for (int k = 0; k < maxDistanceSteps && withinBorders && noNewDependenciesfound; k++)
{
double xNew = (m_topLeftPos[i][j].first
- sin(PI / 180. * windDirections[i]) * static_cast<double>(k));
double yNew = (m_topLeftPos[i][j].second
+ cos(PI / 180. * windDirections[i]) * static_cast<double>(k));
if (xNew < 0. || yNew < 0. || xNew >= xMax || yNew >= yMax)
{
withinBorders = false;
continue;
}
double x = xNew - (cos(PI / 180. * windDirections[i])
* m_entrainmentConstant * k);
double y = yNew - (sin(PI / 180. * windDirections[i])
* m_entrainmentConstant * k);
if (xNew < 0. || yNew < 0. || xNew >= xMax || yNew >= yMax
|| x < 0. || y < 0. || x > xMax || y > yMax)
{
withinBorders = false;
continue;
}
int xNewIdInt = static_cast<int>(x / m_rotorDiameter);
int yNewIdInt = static_cast<int>(y / m_rotorDiameter);
size_t xNewId = static_cast<size_t>(xNewIdInt);
......@@ -732,13 +737,13 @@ Wind::Wind(string name, double installedPower, double hubHeight, double rotorDia
&& m_turbineDependencies[i][static_cast<size_t>(m_gridToTurbineIdMap[yNewId][xNewId])] < 0)
{
m_turbineDependencies[i][static_cast<size_t>(m_gridToTurbineIdMap[yNewId][xNewId])] = static_cast<int>(j);
noNewDependencesfound = false;
noNewDependenciesfound = false;
}
}
}
withinBorders = true;
for (int k = 0;
k < maxDistanceSteps && withinBorders && noNewDependencesfound;
k < maxDistanceSteps && withinBorders && noNewDependenciesfound;
k++)
{
double xNew = (m_bottomRightPos[i][j].first
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment