-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcapacity.h
More file actions
218 lines (169 loc) · 5.42 KB
/
capacity.h
File metadata and controls
218 lines (169 loc) · 5.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
/*
* This file is part of the ResOpt project.
*
* Copyright (C) 2011-2012 Aleksander O. Juell <aleksander.juell@ntnu.no>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef CAPACITY_H
#define CAPACITY_H
#include <QVector>
#include <QString>
#include <tr1/memory>
using std::tr1::shared_ptr;
namespace ResOpt
{
class Constraint;
class Pipe;
/**
* @brief Capacity constraints at a given point in the pipe network.
* @details A capacity constraint is used to set maximum allowed rates for the different phases at points in the pipe network.
* Constraints can be set for the maximum rate of gas, oil, water, or total liquid (oil + water). This is done through the
* setMax() functions.
*
* The Capacity is fed by any number of pipes. When the Capacity is generated from the driver file, the identifying pipe numbers
* are added through addFeedPipeNumber(). The Model takes care of translating the numbers to Pipe pointers during initialization.
* The pointers to the feed pipes are added through addFeedPipe().
*
*/
class Capacity
{
private:
QString m_name;
double m_max_oil;
double m_max_gas;
double m_max_water;
double m_max_liquid;
QVector<shared_ptr<Constraint> > m_cons_oil;
QVector<shared_ptr<Constraint> > m_cons_gas;
QVector<shared_ptr<Constraint> > m_cons_water;
QVector<shared_ptr<Constraint> > m_cons_liquid;
QVector<Pipe*> m_feed_pipes; /**< TODO */
QVector<int> m_feed_pipe_numbers;
QVector<double> m_schedule;
public:
/**
* @brief
*
*/
Capacity();
Capacity(const Capacity &s);
// misc functions
void setupConstraints(const QVector<double> &master_schedule);
/**
* @brief Updates the constraints based on the maximum rates going through the separator
*
*/
void updateConstraints();
QString description() const;
// add functions
/**
* @brief Adds a Pipe as a feed to the Separator
*
* @param p
*/
void addFeedPipe(Pipe *p) {m_feed_pipes.push_back(p);}
/**
* @brief Adds the identifying number to a feed pipe.
* @details The numbers must be resolved to pointers before running the model.
*
* @param i
*/
void addFeedPipeNumber(int i) {m_feed_pipe_numbers.push_back(i);}
// set functions
/**
* @brief Sets the separator name
*
* @param n
*/
void setName(const QString &n) {m_name = n;}
/**
* @brief Sets the oil Constraint for the Separator
*
* @param c
*/
void setMaxOil(double m) {m_max_oil = m;}
/**
* @brief Sets the gas Constraint for the Separator
*
* @param c
*/
void setMaxGas(double m) {m_max_gas = m;}
/**
* @brief Sets the water Constraint for the Separator
*
* @param c
*/
void setMaxWater(double m) {m_max_water = m;}
/**
* @brief Sets the total liquid Constraint for the Separator
*
* @param c
*/
void setMaxLiquid(double m) {m_max_liquid = m;}
// get functions
double maxOil() const {return m_max_oil;}
double maxGas() const {return m_max_gas;}
double maxWater() const {return m_max_water;}
double maxLiquid() const {return m_max_liquid;}
const QVector<double>& schedule() const {return m_schedule;}
/**
* @brief Returns the separator name
*
* @return const QString
*/
const QString& name() const {return m_name;}
/**
* @brief Returns the oil Constraint for the Separator
*
* @return Constraint
*/
QVector<shared_ptr<Constraint> > oilConstraints() {return m_cons_oil;}
/**
* @brief Returns the gas Constraint for the Separator
*
* @return Constraint
*/
QVector<shared_ptr<Constraint> > gasConstraints() {return m_cons_gas;}
/**
* @brief Returns the water Constraint for the Separator
*
* @return Constraint
*/
QVector<shared_ptr<Constraint> > waterConstraints() {return m_cons_water;}
/**
* @brief Returns the total liquid Constraint for the Separator
*
* @return Constraint
*/
QVector<shared_ptr<Constraint> > liquidConstraints() {return m_cons_liquid;}
/**
* @brief The number of feed pipes specified in the driver file. Does not neccesary correspond to the number of connected pipes.
*
* @return int
*/
int numberOfFeedPipeNumbers() const {return m_feed_pipe_numbers.size();}
/**
* @brief Returns the number of feed pipe i (as input in the driver file)
*
* @param i
* @return int
*/
int feedPipeNumber(int i) const {return m_feed_pipe_numbers.at(i);}
int numberOfFeedPipes() const {return m_feed_pipes.size();}
Pipe* feedPipe(int i) {return m_feed_pipes.at(i);}
};
} // namespace ResOpt
#endif // SEPARATOR_H