EMlab-generation Documentation  1.0
Documentation of the EMLab-Generation model.
PowerPlantDispatchPlan.java
1 /*******************************************************************************
2  * Copyright 2012 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  ******************************************************************************/
16 package emlab.gen.domain.market.electricity;
17 
18 import org.neo4j.graphdb.Direction;
19 import org.springframework.data.neo4j.annotation.Indexed;
20 import org.springframework.data.neo4j.annotation.NodeEntity;
21 import org.springframework.data.neo4j.annotation.RelatedTo;
22 import org.springframework.transaction.annotation.Transactional;
23 
27 
39 @NodeEntity
40 public class PowerPlantDispatchPlan extends Bid {
41 
42  @RelatedTo(type = "SEGMENT_DISPATCHPLAN", elementClass = Segment.class, direction = Direction.OUTGOING)
43  private Segment segment;
44 
45  @RelatedTo(type = "POWERPLANT_DISPATCHPLAN", elementClass = PowerPlant.class, direction = Direction.OUTGOING)
46  private PowerPlant powerPlant;
47 
48  public static int CONTRACTED = -11;
49  public static int PARTLY_CONTRACTED = -10;
50  public static int NOT_CONTRACTED = -9;
51 
52  private boolean forecast;
53 
57  private final boolean supplyBid = true;
58 
59  private double capacityLongTermContract;
63  // private double amount;
67  // private double price;
68  private double bidWithoutCO2;
69 
70  // private long time;
71 
72  private int SRstatus;
73  private double oldPrice;
74 
75  public int getSRstatus() {
76  return SRstatus;
77  }
78 
79  public void setSRstatus(int sRstatus) {
80  SRstatus = sRstatus;
81  }
82 
83  public double getOldPrice() {
84  return oldPrice;
85  }
86 
87  public void setOldPrice(double oldPrice) {
88  this.oldPrice = oldPrice;
89  }
90 
91  @Indexed(indexName = "ppdpTime")
92  private int ppdpTime;
93 
94  public int getPpdpTime() {
95  return ppdpTime;
96  }
97 
98  public void setPpdpTime(int ppdpTime) {
99  this.ppdpTime = ppdpTime;
100  }
101 
102  public Segment getSegment() {
103  return segment;
104  }
105 
106  public void setSegment(Segment segment) {
107  this.segment = segment;
108  }
109 
110  public PowerPlant getPowerPlant() {
111  return powerPlant;
112  }
113 
114  public void setPowerPlant(PowerPlant powerPlant) {
115  this.powerPlant = powerPlant;
116  }
117 
118  public double getCapacityLongTermContract() {
119  return capacityLongTermContract;
120  }
121 
122  public void setCapacityLongTermContract(double capacityLongTermContract) {
123  this.capacityLongTermContract = capacityLongTermContract;
124  }
125 
126  // public long getTime() {
127  // return time;
128  // }
129  //
130  // public void setTime(long time) {
131  // this.time = time;
132  // this.ppdpTime = (int) time;
133  // }
134 
135  @Override
136  public String toString() {
137  return "for " + getBidder() + " power plant: " + getPowerPlant() + " in segment " + segment + " plans to sell long term: "
138  + getCapacityLongTermContract() + " plans to sell capacity spot: "
139  + getAmount() + "for price: " + getPrice();
140  }
141 
142  public double getBidWithoutCO2() {
143  return bidWithoutCO2;
144  }
145 
146  public void setBidWithoutCO2(double bidWithoutCO2) {
147  this.bidWithoutCO2 = bidWithoutCO2;
148  }
149 
150  @Override
151  public boolean isSupplyBid() {
152  return supplyBid;
153  }
154 
155  public void specifyNotPersist(PowerPlant plant, EnergyProducer producer, ElectricitySpotMarket market, Segment segment, long time,
156  double price, double bidWithoutCO2, double spotMarketCapacity,
157  double longTermContractCapacity, int status, boolean forecast) {
158  this.setPowerPlant(plant);
159  this.setSegment(segment);
160  this.setTime(time);
161  this.setBidder(producer);
162  this.setBiddingMarket(market);
163  this.setPrice(price);
164  this.setBidWithoutCO2(bidWithoutCO2);
165  this.setAmount(spotMarketCapacity);
166  this.setCapacityLongTermContract(longTermContractCapacity);
167  this.setStatus(status);
168  this.setForecast(forecast);
169  }
170 
171  // All transactional methods below are signified by starting with update
172  @Transactional
173  public void specifyAndPersist(PowerPlant plant, EnergyProducer producer, ElectricitySpotMarket market, Segment segment, long time,
174  double price, double bidWithoutCO2, double spotMarketCapacity, double longTermContractCapacity, int status, boolean forecast) {
175  this.persist();
176  this.specifyNotPersist(plant, producer, market, segment, time, price, bidWithoutCO2, spotMarketCapacity, longTermContractCapacity,
177  status, forecast);
178 
179  }
180 
181  @Transactional
182  public void updateCapacityLongTermContract(double capacity) {
183  this.setCapacityLongTermContract(capacity);
184  }
185 
186  @Transactional
187  public void updateCapacitySpotMarket(double capacity) {
188  this.setAmount(capacity);
189  }
190 
191  public boolean isForecast() {
192  return forecast;
193  }
194 
195  public void setForecast(boolean forecast) {
196  this.forecast = forecast;
197  }
198 
199 }