Commit 44c0ee0d authored by Gerrit Erichsen's avatar Gerrit Erichsen
Browse files

Fixed (most) problems regarding configuration problems

parent c66ad64d
......@@ -1172,6 +1172,7 @@ bool CharLGui::configureAlgorithm(CharLAlgorithm * algorithm,
{
size_t nodeIndex = 0;
size_t locationIndex = 0;
int plantOption = 0;
int counter = 0;
const NodesTableItem * node = nullptr;
qDebug() << "About to configure option " << targetOption;
......@@ -1210,9 +1211,9 @@ bool CharLGui::configureAlgorithm(CharLAlgorithm * algorithm,
m_mapNodesLocations.insert(location, std::pair<size_t, size_t>(nodeIndex, locationIndex));
}
targetOption = targetOption / nOptionsOfFollowingPlants[counter];
plantOption = targetOption / nOptionsOfFollowingPlants[counter];
targetOption = targetOption % nOptionsOfFollowingPlants[counter];
double configPower = std::min(config->getMinPower() + targetOption * config->getStepSizePower(),
double configPower = std::min(config->getMinPower() + plantOption * config->getStepSizePower(),
config->getMaxPower());
if (configPower > 1.)
{
......@@ -1242,25 +1243,25 @@ bool CharLGui::configureAlgorithm(CharLAlgorithm * algorithm,
}
for (int j = 0; j < node->getConstStorageTablePtr()->rowCount(); j++)
{
targetOption = targetOption / nOptionsOfFollowingPlants[counter];
plantOption = targetOption / nOptionsOfFollowingPlants[counter];
targetOption = targetOption % nOptionsOfFollowingPlants[counter];
const ConfigTableItem * config = static_cast<const ConfigTableItem *>(node->getConstStorageTablePtr()->getItem(j));
const StorageTableItem * storage = static_cast<const StorageTableItem *>(m_modelStorage->getItem(config->getSelectedItemProducer()));
int nVariationsCapacity = node->getConstStorageTablePtr()->getNumberOfVariationsForItem(j, 1);
int nVariationsPowerDis = node->getConstStorageTablePtr()->getNumberOfVariationsForItem(j, 2);
double configPower = std::min(config->getMinPower()
+ (targetOption
+ (plantOption
/ (nVariationsCapacity * nVariationsPowerDis))
* config->getStepSizePower(),
config->getMaxPower());
double configCapacity = std::min(config->getMinCapacity()
+ ((targetOption
+ ((plantOption
% (nVariationsCapacity * nVariationsPowerDis))
/ nVariationsPowerDis)
* config->getStepSizeCapacity(),
config->getMaxCapacity());
double configPowerDis = std::min(config->getMinPower2()
+ ((targetOption
+ ((plantOption
% (nVariationsCapacity * nVariationsPowerDis))
% nVariationsPowerDis)
* config->getStepSizePower2(),
......@@ -1306,14 +1307,15 @@ bool CharLGui::configureAlgorithm(CharLAlgorithm * algorithm,
}
for (int j = 0; j < node->getConstSolarTablePtr()->rowCount(); j++)
{
targetOption = targetOption / nOptionsOfFollowingPlants[counter];
plantOption = targetOption / nOptionsOfFollowingPlants[counter];
targetOption = targetOption % nOptionsOfFollowingPlants[counter];
const ConfigTableItem * config = static_cast<const ConfigTableItem *>(node->getConstSolarTablePtr()->getItem(j));
if (config->getName().compare("Default", Qt::CaseInsensitive) == 0)
{
algorithm->setGenericSolarCapacity(nodeIndex, std::min(config->getMinPower()
+ targetOption * config->getStepSizePower(),
config->getMaxPower()));
algorithm->setGenericSolarCapacity(nodeIndex,
std::min(config->getMinPower()
+ plantOption * config->getStepSizePower(),
config->getMaxPower()));
}
else
{
......@@ -1321,7 +1323,8 @@ bool CharLGui::configureAlgorithm(CharLAlgorithm * algorithm,
const PhotovoltaicTableItem * module = static_cast<const PhotovoltaicTableItem *>(m_modelModulesPV->getItem(moduleConfig->getModuleID()));
algorithm->addPvPlant(nodeIndex, locationIndex,
moduleConfig->getName().toStdString(),
std::min(config->getMinPower() + targetOption * config->getStepSizePower(),
std::min(config->getMinPower()
+ plantOption * config->getStepSizePower(),
config->getMaxPower()),
1.3/*DCtoAC*/,
module->getArea(),
......@@ -1349,19 +1352,19 @@ bool CharLGui::configureAlgorithm(CharLAlgorithm * algorithm,
}
for (int j = 0; j < node->getConstWindTablePtr()->rowCount(); j++)
{
targetOption = targetOption / nOptionsOfFollowingPlants[counter];
plantOption = targetOption / nOptionsOfFollowingPlants[counter];
targetOption = targetOption % nOptionsOfFollowingPlants[counter];
const ConfigTableItem * config = static_cast<const ConfigTableItem *>(node->getConstWindTablePtr()->getItem(j));
if (config->getName().compare("Default", Qt::CaseInsensitive) == 0)
{
algorithm->setGenericWindCapacity(nodeIndex, std::min(config->getMinPower()
+ targetOption * config->getStepSizePower(),
+ plantOption * config->getStepSizePower(),
config->getMaxPower()));
}
else
{
const WindTableItem * turbine = static_cast<const WindTableItem *>(m_modelWind->getItem(config->getSelectedItemProducer()));
double power = std::min(config->getMinPower() + targetOption * config->getStepSizePower(),
double power = std::min(config->getMinPower() + plantOption * config->getStepSizePower(),
config->getMaxPower());
int powerDensity = static_cast<int>(power * 1e6 / config->getAreaOfPark());
if (turbine->isEfficiencyAvailable(powerDensity,
......
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