Power.Dev Optimization Services

<back to all web services

SolverModelStandaloneRequest

The following routes are available for this service:
POST/solver-model/standalone
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


class SolverModelStandaloneRequest implements JsonSerializable
{
    public function __construct(
        /** @var float */
        public float $batteryCapacity=0.0,
        /** @var float */
        public float $nameplateCapacity=0.0,
        /** @var float */
        public float $chargingEfficiency=0.0,
        /** @var float */
        public float $dischargingEfficiency=0.0,
        /** @var float */
        public float $minProfitPerMw=0.0,
        /** @var float */
        public float $maxDailCycle=0.0,
        /** @var float */
        public float $restingLossRate=0.0,
        /** @var float */
        public float $operationLossRate=0.0,
        /** @var array<float>|null */
        public ?array $prices=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['batteryCapacity'])) $this->batteryCapacity = $o['batteryCapacity'];
        if (isset($o['nameplateCapacity'])) $this->nameplateCapacity = $o['nameplateCapacity'];
        if (isset($o['chargingEfficiency'])) $this->chargingEfficiency = $o['chargingEfficiency'];
        if (isset($o['dischargingEfficiency'])) $this->dischargingEfficiency = $o['dischargingEfficiency'];
        if (isset($o['minProfitPerMw'])) $this->minProfitPerMw = $o['minProfitPerMw'];
        if (isset($o['maxDailCycle'])) $this->maxDailCycle = $o['maxDailCycle'];
        if (isset($o['restingLossRate'])) $this->restingLossRate = $o['restingLossRate'];
        if (isset($o['operationLossRate'])) $this->operationLossRate = $o['operationLossRate'];
        if (isset($o['prices'])) $this->prices = JsonConverters::fromArray('float', $o['prices']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->batteryCapacity)) $o['batteryCapacity'] = $this->batteryCapacity;
        if (isset($this->nameplateCapacity)) $o['nameplateCapacity'] = $this->nameplateCapacity;
        if (isset($this->chargingEfficiency)) $o['chargingEfficiency'] = $this->chargingEfficiency;
        if (isset($this->dischargingEfficiency)) $o['dischargingEfficiency'] = $this->dischargingEfficiency;
        if (isset($this->minProfitPerMw)) $o['minProfitPerMw'] = $this->minProfitPerMw;
        if (isset($this->maxDailCycle)) $o['maxDailCycle'] = $this->maxDailCycle;
        if (isset($this->restingLossRate)) $o['restingLossRate'] = $this->restingLossRate;
        if (isset($this->operationLossRate)) $o['operationLossRate'] = $this->operationLossRate;
        if (isset($this->prices)) $o['prices'] = JsonConverters::toArray('float', $this->prices);
        return empty($o) ? new class(){} : $o;
    }
}

PHP SolverModelStandaloneRequest DTOs

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

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /solver-model/standalone HTTP/1.1 
Host: dev-optimization.power.dev 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	batteryCapacity: 0,
	nameplateCapacity: 0,
	chargingEfficiency: 0,
	dischargingEfficiency: 0,
	minProfitPerMw: 0,
	maxDailCycle: 0,
	restingLossRate: 0,
	operationLossRate: 0
}