POST | /optimizer/yearly |
---|
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
class DataProvider(IntEnum):
UNDEFINED = 0
SPP = 1
ERCOT = 2
MISO = 3
CAISO = 4
PJM = 5
ISONE = 6
NYISO = 7
NW = 8
SW = 9
SE = 10
AESO = 11
IESO = 12
CENACE = 20
NONISO = 99
EIA = 100
PNM = 150
NREL = 200
NOAA = 210
ENTSOE = 1000
EPIAS = 1010
SELF = 10000
class BooleanValue(str, Enum):
UNDEFINED = 'Undefined'
YES = 'Yes'
NO = 'No'
CUSTOM = 'Custom'
class PriceMarketType(IntEnum):
UNDEFINED = 0
REALTIME = 1
DAY_AHEAD = 10
DART = 101
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BatteryProjectTodItem:
month: int = 0
week_day: int = 0
hour: int = 0
price: Decimal = decimal.Decimal(0)
# @Ignore()
id: Optional[str] = None
class RevenueStackingMode(str, Enum):
SOLVE_WITHOUT_ANCILLARY = 'SolveWithoutAncillary'
SOLVE_WITH_ANCILLARY = 'SolveWithAncillary'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class MonthlyRequestBase:
project_id: Optional[str] = None
node_alt_id: int = 0
iso: Optional[DataProvider] = None
use_energy: Optional[BooleanValue] = None
use_ancillary: Optional[BooleanValue] = None
use_capacity_tod: bool = False
base_market: Optional[PriceMarketType] = None
capacity_t_o_ds: Optional[List[BatteryProjectTodItem]] = None
use_regup: Decimal = decimal.Decimal(0)
use_regdown: Decimal = decimal.Decimal(0)
use_spinning: Decimal = decimal.Decimal(0)
use_non_spinning: Decimal = decimal.Decimal(0)
paracitic_losses_operation: Decimal = decimal.Decimal(0)
paracitic_losses_resting: Decimal = decimal.Decimal(0)
hvac_losses: Decimal = decimal.Decimal(0)
ac_cabling_losses: Decimal = decimal.Decimal(0)
transformator_losses: Decimal = decimal.Decimal(0)
other_losses: Decimal = decimal.Decimal(0)
representative_year: int = 0
increment_referance_year: int = 0
use_future_data: int = 0
max_daily_cycle: Decimal = decimal.Decimal(0)
min_daily_profit_per_mw: Decimal = decimal.Decimal(0)
ancillary_file_id: int = 0
lmp_file_id: int = 0
max_charging_price_cap: Decimal = decimal.Decimal(0)
max_discharging_price_cap: Decimal = decimal.Decimal(0)
max_ancillary_price_cap: Decimal = decimal.Decimal(0)
revenue_stacking_mode: Optional[RevenueStackingMode] = None
optimization_quality: int = 0
ensure_exlusive: int = 0
node_ref_id: int = 0
use_internal_solver: bool = False
class PowerPlantType(str, Enum):
UNDEFINED = 'Undefined'
SOLAR = 'Solar'
WIND = 'Wind'
HYBRID = 'Hybrid'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BatteryScenarioKeyGroup:
key_id: int = 0
year: int = 0
node_id: int = 0
provider: Optional[DataProvider] = None
zone_id: int = 0
plant_type: Optional[PowerPlantType] = None
solar_id: int = 0
wind_id: int = 0
is_serverless: bool = False
class BatteryScenarioType(str, Enum):
UNDEFINED = 'Undefined'
OPTIMIZATION = 'Optimization'
SUM = 'Sum'
OPTI_SUM = 'OptiSum'
FULL_TOD = 'FullTod'
CAPACITY_TOD = 'CapacityTod'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BatteryScenarioKeyItem:
project_id: Optional[str] = None
key_id: int = 0
key_type: Optional[BatteryScenarioType] = None
record_key: Optional[str] = None
job_status: int = 0
status: int = 0
min_date: datetime.datetime = datetime.datetime(1, 1, 1)
max_date: datetime.datetime = datetime.datetime(1, 1, 1)
year: int = 0
yoy_status: int = 0
usable_capacity: Decimal = decimal.Decimal(0)
usable_capacity_factor: Decimal = decimal.Decimal(0)
solar_usable_capacity: Decimal = decimal.Decimal(0)
solar_usable_capacity_factor: Decimal = decimal.Decimal(0)
base_market: Optional[PriceMarketType] = None
base_capacity_rate: Decimal = decimal.Decimal(0)
capacity_rate: Decimal = decimal.Decimal(0)
solar_capacity_rate: Decimal = decimal.Decimal(0)
wind_capacity_rate: Decimal = decimal.Decimal(0)
charge_efficinecy: Decimal = decimal.Decimal(0)
discharge_efficinecy: Decimal = decimal.Decimal(0)
node_id: int = 0
provider: Optional[DataProvider] = None
zone_id: int = 0
lmp_file_id: int = 0
production_file_id: int = 0
load_file_id: int = 0
capacity_file_id: int = 0
plant_type: Optional[PowerPlantType] = None
solar_id: int = 0
wind_id: int = 0
ancillary_increment_factor: Decimal = decimal.Decimal(0)
energy_increment_factor: Decimal = decimal.Decimal(0)
capacity_increment_factor: Decimal = decimal.Decimal(0)
class BatteryProjectGroup(str, Enum):
UNDEFINED = 'Undefined'
STAND_ALONE = 'StandAlone'
FTM = 'FTM'
BTM = 'BTM'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CommonOptimizerYearlyRequest(MonthlyRequestBase):
month: int = 0
group: Optional[BatteryScenarioKeyGroup] = None
key: Optional[BatteryScenarioKeyItem] = None
project_group: Optional[BatteryProjectGroup] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class YearlyApiStatusResponse:
failed_count: int = 0
message: Optional[str] = None
Python CommonOptimizerYearlyRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /optimizer/yearly HTTP/1.1
Host: dev-optimization.power.dev
Accept: application/json
Content-Type: application/json
Content-Length: length
{"month":0,"group":{"keyId":0,"year":0,"nodeId":0,"provider":"Undefined","zoneId":0,"plantType":"Undefined","solarId":0,"windId":0,"isServerless":false},"key":{"projectId":"00000000000000000000000000000000","keyId":0,"keyType":"Undefined","recordKey":"String","jobStatus":0,"status":0,"year":0,"yoyStatus":0,"usableCapacity":0,"usableCapacityFactor":0,"solarUsableCapacity":0,"solarUsableCapacityFactor":0,"baseMarket":"Undefined","baseCapacityRate":0,"capacityRate":0,"solarCapacityRate":0,"windCapacityRate":0,"chargeEfficinecy":0,"dischargeEfficinecy":0,"nodeId":0,"provider":"Undefined","zoneId":0,"lmpFileId":0,"productionFileId":0,"loadFileId":0,"capacityFileId":0,"plantType":"Undefined","solarId":0,"windId":0,"ancillaryIncrementFactor":0,"energyIncrementFactor":0,"capacityIncrementFactor":0},"projectGroup":"Undefined","projectId":"00000000000000000000000000000000","nodeAltId":0,"iso":"Undefined","useEnergy":"Undefined","useAncillary":"Undefined","useCapacityTod":false,"baseMarket":"Undefined","useRegup":0,"useRegdown":0,"useSpinning":0,"useNonSpinning":0,"paraciticLossesOperation":0,"paraciticLossesResting":0,"hvacLosses":0,"acCablingLosses":0,"transformatorLosses":0,"otherLosses":0,"representativeYear":0,"incrementReferanceYear":0,"useFutureData":0,"maxDailyCycle":0,"minDailyProfitPerMw":0,"ancillaryFileId":0,"lmpFileId":0,"maxChargingPriceCap":0,"maxDischargingPriceCap":0,"maxAncillaryPriceCap":0,"revenueStackingMode":"SolveWithoutAncillary","optimizationQuality":0,"ensureExlusive":0,"nodeRefId":0,"useInternalSolver":false}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"failedCount":0,"message":"String"}