Commit 72b9d2cc authored by Gerrit Erichsen's avatar Gerrit Erichsen
Browse files

Apparently forgot to add CSPTableModel files. Here they come.

parent f0508cd2
This diff is collapsed.
/// Part of the CharL GUI
/// created : 01/2020
/// created by: Gerrit Erichsen
/// filled with life by: Gerrit Erichsen
/// _________________________________________________________________________________________________________
/// Change-Log:
/// [MM/YYYY] - [Name] - [Description]
/// _________________________________________________________________________________________________________
/// Description:
#include <QtGui>
#include <QtCore>
#include <QItemDelegate>
#include <QDomDocument>
#include "AbstractPlantTableModel.h"
#include "EfficiencyField.h"
class CSPTableItem : public AbstractPlantTableItem
/// \brief Constructors and operator=
/// The main-constructor is usable as empty constructor or partially
/// loaded in the order of the table, except for the vector-parameters.
/// These are loaded from the fileName(s) given.
/// Then there is the copy-constructor which is needed for easy vector-use.
/// Additionally there is the equals operator=, which is basically the
/// copy-constructor, to allow updates and an easy use
CSPTableItem(QString name = "name",
double referencePower = 0.,
double referenceMirrorArea = 0.,
QString efficiencyFileMirrors = "",
QString efficiencyFileReceiver = "",
QString efficiencyFilePowerblock = "",
double solarMultiple = 0.,
double selfdischargeRate = 0.,
double investCostPower = 0.,
double investCostCapacity = 0.,
double fixedOperationCost = 0.,
double specificOperationCost = 0.,
int lifeTime = 1);
/// \brief get-Funktionen
/// Usual access functions that return a copied value of the parameters
double getReferencePower() const {return m_referencePower;}
double getReferenceMirrorArea() const {return m_referenceMirrorArea;}
QString getEfficiencyMirrorsFile() const {return m_efficiencyMirrorsFile;}
const EfficiencyField & getEfficiencyMirrors() const {return m_efficiencyMirrors;}
QString getEfficiencyReceiverFile() const {return m_efficiencyReceiverFile;}
const QVector<std::pair<double, double>> & getEfficiencyReceiver() const {return m_efficiencyReceiver;}
QString getEfficiencyPowerBlockFile() const {return m_powerBlockFile;}
const QVector<std::pair<double, double>> & getEfficiencyPowerBlock() const {return m_efficiencyPowerBlock;}
double getSelfDischargeRate() const {return m_selfDischargeRate;}
double getSolarMultiple() const {return m_solarMultiple;}
double getSpecificInvestCostCapacity() const {return m_specificInvestCostCapacity;}
/// \brief set-Funktionen
/// Used to set the subsequent parameter to a new value. For that
/// an inline implementation seemed acceptable. Exceptions from the
/// inline implementation are commented in the cpp file
void setReferencePower(double power) {m_referencePower = power;}
void setReferenceMirrorArea(double area) {m_referenceMirrorArea = area;}
bool setEfficiencyMirrors(QString fileName);
bool setEfficiencyReceiver(QString fileName);
bool setEfficiencyPowerBlock(QString fileName);
void setSelfDischargeRate(double rate) {m_selfDischargeRate = rate;}
void setSolarMultiple(double multiple) {m_solarMultiple = multiple;}
void setSpecificInvestCostPowerCharge(double investCostPerMW) {this->setSpecInvestCost(investCostPerMW);}
void setSpecificInvestCostCapacity(double investCostPerMWh) {m_specificInvestCostCapacity = investCostPerMWh;}
void setSpecificFixedOperationalCostCharge(double fixedCostPerInvest) {this->setSpecFixOaMCost(fixedCostPerInvest);}
void setSpecificOperationalCostCharge(double costPerMWh) {this->setSpecVarOaMCost(costPerMWh);}
void setLifeTime(int time) {this->setLifeTime(time);}
double m_referencePower; // gradient CSP can manage while charging in %_P_nom / min
double m_referenceMirrorArea; // gradient CSP can manage while discharging in %_P_nom / min
QString m_efficiencyMirrorsFile; // filename to find where the charging efficiency is read from (utility)
EfficiencyField m_efficiencyMirrors; // efficiency of charge given in - / P/P_nom
QString m_efficiencyReceiverFile; // filename to find where the discharging efficiency is read from (utility)
QVector<std::pair<double,double>> m_efficiencyReceiver; // efficiency of discharge given in - / P/P_nom
QString m_powerBlockFile; // filename to find where the self-discharge rate is read from (utility)
QVector<std::pair<double,double>> m_efficiencyPowerBlock; // efficiency of charge given in % / h %_Capacity
double m_selfDischargeRate;
double m_solarMultiple;
double m_specificInvestCostCapacity; // Specific cost of thermal storage in €/MWh CSP capacity
class CSPTableModel : public AbstractPlantTableModel
CSPTableModel(QObject * parent = nullptr);
// default functions reimplemented as demanden by QAbstractTableModel
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
// own functions
virtual void addItem(const AbstractCharLItem & item) override;
virtual bool addItem(const QStringList & entries) override;
virtual void addItem(const CSPTableItem & item);
virtual bool removeItem(const QModelIndex &index) override;
virtual const AbstractCharLItem * getItem(int row) const override;
virtual void clearData() override;
QVector<CSPTableItem> m_data; // collection of table items
class CSPTableDelegate : public QItemDelegate
CSPTableDelegate(QObject * parent = nullptr);
virtual QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
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