Commit a4f0d9df authored by Gerrit Erichsen's avatar Gerrit Erichsen
Browse files

Moving data set-up from NodesTableItem to LocationsWidget

parent 5b430342
......@@ -58,32 +58,32 @@ void CharLAlgorithm::setPreferences(int nTimeSteps, double stepTime, int levelOf
optimization, fi);
}
void CharLAlgorithm::transferDemandData(int network, const vector<float> * powerDemand)
void CharLAlgorithm::transferDemandData(size_t node, const vector<float> * powerDemand)
{
if (network < m_networks.size() && network >= 0)
if (node < m_networks.size())
{
m_networks[network]->setPowerDemand(powerDemand);
m_networks[node]->setPowerDemand(powerDemand);
}
}
void CharLAlgorithm::transferDemandForecastData(int network,
void CharLAlgorithm::transferDemandForecastData(size_t node,
const vector<vector<float> > * powerDemand)
{
if (network < m_networks.size() && network >= 0)
if (node < m_networks.size())
{
m_networks[network]->setPowerDemandForecast(powerDemand);
m_networks[node]->setPowerDemandForecast(powerDemand);
}
}
void CharLAlgorithm::transferReactiveDemandData(int network, vector<float> reactivePowerDemand) //dv
void CharLAlgorithm::transferReactiveDemandData(size_t node, vector<float> reactivePowerDemand) //dv
{
if (network < m_networks.size() && network >= 0)
if (node < m_networks.size())
{
m_networks[network]->setReactivePowerDemand(reactivePowerDemand);
m_networks[node]->setReactivePowerDemand(reactivePowerDemand);
}
}
void CharLAlgorithm::transferPowerDemandToReactiveDemanddata(int network, vector<float> powerDemand)
void CharLAlgorithm::transferPowerDemandToReactiveDemanddata(size_t node, vector<float> powerDemand)
{
double PI = 3.14159265;
double fi = m_preferences->fi();
......@@ -95,9 +95,9 @@ void CharLAlgorithm::transferPowerDemandToReactiveDemanddata(int network, vector
}
if (network < m_networks.size() && network >= 0)
if (node < m_networks.size())
{
m_networks[network]->setReactivePowerDemand(powerDemand);
m_networks[node]->setReactivePowerDemand(powerDemand);
}
}
......@@ -358,19 +358,19 @@ void CharLAlgorithm::addWindPark(size_t network, size_t location, string name,
}
}
void CharLAlgorithm::setGenericWindCapacity(int network, double capacity)
void CharLAlgorithm::setGenericWindCapacity(size_t node, double capacity)
{
if (network < m_networks.size() && network >= 0)
if (node < m_networks.size())
{
m_networks[network]->setGenericWindCapacity(capacity);
m_networks[node]->setGenericWindCapacity(capacity);
}
}
void CharLAlgorithm::setGenericSolarCapacity(int network, double capacity)
void CharLAlgorithm::setGenericSolarCapacity(size_t node, double capacity)
{
if (network < m_networks.size() && network >= 0)
if (node < m_networks.size())
{
m_networks[network]->setGenericSolarCapacity(capacity);
m_networks[node]->setGenericSolarCapacity(capacity);
}
}
......
......@@ -46,12 +46,12 @@ public:
int foreCastPeriod, double optimiserGap, double optimiserTimeLimit, vector<double> storageLevelCurve,
double interestRate, int deprecationPeriod, double co2Costs, double curtailmentCosts, double optimiserTargetWeight, bool optimization, double fi);
void transferDemandData(int network,
void transferDemandData(size_t node,
const vector<float> * powerDemand);
void transferDemandForecastData(int network,
void transferDemandForecastData(size_t node,
const vector<vector<float>> * powerDemand);
void transferReactiveDemandData(int network, vector<float> reactivePowerDemand); //dv
void transferPowerDemandToReactiveDemanddata(int network, vector<float> powerDemand); //dv
void transferReactiveDemandData(size_t node, vector<float> reactivePowerDemand); //dv
void transferPowerDemandToReactiveDemanddata(size_t node, vector<float> powerDemand); //dv
void transferWindData(int node,
const vector<float> * windData);
......@@ -126,8 +126,8 @@ public:
double rotorDiameter, double areaOfPark, vector<pair<double, double> > powerCurve,
vector<pair<double, double> > ctCurve, double investCost, double fixedOM_Cost,
double specOM_Cost, int lifeTime);
void setGenericWindCapacity(int network, double capacity);
void setGenericSolarCapacity(int network, double capacity);
void setGenericWindCapacity(size_t node, double capacity);
void setGenericSolarCapacity(size_t node, double capacity);
//void getNextX(int step); //dv
......
......@@ -471,13 +471,15 @@ void CharLGui::initWidgets()
m_modelPowerDemandData, this);
m_dataWidget->setObjectName("DataWidget");
m_locationsWidget = new LocationsWidget(m_modelLocations, m_modelSelectNode, this);
m_locationsWidget = new LocationsWidget(m_modelLocations, m_modelSelectNode,
m_modelSelectWindData, m_modelSelectSolarData,
m_modelSelectTemperatureData, m_modelSelectPowerDemandData,
this);
m_locationsWidget->setObjectName("LocationsWidget");
m_nodeWidget = new NodesWidget(m_modelNodes,
m_modelSelectPlant, m_modelSelectStorage, m_modelSelectWind,
m_modelSelectPV, m_modelSelectWindData, m_modelSelectSolarData,
m_modelSelectTemperatureData, m_modelSelectPowerDemandData, m_modelSelectLocation, this);
m_modelSelectPV, m_modelSelectLocation, this);
m_nodeWidget->setObjectName("NodeWidget");
m_gridWidget = new GridWidget(m_modelGridCapacities, m_modelGridImpedances,
......@@ -687,38 +689,19 @@ bool CharLGui::configureGridForAlgorithm(int targetOption, QVector<int> & nOptio
}
counter++;
}
const DataTableItem * dataItem = static_cast<const DataTableItem *>(m_modelSolarData->getItem(node->getSolarDataIndex()));
if (dataItem->isScaledData()) // Solar
for (int j = 0; j < node->getSolarTablePtr()->rowCount(); j++)
{
option = targetOption / nOptionsOfFollowingPlants[counter];
targetOption = targetOption % nOptionsOfFollowingPlants[counter];
const ConfigTableItem * config = static_cast<const ConfigTableItem *>(node->getSolarTablePtr()->getItem(0));
m_algorithm.setGenericSolarCapacity(nodeIndex, std::min(config->getMinPower()
+ option * config->getStepSizePower(),
config->getMaxPower()));
if (dataItem->getDataCount() != m_preferences->getNumberOfTimeSteps())
const ConfigTableItem * config = static_cast<const ConfigTableItem *>(node->getSolarTablePtr()->getItem(j));
if (config->getName().compare("Default", Qt::CaseInsensitive) == 0)
{
QMessageBox::information(nullptr, QObject::tr("CharL - Mismatch"),
QObject::tr("Preferences changed and now solar data does "
"not fit specified size.\nCalculation aborted."),
QMessageBox::Ok);
return false;
m_algorithm.setGenericSolarCapacity(nodeIndex, std::min(config->getMinPower()
+ option * config->getStepSizePower(),
config->getMaxPower()));
}
m_algorithm.transferSolarData(nodeIndex, locationIndex,
dataItem->getDataPtr(),
false);
m_algorithm.transferSolarForecastData(nodeIndex, locationIndex,
dataItem->getForecastDataPtr(),
false);
counter++;
}
else // Solar
{
for (int j = 0; j < node->getSolarTablePtr()->rowCount(); j++)
else
{
option = targetOption / nOptionsOfFollowingPlants[counter];
targetOption = targetOption % nOptionsOfFollowingPlants[counter];
const ConfigTableItem * config = static_cast<const ConfigTableItem *>(node->getSolarTablePtr()->getItem(j));
const SolarTableItem * moduleConfig = static_cast<const SolarTableItem *>(m_modelSolar->getItem(config->getSelectedItemProducer()));
const PhotovoltaicTableItem * module = static_cast<const PhotovoltaicTableItem *>(m_modelModulesPV->getItem(moduleConfig->getModuleID()));
m_algorithm.addPvPlant(nodeIndex, locationIndex, moduleConfig->getName().toStdString(),
......@@ -745,59 +728,21 @@ bool CharLGui::configureGridForAlgorithm(int targetOption, QVector<int> & nOptio
* */
counter++;
}
if (dataItem->getDataCount() != m_preferences->getNumberOfTimeSteps())
{
QMessageBox::information(nullptr , QObject::tr("CharL - Mismatch"),
QObject::tr("Preferences changed and now solar data does "
"not fit specified size.\nCalculation aborted."),
QMessageBox::Ok);
return false;
}
if (dataItem->requiresDoubleData())
{
m_algorithm.transferSolarData(nodeIndex, locationIndex,
dataItem->getDataPtr(), dataItem->getDataPtrTwo());
m_algorithm.transferSolarForecastData(nodeIndex, locationIndex,
dataItem->getForecastDataPtr(),
dataItem->getForecastDataPtrTwo());
}
else
{
m_algorithm.transferSolarData(nodeIndex, locationIndex,
dataItem->getDataPtr(), true);
m_algorithm.transferSolarForecastData(nodeIndex, locationIndex,
dataItem->getForecastDataPtr(), true);
}
}
dataItem = static_cast<const DataTableItem *>(m_modelWindData->getItem(node->getWindDataIndex()));
if (dataItem->isScaledData()) // Wind
}
for (int j = 0; j < node->getWindTablePtr()->rowCount(); j++)
{
option = targetOption / nOptionsOfFollowingPlants[counter];
targetOption = targetOption % nOptionsOfFollowingPlants[counter];
const ConfigTableItem * config = static_cast<const ConfigTableItem *>(node->getWindTablePtr()->getItem(0));
m_algorithm.setGenericWindCapacity(nodeIndex, std::min(config->getMinPower()
+ option * config->getStepSizePower(),
config->getMaxPower()));
if (dataItem->getDataCount() != m_preferences->getNumberOfTimeSteps())
const ConfigTableItem * config = static_cast<const ConfigTableItem *>(node->getWindTablePtr()->getItem(j));
if (config->getName().compare("Default", Qt::CaseInsensitive) == 0)
{
QMessageBox::information(nullptr, QObject::tr("CharL - Mismatch"),
QObject::tr("Preferences changed and now wind data does "
"not fit specified size.\nCalculation aborted."),
QMessageBox::Ok);
return false;
m_algorithm.setGenericWindCapacity(nodeIndex, std::min(config->getMinPower()
+ option * config->getStepSizePower(),
config->getMaxPower()));
}
m_algorithm.transferWindData(nodeIndex, dataItem->getDataPtr());
m_algorithm.transferWindForecastData(nodeIndex, dataItem->getForecastDataPtr());
counter++;
}
else // Wind
{
for (int j = 0; j < node->getWindTablePtr()->rowCount(); j++)
else
{
option = targetOption / nOptionsOfFollowingPlants[counter];
targetOption = targetOption % nOptionsOfFollowingPlants[counter];
const ConfigTableItem * config = static_cast<const ConfigTableItem *>(node->getWindTablePtr()->getItem(j));
const WindTableItem * turbine = static_cast<const WindTableItem *>(m_modelWind->getItem(config->getSelectedItemProducer()));
m_algorithm.addWindPark(nodeIndex, locationIndex, turbine->getName().toStdString(),
std::min(config->getMinPower() + option * config->getStepSizePower(),
......@@ -810,23 +755,68 @@ bool CharLGui::configureGridForAlgorithm(int targetOption, QVector<int> & nOptio
turbine->getSpecFixOaMCost(),
turbine->getSpecVarOaMCost(),
turbine->getLifeTime());
counter++;
}
if (dataItem->getDataCount() != m_preferences->getNumberOfTimeSteps())
{
QMessageBox::information(nullptr, QObject::tr("CharL - Mismatch"),
QObject::tr("Preferences changed and now wind data does "
"not fit specified size.\nCalculation aborted."),
QMessageBox::Ok);
return false;
}
m_algorithm.transferWindData(nodeIndex, locationIndex,
dataItem->getDataPtr(), dataItem->getDataPtrTwo());
m_algorithm.transferWindForecastData(nodeIndex, locationIndex,
dataItem->getForecastDataPtr(),
dataItem->getForecastDataPtrTwo());
counter++;
}
if (!transferDataForGrid(nodeIndex, node)) return false;
}
m_algorithm.transferGridConfiguration(m_modelGridCapacities->getDataGrid(),
m_modelGridImpedances->getDataGrid(),
m_modelGridImpedancesReactance->getDataGrid());
return true;
}
bool CharLGui::transferDataForGrid(size_t nodeIndex, const NodesTableItem * node)
{
const DataTableItem * dataItem;
const LocationsTableItem * locationItem;
size_t locationIndex = static_cast<size_t>(-1);
for (int i = 0; i < node->getLocationCount(); i++)
{
// Solar Data -----------------------------------------------------------------------------
locationItem = static_cast<const LocationsTableItem *>(m_modelLocations->getItem(node->getLocationsId(i)));
dataItem = static_cast<const DataTableItem *>(m_modelSolarData->getItem(locationItem->getSolarDataIndex()));
locationIndex = m_mapNodesLocations.value(locationItem).second;
if (dataItem->getDataCount() != m_preferences->getNumberOfTimeSteps())
{
QMessageBox::information(nullptr , QObject::tr("CharL - Mismatch"),
QObject::tr("Preferences changed and now solar data does "
"not fit specified size.\nCalculation aborted."),
QMessageBox::Ok);
return false;
}
if (!dataItem->isScaledData())
{
m_algorithm.transferSolarData(nodeIndex, locationIndex,
dataItem->getDataPtr(), dataItem->getDataPtrTwo());
m_algorithm.transferSolarForecastData(nodeIndex, locationIndex,
dataItem->getForecastDataPtr(),
dataItem->getForecastDataPtrTwo());
}
else
{
m_algorithm.transferSolarData(nodeIndex, locationIndex,
dataItem->getDataPtr(), dataItem->isScaledData());
m_algorithm.transferSolarForecastData(nodeIndex, locationIndex,
dataItem->getForecastDataPtr(), dataItem->isScaledData());
}
dataItem = static_cast<const DataTableItem *>(m_modelTemperatureData->getItem(node->getTemperatureDataIndex()));
// Wind Data ------------------------------------------------------------------------------
if (dataItem->getDataCount() != m_preferences->getNumberOfTimeSteps())
{
QMessageBox::information(nullptr, QObject::tr("CharL - Mismatch"),
QObject::tr("Preferences changed and now wind data does "
"not fit specified size.\nCalculation aborted."),
QMessageBox::Ok);
return false;
}
m_algorithm.transferWindData(nodeIndex, locationIndex,
dataItem->getDataPtr(), dataItem->getDataPtrTwo());
m_algorithm.transferWindForecastData(nodeIndex, locationIndex,
dataItem->getForecastDataPtr(),
dataItem->getForecastDataPtrTwo());
// Temperature Data -----------------------------------------------------------------------
dataItem = static_cast<const DataTableItem *>(m_modelTemperatureData->getItem(locationItem->getTemperatureDataIndex()));
if (dataItem->getDataCount() > 0 && dataItem->getDataCount()!= m_preferences->getNumberOfTimeSteps())
{
QMessageBox::information(nullptr, QObject::tr("CharL - Mismatch"),
......@@ -838,7 +828,8 @@ bool CharLGui::configureGridForAlgorithm(int targetOption, QVector<int> & nOptio
m_algorithm.transferTemperatureData(nodeIndex, locationIndex, dataItem->getDataPtr());
m_algorithm.transferTemperatureForecastData(nodeIndex, locationIndex,
dataItem->getForecastDataPtr());
if (node->getPowerDemandDataIndex() < 0)
// Power Demand Data ----------------------------------------------------------------------
if (locationItem->getPowerDemandDataIndex() < 0)
{
vector<float> defaultDemandData;
vector<float> defaultReactiveDemandData; //dv
......@@ -852,7 +843,7 @@ bool CharLGui::configureGridForAlgorithm(int targetOption, QVector<int> & nOptio
}
else
{
if (static_cast<const DataTableItem *>(m_modelPowerDemandData->getItem(node->getPowerDemandDataIndex()))->getDataCount()
if (static_cast<const DataTableItem *>(m_modelPowerDemandData->getItem(locationItem->getPowerDemandDataIndex()))->getDataCount()
!= m_preferences->getNumberOfTimeSteps())
{
QMessageBox::information(nullptr, QObject::tr("CharL - Mismatch"),
......@@ -862,25 +853,13 @@ bool CharLGui::configureGridForAlgorithm(int targetOption, QVector<int> & nOptio
return false;
}
m_algorithm.transferDemandData(nodeIndex,
static_cast<const DataTableItem *>(m_modelPowerDemandData->getItem(node->getPowerDemandDataIndex()))
static_cast<const DataTableItem *>(m_modelPowerDemandData->getItem(locationItem->getPowerDemandDataIndex()))
->getDataPtr());
m_algorithm.transferDemandForecastData(nodeIndex,
static_cast<const DataTableItem *>(m_modelPowerDemandData->getItem(node->getPowerDemandDataIndex()))
static_cast<const DataTableItem *>(m_modelPowerDemandData->getItem(locationItem->getPowerDemandDataIndex()))
->getForecastDataPtr());
}
//tb - CSP
//QVector<std::pair<double,double>> dummyVector;
//StorageTableItem::loadFile("", dummyVector);
//vector<double,double> myvector = dummyVector.toStdVector();
//tb - CSP end
}
m_algorithm.transferGridConfiguration(m_modelGridCapacities->getDataGrid(),
m_modelGridImpedances->getDataGrid(),
m_modelGridImpedancesReactance->getDataGrid());
return true;
}
......@@ -1059,10 +1038,6 @@ bool CharLGui::saveProject()
nodes.appendChild(node);
NodesTableItem * item = m_modelNodes->getItemNonConst(i);
node.setAttribute("name", item->getName());
node.setAttribute("solar_select", item->getSolarDataIndex());
node.setAttribute("wind_select", item->getWindDataIndex());
node.setAttribute("temperature_select", item->getTemperatureDataIndex());
node.setAttribute("power_demand_select", item->getPowerDemandDataIndex());
QDomElement config = project.createElement("config"); //conventional config
node.appendChild(config);
config.setAttribute("type", "conventional");
......@@ -1198,10 +1173,6 @@ bool CharLGui::loadProject()
childElement.attribute("lat").toDouble(),
childElement.attribute("lon").toDouble()));
NodesTableItem * item = m_modelNodes->getItemNonConst(m_modelNodes->rowCount() - 1);
item->setSolarDataIndex(childElement.attribute("solar_select").toInt());
item->setWindDataIndex(childElement.attribute("wind_select").toInt());
item->setTemperatureDataIndex(childElement.attribute("temperature_select").toInt());
item->setPowerDemandDataIndex(childElement.attribute("power_demand_select").toInt());
QDomNode grandChild = child.firstChild();
while (!grandChild.isNull())
{
......
......@@ -71,8 +71,12 @@ private:
void createActions();
void createMenus();
void makeConnections();
bool configureGridForAlgorithm(int targetOption, QVector<int> & nOptionsOfFollowingPlants);
int getResultPositionInVector(QVector<Result *> * results, Result * newResult);
bool configureGridForAlgorithm(int targetOption,
QVector<int> & nOptionsOfFollowingPlants);
bool transferDataForGrid(size_t nodeIndex,
const NodesTableItem * node);
int getResultPositionInVector(QVector<Result *> * results,
Result * newResult);
void updateOptimisationProgressBar(int current);
bool saveProject();
bool loadProject();
......
......@@ -10,8 +10,10 @@
/// ITEM IMPLEMENTATION ///////////////////////////////////////////////////////////////////////
//////////////////////////////////////////
LocationsTableItem::LocationsTableItem(QString name, QString uniqueName, QString municipalityKey, double lat, double lon,
double areaSolar, double areaWind, int polygonId, int nodeID) :
LocationsTableItem::LocationsTableItem(QString name, QString uniqueName, QString municipalityKey,
double lat, double lon, double areaSolar, double areaWind,
int polygonId, int nodeID, int solarData, int windData,
int temperatureData, int demandData) :
AbstractCharLItem(name),
m_uniqueName(uniqueName),
m_AGS(municipalityKey),
......@@ -20,7 +22,11 @@ LocationsTableItem::LocationsTableItem(QString name, QString uniqueName, QString
m_areaSolar(areaSolar),
m_areaWind(areaWind),
m_nodeID(nodeID),
m_polygonId(polygonId)
m_polygonId(polygonId),
m_solarData(solarData),
m_windData(windData),
m_temperatureData(temperatureData),
m_demandData(demandData)
{
}
......@@ -459,6 +465,10 @@ void LocationsTableModel::writeToXml(QDomDocument doc, QDomElement element)
polygonDOM.appendChild(polygonTextNode);
unit.appendChild(polygonDOM);
}
unit.setAttribute("solar_select", m_data[i]->getSolarDataIndex());
unit.setAttribute("wind_select", m_data[i]->getWindDataIndex());
unit.setAttribute("temperature_select", m_data[i]->getTemperatureDataIndex());
unit.setAttribute("power_demand_select", m_data[i]->getPowerDemandDataIndex());
}
}
......@@ -506,11 +516,15 @@ void LocationsTableModel::readFromXml(QDomElement element)
childLocation = childLocation.nextSiblingElement();
}
LocationsTableItem * item = static_cast<LocationsTableItem *>(const_cast<AbstractCharLItem *>(getItem(rowCount() - 1)));
LocationsTableItem * item = m_data.back();
item->setMapPolygon(mapPolygon);
item->setSecondaryPolygons(secondaryPolygons);
item->setAreaPolygonsSolar(polygonsAreaSolar);
item->setAreaPolygonsWind(polygonsAreaWind);
item->setSolarDataIndex(child.attribute("solar_select").toInt());
item->setWindDataIndex(child.attribute("wind_select").toInt());
item->setTemperatureDataIndex(child.attribute("temperature_select").toInt());
item->setPowerDemandDataIndex(child.attribute("power_demand_select").toInt());
node = node.nextSibling();
}
......@@ -597,6 +611,15 @@ const AbstractCharLItem * LocationsTableModel::getItem(int row) const
return nullptr;
}
LocationsTableItem * LocationsTableModel::getMutableItem(int row)
{
if (row >= 0 && row < this->rowCount())
{
return m_data[row];
}
return nullptr;
}
bool LocationsTableModel::matchLocationsToNodes()
{
qDebug() << endl << "Matching locations to nodes";
......
......@@ -39,7 +39,10 @@ public:
LocationsTableItem(QString name, QString uniqueName, QString municipalityKey,
double lat, double lon,
double areaSolar, double areaWind,
int polygonId = -1, int nodeID = -1);
int polygonId = -1, int nodeID = -1,
int solarData = 0, int windData = 0,
int temperatureData = 0,
int demandData = -1);
//get functions ---------------------------------------
QString getUniqueName() const {return m_uniqueName;}
......@@ -55,6 +58,10 @@ public:
QVector<QPolygonF> getAreaPolygonsSolar() const;
QVector<QPolygonF> getAreaPolygonsWind() const;
QVector<QPolygonF> getSecondaryPolygons() const;
int getWindDataIndex() const {return m_windData;}
int getSolarDataIndex() const {return m_solarData;}
int getTemperatureDataIndex() const {return m_temperatureData;}
int getPowerDemandDataIndex() const {return m_demandData;}
//set functions ---------------------------------------
void setUniqueName(QString name) {if (name != "") m_uniqueName = name;}
......@@ -77,6 +84,10 @@ public:
void setWeatherWindMean(const vector<float> &weatherWindMean);
void setWeatherTempCenter(const vector<float> &weatherTempCenter);
void setWeatherTempMean(const vector<float> &weatherTempMean);
void setWindDataIndex(int index) {m_windData = index;}
void setSolarDataIndex(int index) {m_solarData = index;}
void setTemperatureDataIndex(int index) {m_temperatureData = index;}
void setPowerDemandDataIndex(int index) {m_demandData = index;}
private:
//properties of locations accessible by tablemodel ----
......@@ -103,6 +114,11 @@ private:
vector<float> m_weatherTempCenter;
vector<float> m_weatherTempMean;
vector<float> m_powerDemandData;
//data indices for manual selection -------------------
int m_solarData;
int m_windData;
int m_temperatureData;
int m_demandData;
};
class LocationsTableModel : public AbstractCharLTableModel
......@@ -129,6 +145,7 @@ public:
void addItem();
bool removeItem(const QModelIndex &index) override;
virtual const AbstractCharLItem * getItem(int row) const override;
LocationsTableItem * getMutableItem(int row);
bool matchLocationsToNodes();
......
......@@ -16,10 +16,6 @@ NodesTableItem::NodesTableItem(QString name, double lat, double lon, int polygon
m_storageConfig = new ConfigTableModel((ConfigTableModel::AdditionalInfo::Capacity));
m_solarConfig = new ConfigTableModel(ConfigTableModel::AdditionalInfo::Area);
m_windConfig = new ConfigTableModel(ConfigTableModel::AdditionalInfo::Area);
m_solarData = 0;
m_windData = 0;
m_temperatureData = 0;
m_demandData = -1;
}
void NodesTableItem::setLatitude(double lat)
......@@ -43,11 +39,41 @@ PolygonObject *NodesTableItem::getPolygonObject() const
return m_polygonObject;
}
int NodesTableItem::getLocationCount() const
{
return m_locations.count();
}
int NodesTableItem::getLocationsId(int index) const
{
if (index > -1 && index < m_locations.count())
{
return m_locations[index];
}
return -1;
}
void NodesTableItem::setPolygonObject(PolygonObject *polygonObject)
{
m_polygonObject = polygonObject;
}
void NodesTableItem::addLocation(int id)
{
if (!m_locations.contains(id))
{
m_locations.append(id);
}
}
void NodesTableItem::removeLocation(int id)
{
if (m_locations.contains(id))
{
m_locations.remove(id);
}
}
//////////////////////////////////////////
/// MODEL IMPLEMENTATION //////////////////////////////////////////////////////////////////////
//////////////////////////////////////////
......