EMlab-generation Documentation  1.0
Documentation of the EMLab-Generation model.
NationalGovernment.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.agent;
17 
18 import org.neo4j.graphdb.Direction;
19 import org.springframework.data.neo4j.annotation.NodeEntity;
20 import org.springframework.data.neo4j.annotation.RelatedTo;
21 
22 import agentspring.agent.Agent;
25 
26 @NodeEntity
27 public class NationalGovernment extends DecarbonizationAgent implements Agent {
28 
29  @RelatedTo(type = "GOVERNED_ZONE", elementClass = Zone.class, direction = Direction.OUTGOING)
30  private Zone governedZone;
31 
32  @RelatedTo(type = "MINCO2PRICE_TREND", elementClass = TimeSeriesImpl.class, direction = Direction.OUTGOING)
33  private TimeSeriesImpl minNationalCo2PriceTrend;
34 
35  public TimeSeriesImpl getMinNationalCo2PriceTrend() {
36  return minNationalCo2PriceTrend;
37  }
38 
39  public void setMinNationalCo2PriceTrend(TimeSeriesImpl minNationalCo2PriceTrend) {
40  this.minNationalCo2PriceTrend = minNationalCo2PriceTrend;
41  }
42 
43  public Zone getGovernedZone() {
44  return governedZone;
45  }
46 
47  public void setGovernedZone(Zone governedZone) {
48  this.governedZone = governedZone;
49  }
50 
51  public double getPaymentEffectivePriceDifferenceBetweenNationalMinPriceAndGivenMarketPrice(double marketPrice, long tick) {
52  if (minNationalCo2PriceTrend.getValue(tick) > marketPrice) {
53  return (minNationalCo2PriceTrend.getValue(tick) - marketPrice);
54  } else {
55  return 0d;
56  }
57  }
58 
59 }