EMlab-generation Documentation  1.0
Documentation of the EMLab-Generation model.
PowerPlantRepository.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.repository;
17 
18 import java.util.ArrayList;
19 
20 import org.springframework.data.neo4j.annotation.Query;
21 import org.springframework.data.neo4j.annotation.QueryType;
22 import org.springframework.data.neo4j.repository.GraphRepository;
23 import org.springframework.data.repository.query.Param;
24 import org.springframework.stereotype.Repository;
25 
32 
40 @Repository
41 public interface PowerPlantRepository extends GraphRepository<PowerPlant> {
42 
50  @Query("start owner=node({owner}) match (owner)<-[:POWERPLANT_OWNER]-(plant) return plant")
51  public Iterable<PowerPlant> findPowerPlantsByOwner(@Param("owner") EnergyProducer owner);
52 
53  @Query("start owner=node({owner}) match (owner)<-[:POWERPLANT_OWNER]-(plant) return count(plant)")
54  public long countPowerPlantsByOwner(@Param("owner") EnergyProducer owner);
55 
67  @Query(value = "g.idx('__types__')[[className:'emlab.gen.domain.technology.PowerPlant']].filter{(it.dismantleTime > tick) && ((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick)}", type = QueryType.Gremlin)
68  Iterable<PowerPlant> findOperationalPowerPlants(@Param("tick") long tick);
69 
70  @Query(value = "g.idx('__types__')[[className:'emlab.gen.domain.technology.PowerPlant']].filter{((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.expectedEndOfLife > tick)}", type = QueryType.Gremlin)
71  public Iterable<PowerPlant> findExpectedOperationalPowerPlants(@Param("tick") long tick);
72 
73  @Query(value = "g.idx('__types__')[[className:'emlab.gen.domain.technology.PowerPlant']].as('x').out('TECHNOLOGY').filter{(it.dismantleTime > tick) && ((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick)}", type = QueryType.Gremlin)
74  Iterable<PowerPlant> findOperationalPowerPlantsWithFuelsGreaterZero(@Param("tick") long tick);
75 
76  // @Query(value =
77  // "g.V.filter{it.__type__=='emlab.gen.domain.technology.PowerPlant' && ((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.dismantleTime > tick)}",
78  // type = QueryType.Gremlin)
79  // Iterable<PowerPlant> findOperationalPowerPlants(@Param("tick") long
80  // tick);
81 
82  @Query(value = "g.idx('__types__')[[className:'emlab.gen.domain.technology.PowerPlant']] .propertyFilter('dismantleTime', FilterPipe.Filter.GREATER_THAN, tick)", type = QueryType.Gremlin)
83  Iterable<PowerPlant> findAllPowerPlantsWhichAreNotDismantledBeforeTick(@Param("tick") long tick);
84 
85  @Query(value = "g.idx('__types__')[[className:'emlab.gen.domain.technology.PowerPlant']] .propertyFilter('dismantleTime', FilterPipe.Filter.LESS_THAN, tick)", type = QueryType.Gremlin)
86  Iterable<PowerPlant> findAllPowerPlantsDismantledBeforeTick(@Param("tick") long tick);
87 
88  @Query(value = "g.idx('__types__')[[className:'emlab.gen.domain.technology.PowerPlant']].filter{it.constructionStartTime==tick}", type = QueryType.Gremlin)
89  Iterable<PowerPlant> findAllPowerPlantsWithConstructionStartTimeInTick(@Param("tick") long tick);
101  @Query(value = "g.idx('__types__')[[className:'emlab.gen.domain.technology.PowerPlant']].filter{(it.dismantleTime > tick) && ((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick)}.toList()", type = QueryType.Gremlin)
102  ArrayList<PowerPlant> findOperationalPowerPlantsAsList(@Param("tick") long tick);
103 
104  @Query(value = "g.idx('__types__')[[className:'emlab.gen.domain.technology.PowerPlant']].filter{(it.dismantleTime > tick) && ((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick)}.sum{it.actualNominalCapacity};", type = QueryType.Gremlin)
105  double calculateCapacityOfOperationalPowerPlants(@Param("tick") long tick);
106 
107  @Query(value = "t = new Table();" +
108  "g.idx('__types__')[[className:'emlab.gen.domain.technology.PowerPlant']].filter{(it.dismantleTime > tick) && ((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick)}.as('pp').out('TECHNOLOGY').as('ty').table(t){it.actualNominalCapacity}{it.peakSegmentDependentAvailability}.cap().next(); " +
109  "capacitySum = 0; for (row in t){capacitySum += row.get(0) * row.get(1);}; return capacitySum;" , type = QueryType.Gremlin)
110  double calculatePeakCapacityOfOperationalPowerPlants(@Param("tick") long tick);
111 
121  @Query(value = "g.v(owner).in('POWERPLANT_OWNER').filter{(it.dismantleTime > tick) && ((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick)}", type = QueryType.Gremlin)
122  Iterable<PowerPlant> findOperationalPowerPlantsByOwner(@Param("owner") EnergyProducer owner,
123  @Param("tick") long tick);
124 
125  @Query(value = "g.v(owner).in('POWERPLANT_OWNER').as('x').out('TECHNOLOGY').filter{it.out('FUEL').count()>0}.back('x').filter{(it.dismantleTime > tick) && ((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick)}", type = QueryType.Gremlin)
126  Iterable<PowerPlant> findOperationalPowerPlantsWithFuelsGreaterZeroByOwner(@Param("owner") EnergyProducer owner,
127  @Param("tick") long tick);
128 
138  @Query(value = "g.v(tech).in('TECHNOLOGY').filter{(it.dismantleTime > tick) && ((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.dismantleTime > tick)}", type = QueryType.Gremlin)
139  Iterable<PowerPlant> findOperationalPowerPlantsByTechnology(@Param("tech") PowerGeneratingTechnology technology,
140  @Param("tick") long tick);
141 
142  @Query(value = "result = g.v(tech).as('x').in('TECHNOLOGY').filter{(it.dismantleTime > tick) && ((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick)}.sum{it.actualNominalCapacity};"
143  + "if(result == null){return 0;} else{return result;}", type = QueryType.Gremlin)
144  double calculateCapacityOfOperationalPowerPlantsByTechnology(@Param("tech") PowerGeneratingTechnology technology,
145  @Param("tick") long tick);
146 
147  @Query("start tech=node({tech}) match (tech)<-[:TECHNOLOGY]-(plant) return plant")
148  public Iterable<PowerPlant> findPowerPlantsByTechnology(@Param("tech") PowerGeneratingTechnology technology);
149 
150  @Query("start gridnode=node({gridnode}) match (gridnode)<-[:LOCATION]-(plant) return plant")
151  public Iterable<PowerPlant> findPowerPlantsByPowerGridNode(@Param("gridnode") PowerGridNode node);
152 
153  @Query(value = "g.v(gridnode).in('LOCATION').filter{(it.dismantleTime > tick) && ((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick)}", type = QueryType.Gremlin)
154  public Iterable<PowerPlant> findOperationalPowerPlantsByPowerGridNode(@Param("gridnode") PowerGridNode node,
155  @Param("tick") long tick);
156 
157  @Query("START owner=node({owner}), market=node({market}) "
158  + "MATCH (owner)<-[:POWERPLANT_OWNER]-(plant), (market)-[:ZONE]->()<-[:REGION]-()<-[:LOCATION]-(plant)"
159  + "RETURN plant")
160  public Iterable<PowerPlant> findPowerPlantsByOwnerAndMarket(@Param("owner") EnergyProducer owner,
161  @Param("market") ElectricitySpotMarket market);
162 
163  @Query(value = "g.v(market).out('ZONE').in('REGION').in('LOCATION').filter{it.__type__=='emlab.gen.domain.technology.PowerPlant'}.filter{((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.dismantleTime > tick)}", type = QueryType.Gremlin)
164  public Iterable<PowerPlant> findOperationalPowerPlantsInMarket(@Param("market") ElectricitySpotMarket market,
165  @Param("tick") long tick);
166 
167  @Query(value = "g.v(market).out('ZONE').in('REGION').in('LOCATION').filter{it.__type__=='emlab.gen.domain.technology.PowerPlant'}.filter{((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.dismantleTime > tick)}.sum{it.actualNominalCapacity}", type = QueryType.Gremlin)
168  public double calculateCapacityOfOperationalPowerPlantsInMarket(@Param("market") ElectricitySpotMarket market,
169  @Param("tick") long tick);
170 
171  @Query(value = "t = new Table();" +
172  "g.v(market).out('ZONE').in('REGION').in('LOCATION').filter{it.__type__=='emlab.gen.domain.technology.PowerPlant'}.filter{((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.dismantleTime > tick)}.as('pp').out('TECHNOLOGY').as('ty').table(t){it.actualNominalCapacity}{it.peakSegmentDependentAvailability}.cap().next(); " +
173  "capacitySum = 0; for (row in t){capacitySum += row.get(0) * row.get(1);}; return capacitySum;" , type = QueryType.Gremlin)
174  public double calculatePeakCapacityOfOperationalPowerPlantsInMarket(@Param("market") ElectricitySpotMarket market,
175  @Param("tick") long tick);
176 
177  @Query(value = "g.v(market).out('ZONE').in('REGION').in('LOCATION').filter{it.__type__=='emlab.gen.domain.technology.PowerPlant'}.filter{((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.expectedEndOfLife > tick)}", type = QueryType.Gremlin)
178  public Iterable<PowerPlant> findExpectedOperationalPowerPlantsInMarket(
179  @Param("market") ElectricitySpotMarket market, @Param("tick") long tick);
180 
181  @Query(value = "g.v(market).out('ZONE').in('REGION').in('LOCATION').filter{it.__type__=='emlab.gen.domain.technology.PowerPlant'}.filter{((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.expectedEndOfLife > tick)}.sum{it.actualNominalCapacity}", type = QueryType.Gremlin)
182  public double calculateCapacityOfExpectedOperationalPowerPlantsInMarket(
183  @Param("market") ElectricitySpotMarket market, @Param("tick") long tick);
184 
185  @Query(value = "g.v(market).out('ZONE').in('REGION').in('LOCATION').filter{it.__type__=='emlab.gen.domain.technology.PowerPlant'}.as('x').out('TECHNOLOGY').filter{it==g.v(tech)}.back('x').filter{((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.expectedEndOfLife > tick)}", type = QueryType.Gremlin)
186  public Iterable<PowerPlant> findExpectedOperationalPowerPlantsInMarketAndTechnology(
187  @Param("market") ElectricitySpotMarket market, @Param("tick") long tick);
188 
189  @Query(value = "result = g.v(market).out('ZONE').in('REGION').in('LOCATION').filter{it.__type__=='emlab.gen.domain.technology.PowerPlant'}.filter{((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.expectedEndOfLife > tick)}.as('x').out('TECHNOLOGY').filter{it.name==g.v(tech).name}.back('x').sum{it.actualNominalCapacity};"
190  + "if(result == null){return 0} else{return result}", type = QueryType.Gremlin)
191  public double calculateCapacityOfExpectedOperationalPowerPlantsInMarketAndTechnology(
192  @Param("market") ElectricitySpotMarket market, @Param("tech") PowerGeneratingTechnology technology,
193  @Param("tick") long tick);
194 
195  @Query(value = "result = g.v(node).in('LOCATION').filter{it.__type__=='emlab.gen.domain.technology.PowerPlant'}.filter{((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.expectedEndOfLife > tick)}.as('x').out('TECHNOLOGY').filter{it.name==g.v(tech).name}.back('x').sum{it.actualNominalCapacity};"
196  + "if(result == null){return 0} else{return result}", type = QueryType.Gremlin)
197  public double calculateCapacityOfExpectedOperationalPowerPlantsByNodeAndTechnology(
198  @Param("node") PowerGridNode node, @Param("tech") PowerGeneratingTechnology technology,
199  @Param("tick") long tick);
200 
201  @Query(value = "result = g.v(market).out('ZONE').in('REGION').in('LOCATION').filter{it.__type__=='emlab.gen.domain.technology.PowerPlant'}.as('owner').out('POWERPLANT_OWNER').filter{it==g.v(owner)}.back('owner').filter{((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.expectedEndOfLife > tick)}.out('TECHNOLOGY').filter{it==g.v(tech)};", type = QueryType.Gremlin)
202  public Iterable<PowerPlant> findExpectedOperationalPowerPlantsInMarketByOwnerAndTechnology(
203  @Param("market") ElectricitySpotMarket market, @Param("tech") PowerGeneratingTechnology technology,
204  @Param("tick") long tick, @Param("owner") EnergyProducer owner);
205 
206  @Query(value = "result = g.v(market).out('ZONE').in('REGION').in('LOCATION').filter{it.__type__=='emlab.gen.domain.technology.PowerPlant'}.as('owner').out('POWERPLANT_OWNER').filter{it==g.v(owner)}.back('owner').filter{((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.expectedEndOfLife > tick)}.as('x').out('TECHNOLOGY').filter{it==g.v(tech)}.back('x').sum{it.actualNominalCapacity};"
207  + "if(result == null){return 0} else{return result}", type = QueryType.Gremlin)
208  public double calculateCapacityOfExpectedOperationalPowerPlantsInMarketByOwnerAndTechnology(
209  @Param("market") ElectricitySpotMarket market, @Param("tech") PowerGeneratingTechnology technology,
210  @Param("tick") long tick, @Param("owner") EnergyProducer owner);
211 
212  @Query(value = "result = g.v(owner).in('POWERPLANT_OWNER').filter{((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.expectedEndOfLife > tick)}.sum{it.actualNominalCapacity};"
213  + "if(result == null){return 0} else{return result}", type = QueryType.Gremlin)
214  public double calculateCapacityOfExpectedOperationalPowerPlantsByOwner(@Param("tick") long tick,
215  @Param("owner") EnergyProducer owner);
216 
217  @Query(value = "result = g.v(owner).in('POWERPLANT_OWNER').filter{((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.expectedEndOfLife > tick)}.as('x').out('TECHNOLOGY').filter{it.name==g.v(tech).name}.back('x').sum{it.actualNominalCapacity};"
218  + "if(result == null){return 0} else{return result}", type = QueryType.Gremlin)
219  public double calculateCapacityOfExpectedOperationalPowerPlantsByOwnerByTechnology(@Param("tick") long tick,
220  @Param("owner") EnergyProducer owner, @Param("tech") PowerGeneratingTechnology pgt);
221 
222  @Query(value = "result = g.v(owner).in('POWERPLANT_OWNER').filter{it.expectedEndOfLife == tick}.as('x').out('TECHNOLOGY').filter{it.name==g.v(tech).name}.back('x').sum{it.actualNominalCapacity};"
223  + "if(result == null){return 0} else{return result}", type = QueryType.Gremlin)
224  public double calculateCapacityOfExpectedDismantledPowerPlantsByOwnerByTechnology(@Param("tick") long tick,
225  @Param("owner") EnergyProducer owner, @Param("tech") PowerGeneratingTechnology pgt);
226 
227  @Query(value = "result = g.v(market).out('ZONE').in('REGION').in('LOCATION').filter{it.__type__=='emlab.gen.domain.technology.PowerPlant'}.as('x').out('POWERPLANT_OWNER').filter{it==g.v(owner)}.back('x').filter{((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.expectedEndOfLife > tick)}.out('TECHNOLOGY');", type = QueryType.Gremlin)
228  public Iterable<PowerPlant> findExpectedOperationalPowerPlantsInMarketByOwner(
229  @Param("market") ElectricitySpotMarket market, @Param("tick") long tick,
230  @Param("owner") EnergyProducer owner);
231 
232  @Query(value = "result = g.v(market).out('ZONE').in('REGION').in('LOCATION').filter{it.__type__=='emlab.gen.domain.technology.PowerPlant'}.out('POWERPLANT_OWNER').filter{it==g.v(owner)}.in('POWERPLANT_OWNER').filter{((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.expectedEndOfLife > tick)}.sum{it.actualNominalCapacity};"
233  + "if(result == null){return 0} else{return result}", type = QueryType.Gremlin)
234  public double calculateCapacityOfExpectedOperationalPowerPlantsInMarketByOwner(
235  @Param("market") ElectricitySpotMarket market, @Param("tick") long tick,
236  @Param("owner") EnergyProducer owner);
237 
238  @Query(value = "g.v(market).out('ZONE').in('REGION').in('LOCATION').filter{it.__type__=='emlab.gen.domain.technology.PowerPlant'}", type = QueryType.Gremlin)
239  public Iterable<PowerPlant> findPowerPlantsInMarket(@Param("market") ElectricitySpotMarket market);
240 
241  @Query(value = "g.v(market).out('ZONE').in('REGION').in('LOCATION').filter{it.__type__=='emlab.gen.domain.technology.PowerPlant'}.as('plant').out('POWERPLANT_OWNER').filter{it==g.v(owner)}.back('plant').filter{((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.dismantleTime > tick)}", type = QueryType.Gremlin)
242  public Iterable<PowerPlant> findOperationalPowerPlantsByOwnerAndMarket(@Param("owner") EnergyProducer owner,
243  @Param("market") ElectricitySpotMarket market, @Param("tick") long tick);
244 
245  @Query(value = "plantByOwnerMarket=g.v(market).out('ZONE').in('REGION').in('LOCATION').filter{it.__type__=='emlab.gen.domain.technology.PowerPlant'}.as('plant').out('POWERPLANT_OWNER').filter{it==g.v(owner)}.back('plant');"
246  + "plantByOwnerMarket.filter{!((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.dismantleTime > tick || it.dismantleTime == 0)}", type = QueryType.Gremlin)
247  public Iterable<PowerPlant> findPowerPlantsByOwnerAndMarketInPipeline(@Param("owner") EnergyProducer owner,
248  @Param("market") ElectricitySpotMarket market, @Param("tick") long tick);
249 
250  @Query(value = "plantByTechnology=g.v(tech).in('TECHNOLOGY');"
251  + "plantByTechnology.filter{!((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.dismantleTime > tick || it.dismantleTime == 0)}", type = QueryType.Gremlin)
252  public Iterable<PowerPlant> findPowerPlantsByTechnologyInPipeline(
253  @Param("tech") PowerGeneratingTechnology technology, @Param("tick") long tick);
254 
255  @Query(value = "plantByTechnology=g.v(tech).in('TECHNOLOGY');"
256  + "result = plantByTechnology.filter{!((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.dismantleTime > tick || it.dismantleTime == 0)}.sum{it.actualNominalCapacity};"
257  + "if(result == null){return 0} else{return result}", type = QueryType.Gremlin)
258  public double calculateCapacityOfPowerPlantsByTechnologyInPipeline(
259  @Param("tech") PowerGeneratingTechnology technology, @Param("tick") long tick);
260 
261  @Query(value = "plantByMarket=g.v(market).out('ZONE').in('REGION').in('LOCATION').filter{it.__type__=='emlab.gen.domain.technology.PowerPlant'};"
262  + "result = plantByMarket.filter{!((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.dismantleTime > tick || it.dismantleTime == 0)}.sum{it.actualNominalCapacity};"
263  + "if(result == null){return 0} else{return result}", type = QueryType.Gremlin)
264  public double calculateCapacityOfPowerPlantsByMarketInPipeline(@Param("market") ElectricitySpotMarket market,
265  @Param("tick") long tick);
266 
267  @Query(value = "substanceShares = g.v(substance).in('SUBSTANCE').filter{it.__type__=='emlab.gen.domain.technology.SubstanceShareInFuelMix'};"
268  + "sum=substanceShares.sum{it.share}; if(sum!=null) return sum else return 0;;", type = QueryType.Gremlin)
269  public double calculateSubstanceUsage(@Param("substance") Substance substance);
270 
271  @Query(value = "g.v(gridnode).in('LOCATION').filter{(it.__type__=='emlab.gen.domain.technology.PowerPlant')}.as('p').out('TECHNOLOGY').filter{it.intermittent == true}.back('p').filter{((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.dismantleTime > tick)}", type = QueryType.Gremlin)
272  Iterable<PowerPlant> findOperationalIntermittentPowerPlantsByPowerGridNode(@Param("gridnode") PowerGridNode node,
273  @Param("tick") long tick);
274 
275  @Query(value = "result = g.v(gridnode).in('LOCATION').filter{(it.__type__=='emlab.gen.domain.technology.PowerPlant')}.as('p').out('TECHNOLOGY').filter{it.intermittent == true}.back('p').filter{((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.dismantleTime > tick)}.out('TECHNOLOGY').sum{it.capacity};"
276  + "if(result == null){return 0;} else{return result;}", type = QueryType.Gremlin)
277  double calculateCapacityOfIntermittentPowerPlantsByPowerGridNode(@Param("gridnode") PowerGridNode node,
278  @Param("tick") long tick);
279 
280  @Query(value = "g.v(gridnode).in('LOCATION').filter{(it.__type__=='emlab.gen.domain.technology.PowerPlant')}.as('p').out('TECHNOLOGY').filter{it.intermittent == true && it==g.v(technology)}.back('p').filter{((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.dismantleTime > tick)}", type = QueryType.Gremlin)
281  Iterable<PowerPlant> findOperationalIntermittentPowerPlantsByPowerGridNodeAndTechnology(
282  @Param("gridnode") PowerGridNode node,
283  @Param("technology") PowerGeneratingTechnology powerGeneratingTechnology, @Param("tick") long tick);
284 
285  @Query(value = "result = g.v(gridnode).in('LOCATION').filter{(it.__type__=='emlab.gen.domain.technology.PowerPlant')}.as('p').out('TECHNOLOGY').filter{it.intermittent == true && it==g.v(technology)}.back('p').filter{((it.constructionStartTime + it.actualPermittime + it.actualLeadtime) <= tick) && (it.dismantleTime > tick)}.sum{it.actualNominalCapacity};"
286  + "if(result == null){return 0;} else{return result;}", type = QueryType.Gremlin)
287  double calculateCapacityOfOperationalIntermittentPowerPlantsByPowerGridNodeAndTechnology(
288  @Param("gridnode") PowerGridNode node,
289  @Param("technology") PowerGeneratingTechnology powerGeneratingTechnology, @Param("tick") long tick);
290 
291  @Query(value = "result=g.v(plant).in('REGARDING_POWERPLANT').propertyFilter('type', FilterPipe.Filter.EQUAL, 1).propertyFilter('time', FilterPipe.Filter.EQUAL, tick).money.sum(); if(result==null){result=0}; return result", type = QueryType.Gremlin)
292  double calculateSpotMarketRevenueOfPowerPlant(@Param("plant") PowerPlant plant, @Param("tick") long tick);
293 
294  @Query(value = "result=g.v(plant).in('REGARDING_POWERPLANT').propertyFilter('type', FilterPipe.Filter.EQUAL, 2).propertyFilter('time', FilterPipe.Filter.EQUAL, tick).money.sum(); if(result==null){result=0}; return result", type = QueryType.Gremlin)
295  double calculateLongTermContractRevenueOfPowerPlant(@Param("plant") PowerPlant plant, @Param("tick") long tick);
296 
297  @Query(value = "result=g.v(plant).in('REGARDING_POWERPLANT').propertyFilter('type', FilterPipe.Filter.EQUAL, 10).propertyFilter('time', FilterPipe.Filter.EQUAL, tick).money.sum(); if(result==null){result=0}; return result", type = QueryType.Gremlin)
298  double calculateStrategicReserveRevenueOfPowerPlant(@Param("plant") PowerPlant plant, @Param("tick") long tick);
299 
300  @Query(value = "result=g.v(plant).in('REGARDING_POWERPLANT').propertyFilter('type', FilterPipe.Filter.EQUAL, 11).propertyFilter('time', FilterPipe.Filter.EQUAL, tick).money.sum(); if(result==null){result=0}; return result", type = QueryType.Gremlin)
301  double calculateCapacityMarketRevenueOfPowerPlant(@Param("plant") PowerPlant plant, @Param("tick") long tick);
302 
303  @Query(value = "result=g.v(plant).in('REGARDING_POWERPLANT').propertyFilter('type', FilterPipe.Filter.EQUAL, 12).propertyFilter('time', FilterPipe.Filter.EQUAL, tick).money.sum(); if(result==null){result=0}; return result", type = QueryType.Gremlin)
304  double calculateCO2HedgingRevenueOfPowerPlant(@Param("plant") PowerPlant plant, @Param("tick") long tick);
305 
306  @Query(value = "result=g.v(plant).in('REGARDING_POWERPLANT').filter{it.type==5 || it.type==6 || it.type==9}.propertyFilter('time', FilterPipe.Filter.EQUAL, tick).money.sum(); if(result==null){result=0}; return result", type = QueryType.Gremlin)
307  double calculateCO2CostsOfPowerPlant(@Param("plant") PowerPlant plant, @Param("tick") long tick);
308 
309  @Query(value = "result=g.v(plant).in('REGARDING_POWERPLANT').filter{it.type==3 || it.type==7 || it.type==8}.propertyFilter('time', FilterPipe.Filter.EQUAL, tick).money.sum(); if(result==null){result=0}; return result", type = QueryType.Gremlin)
310  double calculateFixedCostsOfPowerPlant(@Param("plant") PowerPlant plant, @Param("tick") long tick);
311 
312  @Query(value = "ppdps=g.v(plant).in('POWERPLANT_DISPATCHPLAN').filter{it.time==tick}.propertyFilter('forecast', FilterPipe.Filter.EQUAL, false); sum=0;"
313  + "fullLoadHours=0;"
314  + "for(ppdp in ppdps){"
315  + "totalAmount = ppdp.getProperty('acceptedAmount') + ppdp.getProperty('capacityLongTermContract');"
316  + "if(totalAmount==null) totalAmount=0;"
317  + "hoursInSegment = ppdp.out('SEGMENT_DISPATCHPLAN').next().getProperty('lengthInHours');"
318  + "production = totalAmount * hoursInSegment;"
319  + "fullLoadHours = fullLoadHours + hoursInSegment * totalAmount / (ppdp.out('POWERPLANT_DISPATCHPLAN').next().actualNominalCapacity *1.0d);"
320  + "}; return fullLoadHours;", type = QueryType.Gremlin)
321  double calculateFullLoadHoursOfPowerPlant(@Param("plant") PowerPlant plant, @Param("tick") long tick);
322 
323 }
Iterable< PowerPlant > findPowerPlantsByOwner(@Param("owner") EnergyProducer owner)
Iterable< PowerPlant > findOperationalPowerPlantsByTechnology(@Param("tech") PowerGeneratingTechnology technology,@Param("tick") long tick)
Iterable< PowerPlant > findOperationalPowerPlants(@Param("tick") long tick)
ArrayList< PowerPlant > findOperationalPowerPlantsAsList(@Param("tick") long tick)
Iterable< PowerPlant > findOperationalPowerPlantsByOwner(@Param("owner") EnergyProducer owner,@Param("tick") long tick)