/
tesDispatch0.py
32 lines (26 loc) · 1.14 KB
/
tesDispatch0.py
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
# Project: GBS Tool
# Author: Jeremy VanderMeer, jbvandermeer@alaska.edu, Alaska Center for Energy and Power
# Date: February 8, 2018
# License: MIT License (see LICENSE file of this package for more information)
# imports
import numpy as np
class tesDispatch:
def __init__(self):
"""
Constructor used for intialization of a dispatch scheme.
:param eess: an energy storage system that is being dispatched
:param newP: new total power level
:param newQ: new total reactive power level
:param newSRC: new spinning reserve requirement. if set to nan, there is no change in the SRC requirement.
"""
def runDispatch(self, TESS, P):
# Need to check div by zero
sumTESSTesPAVail = sum(TESS.tesPAvail)
if sumTESSTesPAVail == 0:
loadingP = 0
else:
loadingP = min([P/sumTESSTesPAVail, 1])
#loadingP = np.min([np.nanmax([P / np.sum(TESS.tesPAvail), 0]), 1])
TESS.tesP = [P / len(TESS.tesP)] * len(TESS.tesP)
for idx in range(len(TESS.tesP)):
TESS.thermalEnergyStorageUnits[idx].tesP = loadingP * TESS.tesPAvail[idx]