DISPLACE  1.0
A spatial model of fisheries to help sustainable fishing and maritime spatial planning
windfarmstable.h
Go to the documentation of this file.
1 #ifndef WINDFARMSTABLE_H
2 #define WINDFARMSTABLE_H
3 
4 #include "commons_global.h"
5 #include "idtypes.h"
6 
7 #include "sqlitefielddef.h"
8 #include "sqlitetable.h"
9 using namespace sqlite;
10 
11 #include <vector>
12 #include <string>
13 #include <map>
14 
15 class Windmill;
16 
17 class COMMONSSHARED_EXPORT WindfarmsTable : public SQLiteTable
18 {
19  struct Impl;
20  std::unique_ptr<Impl> p;
21 
22 public:
23  const FieldDef<FieldType::Integer> fldTStep = makeFieldDef("TStep",FieldType::Integer()).notNull();
24  const FieldDef<FieldType::Integer> fldWindfarmId = makeFieldDef("WindarmId",FieldType::Integer()).notNull();
25  const FieldDef<FieldType::Integer> fldWindfarmType = makeFieldDef("WindfarmType",FieldType::Integer()).notNull();
26 
27  const FieldDef<FieldType::Real> fldKwh = makeFieldDef("Kwh", FieldType::Real());
28  const FieldDef<FieldType::Real> fldKwhProduction = makeFieldDef("KwhProduction", FieldType::Real());
29 
30  WindfarmsTable(std::shared_ptr<SQLiteStorage> db, std::string name);
31  ~WindfarmsTable() noexcept;
32  void dropAndCreate();
33 
34  void exportWindmillData(Windmill *windmill, int tstep);
35 
36  struct StatData {
37  std::vector<double> t;
38  std::vector<double> v;
39  };
40 
41  enum class StatType { Kwh, KwhProduction };
42  enum class Aggreg { Sum, Min, Max, Avg };
43 
44  StatData getStatData(StatType, Aggreg, int wfType);
45  StatData getStatData(StatType, Aggreg);
46 };
47 
48 #endif // WINDFARMSTABLE_H
Definition: sqliteoutputstorage.h:33
int tstep
Definition: main.cpp:205
Definition: windfarmstable.h:36
std::vector< double > t
Definition: windfarmstable.h:37
Definition: Windmill.h:4
Aggreg
Definition: windfarmstable.h:42
Definition: windfarmstable.h:17
std::vector< double > v
Definition: windfarmstable.h:38
Definition: windfarmstable.cpp:8
StatType
Definition: windfarmstable.h:41
#define COMMONSSHARED_EXPORT
Definition: commons_global.h:23