Power.Dev Optimization Services

<back to all web services

CommonOptimizerYearlyRequest

The following routes are available for this service:
POST/optimizer/yearly
import Foundation
import ServiceStack

public class CommonOptimizerYearlyRequest : MonthlyRequestBase
{
    public var month:Int
    public var group:BatteryScenarioKeyGroup
    public var key:BatteryScenarioKeyItem
    public var projectGroup:BatteryProjectGroup

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case month
        case group
        case key
        case projectGroup
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        month = try container.decodeIfPresent(Int.self, forKey: .month)
        group = try container.decodeIfPresent(BatteryScenarioKeyGroup.self, forKey: .group)
        key = try container.decodeIfPresent(BatteryScenarioKeyItem.self, forKey: .key)
        projectGroup = try container.decodeIfPresent(BatteryProjectGroup.self, forKey: .projectGroup)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if month != nil { try container.encode(month, forKey: .month) }
        if group != nil { try container.encode(group, forKey: .group) }
        if key != nil { try container.encode(key, forKey: .key) }
        if projectGroup != nil { try container.encode(projectGroup, forKey: .projectGroup) }
    }
}

public class MonthlyRequestBase : Codable
{
    public var projectId:String
    public var nodeAltId:Int
    public var iso:DataProvider
    public var useEnergy:BooleanValue
    public var useAncillary:BooleanValue
    public var useCapacityTod:Bool
    public var baseMarket:PriceMarketType
    public var capacityTODs:[BatteryProjectTodItem] = []
    public var useRegup:Double
    public var useRegdown:Double
    public var useSpinning:Double
    public var useNonSpinning:Double
    public var paraciticLossesOperation:Double
    public var paraciticLossesResting:Double
    public var hvacLosses:Double
    public var acCablingLosses:Double
    public var transformatorLosses:Double
    public var otherLosses:Double
    public var representativeYear:Int
    public var incrementReferanceYear:Int
    public var useFutureData:Int
    public var maxDailyCycle:Double
    public var minDailyProfitPerMw:Double
    public var ancillaryFileId:Int
    public var lmpFileId:Int
    public var maxChargingPriceCap:Double
    public var maxDischargingPriceCap:Double
    public var maxAncillaryPriceCap:Double
    public var revenueStackingMode:RevenueStackingMode
    public var optimizationQuality:Int
    public var ensureExlusive:Int
    public var nodeRefId:Int
    public var useInternalSolver:Bool

    required public init(){}
}

public enum DataProvider : Int, Codable
{
    case Undefined = 0
    case SPP = 1
    case ERCOT = 2
    case MISO = 3
    case CAISO = 4
    case PJM = 5
    case ISONE = 6
    case NYISO = 7
    case NW = 8
    case SW = 9
    case SE = 10
    case AESO = 11
    case IESO = 12
    case CENACE = 20
    case NONISO = 99
    case EIA = 100
    case PNM = 150
    case NREL = 200
    case NOAA = 210
    case ENTSOE = 1000
    case EPIAS = 1010
    case SELF = 10000
}

public enum BooleanValue : String, Codable
{
    case Undefined
    case Yes
    case No
    case Custom
}

public enum PriceMarketType : Int, Codable
{
    case Undefined = 0
    case Realtime = 1
    case DayAhead = 10
    case DART = 101
}

public class BatteryProjectTodItem : Codable
{
    public var month:Int
    public var weekDay:Int
    public var hour:Int
    public var price:Double
    // @Ignore()
    public var id:String

    required public init(){}
}

public enum RevenueStackingMode : String, Codable
{
    case SolveWithoutAncillary
    case SolveWithAncillary
}

public class BatteryScenarioKeyGroup : Codable
{
    public var keyId:Int
    public var year:Int
    public var nodeId:Int
    public var provider:DataProvider
    public var zoneId:Int
    public var plantType:PowerPlantType
    public var solarId:Int
    public var windId:Int
    public var isServerless:Bool

    required public init(){}
}

public enum PowerPlantType : String, Codable
{
    case Undefined
    case Solar
    case Wind
    case Hybrid
}

public class BatteryScenarioKeyItem : Codable
{
    public var projectId:String
    public var keyId:Int
    public var keyType:BatteryScenarioType
    public var recordKey:String
    public var jobStatus:Int
    public var status:Int
    public var minDate:Date
    public var maxDate:Date
    public var year:Int
    public var yoyStatus:Int
    public var usableCapacity:Double
    public var usableCapacityFactor:Double
    public var solarUsableCapacity:Double
    public var solarUsableCapacityFactor:Double
    public var baseMarket:PriceMarketType
    public var baseCapacityRate:Double
    public var capacityRate:Double
    public var solarCapacityRate:Double
    public var windCapacityRate:Double
    public var chargeEfficinecy:Double
    public var dischargeEfficinecy:Double
    public var nodeId:Int
    public var provider:DataProvider
    public var zoneId:Int
    public var lmpFileId:Int
    public var productionFileId:Int
    public var loadFileId:Int
    public var capacityFileId:Int
    public var plantType:PowerPlantType
    public var solarId:Int
    public var windId:Int
    public var ancillaryIncrementFactor:Double
    public var energyIncrementFactor:Double
    public var capacityIncrementFactor:Double

    required public init(){}
}

public enum BatteryScenarioType : String, Codable
{
    case Undefined
    case Optimization
    case Sum
    case OptiSum
    case FullTod
    case CapacityTod
}

public enum BatteryProjectGroup : String, Codable
{
    case Undefined
    case StandAlone
    case FTM
    case BTM
}

public class YearlyApiStatusResponse : Codable
{
    public var failedCount:Int
    public var message:String

    required public init(){}
}


Swift CommonOptimizerYearlyRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

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: text/csv
Content-Type: text/csv
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: text/csv
Content-Length: length

{"failedCount":0,"message":"String"}