-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathClass.J_HeatingManagementProfileHybridHeatPump.java
More file actions
159 lines (137 loc) · 5.91 KB
/
Class.J_HeatingManagementProfileHybridHeatPump.java
File metadata and controls
159 lines (137 loc) · 5.91 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
/**
* J_HeatingManagementProfileHybridHeatPump
*/
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
@JsonAutoDetect(
fieldVisibility = Visibility.ANY, //
getterVisibility = Visibility.NONE,
isGetterVisibility = Visibility.NONE,
setterVisibility = Visibility.NONE,
creatorVisibility = Visibility.NONE
)
public class J_HeatingManagementProfileHybridHeatPump implements I_HeatingManagement {
private boolean isInitialized = false;
private GridConnection gc;
private J_TimeParameters timeParameters;
private List<OL_GridConnectionHeatingType> validHeatingTypes = Arrays.asList(
OL_GridConnectionHeatingType.HYBRID_HEATPUMP
);
private OL_GridConnectionHeatingType currentHeatingType;
private J_EAConversionHeatPump heatPumpAsset;
private J_EAConversionGasBurner gasBurnerAsset;
private J_HeatingPreferences heatingPreferences;
/**
* Default constructor
*/
public J_HeatingManagementProfileHybridHeatPump() {
}
public J_HeatingManagementProfileHybridHeatPump( GridConnection gc, J_TimeParameters timeParameters, OL_GridConnectionHeatingType heatingType) {
this.gc = gc;
this.timeParameters = timeParameters;
this.currentHeatingType = heatingType;
}
public void manageHeating(J_TimeVariables timeVariables) {
if ( !isInitialized ) {
this.initializeAssets();
}
double heatDemand_kW = gc.fm_currentBalanceFlows_kW.get(OL_EnergyCarriers.HEAT);
if (heatPumpAsset.getCOP() > 3.0 ) {
if (heatDemand_kW < heatPumpAsset.getOutputCapacity_kW()) {
gc.f_updateFlexAssetFlows(heatPumpAsset, heatDemand_kW / heatPumpAsset.getOutputCapacity_kW(), timeVariables);
gc.f_updateFlexAssetFlows(gasBurnerAsset, 0.0, timeVariables);
return;
}
else if (heatDemand_kW < heatPumpAsset.getOutputCapacity_kW() + gasBurnerAsset.getOutputCapacity_kW() ) {
gc.f_updateFlexAssetFlows(heatPumpAsset, 1.0, timeVariables);
gc.f_updateFlexAssetFlows(gasBurnerAsset, (heatDemand_kW - heatPumpAsset.getOutputCapacity_kW()) / gasBurnerAsset.getOutputCapacity_kW(), timeVariables);
return;
}
else {
throw new RuntimeException(this.getClass() + " in GC: " + gc.p_gridConnectionID + " does not have enough combined capacity to fulfil the heat demand");
}
}
else {
if (heatDemand_kW < gasBurnerAsset.getOutputCapacity_kW()) {
gc.f_updateFlexAssetFlows(gasBurnerAsset, heatDemand_kW / gasBurnerAsset.getOutputCapacity_kW(), timeVariables);
gc.f_updateFlexAssetFlows(heatPumpAsset, 0.0, timeVariables);
return;
}
else if (heatDemand_kW < gasBurnerAsset.getOutputCapacity_kW() + heatPumpAsset.getOutputCapacity_kW() ) {
gc.f_updateFlexAssetFlows(gasBurnerAsset, 1.0, timeVariables);
gc.f_updateFlexAssetFlows(heatPumpAsset, (heatDemand_kW - gasBurnerAsset.getOutputCapacity_kW()) / heatPumpAsset.getOutputCapacity_kW(), timeVariables);
return;
}
else {
throw new RuntimeException(this.getClass() + " in GC: " + gc.p_gridConnectionID + " does not have enough combined capacity to fulfil the heat demand");
}
}
}
public void initializeAssets() {
if (!validHeatingTypes.contains(this.currentHeatingType)) {
throw new RuntimeException(this.getClass() + " does not support heating type: " + this.currentHeatingType);
}
if (gc.p_heatBuffer != null) {
throw new RuntimeException(this.getClass() + " does not support heat buffers.");
}
if (gc.p_BuildingThermalAsset != null) {
throw new RuntimeException(this.getClass() + " does not support a building asset.");
}
J_EAProfile heatProfile = findFirst(gc.c_profileAssets, x -> x.getEnergyCarrier() == OL_EnergyCarriers.HEAT && x.getEAType() != OL_EnergyAssetType.HOT_WATER_CONSUMPTION);
if (heatProfile == null) {
throw new RuntimeException(this.getClass() + " requires a HEAT_DEMAND profile.");
}
if (gc.c_heatingAssets.size() != 2) {
throw new RuntimeException(this.getClass() + " requires exactly two heating assets.");
}
// TODO: Add a check if the power of the asset is sufficient?
if (gc.c_heatingAssets.get(0) instanceof J_EAConversionGasBurner) {
this.gasBurnerAsset = (J_EAConversionGasBurner)gc.c_heatingAssets.get(0);
}
else if (gc.c_heatingAssets.get(1) instanceof J_EAConversionGasBurner) {
this.gasBurnerAsset = (J_EAConversionGasBurner)gc.c_heatingAssets.get(1);
}
else {
throw new RuntimeException(this.getClass() + " requires a Gas Burner");
}
if (gc.c_heatingAssets.get(0) instanceof J_EAConversionHeatPump) {
this.heatPumpAsset = (J_EAConversionHeatPump)gc.c_heatingAssets.get(0);
}
else if (gc.c_heatingAssets.get(1) instanceof J_EAConversionHeatPump) {
this.heatPumpAsset = (J_EAConversionHeatPump)gc.c_heatingAssets.get(1);
}
else {
throw new RuntimeException(this.getClass() + " requires a Heat Pump");
}
this.isInitialized = true;
}
public void notInitialized() {
this.isInitialized = false;
}
public List<OL_GridConnectionHeatingType> getValidHeatingTypes() {
return this.validHeatingTypes;
}
public OL_GridConnectionHeatingType getCurrentHeatingType() {
return this.currentHeatingType;
}
public void setHeatingPreferences(J_HeatingPreferences heatingPreferences) {
this.heatingPreferences = heatingPreferences;
}
public J_HeatingPreferences getHeatingPreferences() {
return this.heatingPreferences;
}
//Get parentagent
public Agent getParentAgent() {
return this.gc;
}
public void storeStatesAndReset() {
//Nothing to store/reset
}
public void restoreStates() {
//Nothing to store/reset
}
@Override
public String toString() {
return super.toString();
}
}