Energy Market
Note
This is the complete exposed API. Not all classes and functions are meant for the End-user, the documentation is a work in progress
Core
Shyft Open Source Energy Market model core
- class shyft.energy_market.core.IdBase
Bases:
instance
The IdBase class provides common properties of the energy_market objects. This includes, the identifier, name, json type properties, and also the python object handle ‘obj’, as well as custom time-series and any type attributes This class can not be constructed, but serves as base class for most objects.
See also
Model,ModelArea,PowerModule,HydroPowerSystem
- __init__()
Raises an exception This class cannot be instantiated from Python
- property custom
Map keeping any_attr
- Type:
StringAnyAttrDict
- get_tsm_object((IdBase)self, (object)key) _ts :
Get a specific extra time series for this object.
The returned time series is wrapped in an object which exposes method for retrieving url etc.
- Parameters:
key (str) – The key in the tsm of the time series to get.
- Raises:
runtime_error – If specified key does not exist.
- property id
The unique id of the component
- Type:
int
- property json
json string with info
- Type:
str
- property name
The name of the component
- Type:
str
- property obj
a python object
- Type:
object
- property ts
Map keeping any extra time series for this object.
- Type:
- class shyft.energy_market.core.Catchment
Bases:
IdBase
Catchment descriptive component, suitable for energy market long-term and/or short term managment. This component usually would contain usable view of the much more details shyft.hydrology region model
- __init__((Catchment)arg1) None
- __init__( (Catchment)self, (object)id, (object)name, (object)json, (HydroPowerSystem)hps) -> None :
tbd
- property hps
returns the hydro power system this Catchment is a part of
- Type:
- class shyft.energy_market.core.CatchmentList
Bases:
instance
Strongly typed list of catchments
- __init__((CatchmentList)arg1) None
- __init__( (CatchmentList)arg1, (CatchmentList)clone) -> None :
Create a clone.
- append((CatchmentList)arg1, (object)arg2) None
- extend((CatchmentList)arg1, (object)arg2) None
- get_item_old()
__getitem__( (object)arg1, (object)arg2) -> object
- items() Generator
Creates a generator of elements contained in self (a C++ std::vector). Solely implemented to imitate the items() method of a python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements and the corresponding element ids
- keys() Generator
Creates a generator for the element ids contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the keys() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of element ids
- values() Generator
Creates a generator for the elements contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the values() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements
- class shyft.energy_market.core.Client
Bases:
instance
The client-api for the energy_market
- __init__((Client)self, (object)host_port, (object)timeout_ms) None :
Creates a python client that can communicate with the corresponding server
- close((Client)self) None :
Close the connection. It will automatically reopen if needed.
- get_model_infos((Client)self, (IntVector)mids[, (UtcPeriod)created_in=[not-valid-period>]) ModelInfoVector :
returns all or selected model-info objects based on model-identifiers(mids)
- Parameters:
mids (IntVector) – empty = all, or a list of known exisiting model-identifiers
created_in (UtcPeriod) – For which period you are interested in model-infos.
- Returns:
model_infos. Strongly typed list of ModelInfo
- Return type:
- property host_port
Endpoint network address of the remote server.
- Type:
str
- property is_open
If the connection to the remote server is (still) open.
- Type:
bool
- read_model((Client)self, (object)mid) Model :
Read and return the model for specified model-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
The resulting model from the server
- Return type:
- read_models((Client)self, (IntVector)mids) ModelList :
Read and return the model for specified model-identifier (mid)
- Parameters:
mids (Int64Vector) – A strongly typed list of ints, the model-identifers for the wanted models
- Returns:
The resulting model from the server
- Return type:
- property reconnect_count
Number of reconnects to the remote server that have been performed.
- Type:
int
- remove_model((Client)self, (object)mid) int :
Remove the specified model bymodel-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
ec. 0 or error-code?
- Return type:
int
- store_model((Client)self, (Model)m, (ModelInfo)mi) int :
Store the model to backend, if m.id==0 then a new unique model-info is created and used
- property timeout_ms
Timout for remote server operations, in number milliseconds.
- Type:
int
- class shyft.energy_market.core.ConnectionRole
Bases:
enum
- bypass = shyft.energy_market.core._core.ConnectionRole.bypass
- flood = shyft.energy_market.core._core.ConnectionRole.flood
- input = shyft.energy_market.core._core.ConnectionRole.input
- main = shyft.energy_market.core._core.ConnectionRole.main
- names = {'bypass': shyft.energy_market.core._core.ConnectionRole.bypass, 'flood': shyft.energy_market.core._core.ConnectionRole.flood, 'input': shyft.energy_market.core._core.ConnectionRole.input, 'main': shyft.energy_market.core._core.ConnectionRole.main}
- values = {0: shyft.energy_market.core._core.ConnectionRole.main, 1: shyft.energy_market.core._core.ConnectionRole.bypass, 2: shyft.energy_market.core._core.ConnectionRole.flood, 3: shyft.energy_market.core._core.ConnectionRole.input}
- class shyft.energy_market.core.Gate
Bases:
IdBase
A gate controls the amount of flow into the waterway by the gate-opening. In the case of tunnels, it’s usually either closed or open. For reservoir flood-routes, the gate should be used to model the volume-flood characteristics. The resulting flow through a waterway is a function of many factors, most imporant:
gate opening and gate-characteristics
upstream water-level
downstrem water-level(in some-cases)
waterway properties(might be state dependent)
- __init__((Gate)arg1) None
- __init__( (Gate)self, (object)id, (object)name, (object)json) -> None :
construct a new gate
- class shyft.energy_market.core.GateList
Bases:
instance
Strongly typed list of gates
- __init__((GateList)arg1) None
- __init__( (GateList)arg1, (GateList)clone) -> None :
Create a clone.
- append((GateList)arg1, (object)arg2) None
- extend((GateList)arg1, (object)arg2) None
- get_item_old()
__getitem__( (object)arg1, (object)arg2) -> object
- items() Generator
Creates a generator of elements contained in self (a C++ std::vector). Solely implemented to imitate the items() method of a python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements and the corresponding element ids
- keys() Generator
Creates a generator for the element ids contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the keys() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of element ids
- values() Generator
Creates a generator for the elements contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the values() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements
- class shyft.energy_market.core.HydroComponent
Bases:
IdBase
A hydro component keeps the common attributes and relational properties common for all components that can contain water
- __init__()
Raises an exception This class cannot be instantiated from Python
- disconnect_from((HydroComponent)self, (HydroComponent)other) None :
disconnect from another component
- property downstreams
list of hydro-components that are conceptually downstreams
- Type:
- equal_structure((HydroComponent)self, (HydroComponent)other) bool :
Returns true if the other object have the same interconnections to the close neighbors as self. The neighbors are identified by their .id attribute, and they must appear in the same role to be considered equal. E.g. if for a reservoir, a waterway is in role flood for self, and in role bypass for other, they are different connections.
- Parameters:
() (other) – the other object, of same type, hydro component, to compare.
- Returns:
bool. True if the other have same interconnections as self
- property hps
returns the hydro-power-system this component is a part of
- Type:
- property upstreams
list of hydro-components that are conceptually upstreams
- Type:
- class shyft.energy_market.core.HydroComponentList
Bases:
instance
Strongly typed list of HydroComponents
- __init__((HydroComponentList)arg1) None
- __init__( (HydroComponentList)arg1, (HydroComponentList)clone) -> None :
Create a clone.
- append((HydroComponentList)arg1, (object)arg2) None
- extend((HydroComponentList)arg1, (object)arg2) None
- get_item_old()
__getitem__( (object)arg1, (object)arg2) -> object
- items() Generator
Creates a generator of elements contained in self (a C++ std::vector). Solely implemented to imitate the items() method of a python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements and the corresponding element ids
- keys() Generator
Creates a generator for the element ids contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the keys() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of element ids
- values() Generator
Creates a generator for the elements contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the values() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements
- class shyft.energy_market.core.HydroConnection
Bases:
instance
A hydro connection is the connection object that relate one hydro component to another. A hydro component have zero or more hydro connections, contained in upstream and downstream lists. If you are using the hydro system builder, there will always be a mutual/two way connection. That is, if a reservoir connects downstream to a tunell (in role main), then the tunell will have a upstream connection pointing to the reservoir (as in role input)
- __init__()
Raises an exception This class cannot be instantiated from Python
- property has_target
true if valid/available target
- Type:
bool
- property role
role like main,bypass,flood,input
- Type:
- property target
target of the hydro-connection, Reservoir|Unit|Waterway
- Type:
- class shyft.energy_market.core.HydroConnectionList
Bases:
instance
- __init__((HydroConnectionList)arg1) None
- append((HydroConnectionList)arg1, (object)arg2) None
- extend((HydroConnectionList)arg1, (object)arg2) None
- class shyft.energy_market.core.HydroGraphTraversal
Bases:
instance
A collection of hydro operations
- __init__()
Raises an exception This class cannot be instantiated from Python
- static extract_water_courses((HydroPowerSystem)hps) HydroPowerSystemList :
extracts the sub-hydro system from a given hydro system
- static get_path_between((HydroComponent)arg1, (HydroComponent)arg2[, (ConnectionRole)arg3]) HydroComponentList :
finds path between two hydro components
- static get_path_to_ocean((HydroComponent)arg1[, (ConnectionRole)arg2]) HydroComponentList :
finds path to ocean for a given hydro component
- static is_connected((HydroComponent)arg1, (HydroComponent)arg2[, (ConnectionRole)arg3]) bool :
finds whether two hydro components are connected
- static path_to_ocean((HydroComponentList)arg1[, (ConnectionRole)arg2]) None :
finds path to ocean for a given hydro component
- class shyft.energy_market.core.HydroPowerSystem
Bases:
IdBase
- __init__((HydroPowerSystem)arg1, (object)name) None :
creates an empty hydro power system with the specified name
- __init__( (HydroPowerSystem)arg1, (object)id, (object)name [, (object)json]) -> None :
creates a an empty new hydro power system with specified id and name and json str info
- property catchments
all the catchments for the system
- Type:
- create_aggregate(uid, name, json='')
- create_catchment(uid, name, json='')
- create_gate(uid, name, json='')
- create_power_plant(uid, name, json='')
- create_power_station(uid, name, json='')
- create_reservoir(uid, name, json='')
- create_river(uid, name, json='')
- create_tunnel(uid, name, json='')
- create_unit(uid, name, json='')
- property created
The time when this system was created(you should specify it when you create it)
- Type:
- equal_content((HydroPowerSystem)self, (HydroPowerSystem)other_hps) bool :
returns true if alle the content of the hps are equal, same as the equal == operator, except that .id, .name .created at the top level is not compared
- equal_structure((HydroPowerSystem)self, (HydroPowerSystem)other_hps) bool :
returns true if equal structure of identified objects, using the .id, but not comparing .name, .attributes etc., to the other
- find_aggregate_by_id((HydroPowerSystem)self, (object)id) Unit :
deprecated:use find_unit_by_id
- find_aggregate_by_name((HydroPowerSystem)self, (object)name) Unit :
deprecated: use find_unit_by_name
- find_gate_by_id((HydroPowerSystem)self, (object)id) Gate :
returns object with specified id
- find_gate_by_name((HydroPowerSystem)self, (object)name) Gate :
returns object that exactly matches name
- find_power_plant_by_id((HydroPowerSystem)self, (object)id) PowerPlant :
returns object with specified id
- find_power_plant_by_name((HydroPowerSystem)self, (object)name) PowerPlant :
returns object that exactly matches name
- find_power_station_by_id((HydroPowerSystem)self, (object)id) PowerPlant :
deprecated:use find_power_plant_by_id
- find_power_station_by_name((HydroPowerSystem)self, (object)name) PowerPlant :
deprecated:use find_power_plant_by_name
- find_reservoir_by_id((HydroPowerSystem)self, (object)id) Reservoir :
returns object with specified id
- find_reservoir_by_name((HydroPowerSystem)self, (object)name) Reservoir :
returns object that exactly matches name
- find_unit_by_id((HydroPowerSystem)self, (object)id) Unit :
returns object with specified id
- find_unit_by_name((HydroPowerSystem)self, (object)name) Unit :
returns object that exactly matches name
- find_water_route_by_id((HydroPowerSystem)self, (object)id) Waterway :
deprecated:use find_waterway_by_id
- find_water_route_by_name((HydroPowerSystem)self, (object)name) Waterway :
deprecated:use find_waterway_by_name
- find_waterway_by_id((HydroPowerSystem)self, (object)id) Waterway :
returns object with specified id
- find_waterway_by_name((HydroPowerSystem)self, (object)name) Waterway :
returns object that exactly matches name
- static from_blob((ByteVector)blob_string) HydroPowerSystem :
constructs a model from a blob_string previously created by the to_blob method
- Parameters:
blob_string (string) – blob-formatted representation of the model, as create by the to_blob method
- property model_area
returns the model area this hydro-power-system is a part of
See also
ModelArea
- Type:
- property power_plants
all power plants, each with references to its units
- Type:
- property power_stations
use power_plant
- Type:
- Type:
deprecated
- property reservoirs
all the reservoirs
- Type:
- to_blob()
- static to_blob_ref((HydroPowerSystem)me) ByteVector :
serialize the model into an blob
- Returns:
blob. blob-serialized version of the model
- Return type:
string
See also
from_blob
- property water_routes
use waterways
- Type:
- Type:
deprecated
- property waterways
all the waterways(tunells,rivers) of the system
- Type:
- class shyft.energy_market.core.HydroPowerSystemBuilder
Bases:
instance
class to support building hydro-power-systems save and easy
- __init__((HydroPowerSystemBuilder)arg1, (HydroPowerSystem)hydro_power_system) None
- create_aggregate((HydroPowerSystemBuilder)self, (object)id, (object)name, (object)json) Unit :
deprecated:use create_unit
- create_catchment((HydroPowerSystemBuilder)self, (object)id, (object)name, (object)json) Catchment :
create and add catchmment to the system
- create_gate((HydroPowerSystemBuilder)self, (object)id, (object)name, (object)json) Gate :
create and add a gate to the system
- create_power_plant((HydroPowerSystemBuilder)self, (object)id, (object)name, (object)json) PowerPlant :
creates and adds a power plant to the system
- create_power_station((HydroPowerSystemBuilder)self, (object)id, (object)name, (object)json) PowerPlant :
deprecated: use create_power_plant
- create_reservoir((HydroPowerSystemBuilder)self, (object)id, (object)name, (object)json) Reservoir :
creates and adds a reservoir to the system
- create_river((HydroPowerSystemBuilder)self, (object)id, (object)name, (object)json) Waterway :
create and add river to the system
- create_tunnel((HydroPowerSystemBuilder)self, (object)id, (object)name, (object)json) Waterway :
create and add river to the system
- create_unit((HydroPowerSystemBuilder)self, (object)id, (object)name, (object)json) Unit :
creates a new unit with the specified parameters
- create_water_route((HydroPowerSystemBuilder)self, (object)id, (object)name, (object)json) Waterway :
deprecated:use create_waterway
- create_waterway((HydroPowerSystemBuilder)self, (object)id, (object)name, (object)json) Waterway :
create and add river to the system
- class shyft.energy_market.core.HydroPowerSystemDict
Bases:
instance
A dict of HydroPowerSystem, the key-value is the watercourse-name
- __init__((HydroPowerSystemDict)arg1) None
- items()
- keys()
- class shyft.energy_market.core.HydroPowerSystemList
Bases:
instance
Strongly typed list of HydroPowerSystems
- __init__((HydroPowerSystemList)arg1) None
- __init__( (HydroPowerSystemList)arg1, (HydroPowerSystemList)clone) -> None :
Create a clone.
- append((HydroPowerSystemList)arg1, (object)arg2) None
- extend((HydroPowerSystemList)arg1, (object)arg2) None
- get_item_old()
__getitem__( (object)arg1, (object)arg2) -> object
- items() Generator
Creates a generator of elements contained in self (a C++ std::vector). Solely implemented to imitate the items() method of a python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements and the corresponding element ids
- keys() Generator
Creates a generator for the element names contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the keys() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of element names
- values() Generator
Creates a generator for the elements contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the values() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements
- class shyft.energy_market.core.IntStringDict
Bases:
instance
A strongly typed dictionary with key type int and value type string.
- __init__((IntStringDict)arg1) None
- class shyft.energy_market.core.StringTimeSeriesDict
Bases:
instance
A strongly typed dictionary with key type string and value type TimeSeries.
- __init__((StringTimeSeriesDict)arg1) None
- class shyft.energy_market.core.Model
Bases:
IdBase
The Model class describes the LTM (persisted) model A model consists of model_areas and power-lines interconnecting them. To buid a model use the .add_area() and .add_power_line() methods
See also
ModelArea,PowerLine,PowerModule
- __init__((Model)arg1) None
- __init__( (Model)arg1, (object)id, (object)name [, (object)json]) -> None :
constructs a Model object with the specified parameters
- Args:
id (int): a global unique identifier of the mode
name (string): the name of the model
json (string): extra info as json for the model
- property area
a dict(area-name,area) for the model-areas
- Type:
- create_model_area(uid, name, json='')
- create_power_line(a, b, uid, name, json='')
- create_power_module(area, uid, name, json='')
- equal_content((Model)self, (Model)other) bool :
Compare this model with other_model for equality, except for the .id, .name,`.created`, attributes of the model it self. This is the same as the equal,==, operation, except that the self model local attributes are not compared. This method can be used to determine that two models have the same content, even if they model.id etc. are different.
- Parameters:
other (Model) – The model to compare with
- Returns:
equal. true if other have exactly the same content as self(disregarding the model .id,.name,.created,.json attributes)
- Return type:
bool
- equal_structure((Model)self, (Model)other) bool :
Compare this model with other_model for equality in topology and interconnections. The comparison is using each object`.id` member to identify the same objects. Notice that the attributes of the objects are not considered, only the topology.
- Parameters:
other (Model) – The model to compare with
- Returns:
equal. true if other_model has structure and objects as self
- Return type:
bool
- static from_blob((ByteVector)blob) Model :
constructs a model from a blob previously created by the to_blob method
- Parameters:
blob (ByteVector) – blob representation of the model, as create by the to_blob method
- property power_lines
list of power-lines,each with connection to the areas they interconnect
- Type:
- to_blob((Model)arg1) ByteVector :
serialize the model into a blob
- Returns:
blob. serialized version of the model
- Return type:
ByteVector
See also
from_blob
- class shyft.energy_market.core.ModelArea
Bases:
IdBase
The ModelArea class describes the EMPS LTM (persisted) model-area A model-area consists of power modules and hydro-power-system. To buid a model-are use the .add_power_module() and the hydro-power-system builder
See also
Model,PowerLine,PowerModule,HydroPowerSystem
- __init__((ModelArea)arg1) None
- __init__( (ModelArea)arg1, (Model)model, (object)id, (object)name [, (object)json]) -> None :
constructs a ModelArea object with the specified parameters
- Args:
model (Model): the model owning the created model-area
id (int): a global unique identifier of the model-area
name (string): the name of the model-area
json (string): extra info as json
- create_power_module(uid, name, json='')
- property detailed_hydro
detailed hydro description.
See also
HydroPowerSystem
- Type:
- equal_structure((ModelArea)self, (ModelArea)other) bool :
Compare this model-area with other_model-area for equality in topology and interconnections. The comparison is using each object`.id` member to identify the same objects. Notice that the attributes of the objects are not considered, only the topology.
- Parameters:
other (ModelArea) – The model-area to compare with
- Returns:
equal. true if other_model has structure and objects as self
- Return type:
bool
- property power_modules
power-modules in this area, a dictionary using power-module unique id
- Type:
- class shyft.energy_market.core.ModelAreaDict
Bases:
instance
A dict of ModelArea, the key-value is the area-name
- __init__((ModelAreaDict)arg1) None
__init__( (ModelAreaDict)arg1, (ModelAreaDict)clone_me) -> None
- class shyft.energy_market.core.ModelBuilder
Bases:
instance
This class helps building an EMPS model, step by step
- __init__((ModelBuilder)arg1, (Model)model) None :
Make a model-builder for the model The model can be modified/built using the methods available in this class
- Parameters:
model (Model) – the model to be built/modified
- create_model_area((ModelBuilder)self, (object)id, (object)name[, (object)json='']) ModelArea :
create and add an area to the model. ensures that area_name, and that area_id is unique.
- Parameters:
id (int) – unique identifier for the area, must be unique within model
name (string) – any valid area-name, must be unique within model
json (string) – json for the area
- Returns:
area. a reference to the newly added area
- Return type:
See also
add_area
- create_power_line((ModelBuilder)self, (object)a, (object)b, (object)id, (ModelArea)name[, (ModelArea)json='']) PowerLine :
create and add a power line with capacity_MW between area a and b to the model
- Parameters:
- Returns:
pl. the newly created power-line, that is now a part of the model
- Return type:
- create_power_module((ModelBuilder)self, (object)model_area, (object)id, (object)name, (ModelArea)json) PowerModule :
create and add power-module to the area, doing validity checks
- Parameters:
model_area (ModelArea) – the model-area for which we create a power-module
id (string) – encoded power_type/load/wind module id
module_name (string) – unique module-name for each area
json (string) – json for the pm
- Returns:
pm. a reference to the created and added power-module
- Return type:
- class shyft.energy_market.core.ModelInfo
Bases:
instance
Provides model-information useful for selection and filtering
- __init__((ModelInfo)arg1) None
- __init__( (ModelInfo)self, (object)id, (object)name, (time)created [, (object)json=’’]) -> None :
Constructs ModelInfo with the supplied parameters
- Args:
id (int): the unique model id
name (str): any useful name or description
created (time): time of creation
json (str): extra information, preferably a valid json
- property id
the unique model id, can be used to retrieve the real model
- Type:
int
- property json
a json formatted string to enable scripting and python to store more information
- Type:
str
- property name
any useful name or description
- Type:
str
- class shyft.energy_market.core.ModelInfoVector
Bases:
instance
A strongly typed list of ModelInfo
- __init__((ModelInfoVector)arg1) None
- __init__( (ModelInfoVector)arg1, (ModelInfoVector)clone) -> None :
Create a clone.
- append((ModelInfoVector)arg1, (object)arg2) None
- extend((ModelInfoVector)arg1, (object)arg2) None
- class shyft.energy_market.core.ModelList
Bases:
instance
A strongly typed list, vector, of models
- __init__((ModelList)arg1) None
- append((ModelList)arg1, (object)arg2) None
- extend((ModelList)arg1, (object)arg2) None
- get_item_old()
__getitem__( (object)arg1, (object)arg2) -> object
- items() Generator
Creates a generator of elements contained in self (a C++ std::vector). Solely implemented to imitate the items() method of a python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements and the corresponding element ids
- keys() Generator
Creates a generator for the element ids contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the keys() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of element ids
- values() Generator
Creates a generator for the elements contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the values() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements
- class shyft.energy_market.core.Point
Bases:
instance
Simply a point (x,y)
- __init__((Point)arg1) None
- __init__( (Point)arg1, (object)x, (object)y) -> None :
construct a point with x and y
- __init__( (Point)arg1, (Point)clone) -> None :
Create a clone.
- property x
float:
- property y
float:
- class shyft.energy_market.core.PointList
Bases:
instance
A strongly typed list of Point.
- __init__((PointList)arg1) None
- __init__( (PointList)arg1, (PointList)clone) -> None :
Create a clone.
- append((PointList)arg1, (object)arg2) None
- extend((PointList)arg1, (object)arg2) None
- class shyft.energy_market.core.PowerLine
Bases:
IdBase
The PowerLine class describes the LTM (persisted) power-line A power-line represents the transmission capacity between two model-areas. Use the ModelArea.create_power_line(a1,a2,id) to build a power line
See also
Model,ModelArea,PowerModule,HydroPowerSystem
- __init__((PowerLine)arg1, (Model)model, (ModelArea)area_1, (ModelArea)area_2, (object)id, (object)name[, (object)json]) None :
constructs a PowerLine object between area 1 and 2 with the specified id
- Parameters:
model (Model) – the model for the power-line
area_1 (ModelArea) – a reference to an existing area in the model
area_2 (ModelArea) – a reference to an existing area in the model
id (int) – a global unique identifier for the power-line
name (string) – a global unique name for the power-line
json (string) – extra json for the power-line
- equal_structure((PowerLine)self, (PowerLine)other) bool :
Compare this power-line with the other for equality in topology and interconnections. The comparison is using each object`.id` member to identify the same objects. Notice that the attributes of the objects are not considered, only the topology.
- Parameters:
() (other) – The model-area to compare with
- Returns:
equal. true if other has structure equal to self
- Return type:
bool
- class shyft.energy_market.core.PowerLineList
Bases:
instance
A dict of ModelArea, the key-value is the area-name
- __init__((PowerLineList)arg1) None
__init__( (PowerLineList)arg1, (PowerLineList)clone_me) -> None
- append((PowerLineList)arg1, (object)arg2) None
- extend((PowerLineList)arg1, (object)arg2) None
- get_item_old()
__getitem__( (object)arg1, (object)arg2) -> object
- items() Generator
Creates a generator of elements contained in self (a C++ std::vector). Solely implemented to imitate the items() method of a python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements and the corresponding element ids
- keys() Generator
Creates a generator for the element names contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the keys() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of element names
- values() Generator
Creates a generator for the elements contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the values() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements
- class shyft.energy_market.core.PowerModule
Bases:
IdBase
The PowerModule class describes the LTM (persisted) power-module A power-module represents an actor that consume/produces power for given price/volume characteristics. The user can influence this characteristics giving specific semantic load_type/power_type and extra data and/or relations to other power-modules within the same area.
See also
Model,ModelArea,PowerLine,HydroPowerSystem
- __init__((PowerModule)arg1) None
- __init__( (PowerModule)arg1, (ModelArea)area, (object)id, (object)name [, (object)json]) -> None :
constructs a PowerModule with specified mandatory name and module-id
- Args:
area (ModelArea): the area for this power-module
id (int): unique pm-id for area
name (string): the name of the power-module
json (string): optional json
- class shyft.energy_market.core.PowerModuleDict
Bases:
instance
A dict of PowerModule, the key-value is the power module id
- __init__((PowerModuleDict)arg1) None
__init__( (PowerModuleDict)arg1, (PowerModuleDict)clone_me) -> None
- get_item_old()
__getitem__( (object)arg1, (object)arg2) -> object
- items() Generator
Creates a generator of elements contained in self (a C++ std::vector). Solely implemented to imitate the items() method of a python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements and the corresponding element ids
- keys() Generator
Creates a generator for the element ids contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the keys() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of element ids
- values() Generator
Creates a generator for the elements contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the values() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements
- class shyft.energy_market.core.PowerPlant
Bases:
IdBase
A hydro power plant is the site/building that contains a number of units. The attributes of the power plant, are typically sum-requirement and/or operations that applies all of the units.
- __init__((PowerPlant)arg1) None
- __init__( (PowerPlant)self, (object)id, (object)name, (object)json, (HydroPowerSystem)hps) -> None :
tbd
- add_aggregate((PowerPlant)self, (Unit)aggregate) None :
deprecated:use add_unit
- add_unit((PowerPlant)self, (Unit)unit) None :
add unit to plant
- property hps
returns the hydro-power-system this component is a part of
- Type:
- remove_aggregate((PowerPlant)self, (Unit)aggregate) None :
deprecated:use remove_unit
- remove_unit((PowerPlant)self, (Unit)unit) None :
remove unit from plant
- class shyft.energy_market.core.PowerPlantList
Bases:
instance
Strongly typed list of PowerPlants
- __init__((PowerPlantList)arg1) None
- __init__( (PowerPlantList)arg1, (PowerPlantList)clone) -> None :
Create a clone.
- append((PowerPlantList)arg1, (object)arg2) None
- extend((PowerPlantList)arg1, (object)arg2) None
- get_item_old()
__getitem__( (object)arg1, (object)arg2) -> object
- items() Generator
Creates a generator of elements contained in self (a C++ std::vector). Solely implemented to imitate the items() method of a python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements and the corresponding element ids
- keys() Generator
Creates a generator for the element ids contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the keys() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of element ids
- values() Generator
Creates a generator for the elements contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the values() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements
- class shyft.energy_market.core.Reservoir
Bases:
HydroComponent
- __init__((Reservoir)self, (object)id, (object)name, (object)json, (HydroPowerSystem)hps) None :
tbd
- input_from((Reservoir)self, (Waterway)other) Reservoir :
Connect the input of the reservoir to the output of the waterway.
- output_to((Reservoir)self, (Waterway)other[, (ConnectionRole)role=shyft.energy_market.core._core.ConnectionRole.main]) Reservoir :
Connect the output of this reservoir to the input of the waterway, and assign the connection role
- class shyft.energy_market.core.ReservoirList
Bases:
instance
Strongly typed list of reservoirs
- __init__((ReservoirList)arg1) None
- __init__( (ReservoirList)arg1, (ReservoirList)clone) -> None :
Create a clone.
- append((ReservoirList)arg1, (object)arg2) None
- extend((ReservoirList)arg1, (object)arg2) None
- get_item_old()
__getitem__( (object)arg1, (object)arg2) -> object
- items() Generator
Creates a generator of elements contained in self (a C++ std::vector). Solely implemented to imitate the items() method of a python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements and the corresponding element ids
- keys() Generator
Creates a generator for the element ids contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the keys() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of element ids
- values() Generator
Creates a generator for the elements contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the values() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements
- class shyft.energy_market.core.Run
Bases:
instance
Provides a Run concept, goes through states, created->prepinput->running->collect_result->frozen
- __init__((Run)arg1) None
- __init__( (Run)self, (object)id, (object)name, (time)created [, (object)json=’’ [, (object)mid=0]]) -> None :
create a run
- property created
the time of creation, or last modification of the model
- property id
the unique model id, can be used to retrieve the real model
- property json
a json formatted string to enable scripting and python to store more information
- property mid
model id (attached) for this run
- property name
any useful name or description
- property state
the current observed state for the run, like created, running,finished_run etc
- class shyft.energy_market.core.RunClient
Bases:
instance
The client-api for the generic run-repository
- __init__((RunClient)self, (object)host_port, (object)timeout_ms) None :
Creates a python client that can communicate with the corresponding server
- close((RunClient)self) None :
Close the connection. It will automatically reopen if needed.
- get_model_infos((RunClient)self, (IntVector)mids[, (UtcPeriod)created_in=[not-valid-period>]) ModelInfoVector :
returns all or selected model-info objects based on model-identifiers(mids)
- Parameters:
mids (IntVector) – empty = all, or a list of known exisiting model-identifiers
created_in (UtcPeriod) – For which period you are interested in model-infos.
- Returns:
model_infos. Strongly typed list of ModelInfo
- Return type:
- property host_port
Endpoint network address of the remote server.
- Type:
str
- property is_open
If the connection to the remote server is (still) open.
- Type:
bool
- read_model((RunClient)self, (object)mid) Run :
Read and return the model for specified model-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
The resulting model from the server
- Return type:
- read_models((RunClient)self, (IntVector)mids) RunVector :
Read and return the model for specified model-identifier (mid)
- Parameters:
mids (Int64Vector) – A strongly typed list of ints, the model-identifers for the wanted models
- Returns:
The resulting model from the server
- Return type:
- property reconnect_count
Number of reconnects to the remote server that have been performed.
- Type:
int
- remove_model((RunClient)self, (object)mid) int :
Remove the specified model bymodel-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
ec. 0 or error-code?
- Return type:
int
- store_model((RunClient)self, (Run)m, (ModelInfo)mi) int :
Store the model to backend, if m.id==0 then a new unique model-info is created and used
- property timeout_ms
Timout for remote server operations, in number milliseconds.
- Type:
int
- class shyft.energy_market.core.RunServer
Bases:
instance
The server-side component for the skeleton generic run repository
- __init__((RunServer)self, (object)root_dir) None :
Creates a server object that serves models from root_dir. The root_dir will be create if it does not exsists.
- Parameters:
root_dir (str) – Path to the root-directory that keeps/will keep the model-files
- get_listening_port((RunServer)self) int :
returns the port number it’s listening at for serving incoming request
- get_max_connections((RunServer)self) int :
returns the maximum number of connections to be served concurrently
- is_running((RunServer)self) bool :
true if server is listening and running
See also
start_server()
- set_listening_ip((RunServer)self, (object)ip) None :
set the listening port for the service
- Parameters:
ip (str) – ip or host-name to start listening on
- Returns:
nothing.
- Return type:
None
- set_listening_port((RunServer)self, (object)port_no) None :
set the listening port for the service
- Parameters:
port_no (int) – a valid and available tcp-ip port number to listen on.
20000 (typically it could be) –
- Returns:
nothing.
- Return type:
None
- set_max_connections((RunServer)self, (object)max_connect) None :
limits simultaneous connections to the server (it’s multithreaded, and uses on thread pr. connect)
- Parameters:
max_connect (int) – maximum number of connections before denying more connections
See also
get_max_connections()
- start_server((RunServer)self) int :
start server listening in background, and processing messages
See also
set_listening_port(port_no),is_running
- Returns:
port_no. the port used for listening operations, either the value as by set_listening_port, or if it was unspecified, a new available port
- Return type:
in
- stop_server((RunServer)self[, (object)timeout=1000]) None :
stop serving connections, gracefully.
See also
start_server()
- class shyft.energy_market.core.RunVector
Bases:
instance
A strongly typed list, vector, of Run
- __init__((RunVector)arg1) None
- append((RunVector)arg1, (object)arg2) None
- extend((RunVector)arg1, (object)arg2) None
- class shyft.energy_market.core.Server
Bases:
instance
The server-side component for the skeleton energy_market model repository
- __init__((Server)self, (object)root_dir) None :
Creates a server object that serves models from root_dir. The root_dir will be create if it does not exsists.
- Parameters:
root_dir (str) – Path to the root-directory that keeps/will keep the model-files
- get_listening_port((Server)self) int :
returns the port number it’s listening at for serving incoming request
- get_max_connections((Server)self) int :
returns the maximum number of connections to be served concurrently
- is_running((Server)self) bool :
true if server is listening and running
See also
start_server()
- set_listening_ip((Server)self, (object)ip) None :
set the listening port for the service
- Parameters:
ip (str) – ip or host-name to start listening on
- Returns:
nothing.
- Return type:
None
- set_listening_port((Server)self, (object)port_no) None :
set the listening port for the service
- Parameters:
port_no (int) – a valid and available tcp-ip port number to listen on.
20000 (typically it could be) –
- Returns:
nothing.
- Return type:
None
- set_max_connections((Server)self, (object)max_connect) None :
limits simultaneous connections to the server (it’s multithreaded, and uses on thread pr. connect)
- Parameters:
max_connect (int) – maximum number of connections before denying more connections
See also
get_max_connections()
- start_server((Server)self) int :
start server listening in background, and processing messages
See also
set_listening_port(port_no),is_running
- Returns:
port_no. the port used for listening operations, either the value as by set_listening_port, or if it was unspecified, a new available port
- Return type:
in
- stop_server((Server)self[, (object)timeout=1000]) None :
stop serving connections, gracefully.
See also
start_server()
- class shyft.energy_market.core.TurbineCapability
Bases:
enum
Describes the capabilities of a turbine.
- names = {'turbine_backward': shyft.energy_market.core._core.TurbineCapability.turbine_backward, 'turbine_forward': shyft.energy_market.core._core.TurbineCapability.turbine_forward, 'turbine_none': shyft.energy_market.core._core.TurbineCapability.turbine_none, 'turbine_reversible': shyft.energy_market.core._core.TurbineCapability.turbine_reversible}
- turbine_backward = shyft.energy_market.core._core.TurbineCapability.turbine_backward
- turbine_forward = shyft.energy_market.core._core.TurbineCapability.turbine_forward
- turbine_none = shyft.energy_market.core._core.TurbineCapability.turbine_none
- turbine_reversible = shyft.energy_market.core._core.TurbineCapability.turbine_reversible
- values = {0: shyft.energy_market.core._core.TurbineCapability.turbine_none, 1: shyft.energy_market.core._core.TurbineCapability.turbine_forward, 2: shyft.energy_market.core._core.TurbineCapability.turbine_backward, 3: shyft.energy_market.core._core.TurbineCapability.turbine_reversible}
- class shyft.energy_market.core.TurbineDescription
Bases:
instance
Complete description of efficiencies a turbine for all operating zones.
Pelton turbines typically have multiple operating zones; one for each needle combination. Other turbines normally have only a single operating zone describing the entire turbine, but may have more than one to model different isolated operating zones. Each operating zone is described with a turbine efficiency object, which in turn may contain multiple efficiency curves; one for each net head.
- __init__((TurbineDescription)arg1) None
__init__( (TurbineDescription)arg1, (TurbineOperatingZoneList)operating_zones) -> None
- __init__( (TurbineDescription)arg1, (TurbineDescription)clone) -> None :
Create a clone.
- capability((TurbineDescription)arg1) TurbineCapability :
Return the capability of the turbine
- get_operating_zone((TurbineDescription)arg1, (object)p) TurbineOperatingZone :
Find operating zone for given production value p
Notes
If operating zones are overlapping then the zone with lowest value of production_min will be selected.
- property operating_zones
list of TurbineOperatingZone.
Containing a single entry describing the entire turbine, or one entry for each isolated operating zone or Pelton needle combinations.
- Type:
- class shyft.energy_market.core.TurbineOperatingZone
Bases:
instance
A turbine efficiency.
Defined by a set of efficiency curves, one for each net head, with optional production limits. Part of the turbine description, to describe the efficiency of an entire turbine, or an isolated operating zone or a Pelton needle combination. Production limits are only relevant when representing an isolated operating zone or a Pelton needle combination.
- __init__((TurbineOperatingZone)arg1) None
__init__( (TurbineOperatingZone)arg1, (XyPointCurveWithZList)efficiency_curves) -> None
__init__( (TurbineOperatingZone)arg1, (XyPointCurveWithZList)efficiency_curves, (object)production_min, (object)production_max) -> None
__init__( (TurbineOperatingZone)arg1, (XyPointCurveWithZList)efficiency_curves, (object)production_min, (object)production_max, (object)production_nominal, (object)fcr_min, (object)fcr_max) -> None
- __init__( (TurbineOperatingZone)arg1, (TurbineOperatingZone)clone) -> None :
Create a clone.
- property efficiency_curves
A list of XyPointCurveWithZ efficiency curves for the net head range of the entire turbine, or an isolated operating zone or a Pelton needle combination.
- Type:
- evaluate((TurbineOperatingZone)arg1, (object)x, (object)z) float :
Evaluate the efficiency curves at a point (x, z)
- property fcr_max
The temporary maximum production allowed for this set of efficiency curves when delivering FCR.
Notes
Only relevant when representing an isolated operating zone or a Pelton needle combination.
- Type:
float
- property fcr_min
The temporary minimum production allowed for this set of efficiency curves when delivering FCR.
Notes
Only relevant when representing an isolated operating zone or a Pelton needle combination.
- Type:
float
- property production_max
The maximum production for which the efficiency curves are valid.
Notes
Only relevant when representing an isolated operating zone or a Pelton needle combination.
- Type:
float
- property production_min
The minimum production for which the efficiency curves are valid.
Notes
Only relevant when representing an isolated operating zone or a Pelton needle combination.
- Type:
float
- property production_nominal
The nominal production, or installed/rated/nameplate capacity, for which the efficiency curves are valid.
Notes
Only relevant when representing an isolated operating zone or a Pelton needle combination.
- Type:
float
- class shyft.energy_market.core.TurbineOperatingZoneList
Bases:
instance
A strongly typed list of TurbineOperatingZone.
- __init__((TurbineOperatingZoneList)arg1) None
- __init__( (TurbineOperatingZoneList)arg1, (TurbineOperatingZoneList)clone) -> None :
Create a clone.
- append((TurbineOperatingZoneList)arg1, (object)arg2) None
- extend((TurbineOperatingZoneList)arg1, (object)arg2) None
- class shyft.energy_market.core.Unit
Bases:
HydroComponent
An Unit consist of a turbine and a connected generator. The turbine is hydrologically connected to upstream tunnel and downstream tunell/river. The generator part is connected to the electrical grid through a busbar. In the long term models, the entire power plant is represented by a virtual unit that represents the total capability of the power-plant.
The short-term detailed models, usually describes every aggratate up to a granularity that is relevant for the short-term optimization/simulation horizont.
A power plant is a collection of one or more units that are natural to group into one power plant.
- __init__((Unit)arg1) None
- __init__( (Unit)self, (object)id, (object)name, (object)json, (HydroPowerSystem)hps) -> None :
tbd
- input_from((Unit)self, (Waterway)other) Unit :
Connect the input of this unit to the output of the waterway.
- property is_pump
Returns true if the unit is a pump, otherwise, returns false
- Type:
bool
- output_to((Unit)self, (Waterway)other) Unit :
Connect the output of this unit to the input of the waterway.
- property power_plant
return the hydro power plant associated with this unit
- Type:
- property power_station
use power_plant
- Type:
- Type:
deprecated
- class shyft.energy_market.core.UnitList
Bases:
instance
Strongly typed list of units
- __init__((UnitList)arg1) None
- __init__( (UnitList)arg1, (UnitList)clone) -> None :
Create a clone.
- append((UnitList)arg1, (object)arg2) None
- extend((UnitList)arg1, (object)arg2) None
- get_item_old()
__getitem__( (object)arg1, (object)arg2) -> object
- items() Generator
Creates a generator of elements contained in self (a C++ std::vector). Solely implemented to imitate the items() method of a python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements and the corresponding element ids
- keys() Generator
Creates a generator for the element ids contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the keys() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of element ids
- values() Generator
Creates a generator for the elements contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the values() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements
- class shyft.energy_market.core.Waterway
Bases:
HydroComponent
The waterway can be a river or a tunnel, and connects the reservoirs, units(turbine).
- __init__((Waterway)arg1) None
- __init__( (Waterway)self, (object)id, (object)name, (object)json, (HydroPowerSystem)hps) -> None :
tbd
- add_gate((Waterway)self, (Gate)gate) None :
add a gate to the waterway
- property downstream
returns downstream object(if any)
- Type:
- input_from((Waterway)self, (Waterway)other) Waterway :
Connect the input of this waterway to the output of the other waterway.
- input_from( (Waterway)self, (Unit)other) -> Waterway :
Connect the input of this waterway to the output of the unit.
- input_from( (Waterway)reservoir, (Reservoir)other [, (ConnectionRole)role=shyft.energy_market.core._core.ConnectionRole.main]) -> Waterway :
Connect the input of this waterway to the output of the reservoir, and assign the connection role.
- output_to((Waterway)self, (Waterway)other) Waterway :
Connect the output of this waterway to the input of the other waterway.
- output_to( (Waterway)self, (Reservoir)other) -> Waterway :
Connect the output of this waterway to the input of the reservoir.
- output_to( (Waterway)self, (Unit)other) -> Waterway :
Connect the output of this waterway to the input of the unit.
- remove_gate((Waterway)self, (Gate)gate) None :
remove a gate from the waterway
- property upstream
returns upstream object(if any)
- Type:
- property upstream_role
the role the water way has relative to the component above
- class shyft.energy_market.core.WaterwayList
Bases:
instance
Strongly typed list of waterways
- __init__((WaterwayList)arg1) None
- __init__( (WaterwayList)arg1, (WaterwayList)clone) -> None :
Create a clone.
- append((WaterwayList)arg1, (object)arg2) None
- extend((WaterwayList)arg1, (object)arg2) None
- get_item_old()
__getitem__( (object)arg1, (object)arg2) -> object
- items() Generator
Creates a generator of elements contained in self (a C++ std::vector). Solely implemented to imitate the items() method of a python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements and the corresponding element ids
- keys() Generator
Creates a generator for the element ids contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the keys() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of element ids
- values() Generator
Creates a generator for the elements contained in self, which is a C++ std::vector object. The purpose of this method is to imitate the values() method of a Python dictionary. :param self: A C++ std::vector object :return: A generator containing a tuple of elements
- class shyft.energy_market.core.XyPointCurve
Bases:
instance
A curve described using points, piecewise linear.
- __init__((XyPointCurve)arg1) None
__init__( (XyPointCurve)arg1, (PointList)points) -> None
__init__( (object)arg1, (DoubleVector)x_vector, (DoubleVector)y_vector) -> object
- __init__( (XyPointCurve)arg1, (XyPointCurve)clone) -> None :
Create a clone.
- calculate_x((XyPointCurve)self, (object)x) float :
interpolating and extending
- calculate_x( (XyPointCurve)self, (TimeSeries)x [, (interpolation_scheme)method=’linear’]) -> TimeSeries :
interpolating and extending
- calculate_y((XyPointCurve)self, (object)x) float :
interpolating and extending
- calculate_y( (XyPointCurve)self, (TimeSeries)x [, (interpolation_scheme)method=’linear’]) -> TimeSeries :
interpolating and extending
- is_convex((XyPointCurve)arg1) bool :
true if y=f(x) is convex
- is_mono_increasing((XyPointCurve)arg1) bool :
true if y=f(x) is monotone and increasing
- x_max((XyPointCurve)arg1) float :
returns largest value of x
- x_min((XyPointCurve)arg1) float :
returns smallest value of x
- y_max((XyPointCurve)arg1) float :
returns largest value of y
- y_min((XyPointCurve)arg1) float :
returns smallest value of y
- class shyft.energy_market.core.XyPointCurveList
Bases:
instance
A strongly typed list of XyPointCurve.
- __init__((XyPointCurveList)arg1) None
- __init__( (XyPointCurveList)arg1, (XyPointCurveList)clone) -> None :
Create a clone.
- append((XyPointCurveList)arg1, (object)arg2) None
- extend((XyPointCurveList)arg1, (object)arg2) None
- class shyft.energy_market.core.XyPointCurveWithZ
Bases:
instance
A XyPointCurve with a reference value z.
- __init__((XyPointCurveWithZ)arg1) None
__init__( (XyPointCurveWithZ)arg1, (XyPointCurve)xy_point_curve, (object)z) -> None
- __init__( (XyPointCurveWithZ)arg1, (XyPointCurveWithZ)clone) -> None :
Create a clone.
- property xy_point_curve
describes the function at z
- Type:
- property z
z value
- Type:
float
- class shyft.energy_market.core.XyPointCurveWithZList
Bases:
instance
A strongly typed list of XyPointCurveWithZ.
- __init__((XyPointCurveWithZList)arg1) None
- __init__( (XyPointCurveWithZList)arg1, (XyPointCurveWithZList)clone) -> None :
Create a clone.
- append((XyPointCurveWithZList)arg1, (object)arg2) None
- evaluate((XyPointCurveWithZList)arg1, (object)x, (object)z) float :
Evaluate the curve at the point (x, z)
- extend((XyPointCurveWithZList)arg1, (object)arg2) None
- x_max((XyPointCurveWithZList)arg1) float :
returns largest value of x
- x_min((XyPointCurveWithZList)arg1) float :
returns smallest value of x
- y_max((XyPointCurveWithZList)arg1) float :
returns largest value of y
- y_min((XyPointCurveWithZList)arg1) float :
returns smallest value of y
- z_max((XyPointCurveWithZList)arg1) float :
returns largest value of z
- z_min((XyPointCurveWithZList)arg1) float :
returns smallest value of z
- class shyft.energy_market.core.XyzPointCurve
Bases:
instance
A 3D curve consisting of one or more 2D curves parametrised over a third variable.
- __init__((XyzPointCurve)arg1) None
- __init__( (XyzPointCurve)arg1, (XyPointCurveWithZList)curves) -> None :
Create from a list.
- property curves
list the contained curves with z values
- Type:
- evaluate((XyzPointCurve)arg1, (object)x, (object)z) float :
Evaluate the curve at the point (x, z)
- get_curve((XyzPointCurve)arg1, (object)z) XyPointCurve :
get the curve assigned to the value
- gradient((XyzPointCurve)arg1, (object)arg2, (object)arg3) object
- set_curve((XyzPointCurve)arg1, (object)z, (XyPointCurve)xy) None :
Assign an XyzPointCurve to a z-value
- shyft.energy_market.core.compressed_size((DoubleVector)double_vector, (object)accuracy) int
compressed_size( (object)float_vector, (float)accuracy) -> int
- class shyft.energy_market.core.run_state
Bases:
enum
Describes the possible state of the run
- R_CREATED = shyft.energy_market.core._core.run_state.R_CREATED
- R_FAILED = shyft.energy_market.core._core.run_state.R_FAILED
- R_FINISHED_RUN = shyft.energy_market.core._core.run_state.R_FINISHED_RUN
- R_FROZEN = shyft.energy_market.core._core.run_state.R_FROZEN
- R_PREP_INPUT = shyft.energy_market.core._core.run_state.R_PREP_INPUT
- R_READ_RESULT = shyft.energy_market.core._core.run_state.R_READ_RESULT
- R_RUNNING = shyft.energy_market.core._core.run_state.R_RUNNING
- names = {'R_CREATED': shyft.energy_market.core._core.run_state.R_CREATED, 'R_FAILED': shyft.energy_market.core._core.run_state.R_FAILED, 'R_FINISHED_RUN': shyft.energy_market.core._core.run_state.R_FINISHED_RUN, 'R_FROZEN': shyft.energy_market.core._core.run_state.R_FROZEN, 'R_PREP_INPUT': shyft.energy_market.core._core.run_state.R_PREP_INPUT, 'R_READ_RESULT': shyft.energy_market.core._core.run_state.R_READ_RESULT, 'R_RUNNING': shyft.energy_market.core._core.run_state.R_RUNNING}
- values = {0: shyft.energy_market.core._core.run_state.R_CREATED, 1: shyft.energy_market.core._core.run_state.R_PREP_INPUT, 2: shyft.energy_market.core._core.run_state.R_RUNNING, 3: shyft.energy_market.core._core.run_state.R_FINISHED_RUN, 4: shyft.energy_market.core._core.run_state.R_READ_RESULT, 5: shyft.energy_market.core._core.run_state.R_FROZEN, 6: shyft.energy_market.core._core.run_state.R_FAILED}
- shyft.energy_market.core.downstream_reservoirs((HydroComponent)component[, (object)max_dist=0]) ReservoirList :
Find all reservoirs upstream from component, stopping at max_dist traversals
- Parameters:
max_dist (int) – max traversals
- Returns:
reservoirs. The reservoirs within the specified distance
- Return type:
- shyft.energy_market.core.downstream_units((HydroComponent)component[, (object)max_dist=0]) UnitList :
Find all units downstream from component, stopping at max_dist traversals
- Parameters:
max_dist (int) – max traversals
- Returns:
units. The units within the specified distance
- Return type:
- shyft.energy_market.core.upstream_reservoirs((HydroComponent)component[, (object)max_dist=0]) ReservoirList :
Find all reservoirs upstream from component, stopping at max_dist traversals.
- Parameters:
max_dist (int) – max traversals
- Returns:
reservoirs. The reservoirs within the specified distance
- Return type:
- shyft.energy_market.core.upstream_units((HydroComponent)component[, (object)max_dist=0]) UnitList :
Find units upstream from component, stopping at max_dist traversals
- Parameters:
max_dist (int) – max traversals
- Returns:
units. The units within the specified distance
- Return type:
- shyft.energy_market.core.has_forward_capability((TurbineCapability)arg1) bool :
Checks if a turbine can support generating
- shyft.energy_market.core.has_backward_capability((TurbineCapability)arg1) bool :
Checks if a turbine can support pumping
- shyft.energy_market.core.has_reversible_capability((TurbineCapability)arg1) bool :
Checks if a turbine can support both generating and pumping
STM
The detailed energy market model contains all essential energy market objects, entities, that Shyft manages.
For example, power plants with units, unit-groups, reservoirs, waterways, market areas, power-modules, contracts, contract portfolios, network with transmission lines and bus-bars for electrical connections between the elements.
The module also provides ready made services, with clients and api’s, in python, as well as web/socket protocols for setting up a complete application system covering the energy management process tasks.
The design and architecture of the system utilizes the energy market models, combined with the DTSS, the distributed time-series services, and provides a model-driven approach with time-series expressions derived from the model, so that it scales and maintains well.
The Task Services also support the workflow that are operating on StmSystem, to be efficiently orchestrated, including running optimization tasks with Sintef SHOP engine. Generic python callback allows extensions to arbitrary tasks that can be performed using python.
The UI Services and classes completes the Task Services with a a framework for model and data-driven front end., that fits the task-workflow, showing relevant data/information at the workflow process. E.g: if you are planning a power plant, you can configure the Task and UI service to provide a suitable view, e.g. chart/tables with data-bindings, that works with the backend services, in real time.
The test-suites of Shyft for the energy-market includes ready made examples that includes starting up the services, adding energy-market models, running SHOP optimization and getting results back for testing/regressions.
Shyft Energy Market detailed model
- class shyft.energy_market.stm.HydroPowerSystem
Bases:
HydroPowerSystem
A hydro power system, with indataset.
The hydro power system consists of reservoirs, waterway (river/tunnel) and units. In addition, the power plant has the role of keeping related units together into a group that resembles what most people would think is a power plant in this context. The power plant has just references to the units (generator/turbine parts), but can keep sum-requirements/schedules and computations valid at power plant level.
- __init__((HydroPowerSystem)arg1, (object)uid, (object)name) None :
Create hydro power system with unique uid.
- create_aggregate()
- create_unit( (HydroPowerSystem)self, (object)uid, (object)name [, (object)json=’’]) -> Unit :
Create stm unit.
- Returns:
Unit: unit. The new unit.
- create_gate((HydroPowerSystem)self, (object)uid, (object)name[, (object)json='']) Gate :
Create stm gate.
- Returns:
gate. The new gate.
- Return type:
- create_power_plant((HydroPowerSystem)self, (object)uid, (object)name[, (object)json='']) PowerPlant :
Create stm power plant that keeps units.
- Returns:
power_plant. The new PowerPlant.
- Return type:
- create_power_station()
- create_power_plant( (HydroPowerSystem)self, (object)uid, (object)name [, (object)json=’’]) -> PowerPlant :
Create stm power plant that keeps units.
- Returns:
PowerPlant: power_plant. The new PowerPlant.
- create_reservoir((HydroPowerSystem)self, (object)uid, (object)name[, (object)json='']) Reservoir :
Create stm reservoir with unique uid.
- Returns:
reservoir. The new reservoir.
- Return type:
- create_reservoir_aggregate((HydroPowerSystem)self, (object)uid, (object)name[, (object)json='']) ReservoirAggregate :
Create stm reservoir aggregate with unique uid.
- Returns:
reservoir_aggregate. The new ReservoirAggregate.
- Return type:
ReservoirAggregate
- create_river((HydroPowerSystem)self, (object)uid, (object)name[, (object)json='']) Waterway :
Create stm waterway (a tunnel or river).
- Returns:
waterway. The new waterway.
- Return type:
- create_tunnel((HydroPowerSystem)self, (object)uid, (object)name[, (object)json='']) Waterway :
Create stm waterway (a tunnel or river).
- Returns:
waterway. The new waterway.
- Return type:
- create_unit((HydroPowerSystem)self, (object)uid, (object)name[, (object)json='']) Unit :
Create stm unit.
- Returns:
unit. The new unit.
- Return type:
- create_water_route()
- create_waterway( (HydroPowerSystem)self, (object)uid, (object)name [, (object)json=’’]) -> Waterway :
Create stm waterway (a tunnel or river).
- Returns:
Waterway: waterway. The new waterway.
- create_waterway((HydroPowerSystem)self, (object)uid, (object)name[, (object)json='']) Waterway :
Create stm waterway (a tunnel or river).
- Returns:
waterway. The new waterway.
- Return type:
- find_catchment_by_id((HydroPowerSystem)arg1, (object)arg2) object
- find_catchment_by_name((HydroPowerSystem)arg1, (object)arg2) object
- find_power_plant_by_id((HydroPowerSystem)arg1, (object)arg2) PowerPlant
- find_power_plant_by_name((HydroPowerSystem)arg1, (object)arg2) PowerPlant
- find_reservoir_aggregate_by_id((HydroPowerSystem)arg1, (object)arg2) ReservoirAggregate
- find_reservoir_aggregate_by_name((HydroPowerSystem)arg1, (object)arg2) ReservoirAggregate
- static from_blob((ByteVector)blob) HydroPowerSystem :
Re-create a stm hps from a previously created blob.
- Parameters:
blob (ByteVector) – The blob containing a previously stored hps.
- Returns:
hps. A stm hydro-power-system including it’s attributes in the ids.
- Return type:
- static from_stripped_blob((ByteVector)blob) HydroPowerSystem :
Re-create a stm hps from a previously created stripped blob.
- Parameters:
blob (ByteVector) – The blob containing a previously stripped stored hps.
- Returns:
hps. A stripped stm hydro-power-system.
- Return type:
- property reservoir_aggregates
all the reservoir aggregates
- Type:
ReservoirAggregateList
- to_blob((HydroPowerSystem)self) ByteVector :
Serialize the model to a blob.
- Returns:
blob. Blob form of the model.
- Return type:
ByteVector
- to_stripped_blob((HydroPowerSystem)self) ByteVector :
Serialize the model to a blob, stripping expressions, custom attributes and json.
- Returns:
blob. Blob form of the stripped model.
- Return type:
ByteVector
- class shyft.energy_market.stm.HydroPowerSystemList
Bases:
instance
A strongly typed list of HydroPowerSystem.
- __init__((HydroPowerSystemList)arg1) None
- __init__( (HydroPowerSystemList)arg1, (HydroPowerSystemList)clone) -> None :
Create a clone.
- append((HydroPowerSystemList)arg1, (object)arg2) None
- extend((HydroPowerSystemList)arg1, (object)arg2) None
- class shyft.energy_market.stm.StmSystem
Bases:
instance
A complete stm system, with market areas, and hydro power systems.
- __init__((StmSystem)arg1, (object)uid, (object)name, (object)json) None :
Create stm system.
- add_unit_group((StmSystem)self, (object)id, (object)name, (object)json[, (UnitGroupType)group_type=shyft.energy_market.stm._stm.UnitGroupType.UNSPECIFIED]) UnitGroup :
Add an empty named unit-group to the system.
- Parameters:
id (int) – Unique id of the group.
name (str) – Unique name of the group.
json (str) – Json payload for py customization.
group_type (int) – One of UnitGroupType values, default 0.
- Returns:
unit_group. The newly created unit-group.
- Return type:
- property contract_portfolios
List of contract portfolios.
- Type:
- property contracts
List of contracts.
- Type:
- create_hydro_power_system((StmSystem)self, (object)uid, (object)name[, (object)json='']) HydroPowerSystem :
Create hydro power system with unique uid.
- Returns:
hps. The new hydro power system.
- Return type:
- create_market_area((StmSystem)self, (object)uid, (object)name[, (object)json='']) MarketArea :
Create stm energy market area with unique uid.
- Returns:
market_area. The new market area.
- Return type:
- create_network((StmSystem)self, (object)uid, (object)name[, (object)json='']) Network :
Create stm network with unique uid.
- Returns:
network. The new network.
- Return type:
- create_power_module((StmSystem)self, (object)uid, (object)name[, (object)json='']) PowerModule :
Create stm power module with unique uid.
- Returns:
power_module. The new power module.
- Return type:
- create_wind_farm((StmSystem)self, (object)uid, (object)name[, (object)json='']) WindFarm :
Create stm network with unique uid.
- Returns:
wind_farm. The new wind farm.
- Return type:
- fix_uplinks((StmSystem)self) bool :
Ensure all members(hps,contracts etc.) refers to this system to enable easy py navigation. Usually only needed in cases where the stm-system is built without proper system refrences for child objects. side-effects: Missing uplinks are fixed.
- Returns:
result. True if anything was changed in uplinks
- static from_blob((ByteVector)blob) StmSystem :
Re-create a stm system from a previously create blob.
- Returns:
stm_sys. A stm system including hydro-power-systems and markets.
- Return type:
- static from_stripped_blob((ByteVector)blob) StmSystem :
Re-create a stm system from a previously created stripped blob.
- Returns:
stm_sys. A stripped stm system including hydro-power-systems and markets.
- Return type:
- property hydro_power_systems
List of hydro power systems.
- Type:
- property id
Unique id for this object.
- Type:
int
- property json
Json keeping any extra data for this object.
- Type:
str
- property market_areas
List of market areas.
- Type:
MarketAreaList
- property name
Name for this object.
- Type:
str
- property networks
List of networks.
- Type:
NetworkList
- patch((StmSystem)self, (StmPatchOperation)op, (StmSystem)p) bool :
Patch self with patch p using operation op. If operation is ADD, the new objects in p that have id==0, will have auto assigned unique id`s For the value of the auto assigned `id is max(obj.id)+1, in the order of appearance. side-effects: The patch p is updated with these new object id values.
- Parameters:
() (p) – Operation is one of ADD,REMOVE_RELATIONS,REMOVE_OBJECTS
() – The StmSystem describing the patch
- Returns:
result. True if patch operation and type was applied, false if not supported operation
- property power_modules
List of power modules.
- Type:
PowerModuleList
- result_ts_urls((StmSystem)self, (object)prefix) StringVector :
Generate and return all result time series urls for the specified model. Useful in the context of a dstm client, that have a get_ts method that accepts this list.
- Parameters:
() (prefix) – Url prefix, like dstm://Mmodel_id.
- Returns:
ts_urls. A strongly typed list of strings with ready to use ts-urls.
- Return type:
StringVector
- property run_parameters
Run parameters.
- Type:
RunParameters
- property summary
Key result values from simulations.
- Type:
_OptimizationSummary
- to_blob((StmSystem)self) ByteVector :
Serialize the model to a blob.
- Returns:
blob. Blob form of the model.
- Return type:
ByteVector
- to_stripped_blob((StmSystem)self) ByteVector :
Serialize the model to a blob, stripping away expressions, json and custom attributes.
- Returns:
blob. Blob form of the stripped model.
- Return type:
ByteVector
- property unit_groups
Unit groups with constraints. These groups holds a list of units, plus the constraints that apply to them. During optimisation, the groups along with their constraints, so that the optimization can take it into account when finding the optimal solution.
- Type:
UnitGroupList
- property wind_farms
List of wind parks.
- Type:
WindFarmList
- class shyft.energy_market.stm.StmSystemList
Bases:
instance
Strongly typed list of StmSystem
- __init__((StmSystemList)arg1) None
- __init__( (StmSystemList)arg1, (StmSystemList)clone) -> None :
Create a clone.
- append((StmSystemList)arg1, (object)arg2) None
- extend((StmSystemList)arg1, (object)arg2) None
- class shyft.energy_market.stm.StmPatchOperation
Bases:
enum
Describes how a patch should be applied to the STM model
- ADD = shyft.energy_market.stm._stm.StmPatchOperation.ADD
- REMOVE_OBJECTS = shyft.energy_market.stm._stm.StmPatchOperation.REMOVE_OBJECTS
- REMOVE_RELATIONS = shyft.energy_market.stm._stm.StmPatchOperation.REMOVE_RELATIONS
- names = {'ADD': shyft.energy_market.stm._stm.StmPatchOperation.ADD, 'REMOVE_OBJECTS': shyft.energy_market.stm._stm.StmPatchOperation.REMOVE_OBJECTS, 'REMOVE_RELATIONS': shyft.energy_market.stm._stm.StmPatchOperation.REMOVE_RELATIONS}
- values = {0: shyft.energy_market.stm._stm.StmPatchOperation.ADD, 1: shyft.energy_market.stm._stm.StmPatchOperation.REMOVE_RELATIONS, 2: shyft.energy_market.stm._stm.StmPatchOperation.REMOVE_OBJECTS}
- class shyft.energy_market.stm.MarketArea
Bases:
IdBase
A market area, with load/price and other properties.
Within the market area, there are zero or more energy- producing/consuming units.
- class Offering
Bases:
instance
describes actors (supply/demand) offering into the market
- __init__()
Raises an exception This class cannot be instantiated from Python
- property bids
time dep x,y, x=price[Money/J],y=amount[W]
- Type:
_t_xy_
- class TsTriplet
Bases:
instance
describes .realised, .schedule and .result time-series
- __init__()
Raises an exception This class cannot be instantiated from Python
- property realised
SI-units, realised time-series, as in historical fact
- Type:
_ts
- property result
SI-units, result, as provided by optimisation
- Type:
_ts
- property schedule
SI-units, schedule, as in current schedule
- Type:
_ts
- class TsTripletResult
Bases:
instance
describes .realised, .schedule and .result time-series
- __init__()
Raises an exception This class cannot be instantiated from Python
- property realised
SI-units, realised time-series, as in historical fact
- Type:
_ts
- property result
SI-units, result, as provided by optimisation
- Type:
_ts
- property schedule
SI-units, schedule, as in current schedule
- Type:
_ts
- __init__((MarketArea)arg1, (object)uid, (object)name, (object)json, (StmSystem)stm_sys) None :
Create market area for a stm system.
- property busbars
List of busbars.
- Type:
BusbarList
- property buy
[W] Buy result.
- Type:
_ts
- property contracts
List of contracts.
- Type:
- create_busbar_derived_unit_group((MarketArea)self, (object)id, (object)name, (object)json) UnitGroup :
Add a unit-group of type ‘production’ to the system and to the market area. The unit group will derive its units from the associated network busbars. Units are automatically added/removed if busbars are added/removed on the network.
- Parameters:
id (int) – Unique id of the group.
name (str) – Unique name of the group.
json (str) – Json payload for py customization.
- Returns:
unit_group. The newly created unit-group.
- Return type:
- property custom
Map keeping any_attr
- Type:
StringAnyAttrDict
- flattened_attributes((MarketArea)arg1) dict :
Flat dict containing all component attributes.
- get_consumption((MarketArea)self) TsTripletResult :
Get the sum of consumption contribution for all busbars
Args: :returns: consumption. Consumption contribution sum, as triplet: result,realised,schedule :rtype: TsTripletResult
- get_export((MarketArea)self) TsTripletResult :
Get the total export of the market area. (converted to positive value) If the actual sum of busbar flow is positive, export is 0.
Args: :returns: export. Market area export, as triplet: result,realised,schedule :rtype: TsTripletResult
- get_import((MarketArea)self) TsTripletResult :
Get the total import of the market area. If the actual sum of busbar flow is negative, import is 0.
Args: :returns: import. Market area import, as triplet: result,realised,schedule :rtype: TsTripletResult
- get_production((MarketArea)self) TsTripletResult :
Get the sum of production contribution for all busbars
Args: :returns: production. Production contribution sum, as triplet: result,realised,schedule :rtype: TsTripletResult
- get_tsm_object((MarketArea)self, (object)key) _ts :
Get a specific extra time series for this object.
The returned time series is wrapped in an object which exposes method for retrieving url etc.
- Parameters:
key (str) – The key in the tsm of the time series to get.
- Raises:
runtime_error – If specified key does not exist.
- property load
[W] Load.
- Type:
_ts
- property max_buy
[W] Maximum buy.
- Type:
_ts
- property max_sale
[W] Maximum sale.
- Type:
_ts
- property price
[Money/J] Price.
- Type:
_ts
- property production
[W] Production result.
- Type:
_ts
- remove_unit_group((MarketArea)self) UnitGroup :
Remove the unit group associated with this market if available.
Args: :returns: unit_group. The newly removed unit group. :rtype: UnitGroup
- property reserve_obligation_penalty
[Money/x] Obligation penalty.
- Type:
_ts
- property sale
[W] Sale result.
- Type:
_ts
- property tag
Url tag.
- Type:
str
- transmission_lines_from((MarketArea)self, (MarketArea)from_market) TransmissionLineList :
Remove the unit group associated with this market if available.
- Parameters:
from (MarketArea) – MarketArea to get transmission lines from
- Returns:
transmission_line_list. List of transmission lines from MarketArea
- Return type:
TransmissionLineList
- transmission_lines_to((MarketArea)self, (MarketArea)to_market) TransmissionLineList :
Get transmission lines (from this) to MarketArea
- Parameters:
to (MarketArea) – MarketArea to get transmission lines to
- Returns:
transmission_line_list. List of transmission lines to MarketArea
- Return type:
TransmissionLineList
- property ts
Map keeping any extra time series for this object.
- Type:
- class shyft.energy_market.stm.ModelState
Bases:
enum
Describes the possible state of the STM model
- FAILED = shyft.energy_market.stm._stm.ModelState.FAILED
- FINISHED = shyft.energy_market.stm._stm.ModelState.FINISHED
- IDLE = shyft.energy_market.stm._stm.ModelState.IDLE
- RUNNING = shyft.energy_market.stm._stm.ModelState.RUNNING
- TUNING = shyft.energy_market.stm._stm.ModelState.TUNING
- names = {'FAILED': shyft.energy_market.stm._stm.ModelState.FAILED, 'FINISHED': shyft.energy_market.stm._stm.ModelState.FINISHED, 'IDLE': shyft.energy_market.stm._stm.ModelState.IDLE, 'RUNNING': shyft.energy_market.stm._stm.ModelState.RUNNING, 'TUNING': shyft.energy_market.stm._stm.ModelState.TUNING}
- values = {0: shyft.energy_market.stm._stm.ModelState.IDLE, 1: shyft.energy_market.stm._stm.ModelState.RUNNING, 2: shyft.energy_market.stm._stm.ModelState.TUNING, 3: shyft.energy_market.stm._stm.ModelState.FINISHED, 4: shyft.energy_market.stm._stm.ModelState.FAILED}
- class shyft.energy_market.stm.Unit
Bases:
Unit
Stm unit (turbine and generator assembly).
- class BestProfit
Bases:
instance
Describes the best profit (BP) curves of the unit.
- __init__()
Raises an exception This class cannot be instantiated from Python
- property discharge
Optimal discharge for the generator given a certain production level of the plant.
- Type:
_t_xy_
- property discharge_production_ratio
Ratio between discharge and production for the generator given a certain production level of the plant.
- Type:
_t_xy_
- property operating_zone
Optimal operating zone or Pelton needle combination for the generator given a certain production level of the plant.
- Type:
_t_xy_
- property production
Optimal production for the unit given a certain production level of the plant.
- Type:
_t_xy_
- class Cost
Bases:
instance
Unit.Cost contains the start/stop costs.
- __init__()
Raises an exception This class cannot be instantiated from Python
- property pump_start
[money] Start pump cost.
- Type:
_ts
- property pump_stop
[money] Stop pump cost.
- Type:
_ts
- property start
[money] Start cost.
- Type:
_ts
- property stop
[money] Stop cost.
- Type:
_ts
- class Discharge
Bases:
instance
Unit.Discharge attributes, flow[m3/s].
- class Constraint
Bases:
instance
Constraints and limitations to the unit-flow.
- __init__()
Raises an exception This class cannot be instantiated from Python
- property max
[m3/s] Discharge constraint maximum.
- Type:
_ts
- property max_from_downstream_level
Discharge maximum, as a function of downstream pressure/water level.
- Type:
_t_xy_
- property min
[m3/s] Discharge constraint minimum.
- Type:
_ts
- __init__()
Raises an exception This class cannot be instantiated from Python
- property constraint
Constraint group.
- Type:
- property realised
[m^3/s] Discharge realised, usually the result of non trivial computation based on the measured unit.production.realised.
- Type:
_ts
- property result
[m^3/s] Discharge result.
- Type:
_ts
- property schedule
[m^3/s] Discharge schedule.
- Type:
_ts
- class Production
Bases:
instance
Unit.Production attributes, effect[W].
- class Constraint
Bases:
instance
Contains the effect constraints to the unit.
- __init__()
Raises an exception This class cannot be instantiated from Python
- property max
[W] Production constraint maximum.
- Type:
_ts
- property min
[W] Production constraint minimum.
- Type:
_ts
- __init__()
Raises an exception This class cannot be instantiated from Python
- property commitment
Production commitment.
- Type:
_ts
- property constraint
Constraint group.
- Type:
- property nominal
[W] Nominal production, or installed/rated/nameplate capacity, time-dependent attribute.
- Type:
_ts
- property pump_commitment
Consumption commitment.
- Type:
_ts
- property realised
[W] Historical production.
- Type:
_ts
- property result
[W] Production result, time series.
- Type:
_ts
- property schedule
[W] Production schedule.
- Type:
_ts
- property static_max
[W] Production maximum, time-dependent attribute.
- Type:
_ts
- property static_min
[W] Production minimum, time-dependent attribute.
- Type:
_ts
- class ProductionDischargeRelation
Bases:
instance
Describes the production discharge relation (PQ) curves of the unit.
- __init__()
Raises an exception This class cannot be instantiated from Python
- property convex
Convexified PQ curve that includes all the time-dependent operating limits and removes all the nonconcave points of the original PQ curve, the slope of each segment is non-increasing, x=flow[m3/s], y=effect[W].
- Type:
_t_xy_
- property final
Final PQ curve that is the final form included into the MILP optimization problem, the first point of the convex PQ curve is extended to Q=0, x=flow[m3/s], y=effect[W].
- Type:
_t_xy_
- property original
Original PQ curve that includes non-convex regions, x=flow[m3/s], y=effect[W].
- Type:
_t_xy_
- class PumpConstraint
Bases:
instance
Contains the pump constraints.
- __init__()
Raises an exception This class cannot be instantiated from Python
- property min_downstream_level
[masl] Minimum level downstream pump.
- Type:
_ts
- class Reserve
Bases:
instance
Unit.Reserve contains all operational reserve related attributes.
- class FcrDroop
Bases:
instance
Per reserve type attributes
- __init__()
Raises an exception This class cannot be instantiated from Python
- property cost
Droop cost. test
- Type:
_ts
- property result
Droop result. test
- Type:
_ts
- property steps
General discrete droop steps, x=step number, y=droop settings value.
- Type:
_t_xy_
- class Pair
Bases:
instance
Describes the up and down pair of reserve specification.
- __init__()
Raises an exception This class cannot be instantiated from Python
- class Spec
Bases:
instance
Describes reserve specification, (.schedule, or min..result..max) SI-units is W.
- __init__()
Raises an exception This class cannot be instantiated from Python
- property cost
Reserve cost.
- Type:
_ts
- property max
Reserve minimum of range if no schedule.
- Type:
_ts
- property min
Reserve minimum of range if no schedule.
- Type:
_ts
- property penalty
Reserve penalty.
- Type:
_ts
- property realised
Reserve realised.
- Type:
_ts
- property result
Reserve result.
- Type:
_ts
- property schedule
Reserve schedule.
- Type:
_ts
- __init__()
Raises an exception This class cannot be instantiated from Python
- property afrr_static_max
[W] Unit max-limit valid for aFRR calculations.
- Type:
_ts
- property afrr_static_min
[W] Unit min-limit valid for aFRR calculations.
- Type:
_ts
- property droop
Droop attributes, related/common to fcr settings.
- Type:
_Droop
- property droop_steps
General discrete droop steps, x=step number, y=droop settings value.
- Type:
_t_xy_
- property fcr_mip
FCR flag.
- Type:
_ts
- property fcr_static_max
[W] Unit max-limit valid for FCR calculations (otherwise long running max is used).
- Type:
_ts
- property fcr_static_min
[W] Unit min-limit valid for FCR calculations (otherwise long running min is used).
- Type:
_ts
- property mfrr_static_min
[W] Unit max-limit valid for mFRR calculations.
- Type:
_ts
- __init__((Unit)arg1, (object)uid, (object)name, (object)json, (HydroPowerSystem)hps) None :
Create unit with unique id and name for a hydro power system.
- property best_profit
BP curves.
- Type:
- property custom
Map keeping any_attr
- Type:
StringAnyAttrDict
- property effective_head
Effective head of the generator, time-dependent attribute.
- Type:
_ts
- flattened_attributes((Unit)arg1) dict :
Flat dict containing all component attributes.
- property generator_description
Generator efficiency curve, time-dependent attribute.
- Type:
_t_xy_
- get_tsm_object((Unit)self, (object)key) _ts :
Get a specific extra time series for this object.
The returned time series is wrapped in an object which exposes method for retrieving url etc.
- Parameters:
key (str) – The key in the tsm of the time series to get.
- Raises:
runtime_error – If specified key does not exist.
- property priority
Priority value for determining uploading order.
- Type:
_ts
- property production
Production attributes.
- Type:
- property production_discharge_relation
PQ curves.
- property pump_constraint
Pump constraint attributes.
- Type:
- property pump_description
Time-dependent description of pump efficiency.
- Type:
_t_xy_z_list
Time series where time steps the unit is unavailable are marked with value 1, while a value nan or 0 means it is available.
- Type:
_ts
- property tag
Url tag.
- Type:
str
- property ts
Map keeping any extra time series for this object.
- Type:
- property turbine_description
Time-dependent description of turbine efficiency.
- Type:
_turbine_description
Time series where time steps the unit is unavailable are marked with value 1, while a value nan or 0 means it is available.
- Type:
_ts
- class shyft.energy_market.stm.UnitList
Bases:
instance
A strongly typed list of Units.
- __init__((UnitList)arg1) None
- __init__( (UnitList)arg1, (UnitList)clone) -> None :
Create a clone.
- append((UnitList)arg1, (object)arg2) None
- extend((UnitList)arg1, (object)arg2) None
- class shyft.energy_market.stm.Reservoir
Bases:
Reservoir
Stm reservoir.
- class Inflow
Bases:
instance
- __init__()
Raises an exception This class cannot be instantiated from Python
- property realised
[m3/s] Historical inflow, time series.
- Type:
_ts
- property result
[m3/s] Inflow result, time series.
- Type:
_ts
- property schedule
[m3/s] Inflow input, time series.
- Type:
_ts
- class Level
Bases:
instance
- class Constraints
Bases:
instance
- __init__()
Raises an exception This class cannot be instantiated from Python
- property max
[masl] Level constraint maximum, time series.
- Type:
_ts
- property min
[masl] Level constraint minimum, time series.
- Type:
_ts
- __init__()
Raises an exception This class cannot be instantiated from Python
- property constraint
Level constraint attributes.
- Type:
- property realised
[masl] Historical water level, time series.
- Type:
_ts
- property regulation_max
[masl] Highest regulated water level, time-dependent attribute.
- Type:
_ts
- property regulation_min
[masl] Lowest regulated water level, time-dependent attribute.
- Type:
_ts
- property result
[masl] Level results, time series.
- Type:
_ts
- property schedule
[masl] Level schedule, time series.
- Type:
_ts
- class Ramping
Bases:
instance
- __init__()
Raises an exception This class cannot be instantiated from Python
- property amplitude_down
[s][m] Max level change down for a time period, duration vs m change.
- Type:
_t_xy
- property amplitude_up
[s][m] Max level change up for a time period, duration vs m change.
- Type:
_t_xy
- property level_down
[m/s] Max level change down, time series.
- Type:
_ts
- property level_up
[m/s] Max level change up, time series.
- Type:
_ts
- class Volume
Bases:
instance
- class Constraints
Bases:
instance
- class Tactical
Bases:
instance
- __init__()
Raises an exception This class cannot be instantiated from Python
- property max
[masl],[money] Tactical maximum volume constraint.
- Type:
PenaltyConstraint
- property min
[masl],[money] Tactical minimum volume constraint.
- Type:
PenaltyConstraint
- __init__()
Raises an exception This class cannot be instantiated from Python
- property max
[m3] Volume constraint maximum, time series.
- Type:
_ts
- property min
[m3] Volume constraint minimum, time series.
- Type:
_ts
- class Cost
Bases:
instance
- class CostCurve
Bases:
instance
- __init__()
Raises an exception This class cannot be instantiated from Python
- property curve
[m3],[money/m3] Volume cost curve.
- Type:
_t_xy_
- property penalty
[money] Volume penalty, time series.
- Type:
_ts
- __init__()
Raises an exception This class cannot be instantiated from Python
- property flood
Cost applied to volume.
- Type:
_CostCurve
- class Slack
Bases:
instance
- __init__()
Raises an exception This class cannot be instantiated from Python
- property lower
[m3] Lower volume slack
- Type:
_ts
- property upper
[m3] Upper volume slack
- Type:
_ts
- __init__()
Raises an exception This class cannot be instantiated from Python
- property constraint
Volume constraint attributes.
- Type:
- property penalty
[m3] Volume penalty, time series.
- Type:
_ts
- property realised
[m3] Historical volume, time series.
- Type:
_ts
- property result
[m3] Volume results, time series.
- Type:
_ts
- property schedule
[m3] Volume schedule, time series.
- Type:
_ts
- property static_max
[m3] Maximum regulated volume, time-dependent attribute.
- Type:
_ts
- class WaterValue
Bases:
instance
- class Result
Bases:
instance
- __init__()
Raises an exception This class cannot be instantiated from Python
- property end_value
[money] Resulting water-value at the endpoint.
- Type:
_ts
- property global_volume
[money/m3] Resulting water-value.
- Type:
_ts
- property local_energy
[money/joule] Resulting water-value.
- Type:
_ts
- property local_volume
[money/m3] Resulting water-value.
- Type:
_ts
- __init__()
Raises an exception This class cannot be instantiated from Python
- property endpoint_desc
[money/joule] Fixed water-value endpoint.
- Type:
_ts
- __init__((Reservoir)arg1, (object)uid, (object)name, (object)json, (HydroPowerSystem)hps) None :
Create reservoir with unique id and name for a hydro power system.
- property custom
Map keeping any_attr
- Type:
StringAnyAttrDict
- flattened_attributes((Reservoir)arg1) dict :
Flat dict containing all component attributes.
- get_tsm_object((Reservoir)self, (object)key) _ts :
Get a specific extra time series for this object.
The returned time series is wrapped in an object which exposes method for retrieving url etc.
- Parameters:
key (str) – The key in the tsm of the time series to get.
- Raises:
runtime_error – If specified key does not exist.
- property level
Level attributes.
- Type:
_Level
- property tag
Url tag.
- Type:
str
- property ts
Map keeping any extra time series for this object.
- Type:
- property volume_level_mapping
Volume capacity description, time-dependent x=[masl], y=[m3].
- Type:
_t_xy_
- property water_value
water-value attributes.
- Type:
- class shyft.energy_market.stm.PowerPlant
Bases:
PowerPlant
A power plant keeping stm units.
After creating the units, create the power plant, and add the units to the power plant.
- class BestProfit
Bases:
instance
Describes the best profit (BP) curves of the power plant.
- __init__()
Raises an exception This class cannot be instantiated from Python
- property cost_average
Average production cost after changing the production of the plant from the current operating point to a new point in the best profit curve of the plant.
- Type:
_t_xy_
- property cost_commitment
Sum of startup costs or shutdown costs after changing the production of the plant from the current operating point to a new point in the best profit curve of the plant.
- Type:
_t_xy_
- property cost_marginal
Marginal production cost after changing the production of the plant from the current operating point to a new point in the best profit curve of the plant.
- Type:
_t_xy_
- property discharge
Plant discharge after changing the production of the plant from the current operating point to a new point in the best profit curve of the plant.
- Type:
_t_xy_
- property dynamic_water_value
Flag determining whether water values in the best profit calculation should be based on dynamic results per time step from the optimization or the static end value description.
- Type:
_ts
- class Discharge
Bases:
instance
- __init__()
Raises an exception This class cannot be instantiated from Python
- property constraint_max
[m3/s] Discharge maximum restriction, time series.
- Type:
_ts
- property constraint_min
[m3/s] Discharge minimum restriction, time series.
- Type:
_ts
- property downstream_level_constraint
Max discharge limited by downstream water level.
- Type:
_t_xy_
- property intake_loss_from_bypass_flag
Headloss of intake affected by bypass discharge.
- Type:
_ts
- property ramping_down
[m3/s] Constraint on decreasing discharge, time-dependent attribute.
- Type:
_ts
- property ramping_up
[m3/s] Constraint on increasing discharge, time-dependent attribute.
- Type:
_ts
- property realised
[m3/s] Discharge realised, usually related/or defined as unit.discharge.realised.
- Type:
_ts
- property result
[m3/s] Discharge result, time series.
- Type:
_ts
- property schedule
[m3/s] Discharge schedule, time series.
- Type:
_ts
- property upstream_level_constraint
Max discharge limited by upstream water level.
- Type:
_t_xy_
- class Fees
Bases:
instance
Describes other costs when producing.
- __init__()
Raises an exception This class cannot be instantiated from Python
- property feeding_fee
Use nan for periods that should have no fee.
- Type:
_ts
- Type:
Extra cost for feeding electricity into the grid. The feeding fee is added as an extra production cost in the objective function. Tip
- class Production
Bases:
instance
- __init__()
Raises an exception This class cannot be instantiated from Python
- property constraint_max
[W] Production maximum restriction, time series.
- Type:
_ts
- property constraint_min
[W] Production minimum restriction, time series.
- Type:
_ts
- property instant_max
[W] Computed instant max production for the rotating units
- Type:
_ts
- property merge_tolerance
[W] Max deviation in production, time-dependent attribute.
- Type:
_ts
- property ramping_down
[W] Constraint on decreasing production, time-dependent attribute.
- Type:
_ts
- property ramping_up
[W] Constraint on increasing production, time-dependent attribute.
- Type:
_ts
- property realised
[W] Production realised, usually related to sum of unit.production.realised.
- Type:
_ts
- property result
[W] Production result, time series.
- Type:
_ts
- property schedule
[W] Production schedule, time series.
- Type:
_ts
- __init__((PowerPlant)arg1, (object)uid, (object)name, (object)json, (HydroPowerSystem)hps) None :
Create power plant with unique id and name for a hydro power system.
- add_unit((PowerPlant)self, (Unit)unit) None :
Add unit to plant.
- property best_profit
BP curves.
- Type:
- property custom
Map keeping any_attr
- Type:
StringAnyAttrDict
- flattened_attributes((PowerPlant)arg1) dict :
Flat dict containing all component attributes.
- get_tsm_object((PowerPlant)self, (object)key) _ts :
Get a specific extra time series for this object.
The returned time series is wrapped in an object which exposes method for retrieving url etc.
- Parameters:
key (str) – The key in the tsm of the time series to get.
- Raises:
runtime_error – If specified key does not exist.
- property gross_head
[masl]Gross head, time-dependent attribute.
- Type:
_ts
- property mip
Mip flag.
- Type:
_ts
- property outlet_level
[masl] Outlet level, time-dependent attribute.
- Type:
_ts
- property production
Production attributes.
- Type:
- property tag
Url tag.
- Type:
str
- property ts
Map keeping any extra time series for this object.
- Type:
Unavailability, time series.
- Type:
_ts
- class shyft.energy_market.stm.Gate
Bases:
Gate
Stm gate.
- class Discharge
Bases:
instance
- class Constraints
Bases:
instance
- __init__()
Raises an exception This class cannot be instantiated from Python
- property max
[masl] Discharge constraint maximum, time series.
- Type:
_ts
- property min
[masl] Discharge constraint minimum, time series.
- Type:
_ts
- __init__()
Raises an exception This class cannot be instantiated from Python
- property constraint
Discharge constraint attributes.
- Type:
- property merge_tolerance
[m3/s] Maximum deviation in discharge between two timesteps.
- Type:
_ts
- property realised
[m3/s] Historical discharge restriction.
- Type:
_ts
- property result
[m3/s] Discharge result.
- Type:
_ts
- property schedule
[m3/s] Discharge schedule restriction.
- Type:
_ts
- property static_max
[m3/s] Maximum discharge.
- Type:
_ts
- class Opening
Bases:
instance
- class Constraints
Bases:
instance
- __init__()
Raises an exception This class cannot be instantiated from Python
- property continuous
Flag determining whether the gate can be set to anything between predefined positions, time-dependent attribute.
- Type:
_ts
- property positions
Predefined gate positions mapped to gate opening.
- Type:
_t_xy_
- __init__()
Raises an exception This class cannot be instantiated from Python
- property constraint
Opening constraint attributes.
- Type:
- property realised
Historical opening schedule, value between 0.0 and 1.0.
- Type:
_ts
- property result
Result opening schedule, value between 0.0 and 1.0.
- Type:
_ts
- property schedule
Planned opening schedule, value between 0.0 and 1.0.
- Type:
_ts
- __init__()
Raises an exception This class cannot be instantiated from Python
- property cost
Gate adjustment cost, time series.
- Type:
_ts
- property custom
Map keeping any_attr
- Type:
StringAnyAttrDict
- flattened_attributes((Gate)arg1) dict :
Flat dict containing all component attributes.
- property flow_description
Gate flow description. Flow [m^3/s] as a function of water level [m] for relative gate opening [%].
- Type:
_t_xy_z_list
- property flow_description_delta_h
Gate flow description. Flow [m^3/s] as a function of water level difference [m] for relative gate opening [%].
- Type:
_t_xy_z_list
- get_tsm_object((Gate)self, (object)key) _ts :
Get a specific extra time series for this object.
The returned time series is wrapped in an object which exposes method for retrieving url etc.
- Parameters:
key (str) – The key in the tsm of the time series to get.
- Raises:
runtime_error – If specified key does not exist.
- property tag
Url tag.
- Type:
str
- property ts
Map keeping any extra time series for this object.
- Type:
- class shyft.energy_market.stm.Waterway
Bases:
Waterway
Stm waterway.
- class Discharge
Bases:
instance
- class Constraints
Bases:
instance
The constraints for a waterway, provide means of controlling the flow, change of flow, or even accumulated volume of flow.
- __init__()
Raises an exception This class cannot be instantiated from Python
- property accumulated_max
[m3] allowed accumulated positive deviation volume, actual vs .reference. If set to nan at a timestep, the accumulator is reset to 0 starting from that timestep.
- Type:
_ts
- property accumulated_min
[m3] allowed accumulated negative deviation volume, actual vs .reference. If set to nan at a timestep, the accumulator is reset to 0 starting from that timestep.
- Type:
_ts
- property max
[m3/s] Discharge constraint max flow.
- Type:
_ts
- property max_average
[s][m3/s] maximum average discharge on waterway as a function of duration in seconds.
- Type:
_t_xy
- property min
[m3/s] Discharge constraint min flow.
- Type:
_ts
- property min_average
[s][m3/s] minimum average discharge on waterway as a function of duration in seconds.
- Type:
_t_xy
- property ramping_down
[m3/s] Discharge constraint ramping_down.
- Type:
_ts
- property ramping_up
[m3/s] Discharge constraint ramping_up.
- Type:
_ts
- class Penalties
Bases:
instance
- class Costs
Bases:
instance
- __init__()
Raises an exception This class cannot be instantiated from Python
- property accumulated_max
[money/m3] Penalty cost constraint accumulated_max.
- Type:
_ts
- property accumulated_min
[money/m3] Penalty cost accumulated_min.
- Type:
_ts
- property constraint_max
[m3/s] Penalty cost constraint_max.
- Type:
_ts
- property constraint_min
[m3/s] Penalty cost constraint_min.
- Type:
_ts
- property max_average
[(money/h)/(m3/s)] Penalty cost for constraint max_average_discharge.
- Type:
_ts
- property min_average
[(money/h)/(m3/s)] Penalty cost for constraint min_average_discharge.
- Type:
_ts
- property peak_curve
[m3/s][nok/m3/s] Cost of peak flow curve.
- Type:
_t_xy
- property ramping_down
[m3/s] Penalty cost ramping_down.
- Type:
_ts
- property ramping_up
[m3/s] Penalty cost ramping_up.
- Type:
_ts
- property rate
[money/(m3/s)] Penalty cost for rate of discharge.
- Type:
_ts
- class Results
Bases:
instance
- __init__()
Raises an exception This class cannot be instantiated from Python
- property accumulated_max
[money] Resulting penalty for violating accumulated_max.
- Type:
_ts
- property accumulated_min
[money] Resulting penalty for violating accumulated_min,
- Type:
_ts
- property constraint_max
[money] Resulting penalty for violating max constraint.
- Type:
_ts
- property constraint_min
[money] Resulting penalty for violating min constraint.
- Type:
_ts
- property ramping_down
[money] Resulting penalty for violating ramping down constraint.
- property ramping_up
[money] Resulting penalty for violating ramping up constraint.
- Type:
_ts
- property rate
[money] Resulting penalty for discharge.
- Type:
_ts
- __init__()
Raises an exception This class cannot be instantiated from Python
- __init__()
Raises an exception This class cannot be instantiated from Python
- property constraint
Discharge constraint attributes
- Type:
- property realised
[m3/s] Discharge realised. - as in historical fact. For the case of constraint, used to establish initial accumulated deviation at the start of the optimisation period.
- Type:
_ts
- property reference
[m3/s] Discharge reference. Used as reference for the constraint criteria (might be different from .schedule).
- Type:
_ts
- property result
[m3/s] Discharge result. As computed by optimization/simulation process.
- Type:
_ts
- property schedule
[m3/s] Discharge schedule. As in wanted scheduled flow.
- Type:
_ts
- property static_max
[m3/s] Discharge maximum, time-dependent attribute, bi-directional value.
- Type:
_ts
- class FlowDescription
Bases:
instance
- class DeltaMeter
Bases:
instance
Delta meter flow description of the waterway.
- __init__()
Raises an exception This class cannot be instantiated from Python
- property downstream_ref
x=difference between up- and downstream level [m], y=flow [m3/s]. z=downstream level [masl]
- Type:
_t_xy_z_list
- property upstream_ref
x=difference between up- and downstream level [m], y=flow [m3/s]. z=upstream level [masl]
- Type:
_t_xy_z_list
- __init__()
Raises an exception This class cannot be instantiated from Python
- property delta_meter
Delta meter description.
- Type:
- property upstream_ref
[m3/s] Discharge constraint min flow.
- Type:
_ts
- class Geometry
Bases:
instance
- __init__()
Raises an exception This class cannot be instantiated from Python
- property diameter
[m] Tunnel diameter, time-dependent attribute.
- Type:
_ts
- property length
[m] Tunnel length, time-dependent attribute.
- Type:
_ts
- property z0
[masl] Tunnel inlet level, time-dependent attribute.
- Type:
_ts
- property z1
[masl] Tunnel outlet level, time-dependent attribute.
- Type:
_ts
- __init__((Waterway)arg1, (object)uid, (object)name, (object)json, (HydroPowerSystem)hps) None :
Create waterway with unique id and name for a hydro power system.
- add_gate((Waterway)self, (object)uid, (object)name[, (object)json='']) Gate :
Create and add a new gate to the waterway.
- add_gate( (Waterway)self, (Gate)gate) -> Gate :
Add an existing gate to the waterway.
- property custom
Map keeping any_attr
- Type:
StringAnyAttrDict
- property delay
Time delay of flow.
- Type:
_t_xy_
- property deviation
Deviation attributes.
- Type:
_Deviation
- flattened_attributes((Waterway)arg1) dict :
Flat dict containing all component attributes.
- property flow_description
Flow describing attributes.
- Type:
- get_tsm_object((Waterway)self, (object)key) _ts :
Get a specific extra time series for this object.
The returned time series is wrapped in an object which exposes method for retrieving url etc.
- Parameters:
key (str) – The key in the tsm of the time series to get.
- Raises:
runtime_error – If specified key does not exist.
- property head_loss_coeff
Loss factor, time-dependent attribute.
- Type:
_ts
- property head_loss_func
Loss function, time-dependent attribute.
- Type:
_t_xy_z_list
- property tag
Url tag.
- Type:
str
- property ts
Map keeping any extra time series for this object.
- Type:
- class shyft.energy_market.stm.UnitGroupType
Bases:
enum
The unit-group type specifies the purpose of the group, and thus also how it is mapped to the optimization as constraint. E.g. operational reserve fcr_n.up. Current mapping to optimizer/shop:
FCR* : primary reserve, instant response, note, sensitivity set by droop settings on the unit
AFRR* : automatic frequency restoration reserve, ~ minute response
MFRR* : it is the manual frequency restoration reserve, ~ 15 minute response
FFR : NOT MAPPED, fast frequency restoration reserve, 49.5..49.7 Hz, ~ 1..2 sec response
RR* : NOT MAPPED, replacement reserve, 40..60 min response
COMMIT : currently not mapped
PRODUCTION : used for energy market area unit groups
- AFRR_DOWN = shyft.energy_market.stm._stm.UnitGroupType.AFRR_DOWN
- AFRR_UP = shyft.energy_market.stm._stm.UnitGroupType.AFRR_UP
- COMMIT = shyft.energy_market.stm._stm.UnitGroupType.COMMIT
- FCR_D_DOWN = shyft.energy_market.stm._stm.UnitGroupType.FCR_D_DOWN
- FCR_D_UP = shyft.energy_market.stm._stm.UnitGroupType.FCR_D_UP
- FCR_N_DOWN = shyft.energy_market.stm._stm.UnitGroupType.FCR_N_DOWN
- FCR_N_UP = shyft.energy_market.stm._stm.UnitGroupType.FCR_N_UP
- FFR = shyft.energy_market.stm._stm.UnitGroupType.FFR
- MFRR_DOWN = shyft.energy_market.stm._stm.UnitGroupType.MFRR_DOWN
- MFRR_UP = shyft.energy_market.stm._stm.UnitGroupType.MFRR_UP
- PRODUCTION = shyft.energy_market.stm._stm.UnitGroupType.PRODUCTION
- RR_DOWN = shyft.energy_market.stm._stm.UnitGroupType.RR_DOWN
- RR_UP = shyft.energy_market.stm._stm.UnitGroupType.RR_UP
- UNSPECIFIED = shyft.energy_market.stm._stm.UnitGroupType.UNSPECIFIED
- names = {'AFRR_DOWN': shyft.energy_market.stm._stm.UnitGroupType.AFRR_DOWN, 'AFRR_UP': shyft.energy_market.stm._stm.UnitGroupType.AFRR_UP, 'COMMIT': shyft.energy_market.stm._stm.UnitGroupType.COMMIT, 'FCR_D_DOWN': shyft.energy_market.stm._stm.UnitGroupType.FCR_D_DOWN, 'FCR_D_UP': shyft.energy_market.stm._stm.UnitGroupType.FCR_D_UP, 'FCR_N_DOWN': shyft.energy_market.stm._stm.UnitGroupType.FCR_N_DOWN, 'FCR_N_UP': shyft.energy_market.stm._stm.UnitGroupType.FCR_N_UP, 'FFR': shyft.energy_market.stm._stm.UnitGroupType.FFR, 'MFRR_DOWN': shyft.energy_market.stm._stm.UnitGroupType.MFRR_DOWN, 'MFRR_UP': shyft.energy_market.stm._stm.UnitGroupType.MFRR_UP, 'PRODUCTION': shyft.energy_market.stm._stm.UnitGroupType.PRODUCTION, 'RR_DOWN': shyft.energy_market.stm._stm.UnitGroupType.RR_DOWN, 'RR_UP': shyft.energy_market.stm._stm.UnitGroupType.RR_UP, 'UNSPECIFIED': shyft.energy_market.stm._stm.UnitGroupType.UNSPECIFIED}
- values = {0: shyft.energy_market.stm._stm.UnitGroupType.UNSPECIFIED, 1: shyft.energy_market.stm._stm.UnitGroupType.FCR_N_UP, 2: shyft.energy_market.stm._stm.UnitGroupType.FCR_N_DOWN, 3: shyft.energy_market.stm._stm.UnitGroupType.FCR_D_UP, 4: shyft.energy_market.stm._stm.UnitGroupType.FCR_D_DOWN, 5: shyft.energy_market.stm._stm.UnitGroupType.AFRR_UP, 6: shyft.energy_market.stm._stm.UnitGroupType.AFRR_DOWN, 7: shyft.energy_market.stm._stm.UnitGroupType.MFRR_UP, 8: shyft.energy_market.stm._stm.UnitGroupType.MFRR_DOWN, 9: shyft.energy_market.stm._stm.UnitGroupType.FFR, 10: shyft.energy_market.stm._stm.UnitGroupType.RR_UP, 11: shyft.energy_market.stm._stm.UnitGroupType.RR_DOWN, 12: shyft.energy_market.stm._stm.UnitGroupType.COMMIT, 13: shyft.energy_market.stm._stm.UnitGroupType.PRODUCTION}
- class shyft.energy_market.stm.UnitGroup
Bases:
IdBase
A a group of Units, with constraints applicable to the sum of the unit-features (production, flow…), that the optimization can take into account.
- class Delivery
Bases:
instance
This describes the sum of product delivery aspects for the units.
- __init__()
Raises an exception This class cannot be instantiated from Python
- property realised
[product-unit] sum realised, as historical fact
- Type:
_ts
- property result
[product-unit] sum result
- Type:
_ts
- property schedule
[product-unit] sum schedule
- Type:
_ts
- class Member
Bases:
instance
A unit group member, refers to a specific unit along with the time-series that takes care of the temporal membership/contribution to the unit_group sum.
- __init__()
Raises an exception This class cannot be instantiated from Python
- property active
[unit-less] if available, this time-series is multiplied with the contribution from the unit.
- Type:
_ts
- class MemberList
Bases:
instance
A strongly typed list of UnitsGroup.Member.
- __init__((MemberList)arg1) None
- __init__( (object)arg1, (list)unit_group_members.) -> object :
Construct from list.
- append((MemberList)arg1, (object)arg2) None
- extend((MemberList)arg1, (object)arg2) None
- class Obligation
Bases:
instance
This describes the obligation aspects of the unit group that the members should satisfy.
- __init__()
Raises an exception This class cannot be instantiated from Python
- property cost
[money/W] the cost of not satisfying the schedule.
- Type:
_ts
- property penalty
[money] If target violated, the cost of the violation.
- Type:
_ts
- property result
[W] the resulting target/slack met after optimization.
- Type:
_ts
- property schedule
[W] schedule/target that should be met.
- Type:
_ts
- __init__()
Raises an exception This class cannot be instantiated from Python
- add_unit((UnitGroup)self, (Unit)unit, (TimeSeries)active) None :
Adds a unit to the group, maintaining any needed expressions.
- Parameters:
unit (Unit) – The unit to be added to the group (sum expressions automagically updated).
active (TimeSeries) – Determine the temporal group-member-ship, if empty Ts, then always member.
- property custom
Map keeping any_attr
- Type:
StringAnyAttrDict
- property delivery
Sum of product/obligation delivery schedule,result and realised for unit-members.
- Type:
- flattened_attributes((UnitGroup)arg1) dict :
Flat dict containing all component attributes.
- property flow
[m3/s] the sum resulting water flow for this unit-group.
- Type:
_ts
- get_tsm_object((UnitGroup)self, (object)key) _ts :
Get a specific extra time series for this object.
The returned time series is wrapped in an object which exposes method for retrieving url etc.
- Parameters:
key (str) – The key in the tsm of the time series to get.
- Raises:
runtime_error – If specified key does not exist.
- property group_type
Unit group-type, one of GroupType enum, fcr_n_up, fcr_n_down etc.
- Type:
unit_group_type
- property market_area
Getter market area.
- Type:
- property members
unit group members
- Type:
- property obj
python object
- Type:
object
- property obligation
Obligation schedule, cost, results and penalty.
- Type:
- property production
[W] the sum resulting production for this unit-group.
- Type:
_ts
- remove_unit((UnitGroup)self, (Unit)unit) None :
Remove a nunit from the group maintaining any needed expressions.
- Parameters:
unit (Unit) – The unit to be removed from the group (sum expressions automagically updated).
- property tag
Url tag.
- Type:
str
- property ts
Map keeping any extra time series for this object.
- Type:
- class shyft.energy_market.stm.t_xy
Bases:
instance
Time variable value-type.
Implemented as a sorted map of tuple (time,value) items.
You can assign/replace a new item using: >>> from shyft.energy_market.stm import t_xy >>> from shyft.energy_market.core import XyPointCurve,Point,PointList >>> m = t_xy() # create a time-dependent map-type >>> pts = XyPointCurve(PointList([Point(0.0, 1000.0), Point(1200.0, 2000.0)])) >>> m[time(‘2018-01-01T00:00:00Z’)] = pts
And iterate over the tuple like this: >>> for i in m: >>> print(i.key(),i.data())
To make a copy of a time-dependent variable, use: >>> m_clone=t_double_(m) # pass in the object to clone in the constructor
- __call__((t_xy)self, (time)time) XyPointCurve :
Find value for a given time.
- __init__((t_xy)arg1) None
- __init__( (t_xy)arg1, (t_xy)clone) -> None :
create a copy of the object to clone
- class shyft.energy_market.stm.t_turbine_description
Bases:
instance
Time variable value-type.
Implemented as a sorted map of tuple (time,value) items.
You can assign/replace a new item using: >>> from shyft.energy_market.stm import t_xy >>> from shyft.energy_market.core import XyPointCurve,Point,PointList >>> m = t_xy() # create a time-dependent map-type >>> pts = XyPointCurve(PointList([Point(0.0, 1000.0), Point(1200.0, 2000.0)])) >>> m[time(‘2018-01-01T00:00:00Z’)] = pts
And iterate over the tuple like this: >>> for i in m: >>> print(i.key(),i.data())
To make a copy of a time-dependent variable, use: >>> m_clone=t_double_(m) # pass in the object to clone in the constructor
- __call__((t_turbine_description)self, (time)time) TurbineDescription :
Find value for a given time.
- __init__((t_turbine_description)arg1) None
- __init__( (t_turbine_description)arg1, (t_turbine_description)clone) -> None :
create a copy of the object to clone
- class shyft.energy_market.stm.MessageList
Bases:
instance
A strongly typed list of str.
- __init__((MessageList)arg1) None
- __init__( (object)arg1, (list)messages) -> object :
Construct from list of messages.
- append((MessageList)arg1, (object)arg2) None
- property exists
true if any messages
- Type:
bool
- extend((MessageList)arg1, (object)arg2) None
- class shyft.energy_market.stm.t_xyz_list
Bases:
instance
Time variable value-type.
Implemented as a sorted map of tuple (time,value) items.
You can assign/replace a new item using: >>> from shyft.energy_market.stm import t_xy >>> from shyft.energy_market.core import XyPointCurve,Point,PointList >>> m = t_xy() # create a time-dependent map-type >>> pts = XyPointCurve(PointList([Point(0.0, 1000.0), Point(1200.0, 2000.0)])) >>> m[time(‘2018-01-01T00:00:00Z’)] = pts
And iterate over the tuple like this: >>> for i in m: >>> print(i.key(),i.data())
To make a copy of a time-dependent variable, use: >>> m_clone=t_double_(m) # pass in the object to clone in the constructor
- __call__((t_xyz_list)self, (time)time) XyPointCurveWithZList :
Find value for a given time.
- __init__((t_xyz_list)arg1) None
- __init__( (t_xyz_list)arg1, (t_xyz_list)clone) -> None :
create a copy of the object to clone
- class shyft.energy_market.stm.t_xyz
Bases:
instance
Time variable value-type.
Implemented as a sorted map of tuple (time,value) items.
You can assign/replace a new item using: >>> from shyft.energy_market.stm import t_xy >>> from shyft.energy_market.core import XyPointCurve,Point,PointList >>> m = t_xy() # create a time-dependent map-type >>> pts = XyPointCurve(PointList([Point(0.0, 1000.0), Point(1200.0, 2000.0)])) >>> m[time(‘2018-01-01T00:00:00Z’)] = pts
And iterate over the tuple like this: >>> for i in m: >>> print(i.key(),i.data())
To make a copy of a time-dependent variable, use: >>> m_clone=t_double_(m) # pass in the object to clone in the constructor
- __call__((t_xyz)self, (time)time) XyPointCurveWithZ :
Find value for a given time.
- __init__((t_xyz)arg1) None
- __init__( (t_xyz)arg1, (t_xyz)clone) -> None :
create a copy of the object to clone
- class shyft.energy_market.stm.DStmClient
Bases:
instance
Client side for the DStmServer
Takes care of message exchange to the remote server, using the supplied parameters. It implements the message protocol of the server, sending message-prefix, arguments, waiting for the response, deserialize the response and handle it back to the user.
See also
DStmServer
- __init__((DStmClient)self, (object)host_port, (object)timeout_ms) None
- add_compute_server((DStmClient)self, (object)host_port) bool :
add a compute node specified by it’s address string of form host:port
- Parameters:
host_port (str) – the address of the dstm compute node service in the form of host:port
- add_model((DStmClient)self, (object)mid, (StmSystem)mdl) bool :
Add model to server
- Parameters:
mid (str) – ID/key to store model as.
mdl (StmSystem) – STM System to store in key ‘mid’
- Returns:
success. Returns True on success
- Return type:
bool
- clone_model((DStmClient)self, (object)old_mid, (object)new_mid[, (object)fast=False]) bool :
Clone existing model with ID.
- Parameters:
old_mid (str) – ID of model to clone
new_mid (str) – ID to store cloned model against
fast (bool) – Stips model of expressions if true, increases speed.
- Returns:
success. Returns True on success
- Return type:
bool
- close((DStmClient)self) None :
Close the connection. It will automatically reopen if needed.
- compute_server_status((DStmClient)self) list :
Get status of managed compute servers
- Returns:
status. status of managed compute servers.
- Return type:
List[ComputeServerStatus]
- create_model((DStmClient)self, (object)mid) bool :
Create an empty model and store it server side.
- Parameters:
mid (str) – ID of new model
- Returns:
success. Returns true on success
- Return type:
bool
- evaluate_model((DStmClient)self, (object)mid, (UtcPeriod)bind_period[, (object)use_ts_cached_read=True[, (object)update_ts_cache=False[, (UtcPeriod)clip_period=[not-valid-period>]]]) bool :
Evaluate any unbound time series attributes of a model
- Parameters:
mid (str) – ID of model to evaluate
bind_period (UtcPeriod) – Period for bind in evaluate.
use_ts_cached_read (bool) – allow use of cached results. Use it for immutable data reads!
update_ts_cache (bool) – when reading time-series, also update the cache with the data. Use it for immutable data reads!
clip_period (UtcPeriod) – Period for clip in evaluate.
See also
UtcPeriod
- Returns:
bound. Returns whether any of the model’s attributes had to be bound.
- Return type:
bool
- evaluate_ts((DStmClient)self, (TsVector)tsv, (UtcPeriod)bind_period[, (object)use_ts_cached_read=True[, (object)update_ts_cache=False[, (UtcPeriod)clip_period=[not-valid-period>]]]) list :
Evaluate any time series expressions If an expression can not be evaluated, TsEvaluationError is returned in place of the ts.
- Parameters:
tsv (TsVector) – Timeseries to evaluate
bind_period (UtcPeriod) – Period for bind in evaluate.
use_ts_cached_read (bool) – allow use of cached results. Use it for immutable data reads!
update_ts_cache (bool) – when reading time-series, also update the cache with the data. Use it for immutable data reads!
clip_period (UtcPeriod) – Period for clip in evaluate.
See also
UtcPeriod
- Returns:
result. Returns the evaluated timeseries or an evaluation error.
- Return type:
list
- fx((DStmClient)self, (object)mid, (object)fx_arg) bool :
Execute the serverside fx, passing supplied arguments
- Parameters:
mid (str) – ID of model for the server-side fx
fx_arg (str) – any argument passed to the server-side fx
- Returns:
success. true if call successfully done
- Return type:
bool
- get_attrs((DStmClient)self, (StringVector)urls) list :
Get a list of attributes specified by url. If an url is unable to be resolved UrlResolveError is returned in place of the attribute.
- Parameters:
urls (list) – list of dstm attribute urls.
- Returns:
attrs. list of dstm attributes.
- Return type:
list
- get_log((DStmClient)self, (object)mid) LogEntryList :
Get log for a model
- Parameters:
mid (str) – ID of model to get log for
- Returns:
entries. List of log entries
- Return type:
ShopLogEntryList
- get_model((DStmClient)self, (object)mid) StmSystem :
Get a stored model by ID
- Parameters:
mid (str) – ID of model to get
- Returns:
Requested model
- Return type:
- get_model_ids((DStmClient)self) StringVector :
Get IDs of all models stored
- Returns:
id_list. List of model IDs
- Return type:
List[str]
- get_model_infos((DStmClient)self) ModelInfoDict :
Get model infos of all models stored
- Returns:
mi_list. Dict of (ModelKey, ModelInfo) for each model stored.
- Return type:
ModelInfoList
See also
shyft.energy_market.core.ModelInfo
- get_optimization_summary((DStmClient)self, (object)mid) _OptimizationSummary :
Get the optimization summary of a model by ID
- Parameters:
mid (str) – ID of model to get state of
- Returns:
summary. The summary of last successful optimization. Values will be nan if not available
- get_server_version((DStmClient)self) str :
Get version of remote server.
- Returns:
version. Server version string
- Return type:
str
- get_state((DStmClient)self, (object)mid) ModelState :
Get the state of a model by ID
- Parameters:
mid (str) – ID of model to get state of
- Returns:
state. State of requested model
- Return type:
- get_ts((DStmClient)self, (object)mid, (StringVector)ts_urls) TsVector :
Get the time-series from the model mid, as specified by ts_urls
- Parameters:
mid (str) – ID of model
ts_urls (StringVector) – Strongly typed list of strings, urls, like dstm://Mmid/..
- Returns:
time-series. list of time-series as specifed by the list of ts_urls, same order
- Return type:
- property host_port
Endpoint network address of the remote server.
- Type:
str
- property is_open
If the connection to the remote server is (still) open.
- Type:
bool
- kill_optimization((DStmClient)self, (object)mid) bool :
Request to kill a running optimization for a model by ID
- Parameters:
mid (str) – ID of model to get state of
- Returns:
success. true if the server-side accepted the kill signal (optimization was running)
- Return type:
bool
- optimize((DStmClient)self, (object)mid, (TimeAxis)ta, (ShopCommandList)cmd[, (object)compute_node_mode=False]) bool :
Run optimization on a model
- Parameters:
mid (str) – ID of model to run optimization on
ta (TimeAxis) – Time span to run optimization over
cmd (List[ShopCommand]) – List of SHOP commands
compute_node_mode (bool) – default false, for compute nodes set to true to minimize work done after optimize
See also
ShopCommand
- Returns:
success. Stating whether optimization was started successfully or not.
- Return type:
bool
- patch((DStmClient)self, (object)mid, (StmPatchOperation)op, (StmSystem)p) bool :
Patch the model mid with patch p using operation op.
- Parameters:
mid (str) – ID of model
() (p) – Operation is one of ADD,REMOVE_RELATIONS,REMOVE_OBJECTS
() – The StmSystem describing the patch
- Returns:
ok. whether or not the model was reset.
- Return type:
bool
- property reconnect_count
Number of reconnects to the remote server that have been performed.
- Type:
int
- remove_model((DStmClient)self, (object)mid) bool :
Remove model by ID.
- Parameters:
mid (str) – ID of model to remove.
- Returns:
success. Returns True on success.
- Return type:
bool
- rename_model((DStmClient)self, (object)old_mid, (object)new_mid) bool :
Rename a model
- Parameters:
old_mid (str) – ID of model to rename
new_mid (str) – New ID of model
- Returns:
success. Returns True on success.
- Return type:
bool
- reset_model((DStmClient)self, (object)mid) bool :
Reset the model specified by mid.
- Parameters:
mid (str) – ID of model
- Returns:
ok. whether or not the model was reset.
- Return type:
bool
- set_attrs((DStmClient)self, (list)attrs) object :
Set a list of attributes specified by url. If anyone is subscribed on the attribute they are notified
- Parameters:
attrs (list) – list of pairs of dstm url and attribute.
- Returns:
attrs. list of None if successful or UrlResolveError if the attribute could not be set.
- Return type:
list
- set_ts((DStmClient)self, (object)mid, (TsVector)tsv) None :
Set the time-series in the model mid, as specified by ts_urls in the tsv. If anyone is subscribers on time-series, or expressions affected, they are notified
- Parameters:
mid (str) – ID of model
tsv (TsVector) – list of TimeSeries(ts_url,ts_with_values) ,ts_url, like dstm://Mmid/..
- start_tune((DStmClient)self, (object)mid) bool :
Start tuning a model
- Parameters:
mid (str) – ID of model to run optimization on
- Returns:
success. Stating tuning was started successfully or not.
- Return type:
bool
- stop_tune((DStmClient)self, (object)mid) bool :
Stop tuning a model
- Parameters:
mid (str) – ID of model to run optimization on
- Returns:
success. Stating tuning was stopped successfully or not.
- Return type:
bool
- property timeout_ms
Timout for remote server operations, in number milliseconds.
- Type:
int
- tune((DStmClient)self, (object)mid, (TimeAxis)ta, (ShopCommandList)cmd) bool :
Run tuning optimization on a model
- Parameters:
mid (str) – ID of model to run optimization on
ta (TimeAxis) – Time span to run optimization over
cmd (List[ShopCommand]) – List of SHOP commands
See also
ShopCommand
- Returns:
success. Stating whether tuning optimization was started successfully or not.
- Return type:
bool
- class shyft.energy_market.stm.DStmServer
Bases:
instance
A server object serving distributed, ‘live’ STM systems. The server contains an DTSS that handles time series for the models stored in the server.
- __init__((DStmServer)arg1) None
__init__( (DStmServer)arg1 [, (JanitorConfig)j_config=<shyft.energy_market.stm._stm.JanitorConfig object at 0x7eb501140c80>]) -> None
- add_compute_server((DStmServer)self, (object)host_port) bool :
add a compute node specified by it’s address string of form host:port
- Parameters:
host_port (str) – the address of the dstm compute node service in the form of host:port
- add_container((DStmServer)self, (object)container_name, (object)root_dir) None :
Add a container to the server’s DTSS.
- Parameters:
container_name (str) – name of container to create.
root_dir (str) – Directory where container’s time series are stored.
- Returns:
nothing.
- Return type:
None
- apply((DStmServer)self, (object)mid, (object)action) object :
Apply an action to a model.
The action gets exclusive access to the model when applied. Take care not to return something owned by the model itself, as exclusive access will be lost on return
- Parameters:
mid (str) – ID of model
action (Callable[[StmSystem],object]) – function to apply to model
- Returns:
obj. Object returned by the action
- Return type:
object
- property cache_max_items
internal dtss cache_max_items is the maximum number of time-series identities that are kept in memory. Elements exceeding this capacity is elided using the least-recently-used algorithm. Notice that assigning a lower value than the existing value will also flush out time-series from cache in the least recently used order.
- Type:
int
- property cache_memory_target
The internal dtss servere memory max target in number of bytes. If not set directly the following equation is use: cache_memory_target = cache_ts_initial_size_estimate * cache_max_items When setting the target directly, number of items in the chache is set so that real memory usage is less than the specified target. The setter could cause elements to be flushed out of cache.
- Type:
int
- property cache_stats
the internal dtss current cache statistics
- Type:
- property cache_ts_initial_size_estimate
The internal dtss initial time-series size estimate in bytes for the cache mechanism. memory-target = cache_ts_initial_size_estimate * cache_max_items algorithm. Notice that assigning a lower value than the existing value will also flush out time-series from cache in the least recently used order.
- Type:
int
- clear_cache_stats((DStmServer)self) None :
clear accumulated cache_stats of the internal dtss server
- close((DStmServer)self) None :
close and stop serving requests on the hpc binary socket interface
- do_add_model((DStmServer)self, (object)mid, (StmSystem)mdl) bool :
Add model to server
- Parameters:
mid (str) – ID/key to store model as.
mdl (StmSystem) – STM System to store in key ‘mid’
- Returns:
success. Returns True on success
- Return type:
bool
- Raises:
RuntimeError – If ‘mid’ is already an ID of a model.
- do_clone_model((DStmServer)self, (object)old_mid, (object)new_mid[, (object)fast=False]) bool :
Clone existing model with ID.
- Parameters:
old_mid (str) – ID of model to clone
new_mid (str) – ID to store cloned model against
fast (bool) – Stips model of expressions if true, increases speed.
- Returns:
success. Returns True on success
- Return type:
bool
- Raises:
RuntimeError – ‘new_mid’ already stores a model
RuntimeError – ‘old_mid’ doesn’t store a model to clone
- do_create_model((DStmServer)self, (object)mid) bool :
Create a new model
- Parameters:
mid (str) – ID of new model
- Returns:
Empty model with ID set to ‘mid’
- Return type:
- Raises:
RuntimeError – If ‘mid’ already is ID of a model
- do_evaluate_model((DStmServer)self, (object)mid, (UtcPeriod)bind_period[, (object)use_ts_cached_read=True[, (object)update_ts_cache=False[, (UtcPeriod)clip_period=[not-valid-period>]]]) bool :
Evaluate any unbound time series attributes of a model
- Parameters:
mid (str) – ID of model to evaluate
bind_period (UtcPeriod) – Period for bind in evaluate.
use_ts_cached_read (bool) – allow use of cached results. Use it for immutable data reads!
update_ts_cache (bool) – when reading time-series, also update the cache with the data. Use it for immutable data reads!
clip_period (UtcPeriod) – Period for clip in evaluate.
See also
UtcPeriod
- Returns:
bound. Returns whether any of the model’s attributes had to be bound.
- Return type:
bool
- do_get_model_ids((DStmServer)self) StringVector :
Get IDs of all models stored
- Returns:
id_list. List of model IDs
- Return type:
List[str]
- do_get_model_infos((DStmServer)self) ModelInfoDict :
Get model infos of all models stored
- Returns:
mi_list. Dict of (ModelKey, ModelInfo) for each model stored.
- Return type:
ModelInfoList
See also
shyft.energy_market.core.ModelInfo
- do_get_state((DStmServer)self, (object)mid) ModelState :
Get state of stored model by ID
- Parameters:
mid (str) – ID of model to get state of
- Returns:
state. State of requested model
- Return type:
- Raises:
RuntimeError – Unable to find model with ID ‘mid’
- do_get_version_info((DStmServer)self) str :
returns the version number of the StsServer
- do_optimize((DStmServer)self, (object)mid, (TimeAxis)ta, (ShopCommandList)cmd[, (object)compute_node_mode=False]) bool :
Run SHOP optimization on a model
- Parameters:
mid (str) – ID of model to run optimization on
ta (TimeAxis) – Time span to run optimization over
cmd (List[ShopCommand]) – List of SHOP commands
compute_node_mode (bool) – default false, for compute nodes set to true to minimize work done after optimize
See also
ShopCommand
- Returns:
success. Stating whether optimization was started successfully or not.
- Return type:
bool
- do_remove_model((DStmServer)self, (object)mid) bool :
Remove model by ID.
- Parameters:
mid (str) – ID of model to remove.
- Returns:
success. Returns True on success.
- Return type:
bool
- Raises:
RuntimeError – If model with ID ‘mid’ does not exist.
- do_rename_model((DStmServer)self, (object)old_mid, (object)new_mid) bool :
Rename a model
- Parameters:
old_mid (str) – ID of model to rename
new_mid (str) – New ID of model
- Returns:
success. Returns True on success.
- Return type:
bool
- Raises:
RuntimeError – ‘new_mid’ already stores a model
RuntimeError – ‘old_mid’ doesn’t store a model to rename
- flush_cache((DStmServer)self, (StringVector)ts_ids) None :
flushes the specified ts_ids from cache Has only effect for ts-ids that are in cache, non-existing items are ignored
- Parameters:
ts_ids (StringVector) – a list of time-series ids to flush out
- flush_cache_all((DStmServer)self) None :
flushes all items out of internal dtss cache (cache_stats remain un-touched)
- property fx
server-side callable function(lambda) that takes two parameters: mid : the model id fx_arg: arbitrary string to pass to the server-side function The server-side fx is called when the client (or web-api) invokea the c.fx(mid,fx_arg). The signature of the callback function should be fx_cb(mid:str, fx_arg:str)->bool This feature is simply enabling the users to tailor server-side functionality in python! Examples:
>>> from shyft.energy_market.stm import DStmServer >>> s=DStmServer() >>> def my_fx(mid:str, fx_arg:str)->bool: >>> print(f'invoked with mid={mid} fx_arg={fx_arg}') >>> # note we can use captured Server s here!>>> return True >>> # and then bind the function to the callback >>> s.fx=my_fx >>> s.start_server() >>> : # later using client from anywhere to invoke the call >>> fx_result=c.fx('my_model_id', 'my_args')
- Type:
Callable[[str,str],bool]
- get_listening_ip((DStmServer)self) str :
return the ip adress the server is listening on for serving incoming requests
- get_listening_port((DStmServer)self) int :
returns the port number it’s listening at for serving incoming request
- get_web_api_ip((DStmServer)self) str :
Get listening IP for web API. Returns empty string if not running.
- get_web_api_port((DStmServer)self) int :
Get listening port for web API. Returns -1 if not running
- is_running((DStmServer)self) bool :
true if server is listening and running
See also
start_server()
- notify_change((DStmServer)self, (StringVector)urls) None :
Notify change on model urls, dstm://M…, so that changes are pushed to subscribers. In case the urls are wrong, misformed etc, there is no exception raised for that. It’s the callers responsibility entirely to provide valid URLs
- Parameters:
urls (StringVector) – List of valid model-urls as kept by this server
- set_listening_ip((DStmServer)self, (object)ip) None :
set the listening port for the service
- Parameters:
ip (str) – ip or host-name to start listening on
- Returns:
nothing.
- Return type:
None
- set_listening_port((DStmServer)self, (object)port_no) None :
set the listening port for the service
- Parameters:
port_no (int) – a valid and available tcp-ip port number to listen on.
20000 (typically it could be) –
- Returns:
nothing.
- Return type:
None
- set_master_slave_mode((DStmServer)self, (object)ip, (object)port, (object)master_poll_time, (int)unsubscribe_threshold, (object)unsubscribe_max_delay) None :
Set master-slave mode, redirecting all IO calls on this dtss to the master ip:port dtss. This instance of the dtss is kept in sync with changes done on the master using subscription to changes on the master Calculations, and caches are still done locally unloading the computational efforts from the master.
- Parameters:
ip (str) – The ip address where the master dtss is running
port (int) – The port number for the master dtss
master_poll_time (time) – [s] max time between each update from master, typicall 0.1 s is ok
unsubscribe_threshold (int) – minimum number of unsubscribed time-series before also unsubscribing from the master
unsubscribe_max_delay (time) – maximum time to delay unsubscriptions, regardless number
maximum time to wait for shared-lock on models when doing evaluate call(default 200 ms)
- start_server((DStmServer)arg1) int
- start_web_api((DStmServer)self, (object)host_ip, (object)port, (object)doc_root[, (object)fg_threads=2[, (object)bg_threads=4[, (object)tls_only=False]]]) None :
Start a web API for communicating with server
- Parameters:
host_ip (str) – 0.0.0.0 for any interface, 127.0.0.1 for local only, etc.
port (int) – port number to serve the web API on. Ensure it’s available!
doc_root (str) – directory from which we will serve http/https documents.
fg_threads (int) – number of web API foreground threads, typical 1-4 depending on load.
bg_threads (int) – number of long running background thread workers to serve requests etc.
tls_only (bool) – default false, set to true to enforce tls sessions only.
- stop_server((DStmServer)self[, (object)timeout=1000]) None :
stop serving connections, gracefully.
See also
start_server()
- stop_web_api((DStmServer)self) None :
Stops any ongoing web API service
- class shyft.energy_market.stm.HpsClient
Bases:
instance
The client api for the hydro-power-system repostory server.
- __init__((HpsClient)self, (object)host_port, (object)timeout_ms) None :
Creates a python client that can communicate with the corresponding server
- close((HpsClient)self) None :
Close the connection. It will automatically reopen if needed.
- get_model_infos((HpsClient)self, (IntVector)mids[, (UtcPeriod)created_in=[not-valid-period>]) ModelInfoVector :
returns all or selected model-info objects based on model-identifiers(mids)
- Parameters:
mids (IntVector) – empty = all, or a list of known exisiting model-identifiers
created_in (UtcPeriod) – For which period you are interested in model-infos.
- Returns:
model_infos. Strongly typed list of ModelInfo
- Return type:
- property host_port
Endpoint network address of the remote server.
- Type:
str
- property is_open
If the connection to the remote server is (still) open.
- Type:
bool
- read_model((HpsClient)self, (object)mid) HydroPowerSystem :
Read and return the model for specified model-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
The resulting model from the server
- Return type:
- read_models((HpsClient)self, (IntVector)mids) HydroPowerSystemList :
Read and return the model for specified model-identifier (mid)
- Parameters:
mids (Int64Vector) – A strongly typed list of ints, the model-identifers for the wanted models
- Returns:
The resulting model from the server
- Return type:
- property reconnect_count
Number of reconnects to the remote server that have been performed.
- Type:
int
- remove_model((HpsClient)self, (object)mid) int :
Remove the specified model bymodel-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
ec. 0 or error-code?
- Return type:
int
- store_model((HpsClient)self, (HydroPowerSystem)m, (ModelInfo)mi) int :
Store the model to backend, if m.id==0 then a new unique model-info is created and used
- property timeout_ms
Timout for remote server operations, in number milliseconds.
- Type:
int
- class shyft.energy_market.stm.HpsServer
Bases:
instance
The server-side component for the hydro-power-system model repository.
- __init__((HpsServer)self, (object)root_dir) None :
Creates a server object that serves models from root_dir. The root_dir will be create if it does not exsists.
- Parameters:
root_dir (str) – Path to the root-directory that keeps/will keep the model-files
- get_listening_port((HpsServer)self) int :
returns the port number it’s listening at for serving incoming request
- get_max_connections((HpsServer)self) int :
returns the maximum number of connections to be served concurrently
- is_running((HpsServer)self) bool :
true if server is listening and running
See also
start_server()
- set_listening_ip((HpsServer)self, (object)ip) None :
set the listening port for the service
- Parameters:
ip (str) – ip or host-name to start listening on
- Returns:
nothing.
- Return type:
None
- set_listening_port((HpsServer)self, (object)port_no) None :
set the listening port for the service
- Parameters:
port_no (int) – a valid and available tcp-ip port number to listen on.
20000 (typically it could be) –
- Returns:
nothing.
- Return type:
None
- set_max_connections((HpsServer)self, (object)max_connect) None :
limits simultaneous connections to the server (it’s multithreaded, and uses on thread pr. connect)
- Parameters:
max_connect (int) – maximum number of connections before denying more connections
See also
get_max_connections()
- start_server((HpsServer)self) int :
start server listening in background, and processing messages
See also
set_listening_port(port_no),is_running
- Returns:
port_no. the port used for listening operations, either the value as by set_listening_port, or if it was unspecified, a new available port
- Return type:
in
- stop_server((HpsServer)self[, (object)timeout=1000]) None :
stop serving connections, gracefully.
See also
start_server()
- class shyft.energy_market.stm.StmClient
Bases:
instance
The client api for the stm repository server.
- __init__((StmClient)self, (object)host_port, (object)timeout_ms) None :
Creates a python client that can communicate with the corresponding server
- close((StmClient)self) None :
Close the connection. It will automatically reopen if needed.
- get_model_infos((StmClient)self, (IntVector)mids[, (UtcPeriod)created_in=[not-valid-period>]) ModelInfoVector :
returns all or selected model-info objects based on model-identifiers(mids)
- Parameters:
mids (IntVector) – empty = all, or a list of known exisiting model-identifiers
created_in (UtcPeriod) – For which period you are interested in model-infos.
- Returns:
model_infos. Strongly typed list of ModelInfo
- Return type:
- property host_port
Endpoint network address of the remote server.
- Type:
str
- property is_open
If the connection to the remote server is (still) open.
- Type:
bool
- read_model((StmClient)self, (object)mid) StmSystem :
Read and return the model for specified model-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
The resulting model from the server
- Return type:
- read_models((StmClient)self, (IntVector)mids) StmSystemList :
Read and return the model for specified model-identifier (mid)
- Parameters:
mids (Int64Vector) – A strongly typed list of ints, the model-identifers for the wanted models
- Returns:
The resulting model from the server
- Return type:
- property reconnect_count
Number of reconnects to the remote server that have been performed.
- Type:
int
- remove_model((StmClient)self, (object)mid) int :
Remove the specified model bymodel-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
ec. 0 or error-code?
- Return type:
int
- store_model((StmClient)self, (StmSystem)m, (ModelInfo)mi) int :
Store the model to backend, if m.id==0 then a new unique model-info is created and used
- property timeout_ms
Timout for remote server operations, in number milliseconds.
- Type:
int
- class shyft.energy_market.stm.StmServer
Bases:
instance
The server-side component for the stm energy_market model repository.
- __init__((StmServer)self, (object)root_dir) None :
Creates a server object that serves models from root_dir. The root_dir will be create if it does not exsists.
- Parameters:
root_dir (str) – Path to the root-directory that keeps/will keep the model-files
- get_listening_port((StmServer)self) int :
returns the port number it’s listening at for serving incoming request
- get_max_connections((StmServer)self) int :
returns the maximum number of connections to be served concurrently
- is_running((StmServer)self) bool :
true if server is listening and running
See also
start_server()
- set_listening_ip((StmServer)self, (object)ip) None :
set the listening port for the service
- Parameters:
ip (str) – ip or host-name to start listening on
- Returns:
nothing.
- Return type:
None
- set_listening_port((StmServer)self, (object)port_no) None :
set the listening port for the service
- Parameters:
port_no (int) – a valid and available tcp-ip port number to listen on.
20000 (typically it could be) –
- Returns:
nothing.
- Return type:
None
- set_max_connections((StmServer)self, (object)max_connect) None :
limits simultaneous connections to the server (it’s multithreaded, and uses on thread pr. connect)
- Parameters:
max_connect (int) – maximum number of connections before denying more connections
See also
get_max_connections()
- start_server((StmServer)self) int :
start server listening in background, and processing messages
See also
set_listening_port(port_no),is_running
- Returns:
port_no. the port used for listening operations, either the value as by set_listening_port, or if it was unspecified, a new available port
- Return type:
in
- stop_server((StmServer)self[, (object)timeout=1000]) None :
stop serving connections, gracefully.
See also
start_server()
- class shyft.energy_market.stm.StmTaskServer
Bases:
instance
The server-side component for the STM Task repository.
- __init__((StmTaskServer)self, (object)root_dir) None :
Creates a server object that serves models from root_dir. The root_dir will be create if it does not exsists.
- Parameters:
root_dir (str) – Path to the root-directory that keeps/will keep the model-files
- add_auth_tokens((StmTaskServer)self, (StringVector)tokens) None :
Adds auth tokens, and activate authentication. The tokens is compared exactly to the autorization token passed in the request. Authorization should onlye be used for the https/wss, unless other measures(vpn/ssh tunnels etc.) are used to protect auth tokens on the wire
- Parameters:
() (tokens) – list of tokens, where each token is like Basic dXNlcjpwd2Q=, e.g: base64 user:pwd
- property auth_needed
returns true if the server is setup with auth-tokens, requires web-api clients to pass a valid token
- Type:
bool
- auth_tokens((StmTaskServer)self) StringVector :
returns the registered authentication tokens.
- property fx
server-side callable function(lambda) that takes two parameters: mid : the model id fx_arg: arbitrary string to pass to the server-side function The server-side fx is called when the client (or web-api) invoke the c.fx(mid,fx_arg). The signature of the callback function should be fx_cb(mid:str, fx_arg:str)->bool This feature is simply enabling the users to tailor server-side functionality in python!
Examples:
>>> from shyft.energy_market.stm import StmTaskServer >>> s=StmTaskServer() >>> def my_fx(mid:str, fx_arg:str)->bool: >>> print(f'invoked with mid={mid} fx_arg={fx_arg}') >>> # note we can use captured Server s here!>>> return True >>> # and then bind the function to the callback >>> s.fx=my_fx >>> s.start_server() >>> : # later using client from anywhere to invoke the call >>> fx_result=c.fx('my_model_id', 'my_args')
- Type:
Callable[[str,str],bool]
- get_listening_port((StmTaskServer)self) int :
returns the port number it’s listening at for serving incoming request
- get_max_connections((StmTaskServer)self) int :
returns the maximum number of connections to be served concurrently
- is_running((StmTaskServer)self) bool :
true if server is listening and running
See also
start_server()
- remove_auth_tokens((StmTaskServer)self, (StringVector)tokens) None :
removes auth tokens, if it matches all available tokens, then deactivate auth requirement for clients
- Parameters:
() (tokens) – list of tokens, where each token is like Basic dXNlcjpwd2Q=, e.g: base64 user:pwd
- set_listening_ip((StmTaskServer)self, (object)ip) None :
set the listening port for the service
- Parameters:
ip (str) – ip or host-name to start listening on
- Returns:
nothing.
- Return type:
None
- set_listening_port((StmTaskServer)self, (object)port_no) None :
set the listening port for the service
- Parameters:
port_no (int) – a valid and available tcp-ip port number to listen on.
20000 (typically it could be) –
- Returns:
nothing.
- Return type:
None
- set_max_connections((StmTaskServer)self, (object)max_connect) None :
limits simultaneous connections to the server (it’s multithreaded, and uses on thread pr. connect)
- Parameters:
max_connect (int) – maximum number of connections before denying more connections
See also
get_max_connections()
- start_server((StmTaskServer)self) int :
start server listening in background, and processing messages
See also
set_listening_port(port_no),is_running
- Returns:
port_no. the port used for listening operations, either the value as by set_listening_port, or if it was unspecified, a new available port
- Return type:
in
- start_web_api((StmTaskServer)self, (object)host_ip, (object)port, (object)doc_root[, (object)fg_threads=2[, (object)bg_threads=4[, (object)tls_only=False]]]) None :
Start a web API for communicating with server
- Parameters:
host_ip (str) – 0.0.0.0 for any interface, 127.0.0.1 for local only, &c.
port (int) – port number to serve the web API on. Ensure it’s available
doc_root (str) – directory form which we will serve http/https documents.
fg_threads (int) – number of web API foreground threads, typically 1-4 depending on load.
bg_threads (int) – number of long running background thread workers to serve requests &c.
tls_only (bool) – default false, set to true to enforce tls sessions only.
- stop_server((StmTaskServer)self[, (object)timeout=1000]) None :
stop serving connections, gracefully.
See also
start_server()
- stop_web_api((StmTaskServer)self) None :
Stops any ongoing web API service.
- class shyft.energy_market.stm.StmTaskClient
Bases:
instance
The client api for the Stm Task repository.
- __init__((StmTaskClient)self, (object)host_port, (object)timeout_ms) None :
Creates a python client that can communicate with the corresponding server
- add_case((StmTaskClient)self, (object)mid, (StmCase)case) None :
Add a case to a task on server.
- Parameters:
mid (int) – Task id to add a run to.
case (StmCase) – The case to add to the task.
- Raises:
RuntimeError – If provided mid is an invalid task id.
RuntimeError – If provided case has the same id or name as a case already in task.
- add_model_ref((StmTaskClient)self, (object)mid, (object)cid, (StmModelRef)mr) None :
Add a model reference to a case on server.
- Parameters:
mid (int) – Task ID.
cid (int) – Case ID.
mr (StmModelRef) – The model reference to add to case with ID=cid, contained in task with ID=mid.
- close((StmTaskClient)self) None :
Close the connection. It will automatically reopen if needed.
- fx((StmTaskClient)self, (object)mid, (object)fx_arg) bool :
Execute the serverside fx, passing supplied arguments.
- Parameters:
mid (str) – ID of task for the server-side fx.
fx_arg (str) – Any argument passed to the server-side fx.
- Returns:
success. true if call successfully done.
- Return type:
bool
- get_case((StmTaskClient)self, (object)mid, (object)cid) StmCase :
Get case from task based on case’s id.
- Args:
mid (int): Task ID.
cid (int): Case ID.
- Returns:
StmCase: case. Requested case, or None if not found.
- get_case( (StmTaskClient)self, (object)mid, (object)cname) -> StmCase :
Get from task based on case’s name.
- Args:
mid (int): Task ID.
cname (str): Case name.
case (StmCase): Requested run, or None if not found.
- get_model_infos((StmTaskClient)self, (IntVector)mids[, (UtcPeriod)created_in=[not-valid-period>]) ModelInfoVector :
returns all or selected model-info objects based on model-identifiers(mids)
- Parameters:
mids (IntVector) – empty = all, or a list of known exisiting model-identifiers
created_in (UtcPeriod) – For which period you are interested in model-infos.
- Returns:
model_infos. Strongly typed list of ModelInfo
- Return type:
- get_model_ref((StmTaskClient)self, (object)mid, (object)cid, (object)mkey) StmModelRef :
Get a model reference stored in a case contained in a task.
- Parameters:
mid (int) – Task ID.
cid (int) – Case ID.
mkey (str) – Model key of model reference. What is stored in StmModelRef.model_key.
- Returns:
mr. Requested model reference. None if run wasn’t found or didn’t contain requested model reference.
- Return type:
- property host_port
Endpoint network address of the remote server.
- Type:
str
- property is_open
If the connection to the remote server is (still) open.
- Type:
bool
- read_model((StmTaskClient)self, (object)mid) StmTask :
Read and return the model for specified model-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
The resulting model from the server
- Return type:
- read_models((StmTaskClient)self, (IntVector)mids) StmTaskVector :
Read and return the model for specified model-identifier (mid)
- Parameters:
mids (Int64Vector) – A strongly typed list of ints, the model-identifers for the wanted models
- Returns:
The resulting model from the server
- Return type:
- property reconnect_count
Number of reconnects to the remote server that have been performed.
- Type:
int
- remove_case((StmTaskClient)self, (object)mid, (object)cid) bool :
Remove a case from a task on server.
- Args:
mid (int): Task id to remove run from.
cid (int): Id of case to remove.
- Returns:
Boolean: success. True if the case was successfully removed from task.
- remove_case( (StmTaskClient)self, (object)mid, (object)rname) -> bool :
Remove case from a task on server based on it’s case name.
- Args:
mid (int): Task id to remove run from.
cname (str): Name of the case to remove.
- Returns:
Boolean: success. True if case was successfully removed from task.
- remove_model((StmTaskClient)self, (object)mid) int :
Remove the specified model bymodel-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
ec. 0 or error-code?
- Return type:
int
- remove_model_ref((StmTaskClient)self, (object)mid, (object)cid, (object)mkey) bool :
Remove a model reference from a case contained in a task.
- Parameters:
mid (int) – Task ID.
cid (int) – Case ID.
mkey (str) – Model key of model reference. What is stored in StmModelRef.model_key.
- Returns:
success. True if model reference was successfully removed, False otherwise.
- Return type:
Boolean
- store_model((StmTaskClient)self, (StmTask)m, (ModelInfo)mi) int :
Store the model to backend, if m.id==0 then a new unique model-info is created and used
- property timeout_ms
Timout for remote server operations, in number milliseconds.
- Type:
int
- class shyft.energy_market.stm.StmCase
Bases:
instance
Provided a case concept for Stm. A case, can hold a number of references to stm model runs. A StmTask contains many cases, each with a set of stm model runs.
- __init__((StmCase)arg1) None
- __init__( (StmCase)self, (object)id, (object)name, (time)created [, (object)json=’’ [, (StringVector)labels=[] [, (ModelRefList)model_refs=<shyft.energy_market.stm._stm.ModelRefList object at 0x7eb5011394c0>]]]) -> None :
Create a stm case
- add_model_ref((StmCase)self, (StmModelRef)mr) None :
Add a model reference to the case.
- Parameters:
mr (StmModelRef) – The model reference to add.
- get_model_ref((StmCase)self, (object)mkey) StmModelRef :
Get model reference in the case based on model key.
- Parameters:
mkey (str) – The model key the reference has stored. Cf. StmModelRef.model_key.
- Returns:
mr. Requested model reference. None if not found in the case.
- Return type:
- property id
The unique case ID.
- Type:
int
- property json
A json formatted string with miscellaneous data.
- Type:
str
- property labels
A set of labels for the case.
- Type:
StringVector
- property model_refs
Set of stm run model references that are related to the case.
- Type:
- property name
Any useful name of description.
- Type:
str
- remove_model_ref((StmCase)self, (object)mkey) bool :
Remove a stm run model reference from the case.
- Parameters:
mkey (str) – The stm run model key the reference has stored. Cf. StmModelRef.model_key.
- Returns:
success. True if model reference was successfully removed. False if case did not contain model reference with given model key.
- Return type:
Boolean
- class shyft.energy_market.stm.ModelRefList
Bases:
instance
A strongly typed list of StmModelRef.
- __init__((ModelRefList)arg1) None
- append((ModelRefList)arg1, (object)arg2) None
- extend((ModelRefList)arg1, (object)arg2) None
- class shyft.energy_market.stm.StmModelRef
Bases:
instance
Reference to a model, and where to find it.
- __init__((StmModelRef)self, (object)host, (object)port_num, (object)api_port_num, (object)model_key) None :
Create a run info.
- Args:
host (str): Where the referenced model is stored.
port_num (int): At what port number to interface with the server.
api_port_num (int): At what port number to interface with the server using the web API.
model_key (str): The model key the referenced model is stored under.
- __init__( (StmModelRef)self) -> None :
Default constructor for StmRunInfo.
- property api_port_num
Port number to interface with server through web API.
- Type:
int
- property host
Where model is stored.
- Type:
str
- property model_key
The model key the referenced model is stored under.
- Type:
str
- property port_num
Port number to interface with server.
- Type:
int
- class shyft.energy_market.stm.StmTask
Bases:
instance
Task concept for Stm. Can contain a number of cases, each of them can contain one or more stm model-run references. Defined through its set of labels, a base model, which should relate to child runs and model_refs, and a task name.
- __init__((StmTask)arg1) None
- __init__( (StmTask)self, (object)id, (object)name, (time)created [, (object)json=’’ [, (StringVector)labels=[] [, (StmCaseVector)cases=<shyft.energy_market.stm._stm.StmCaseVector object at 0x7eb501139640> [, (StmModelRef)base_model=<shyft.energy_market.stm._stm.StmModelRef object at 0x7eb5011412a0> [, (object)task_name=’’]]]]]) -> None :
Create an stm task.
- add_case((StmTask)self, (StmCase)case) None :
Add a case (set of stm model runs) to the task.
- Parameters:
case (StmCase) – The case instance to add to the task.
- Returns:
None. Returns nothing.
- Return type:
None
- property base_model
Base model, which should correspond to models used in runs.
- Type:
- property cases
Set of runs connected to task.
- Type:
StmCaseVector
- get_case((StmTask)self, (object)cid) StmCase :
Get run from task based on ID.
- Args:
cid (int): Id of case you want to get.
- Returns:
StmCase: case. Request case, None if not found.
- get_case( (StmTask)self, (object)rname) -> StmCase :
Get case based on its name.
- Args:
rname (str): Name of case you want to get.
- Returns:
StmCase: case. Request case, None if not found.
- property id
The unique task ID.
- Type:
int
- property json
A json formatted string with miscellaneous data.
- Type:
str
- property labels
A set of labels for the task.
- Type:
StringVector
- property name
Any useful name or description.
- Type:
str
- remove_case((StmTask)self, (object)id) bool :
Remove a case from task based on id.
- remove_case( (StmTask)self, (object)name) -> bool :
Remove a case from task based on name.
- property task_name
Name of task connected to task.
- Type:
str
- class shyft.energy_market.stm.Contract
Bases:
IdBase
A contract between two parties, seller and buyer, for sale of a product at a given price. The contract can refer to specific power-plant, unit group, or even other contracts.
- class Constraint
Bases:
instance
Contract.Constraint attributes
- __init__()
Raises an exception This class cannot be instantiated from Python
- property max_trade
Maximum quantity (volume) that must be traded for this contract.
- Type:
_ts
- property min_trade
Minimum quantity (volume) that must be traded for this contract.
- Type:
_ts
- property ramping_down
Max quantity (volume) to ramp down between timesteps for this contract.
- Type:
_ts
- property ramping_down_penalty_cost
Penalty for violating ramping down limit.
- Type:
_ts
- property ramping_up
Max quantity (volume) to ramp up between timesteps for this contract.
- Type:
_ts
- property ramping_up_penalty_cost
Penalty for violating ramping up limit.
- Type:
_ts
- class ContractRelation
Bases:
instance
A relation to another contract, where the relation-type is a user specified integer. This allows building and maintaining contract system that have internal rules/constraints There is a minimal set of rules, like avoiding circularities that are enforced
- __init__()
Raises an exception This class cannot be instantiated from Python
- property id
The id of the relation
- Type:
int
The related contract
- Type:
- property relation_type
Free to use integer to describe relation type
- Type:
_u16
- class ContractRelationList
Bases:
instance
A strongly typed list of Contracts.ContractRelation.
- __init__((ContractRelationList)arg1) None
- __init__( (object)arg1, (list)contract_relation.) -> object :
Construct from list.
- append((ContractRelationList)arg1, (object)arg2) None
- extend((ContractRelationList)arg1, (object)arg2) None
- __init__((Contract)arg1, (object)uid, (object)name, (object)json, (StmSystem)sys) None :
Create contract with unique id and name for a stm system.
- property active
Contract status (dead/alive).
- Type:
_ts
- add_relation((Contract)self, (object)id, (Contract)contract, (object)relation_type) ContractRelation :
Add a contract as a relation from this contract
- Parameters:
id (Id) – The relation id (must be unique for this contract)
contract (Contract) – The contract to be added as a relation
relation_type (RelationType) – A free to use integer to describe relation type
- add_to_market_area((Contract)arg1, (MarketArea)arg2) None :
Add this contract to specified energy market area. Convenience for appending to MarketArea.contracts.
- add_to_portfolio((Contract)arg1, (ContractPortfolio)arg2) None :
Add this contract to specified portfolio. Convenience for appending to ContractPortfolio.contracts.
- property buyer
The name of the buyer party of the contract.
- Type:
_string
- property constraint
Constrant of this contract.
- Type:
- property custom
Map keeping any_attr
- Type:
StringAnyAttrDict
- property fee
[money/s] Any contract fees, in rate units so that fee over the contract period gives total fee.
- Type:
_ts
Find contracts that have a relation to self.
- Returns:
contracts. The contracts that have a relation to this contract
- Return type:
ContractVector
- flattened_attributes((Contract)arg1) dict :
Flat dict containing all component attributes.
- get_market_areas((Contract)arg1) MarketAreaList :
Get any energy market areas this contract is associated with. Convenience for search in MarketArea.contracts.
- get_portfolios((Contract)arg1) ContractPortfolioList :
Get any portfolios this contract is associated with. Convenience for search in ContractPortfolio.contracts.
- get_tsm_object((Contract)self, (object)key) _ts :
Get a specific extra time series for this object.
The returned time series is wrapped in an object which exposes method for retrieving url etc.
- Parameters:
key (str) – The key in the tsm of the time series to get.
- Raises:
runtime_error – If specified key does not exist.
- property options
Defines optional price/volume curves for future trading.
- Type:
_t_xy_
- property parent_id
Optional reference to parent (contract). Typically for forwardes/futures, that is splitted into shorter terms as time for the delivery is approaching.
- Type:
_string
- property power_plants
List of associated power plants.
- Type:
- property price
[money/J] Contract price.
- Type:
_ts
- property quantity
[J/s] Contract quantity, in rate units, so that integrated over contract period gives total volume.
- Type:
_ts
- property relations
List of related contracts.
- Type:
- remove_relation((Contract)self, (ContractRelation)contract_relation) None :
Remove relation to contract.
- Parameters:
contract_relation (ContractRelation) – The relation to be removed
- property revenue
[money/s] Calculated revenue, in rate units, so that integrated of the contract period gives total revenue volume
- Type:
_ts
- property seller
The name of the seller party of the contract.
- Type:
_string
- property tag
Url tag.
- Type:
str
- property ts
Map keeping any extra time series for this object.
- Type:
- property validation
Validation status (and whether the contract has been validated or not).
- Type:
_ts
- class shyft.energy_market.stm.ContractList
Bases:
instance
A strongly typed list of Contract.
- __init__((ContractList)arg1) None
- __init__( (ContractList)arg1, (ContractList)clone) -> None :
Create a clone.
- append((ContractList)arg1, (object)arg2) None
- extend((ContractList)arg1, (object)arg2) None
- class shyft.energy_market.stm.ContractPortfolio
Bases:
instance
Stm contract portfolio represents a set of contracts, so that the sum of interesting contract properties can be evaluated and compared.
- __init__((ContractPortfolio)arg1, (object)uid, (object)name, (object)json, (StmSystem)sys) None :
Create contract portfolio with unique id and name for a stm system.
- property contracts
List of contracts.
- Type:
- property custom
Map keeping any_attr
- Type:
StringAnyAttrDict
- property fee
[money/s] Fees of the portfolio, normally sum of contracts.
- Type:
_ts
- flattened_attributes((ContractPortfolio)arg1) dict :
Flat dict containing all component attributes.
- get_tsm_object((ContractPortfolio)self, (object)key) _ts :
Get a specific extra time series for this object.
The returned time series is wrapped in an object which exposes method for retrieving url etc.
- Parameters:
key (str) – The key in the tsm of the time series to get.
- Raises:
runtime_error – If specified key does not exist.
- property id
Unique id for this object.
- Type:
int
- property json
Json keeping any extra data for this object.
- Type:
str
- property name
Name for this object.
- Type:
str
- property quantity
[J/s] normally sum of contracts, unit depends on the contracts.
- Type:
_ts
- property revenue
[money/s] Calculated revenue.
- Type:
_ts
- property tag
Url tag.
- Type:
str
- property ts
Map keeping any extra time series for this object.
- Type:
- class shyft.energy_market.stm.ContractPortfolioList
Bases:
instance
A strongly typed list of ContractPortfolio.
- __init__((ContractPortfolioList)arg1) None
- __init__( (ContractPortfolioList)arg1, (ContractPortfolioList)clone) -> None :
Create a clone.
- append((ContractPortfolioList)arg1, (object)arg2) None
- extend((ContractPortfolioList)arg1, (object)arg2) None
- class shyft.energy_market.stm.PowerModule
Bases:
IdBase
A power module representing consumption.
- class Power
Bases:
instance
Unit.Power attributes, consumption[W, J/s].
- __init__()
Raises an exception This class cannot be instantiated from Python
- property realised
Historical fact, time series. W, J/s, if positive then production, if negative then consumption.
- Type:
_ts
- property result
The optimal/simulated/estimated result, time series. W, J/s, if positive then production, if negative then consumption
- Type:
_ts
- property schedule
The current schedule, time series. W, J/s, if positive then production, if negative then consumption
- Type:
_ts
- __init__((PowerModule)arg1, (object)uid, (object)name, (object)json, (StmSystem)sys) None :
Create power module with unique id and name for a stm system.
- property custom
Map keeping any_attr
- Type:
StringAnyAttrDict
- flattened_attributes((PowerModule)arg1) dict :
Flat dict containing all component attributes.
- get_tsm_object((PowerModule)self, (object)key) _ts :
Get a specific extra time series for this object.
The returned time series is wrapped in an object which exposes method for retrieving url etc.
- Parameters:
key (str) – The key in the tsm of the time series to get.
- Raises:
runtime_error – If specified key does not exist.
- property tag
Url tag.
- Type:
str
- property ts
Map keeping any extra time series for this object.
- Type:
- class shyft.energy_market.stm.Busbar
Bases:
instance
A hub connected by transmission lines
- class TsTriplet
Bases:
instance
Describes .realised, .schedule and .result time-series
- __init__()
Raises an exception This class cannot be instantiated from Python
- property realised
SI-units, realised time-series, as in historical fact
- Type:
_ts
- property result
SI-units, result, as provided by optimisation
- Type:
_ts
- property schedule
SI-units, schedule, as in current schedule
- Type:
_ts
- __init__((Busbar)arg1, (object)uid, (object)name, (object)json, (Network)net) None :
Create busbar with unique id and name for a network.
- add_power_module((Busbar)arg1, (PowerModule)arg2, (TimeSeries)arg3) None :
Associate a (time-dependent) power module to this busbar
- add_to_end_of_transmission_line((Busbar)arg1, (TransmissionLine)arg2) None :
Add this busbar to the end of a transmission line
- add_to_market_area((Busbar)arg1, (MarketArea)arg2) None :
Associate a market area to this busbar
- add_to_start_of_transmission_line((Busbar)arg1, (TransmissionLine)arg2) None :
Add this busbar to the start of a transmission line
- add_unit((Busbar)arg1, (Unit)arg2, (TimeSeries)arg3) None :
Associate a (time-dependent) unit to this busbar
- add_wind_farm((Busbar)arg1, (WindFarm)arg2, (TimeSeries)arg3) None :
Associate a (time-dependent) wind farm to this busbar
- property custom
Map keeping any_attr
- Type:
StringAnyAttrDict
- flattened_attributes((Busbar)arg1) dict :
dict: Flat dict containing all component attributes.
- get_market_areas((Busbar)arg1) MarketAreaList :
Get any market areas associated with this busbar
- get_transmission_lines_from_busbar((Busbar)arg1) TransmissionLineList :
Get any transmission lines connected from this busbar
- get_transmission_lines_to_busbar((Busbar)arg1) TransmissionLineList :
Get any transmission lines connected to this busbar
- get_tsm_object((Busbar)self, (object)key) _ts :
Get a specific extra time series for this object.
The returned time series is wrapped in an object which exposes method for retrieving url etc.
- Parameters:
key (str) – The key in the tsm of the time series to get.
- Raises:
runtime_error – If specified key does not exist.
- property id
Unique id for this object.
- Type:
int
- property json
Json keeping any extra data for this object.
- Type:
str
- property name
Name for this object.
- Type:
str
- property power_modules
modules associated with this busbar
- Type:
PowerModuleMemberList
- remove_power_module((Busbar)arg1, (PowerModule)arg2) None :
Remove a (time-dependent) power module from this busbar
- remove_unit((Busbar)arg1, (Unit)arg2) None :
Remove a (time-dependent) unit from this busbar
- remove_wind_farm((Busbar)arg1, (WindFarm)arg2) None :
Remove a (time-dependent) wind farm from this busbar
- property tag
Url tag.
- Type:
str
- property ts
Map keeping any extra time series for this object.
- Type:
- property units
Units associated with this busbar
- Type:
UnitMemberList
- property wind_farms
Wind Farms associated with this busbar
- Type:
WindFarmMemberList
- class shyft.energy_market.stm.Network
Bases:
IdBase
A network consisting of busbars and transmission lines.
- __init__((Network)arg1, (object)uid, (object)name, (object)json, (StmSystem)sys) None :
Create network with unique id and name for a stm system.
- property busbars
List of busbars.
- Type:
BusbarList
- create_busbar((Network)self, (object)uid, (object)name[, (object)json='']) Busbar :
Create stm busbar with unique uid.
- Returns:
busbar. The new busbar.
- Return type:
- create_transmission_line((Network)self, (object)uid, (object)name[, (object)json='']) TransmissionLine :
Create stm transmission line with unique uid.
- Returns:
transmission_line. The new transmission line.
- Return type:
- property custom
Map keeping any_attr
- Type:
StringAnyAttrDict
- get_tsm_object((Network)self, (object)key) _ts :
Get a specific extra time series for this object.
The returned time series is wrapped in an object which exposes method for retrieving url etc.
- Parameters:
key (str) – The key in the tsm of the time series to get.
- Raises:
runtime_error – If specified key does not exist.
- property tag
Url tag.
- Type:
str
- property transmission_lines
List of transmission lines.
- Type:
TransmissionLineList
- property ts
Map keeping any extra time series for this object.
- Type:
- class shyft.energy_market.stm.TransmissionLine
Bases:
IdBase
A transmission line connecting two busbars.
- __init__((TransmissionLine)arg1, (object)uid, (object)name, (object)json, (Network)net) None :
Create transmission line with unique id and name for a network.
- property capacity
Transmission line capacity
- Type:
_ts
- property custom
Map keeping any_attr
- Type:
StringAnyAttrDict
- flattened_attributes((TransmissionLine)arg1) dict :
Flat dict containing all component attributes.
- get_tsm_object((TransmissionLine)self, (object)key) _ts :
Get a specific extra time series for this object.
The returned time series is wrapped in an object which exposes method for retrieving url etc.
- Parameters:
key (str) – The key in the tsm of the time series to get.
- Raises:
runtime_error – If specified key does not exist.
- property tag
Url tag.
- Type:
str
- property ts
Map keeping any extra time series for this object.
- Type:
- class shyft.energy_market.stm.WindFarm
Bases:
IdBase
Stm wind park
- class Production
Bases:
instance
WindFarm.production attributes, amount power produced[W, J/s].
- __init__()
Raises an exception This class cannot be instantiated from Python
- property forecast
[W, J/s] The forecast amount of power produced, time series.
- Type:
_ts
- property realised
The current schedule, time series. [W, J/s]
- Type:
_ts
- property result
[W, J/s] Power produced. As computed by optimization/simulation process.
- Type:
_ts
- __init__((WindFarm)arg1, (object)uid, (object)name, (object)json, (StmSystem)sys) None :
Create wind farm with unique id and name for a stm system.
- property custom
Map keeping any_attr
- Type:
StringAnyAttrDict
- flattened_attributes((WindFarm)arg1) dict :
Flat dict containing all component attributes.
- get_tsm_object((WindFarm)self, (object)key) _ts :
Get a specific extra time series for this object.
The returned time series is wrapped in an object which exposes method for retrieving url etc.
- Parameters:
key (str) – The key in the tsm of the time series to get.
- Raises:
runtime_error – If specified key does not exist.
- property production
Production attributes.
- Type:
- property tag
Url tag.
- Type:
str
- property ts
Map keeping any extra time series for this object.
- Type:
- shyft.energy_market.stm.compute_effective_price((TimeSeries)usage, (t_xy)bids, (object)use_cheapest) TimeSeries :
Given usage, and bids, compute the effective price achieved consuming bids in the order as speficied with use_cheapest. If usage is 0, then first available price is computed. If bids are None, usage None, or empty, then empty is returned. If usage is more than available in the bids, the effective price for all the bids are computed.
- Parameters:
usage – The usage in W
bids – The available bids, time-dependent xy, where x= price [Money/J], y= energy [W]
use_cheapest – Take cheapest bids first, act as buyer, if false, act as seller, and take highest bids first
- Returns:
The computed effective price result
- Return type:
effective price
STM Compute and Shop
A scalable compute node service, currently implementing the running Sintef SHOP optimizations. It is automatically managed through the shyft.energy_market.stm.DStmServer class.
Note
This module require license from Sintef, and that you have a in-house build setup according to recipe as described on Shyft wiki: https://gitlab.com/shyft-os/shyft/-/wikis/Reference-docs/Shyft-for-SHOP
Shyft Energy Market compute server
- class shyft.energy_market.stm.compute.Client
Bases:
instance
A client to the Server.
- __init__((Client)arg1, (object)host_port, (object)timeout_ms) None :
Create a client with the host port host_port
- send((Client)arg1, (object)request) object
- class shyft.energy_market.stm.compute.GetAttrsReply
Bases:
instance
Compute reply
- __init__((GetAttrsReply)arg1) None
- property attrs
- class shyft.energy_market.stm.compute.GetAttrsRequest
Bases:
instance
Compute request
- __init__((GetAttrsRequest)arg1) None
- property urls
- class shyft.energy_market.stm.compute.GetPlanReply
Bases:
instance
Compute reply
- __init__((GetPlanReply)arg1) None
- property summary
- class shyft.energy_market.stm.compute.GetPlanRequest
Bases:
instance
Compute request
- __init__((GetPlanRequest)arg1) None
- class shyft.energy_market.stm.compute.GetStatusReply
Bases:
instance
Compute reply
- __init__((GetStatusReply)arg1) None
- property log
- property state
- class shyft.energy_market.stm.compute.GetStatusRequest
Bases:
instance
Compute request
- __init__((GetStatusRequest)arg1) None
- property log_index
- class shyft.energy_market.stm.compute.ManagedServerState
Bases:
enum
Describes the possible states of a managed compute server
- ASSIGNED = shyft.energy_market.stm.compute.ManagedServerState.ASSIGNED
- BUSY = shyft.energy_market.stm.compute.ManagedServerState.BUSY
- DEAD = shyft.energy_market.stm.compute.ManagedServerState.DEAD
- IDLE = shyft.energy_market.stm.compute.ManagedServerState.IDLE
- names = {'ASSIGNED': shyft.energy_market.stm.compute.ManagedServerState.ASSIGNED, 'BUSY': shyft.energy_market.stm.compute.ManagedServerState.BUSY, 'DEAD': shyft.energy_market.stm.compute.ManagedServerState.DEAD, 'IDLE': shyft.energy_market.stm.compute.ManagedServerState.IDLE}
- values = {0: shyft.energy_market.stm.compute.ManagedServerState.IDLE, 1: shyft.energy_market.stm.compute.ManagedServerState.ASSIGNED, 2: shyft.energy_market.stm.compute.ManagedServerState.BUSY, 3: shyft.energy_market.stm.compute.ManagedServerState.DEAD}
- class shyft.energy_market.stm.compute.PlanReply
Bases:
instance
Compute reply
- __init__((PlanReply)arg1) None
- class shyft.energy_market.stm.compute.PlanRequest
Bases:
instance
Compute request
- __init__((PlanRequest)arg1) None
- property commands
- property time_axis
- class shyft.energy_market.stm.compute.Server
Bases:
instance
A server for running heavy STM computations.
- __init__((Server)arg1) None
- close((Server)self) None
- get_listening_ip((Server)self) str
- get_listening_port((Server)self) int
- is_running((Server)self) bool
- set_listening_ip((Server)self, (object)ip) None
- set_listening_port((Server)self, (object)port_no) None
- start_server((Server)self) int
- stop_server((Server)self[, (object)timeout=1000]) None
- class shyft.energy_market.stm.compute.ServerStatus
Bases:
instance
Status of a managed compute server
- __init__((ServerStatus)arg1) None
- property address
- property last_send
- property model_id
- property state
- class shyft.energy_market.stm.compute.ServerStatusVector
Bases:
instance
- __init__((ServerStatusVector)arg1) None
- __init__( (ServerStatusVector)arg1, (ServerStatusVector)clone) -> None :
Create a clone.
- append((ServerStatusVector)arg1, (object)arg2) None
- extend((ServerStatusVector)arg1, (object)arg2) None
- class shyft.energy_market.stm.compute.SetAttrsReply
Bases:
instance
Compute reply
- __init__((SetAttrsReply)arg1) None
- property attrs
- class shyft.energy_market.stm.compute.SetAttrsRequest
Bases:
instance
Compute request
- __init__((SetAttrsRequest)arg1) None
- property attrs
- class shyft.energy_market.stm.compute.StartReply
Bases:
instance
Compute reply
- __init__((StartReply)arg1) None
- class shyft.energy_market.stm.compute.StartRequest
Bases:
instance
Compute request
- __init__((StartRequest)arg1) None
- property model
- property model_id
- class shyft.energy_market.stm.compute.State
Bases:
enum
Describes the possible states of a compute server
- DONE = shyft.energy_market.stm.compute.State.DONE
- IDLE = shyft.energy_market.stm.compute.State.IDLE
- RUNNING = shyft.energy_market.stm.compute.State.RUNNING
- STARTED = shyft.energy_market.stm.compute.State.STARTED
- names = {'DONE': shyft.energy_market.stm.compute.State.DONE, 'IDLE': shyft.energy_market.stm.compute.State.IDLE, 'RUNNING': shyft.energy_market.stm.compute.State.RUNNING, 'STARTED': shyft.energy_market.stm.compute.State.STARTED}
- values = {0: shyft.energy_market.stm.compute.State.IDLE, 1: shyft.energy_market.stm.compute.State.STARTED, 2: shyft.energy_market.stm.compute.State.RUNNING, 3: shyft.energy_market.stm.compute.State.DONE}
STM Shop
This module provide the direct interface to emit StmSystem to the Shop engine, running commands etc.
Note
This module require license from Sintef, and that you have a in-house build setup according to recipe as described on Shyft wiki: https://gitlab.com/shyft-os/shyft/-/wikis/Reference-docs/Shyft-for-SHOP
Statkraft Energy Market short term model Shop adapter
- class shyft.energy_market.stm.shop.ShopCommand
Bases:
instance
A shop command, which can later be sent to the shop core.
In the shop core a command can be described as a string with syntax: “<keyword> <specifier> [/<opt> [/<opt>…]] [[<obj>] [<obj>…]]”. The keyword is a general word that specifies the kind of action, for example ‘set’, ‘save’ or ‘return’. The specifier identifies what data will be affected by the command, and it is unique for every command, for example ‘method’, or ‘ramping’. Commands can accept one or several pre-set options to further specify the command. These always start with a forward slash, consist of one word only, and if more than one the order is important. Some commands also needs input objects, usually an integer, floating point, or string value.
- __init__((ShopCommand)arg1, (object)command) None :
Create from a single string in shop command language syntax.
- __init__( (ShopCommand)arg1, (object)keyword, (object)specifier, (StringVector)options, (StringVector)objects) -> None :
Create from individual components.
- property keyword
keyword of the command
- static log_file() ShopCommand :
Shop command string “log file”.
- log_file( (object)filename) -> ShopCommand :
Shop command string “log file <filename>”.
- static log_file_lp((object)filename) ShopCommand :
Shop command string “log file /lp <filename>”.
- property objects
list of objects
- property options
list of options
- static penalty_cost_all((object)value) ShopCommand :
Shop command string “penalty cost /all <value>”.
- static penalty_cost_discharge((object)value) ShopCommand :
Shop command string “penalty cost /discharge <value>”.
- static penalty_cost_gate_ramping((object)value) ShopCommand :
Shop command string “penalty cost /gate /ramping <value>”.
- static penalty_cost_load((object)value) ShopCommand :
Shop command string “penalty cost /load <value>”.
- static penalty_cost_overflow((object)value) ShopCommand :
Shop command string “penalty cost /overflow <value>”.
- static penalty_cost_overflow_time_adjust((object)value) ShopCommand :
Shop command string “penalty cost /overflow_time_adjust <value>”.
- static penalty_cost_powerlimit((object)value) ShopCommand :
Shop command string “penalty cost /powerlimit <value>”.
- static penalty_cost_reserve((object)value) ShopCommand :
Shop command string “penalty cost /reserve <value>”.
- static penalty_cost_reservoir_endpoint((object)value) ShopCommand :
Shop command string “penalty cost /reservoir /endpoint <value>”.
- static penalty_cost_reservoir_ramping((object)value) ShopCommand :
Shop command string “penalty cost /reservoir /ramping <value>”.
- static penalty_cost_soft_p_penalty((object)value) ShopCommand :
Shop command string “penalty cost /soft_p_penalty <value>”.
- static penalty_cost_soft_q_penalty((object)value) ShopCommand :
Shop command string “penalty cost /soft_q_penalty <value>”.
- static penalty_flag_all((object)on) ShopCommand :
Shop command string “penalty flag /all /on|/off”.
- static penalty_flag_discharge((object)on) ShopCommand :
Shop command string “penalty flag /on|/off /discharge”.
- static penalty_flag_gate_max_q_con((object)on) ShopCommand :
Shop command string “penalty flag /on|/off /gate /max_q_con”.
- static penalty_flag_gate_min_q_con((object)on) ShopCommand :
Shop command string “penalty flag /on|/off /gate /min_q_con”.
- static penalty_flag_gate_ramping((object)on) ShopCommand :
Shop command string “penalty flag /on|/off /gate /ramping”.
- static penalty_flag_load((object)on) ShopCommand :
Shop command string “penalty flag /on|/off /load”.
- static penalty_flag_plant_max_p_con((object)on) ShopCommand :
Shop command string “penalty flag /on|/off /plant /max_p_con”.
- static penalty_flag_plant_max_q_con((object)on) ShopCommand :
Shop command string “penalty flag /on|/off /plant /max_q_con”.
- static penalty_flag_plant_min_p_con((object)on) ShopCommand :
Shop command string “penalty flag /on|/off /plant /min_p_con”.
- static penalty_flag_plant_min_q_con((object)on) ShopCommand :
Shop command string “penalty flag /on|/off /plant /min_q_con”.
- static penalty_flag_plant_schedule((object)on) ShopCommand :
Shop command string “penalty flag /on|/off /plant /schedule”.
- static penalty_flag_powerlimit((object)on) ShopCommand :
Shop command string “penalty flag /on|/off /powerlimit”.
- static penalty_flag_reservoir_endpoint((object)on) ShopCommand :
Shop command string “penalty flag /on|/off /reservoir /endpoint”.
- static penalty_flag_reservoir_ramping((object)on) ShopCommand :
Shop command string “penalty flag /on|/off /reservoir /ramping”.
- static print_bp_curves() ShopCommand :
Shop command string “print bp_curves”.
- static print_bp_curves_all_combinations() ShopCommand :
Shop command string “print bp_curves /all_combinations”.
- static print_bp_curves_current_combination() ShopCommand :
Shop command string “print bp_curves /current_combination”.
- static print_bp_curves_discharge() ShopCommand :
Shop command string “print bp_curves /discharge”.
- static print_bp_curves_dyn_points() ShopCommand :
Shop command string “print bp_curves /dyn_points”.
- static print_bp_curves_from_zero() ShopCommand :
Shop command string “print bp_curves /from_zero”.
- static print_bp_curves_market_ref_mc() ShopCommand :
Shop command string “print bp_curves /market_ref_mc”.
- static print_bp_curves_mc_format() ShopCommand :
Shop command string “print bp_curves /mc_format”.
- static print_bp_curves_no_vertical_step() ShopCommand :
Shop command string “print bp_curves /no_vertical_step”.
- static print_bp_curves_old_points() ShopCommand :
Shop command string “print bp_curves /old_points”.
- static print_bp_curves_operation() ShopCommand :
Shop command string “print bp_curves /operation”.
- static print_bp_curves_production() ShopCommand :
Shop command string “print bp_curves /production”.
- static print_mc_curves((object)filename) ShopCommand :
Shop command string “print mc_curves <filename>”.
- static print_mc_curves_down((object)filename) ShopCommand :
Shop command string “print mc_curves /down <filename>”.
- static print_mc_curves_down_mod((object)filename) ShopCommand :
Shop command string “print mc_curves /down /mod <filename>”.
- static print_mc_curves_down_pq((object)filename) ShopCommand :
Shop command string “print mc_curves /down /pq <filename>”.
- static print_mc_curves_down_pq_mod((object)filename) ShopCommand :
Shop command string “print mc_curves /down /pq /mod <filename>”.
- static print_mc_curves_mod((object)filename) ShopCommand :
Shop command string “print mc_curves /mod <filename>”.
- static print_mc_curves_pq((object)filename) ShopCommand :
Shop command string “print mc_curves /pq <filename>”.
- static print_mc_curves_pq_mod((object)filename) ShopCommand :
Shop command string “print mc_curves /pq /mod <filename>”.
- static print_mc_curves_up((object)filename) ShopCommand :
Shop command string “print mc_curves /up <filename>”.
- static print_mc_curves_up_down((object)filename) ShopCommand :
Shop command string “print mc_curves /up /down <filename>”.
- static print_mc_curves_up_down_mod((object)filename) ShopCommand :
Shop command string “print mc_curves /up /down /mod <filename>”.
- static print_mc_curves_up_down_pq((object)filename) ShopCommand :
Shop command string “print mc_curves /up /down /pq <filename>”.
- static print_mc_curves_up_down_pq_mod((object)filename) ShopCommand :
Shop command string “print mc_curves /up /down /pq /mod <filename>”.
- static print_mc_curves_up_mod((object)filename) ShopCommand :
Shop command string “print mc_curves /up /mod <filename>”.
- static print_mc_curves_up_pq((object)filename) ShopCommand :
Shop command string “print mc_curves /up /pq <filename>”.
- static print_mc_curves_up_pq_mod((object)filename) ShopCommand :
Shop command string “print mc_curves /up /pq /mod <filename>”.
- static print_model((object)filename) ShopCommand :
Shop command string “print model <filename>”.
- static print_pqcurves_all() ShopCommand :
Shop command string “print pqcurves /all”.
- print_pqcurves_all( (object)filename) -> ShopCommand :
Shop command string “print pqcurves /all <filename>”.
- static print_pqcurves_convex() ShopCommand :
Shop command string “print pqcurves /convex”.
- print_pqcurves_convex( (object)filename) -> ShopCommand :
Shop command string “print pqcurves /convex <filename>”.
- static print_pqcurves_final() ShopCommand :
Shop command string “print pqcurves /final”.
- print_pqcurves_final( (object)filename) -> ShopCommand :
Shop command string “print pqcurves /final <filename>”.
- static print_pqcurves_original() ShopCommand :
Shop command string “print pqcurves /original”.
- print_pqcurves_original( (object)filename) -> ShopCommand :
Shop command string “print pqcurves /original <filename>”.
- static return_scenario_result_table((object)filename) ShopCommand :
Shop command string “return scenario_result_table <filename>”.
- static return_shopsimres((object)filename) ShopCommand :
Shop command string “return shopsimres <filename>”.
- static return_shopsimres_gen((object)filename) ShopCommand :
Shop command string “return shopsimres /gen <filename>”.
- static return_simres((object)filename) ShopCommand :
Shop command string “return simres <filename>”.
- static return_simres_gen((object)filename) ShopCommand :
Shop command string “return simres /gen <filename>”.
- static save_pq_curves((object)on) ShopCommand :
Shop command string “save pq_curves /on|/off”.
- static save_series((object)filename) ShopCommand :
Shop command string “save series <filename>”.
- static save_shopsimseries((object)filename) ShopCommand :
Shop command string “save shopsimseries <filename>”.
- static save_tunnelloss() ShopCommand :
Shop command string “save tunnelloss”.
- static save_xmlseries((object)filename) ShopCommand :
Shop command string “save xmlseries <filename>”.
- static save_xmlshopsimseries((object)filename) ShopCommand :
Shop command string “save xmlshopsimseries <filename>”.
- static set_bypass_loss((object)on) ShopCommand :
Shop command string “set bypass_loss /on|/off”.
- static set_capacity_all((object)value) ShopCommand :
Shop command string “set capacity /all <value>”.
- static set_capacity_bypass((object)value) ShopCommand :
Shop command string “set capacity /bypass <value>”.
- static set_capacity_gate((object)value) ShopCommand :
Shop command string “set capacity /gate <value>”.
- static set_capacity_spill((object)value) ShopCommand :
Shop command string “set capacity /spill <value>”.
- static set_code_full() ShopCommand :
Shop command string “set code /full”.
- static set_code_head() ShopCommand :
Shop command string “set code /head”.
- static set_code_incremental() ShopCommand :
Shop command string “set code /incremental”.
- static set_com_dec_period((object)value) ShopCommand :
Shop command string “set com_dec_period <value>”.
- static set_droop_discretization_limit((object)value) ShopCommand :
Shop command string “set droop_discretization_limit <value>”.
- static set_dyn_flex_mip((object)value) ShopCommand :
Shop command string “set dyn_flex_mip <value>”.
- static set_dyn_seg_incr() ShopCommand :
Shop command string “set dyn_seg /incr”.
- static set_dyn_seg_mip() ShopCommand :
Shop command string “set dyn_seg /mip”.
- static set_dyn_seg_on() ShopCommand :
Shop command string “set dyn_seg /on”.
- static set_fcr_d_band((object)value) ShopCommand :
Shop command string “set fcr_d_band <value>”.
- static set_fcr_n_band((object)value) ShopCommand :
Shop command string “set fcr_n_band <value>”.
- static set_fcr_n_equality((object)value) ShopCommand :
Shop command string “set fcr_n_equality <value>”.
- static set_gen_turn_off_limit((object)value) ShopCommand :
Shop command string “set gen_turn_off_limit <value>”.
- static set_headopt_feedback((object)value) ShopCommand :
Shop command string “set headopt_feedback <value>”.
- static set_max_num_threads((object)value) ShopCommand :
Shop command string “set max_num_threads <value>”.
- static set_merge_off() ShopCommand :
Shop command string “set merge /off”.
- static set_merge_on() ShopCommand :
Shop command string “set merge /on”.
- static set_merge_stop() ShopCommand :
Shop command string “set merge /stop”.
- static set_method_baropt() ShopCommand :
Shop command string “set method /baropt”.
- static set_method_dual() ShopCommand :
Shop command string “set method /dual”.
- static set_method_hydbaropt() ShopCommand :
Shop command string “set method /hydbaropt”.
- static set_method_netdual() ShopCommand :
Shop command string “set method /netdual”.
- static set_method_netprimal() ShopCommand :
Shop command string “set method /netprimal”.
- static set_method_primal() ShopCommand :
Shop command string “set method /primal”.
- static set_mipgap((object)absolute, (object)value) ShopCommand :
Shop command string “set mipgap /absolute|/relative <value>”.
- static set_newgate((object)on) ShopCommand :
Shop command string “set newgate /on|/off”.
- static set_nseg_all((object)value) ShopCommand :
Shop command string “set nseg /all <value>”.
- static set_nseg_down((object)value) ShopCommand :
Shop command string “set nseg /down <value>”.
- static set_nseg_up((object)value) ShopCommand :
Shop command string “set nseg /up <value>”.
- static set_parallel_mode_auto() ShopCommand :
Shop command string “set parallel_mode /auto”.
- static set_parallel_mode_deterministic() ShopCommand :
Shop command string “set parallel_mode /deterministic”.
- static set_parallel_mode_opportunistic() ShopCommand :
Shop command string “set parallel_mode /opportunistic”.
- static set_password((object)key, (object)value) ShopCommand :
Shop command string “set password <value>”.
- static set_power_head_optimization((object)on) ShopCommand :
Shop command string “set power_head_optimization /on|/off”.
- static set_prod_from_ref_prod() ShopCommand :
Shop command string “set prod_from_ref_prod”.
- static set_ramping((object)mode) ShopCommand :
Shop command string “set ramping <value>”.
- static set_reserve_ramping_cost((object)value) ShopCommand :
Shop command string “set reserve_ramping_cost <value>”.
- static set_reserve_slack_cost((object)value) ShopCommand :
Shop command string “set reserve_slack_cost <value>”.
- static set_time_delay_unit_hour() ShopCommand :
Shop command string “set time_delay_unit hour”.
- static set_time_delay_unit_minute() ShopCommand :
Shop command string “set time_delay_unit minute”.
- static set_time_delay_unit_time_step_length() ShopCommand :
Shop command string “set time_delay_unit time_step_length”.
- static set_timelimit((object)value) ShopCommand :
Shop command string “set timelimit <value>”.
- static set_universal_mip_not_set() ShopCommand :
Shop command string “set universal_mip /not_set”.
- static set_universal_mip_off() ShopCommand :
Shop command string “set universal_mip /off”.
- static set_universal_mip_on() ShopCommand :
Shop command string “set universal_mip /on”.
- static set_xmllog((object)on) ShopCommand :
Shop command string “set xmllog /on|/off”.
- property specifier
specifier of the command
- static start_shopsim() ShopCommand :
Shop command string “start shopsim”.
- static start_sim((object)iterations) ShopCommand :
Shop command string “start sim <iterations>”.
- class shyft.energy_market.stm.shop.ShopCommandList
Bases:
instance
A strongly typed list of ShopCommand.
- __init__((ShopCommandList)arg1) None
- __init__( (ShopCommandList)arg1, (ShopCommandList)clone) -> None :
Create a clone.
- append((ShopCommandList)arg1, (object)arg2) None
- extend((ShopCommandList)arg1, (object)arg2) None
- class shyft.energy_market.stm.shop.ShopSystem
Bases:
instance
A shop system, managing a session to the shop core.
- __init__((object)arg1, (UtcPeriod)arg2, (time)arg3) object :
Create shop system, initialize with fixed time resolution. note that you should provide valid period and reasonable dt
- __init__( (ShopSystem)arg1, (TimeAxis)time_axis) -> None :
Create shop system, initialize with time axis.
- collect((ShopSystem)self, (StmSystem)stm_system) None
- command_raw((ShopSystem)self, (object)command) None
- property commander
Get shop commander object.
- complete((ShopSystem)self, (StmSystem)stm_system) None
- emit((ShopSystem)self, (StmSystem)stm_system) None :
Emit a stm system into the shop core.
- static environment() None :
Print all environment variables to standard output.
- static environment_string() str :
Get all environment variables as a newline delimited string value.
- export_data((ShopSystem)self[, (object)all=False]) None
- export_data_string((ShopSystem)self[, (object)all=False]) str
- export_topology((ShopSystem)self[, (object)all=False[, (object)raw=False]]) None
- export_topology_string((ShopSystem)self[, (object)all=False[, (object)raw=False]]) str
- export_yaml_string((ShopSystem)self[, (object)input_only=False[, (object)compress_txy=False[, (object)compress_connection=False]]]) str
- get_executed_commands_raw((ShopSystem)self) StringVector
- get_log_buffer((ShopSystem)self[, (object)limit]) LogEntryList
- get_version_info((ShopSystem)self) str :
Get version information from the shop core.
- optimize((StmSystem)stm_system, (TimeAxis)time_axis, (ShopCommandList)commands, (object)logging_to_stdstreams, (object)logging_to_files) None
- optimize2((StmSystem)stm_system, (time)time_begin, (time)time_end, (time)time_step, (ShopCommandList)commands, (object)logging_to_stdstreams, (object)logging_to_files) None
- set_logging_to_files((ShopSystem)self[, (object)on=True]) None
- set_logging_to_stdstreams((ShopSystem)self[, (object)on=True]) None
- class shyft.energy_market.stm.shop.ShopCommander
Bases:
instance
A shop commander, utility for sending individual commands to the shop core.
- __init__()
Raises an exception This class cannot be instantiated from Python
- execute((ShopCommander)self, (ShopCommand)command) None :
Execute command object.
- execute_string((ShopCommander)self, (object)command_string) None :
Execute command string.
- executed((ShopCommander)self) ShopCommandList :
Get executed commands as objects.
- executed_strings((ShopCommander)self) StringVector :
Get executed commands as strings.
- log_file((ShopCommander)self) None :
Shop command string “log file”.
- log_file( (ShopCommander)self, (object)filename) -> None :
Shop command string “log file <filename>”.
- log_file_lp((ShopCommander)self, (object)filename) None :
Shop command string “log file /lp <filename>”.
- penalty_cost_all((ShopCommander)self, (object)value) None :
Shop command string “penalty cost /all <value>”.
- penalty_cost_discharge((ShopCommander)self, (object)value) None :
Shop command string “penalty cost /discharge <value>”.
- penalty_cost_gate_ramping((ShopCommander)self, (object)value) None :
Shop command string “penalty cost /gate /ramping <value>”.
- penalty_cost_load((ShopCommander)self, (object)value) None :
Shop command string “penalty cost /load <value>”.
- penalty_cost_overflow((ShopCommander)self, (object)value) None :
Shop command string “penalty cost /overflow <value>”.
- penalty_cost_overflow_time_adjust((ShopCommander)self, (object)value) None :
Shop command string “penalty cost /overflow_time_adjust <value>”.
- penalty_cost_powerlimit((ShopCommander)self, (object)value) None :
Shop command string “penalty cost /powerlimit <value>”.
- penalty_cost_reserve((ShopCommander)self, (object)value) None :
Shop command string “penalty cost /reserve <value>”.
- penalty_cost_reservoir_endpoint((ShopCommander)self, (object)value) None :
Shop command string “penalty cost /reservoir /endpoint <value>”.
- penalty_cost_reservoir_ramping((ShopCommander)self, (object)value) None :
Shop command string “penalty cost /reservoir /ramping <value>”.
- penalty_cost_soft_p_penalty((ShopCommander)self, (object)value) None :
Shop command string “penalty cost /soft_p_penalty <value>”.
- penalty_cost_soft_q_penalty((ShopCommander)self, (object)value) None :
Shop command string “penalty cost /soft_q_penalty <value>”.
- penalty_flag_all((ShopCommander)self, (object)on) None :
Shop command string “penalty flag /all /on|/off”.
- penalty_flag_discharge((ShopCommander)self, (object)on) None :
Shop command string “penalty flag /on|/off /discharge”.
- penalty_flag_gate_max_q_con((ShopCommander)self, (object)on) None :
Shop command string “penalty flag /on|/off /gate /max_q_con”.
- penalty_flag_gate_min_q_con((ShopCommander)self, (object)on) None :
Shop command string “penalty flag /on|/off /gate /min_q_con”.
- penalty_flag_gate_ramping((ShopCommander)self, (object)on) None :
Shop command string “penalty flag /on|/off /gate /ramping”.
- penalty_flag_load((ShopCommander)self, (object)on) None :
Shop command string “penalty flag /on|/off /load”.
- penalty_flag_plant_max_p_con((ShopCommander)self, (object)on) None :
Shop command string “penalty flag /on|/off /plant /max_p_con”.
- penalty_flag_plant_max_q_con((ShopCommander)self, (object)on) None :
Shop command string “penalty flag /on|/off /plant /max_q_con”.
- penalty_flag_plant_min_p_con((ShopCommander)self, (object)on) None :
Shop command string “penalty flag /on|/off /plant /min_p_con”.
- penalty_flag_plant_min_q_con((ShopCommander)self, (object)on) None :
Shop command string “penalty flag /on|/off /plant /min_q_con”.
- penalty_flag_plant_schedule((ShopCommander)self, (object)on) None :
Shop command string “penalty flag /on|/off /plant /schedule”.
- penalty_flag_powerlimit((ShopCommander)self, (object)on) None :
Shop command string “penalty flag /on|/off /powerlimit”.
- penalty_flag_reservoir_endpoint((ShopCommander)self, (object)on) None :
Shop command string “penalty flag /on|/off /reservoir /endpoint”.
- penalty_flag_reservoir_ramping((ShopCommander)self, (object)on) None :
Shop command string “penalty flag /on|/off /reservoir /ramping”.
- print_bp_curves((ShopCommander)self) None :
Shop command string “print bp_curves”.
- print_bp_curves_all_combinations((ShopCommander)self) None :
Shop command string “print bp_curves /all_combinations”.
- print_bp_curves_current_combination((ShopCommander)self) None :
Shop command string “print bp_curves /current_combination”.
- print_bp_curves_discharge((ShopCommander)self) None :
Shop command string “print bp_curves /discharge”.
- print_bp_curves_dyn_points((ShopCommander)self) None :
Shop command string “print bp_curves /dyn_points”.
- print_bp_curves_from_zero((ShopCommander)self) None :
Shop command string “print bp_curves /from_zero”.
- print_bp_curves_market_ref_mc((ShopCommander)self) None :
Shop command string “print bp_curves /market_ref_mc”.
- print_bp_curves_mc_format((ShopCommander)self) None :
Shop command string “print bp_curves /mc_format”.
- print_bp_curves_no_vertical_step((ShopCommander)self) None :
Shop command string “print bp_curves /no_vertical_step”.
- print_bp_curves_old_points((ShopCommander)self) None :
Shop command string “print bp_curves /old_points”.
- print_bp_curves_operation((ShopCommander)self) None :
Shop command string “print bp_curves /operation”.
- print_bp_curves_production((ShopCommander)self) None :
Shop command string “print bp_curves /production”.
- print_mc_curves((ShopCommander)self, (object)filename) None :
Shop command string “print mc_curves <filename>”.
- print_mc_curves_down((ShopCommander)self, (object)filename) None :
Shop command string “print mc_curves /down <filename>”.
- print_mc_curves_down_mod((ShopCommander)self, (object)filename) None :
Shop command string “print mc_curves /down /mod <filename>”.
- print_mc_curves_down_pq((ShopCommander)self, (object)filename) None :
Shop command string “print mc_curves /down /pq <filename>”.
- print_mc_curves_down_pq_mod((ShopCommander)self, (object)filename) None :
Shop command string “print mc_curves /down /pq /mod <filename>”.
- print_mc_curves_mod((ShopCommander)self, (object)filename) None :
Shop command string “print mc_curves /mod <filename>”.
- print_mc_curves_pq((ShopCommander)self, (object)filename) None :
Shop command string “print mc_curves /pq <filename>”.
- print_mc_curves_pq_mod((ShopCommander)self, (object)filename) None :
Shop command string “print mc_curves /pq /mod <filename>”.
- print_mc_curves_up((ShopCommander)self, (object)filename) None :
Shop command string “print mc_curves /up <filename>”.
- print_mc_curves_up_down((ShopCommander)self, (object)filename) None :
Shop command string “print mc_curves /up /down <filename>”.
- print_mc_curves_up_down_mod((ShopCommander)self, (object)filename) None :
Shop command string “print mc_curves /up /down /mod <filename>”.
- print_mc_curves_up_down_pq((ShopCommander)self, (object)filename) None :
Shop command string “print mc_curves /up /down /pq <filename>”.
- print_mc_curves_up_down_pq_mod((ShopCommander)self, (object)filename) None :
Shop command string “print mc_curves /up /down /pq /mod <filename>”.
- print_mc_curves_up_mod((ShopCommander)self, (object)filename) None :
Shop command string “print mc_curves /up /mod <filename>”.
- print_mc_curves_up_pq((ShopCommander)self, (object)filename) None :
Shop command string “print mc_curves /up /pq <filename>”.
- print_mc_curves_up_pq_mod((ShopCommander)self, (object)filename) None :
Shop command string “print mc_curves /up /pq /mod <filename>”.
- print_model((ShopCommander)self, (object)filename) None :
Shop command string “print model <filename>”.
- print_pqcurves_all((ShopCommander)self) None :
Shop command string “print pqcurves /all”.
- print_pqcurves_all( (ShopCommander)self, (object)filename) -> None :
Shop command string “print pqcurves /all <filename>”.
- print_pqcurves_convex((ShopCommander)self) None :
Shop command string “print pqcurves /convex”.
- print_pqcurves_convex( (ShopCommander)self, (object)filename) -> None :
Shop command string “print pqcurves /convex <filename>”.
- print_pqcurves_final((ShopCommander)self) None :
Shop command string “print pqcurves /final”.
- print_pqcurves_final( (ShopCommander)self, (object)filename) -> None :
Shop command string “print pqcurves /final <filename>”.
- print_pqcurves_original((ShopCommander)self) None :
Shop command string “print pqcurves /original”.
- print_pqcurves_original( (ShopCommander)self, (object)filename) -> None :
Shop command string “print pqcurves /original <filename>”.
- return_scenario_result_table((ShopCommander)self, (object)filename) None :
Shop command string “return scenario_result_table <filename>”.
- return_shopsimres((ShopCommander)self, (object)filename) None :
Shop command string “return shopsimres <filename>”.
- return_shopsimres_gen((ShopCommander)self, (object)filename) None :
Shop command string “return shopsimres /gen <filename>”.
- return_simres((ShopCommander)self, (object)filename) None :
Shop command string “return simres <filename>”.
- return_simres_gen((ShopCommander)self, (object)filename) None :
Shop command string “return simres /gen <filename>”.
- save_pq_curves((ShopCommander)self, (object)on) None :
Shop command string “save pq_curves /on|/off”.
- save_series((ShopCommander)self, (object)filename) None :
Shop command string “save series <filename>”.
- save_shopsimseries((ShopCommander)self, (object)filename) None :
Shop command string “save shopsimseries <filename>”.
- save_tunnelloss((ShopCommander)self) None :
Shop command string “save tunnelloss”.
- save_xmlseries((ShopCommander)self, (object)filename) None :
Shop command string “save xmlseries <filename>”.
- save_xmlshopsimseries((ShopCommander)self, (object)filename) None :
Shop command string “save xmlshopsimseries <filename>”.
- set_bypass_loss((ShopCommander)self, (object)on) None :
Shop command string “set bypass_loss /on|/off”.
- set_capacity_all((ShopCommander)self, (object)value) None :
Shop command string “set capacity /all <value>”.
- set_capacity_bypass((ShopCommander)self, (object)value) None :
Shop command string “set capacity /bypass <value>”.
- set_capacity_gate((ShopCommander)self, (object)value) None :
Shop command string “set capacity /gate <value>”.
- set_capacity_spill((ShopCommander)self, (object)value) None :
Shop command string “set capacity /spill <value>”.
- set_code_full((ShopCommander)self) None :
Shop command string “set code /full”.
- set_code_head((ShopCommander)self) None :
Shop command string “set code /head”.
- set_code_incremental((ShopCommander)self) None :
Shop command string “set code /incremental”.
- set_com_dec_period((ShopCommander)self, (object)value) None :
Shop command string “set com_dec_period <value>”.
- set_droop_discretization_limit((ShopCommander)self, (object)value) None :
Shop command string “set droop_discretization_limit <value>”.
- set_dyn_flex_mip((ShopCommander)self, (object)value) None :
Shop command string “set dyn_flex_mip <value>”.
- set_dyn_seg_incr((ShopCommander)self) None :
Shop command string “set dyn_seg /incr”.
- set_dyn_seg_mip((ShopCommander)self) None :
Shop command string “set dyn_seg /mip”.
- set_dyn_seg_on((ShopCommander)self) None :
Shop command string “set dyn_seg /on”.
- set_fcr_d_band((ShopCommander)self, (object)value) None :
Shop command string “set fcr_d_band <value>”.
- set_fcr_n_band((ShopCommander)self, (object)value) None :
Shop command string “set fcr_n_band <value>”.
- set_fcr_n_equality((ShopCommander)self, (object)value) None :
Shop command string “set fcr_n_equality <value>”.
- set_gen_turn_off_limit((ShopCommander)self, (object)value) None :
Shop command string “set gen_turn_off_limit <value>”.
- set_headopt_feedback((ShopCommander)self, (object)value) None :
Shop command string “set headopt_feedback <value>”.
- set_max_num_threads((ShopCommander)self, (object)value) None :
Shop command string “set max_num_threads <value>”.
- set_merge_off((ShopCommander)self) None :
Shop command string “set merge /off”.
- set_merge_on((ShopCommander)self) None :
Shop command string “set merge /on”.
- set_merge_stop((ShopCommander)self) None :
Shop command string “set merge /stop”.
- set_method_baropt((ShopCommander)self) None :
Shop command string “set method /baropt”.
- set_method_dual((ShopCommander)self) None :
Shop command string “set method /dual”.
- set_method_hydbaropt((ShopCommander)self) None :
Shop command string “set method /hydbaropt”.
- set_method_netdual((ShopCommander)self) None :
Shop command string “set method /netdual”.
- set_method_netprimal((ShopCommander)self) None :
Shop command string “set method /netprimal”.
- set_method_primal((ShopCommander)self) None :
Shop command string “set method /primal”.
- set_mipgap((ShopCommander)self, (object)absolute, (object)value) None :
Shop command string “set mipgap /absolute|/relative <value>”.
- set_newgate((ShopCommander)self, (object)on) None :
Shop command string “set newgate /on|/off”.
- set_nseg_all((ShopCommander)self, (object)value) None :
Shop command string “set nseg /all <value>”.
- set_nseg_down((ShopCommander)self, (object)value) None :
Shop command string “set nseg /down <value>”.
- set_nseg_up((ShopCommander)self, (object)value) None :
Shop command string “set nseg /up <value>”.
- set_parallel_mode_auto((ShopCommander)self) None :
Shop command string “set parallel_mode /auto”.
- set_parallel_mode_deterministic((ShopCommander)self) None :
Shop command string “set parallel_mode /deterministic”.
- set_parallel_mode_opportunistic((ShopCommander)self) None :
Shop command string “set parallel_mode /opportunistic”.
- set_password((ShopCommander)self, (object)key, (object)value) None :
Shop command string “set password <value>”.
- set_power_head_optimization((ShopCommander)self, (object)on) None :
Shop command string “set power_head_optimization /on|/off”.
- set_prod_from_ref_prod((ShopCommander)self) None :
Shop command string “set prod_from_ref_prod”.
- set_ramping((ShopCommander)self, (object)mode) None :
Shop command string “set ramping <value>”.
- set_reserve_ramping_cost((ShopCommander)self, (object)value) None :
Shop command string “set reserve_ramping_cost <value>”.
- set_reserve_slack_cost((ShopCommander)self, (object)value) None :
Shop command string “set reserve_slack_cost <value>”.
- set_time_delay_unit_hour((ShopCommander)self) None :
Shop command string “set time_delay_unit hour”.
- set_time_delay_unit_minute((ShopCommander)self) None :
Shop command string “set time_delay_unit minute”.
- set_time_delay_unit_time_step_length((ShopCommander)self) None :
Shop command string “set time_delay_unit time_step_length”.
- set_timelimit((ShopCommander)self, (object)value) None :
Shop command string “set timelimit <value>”.
- set_universal_mip_not_set((ShopCommander)self) None :
Shop command string “set universal_mip /not_set”.
- set_universal_mip_off((ShopCommander)self) None :
Shop command string “set universal_mip /off”.
- set_universal_mip_on((ShopCommander)self) None :
Shop command string “set universal_mip /on”.
- set_xmllog((ShopCommander)self, (object)on) None :
Shop command string “set xmllog /on|/off”.
- start_shopsim((ShopCommander)self) None :
Shop command string “start shopsim”.
- start_sim((ShopCommander)self, (object)iterations) None :
Shop command string “start sim <iterations>”.
Service
This module contains scripts and setup for starting up the Shyft energy market model services.
UI
The ‘UI’ module utilizes pyside/Qt to express web layouts, json-formatted information, that is feed back the front-end.
The sections of the layout can be filled with charts, tables etc, and where the data-binding of the content of those, can be setup to reflect back to the Shyft energy market servers, like the ‘DStmServer’, ‘DtsServer’, ‘TaskServer’ etc.
Note that currently Shyft does not currently contain a front end framework needed to render this on web, but the examples/demo section of the Shyft repository to contain angular examples using the Shyft services.
There are example that companies have created such front end in angular, data-driven, using these services, to support intraday and day-ahead market operations.
The basic idea here is to enable the cooperation of python skilled business users and professional software developers to work together efficiently.
The professional/dedicated software developers provide the tools/framework as needed, and the python skilled business users can then utilize their domain knowledge to orchestrate and provide operational software.
Thus, the goal is ensures fast time-to-useful software in operations, combining all the skills, energy market domain, front end/ux, and backend high performance services.
Since we currently uses Qt to express the UI layouts, there is no explicit doc for this, as it is standard documentation of Qt that applies to this part.
Note that the Qt/pyside2 is only used as a robust well documented tool to create data structures, from where we harvest/generate a json, using the attributes of Qt.
Any other framework, including python could do the job as well, as long as it at the end, generates the json formatted as required from the front end framework that you use.
To get an idea for how this works, with PySide2/Qt, look into the test_suites for shyft, https://gitlab.com/shyft-os/shyft/-/blob/master/python/test_suites/energy_market/ui/test_ui.py#L35
Shyft Energy Market user interface configuration api
- shyft.energy_market.ui.export(window: QWidget) str [source]
Export the window/QWidget layout to a json suitable for the front end framework. Note that the routine harvest the essential properties recursively starting at the top level. Ref. to the shyft/python/test_suites/energy_market/ui directory for examples.
- Parameters:
window (QWidget) – A QWidget containing the layout and components to be converted to a json string
- Return type:
A json formatted string that contains the essential information harvested from the QWidget
- shyft.energy_market.ui.export_print(window: QWidget, pretty: bool = False, indent: int = 2)[source]
Same as export, but using json loads and dumps to provide a pretty readable version.
- Parameters:
window (QWidget) – A QWidget containing the layout and components to be converted to a json string
pretty (bool) – If true then pretty format
indent (int) – The indent used to format th json
- Return type:
A json pretty formatted string that contains the essential information harvested from the QWidget
- class shyft.energy_market.ui.ItemDataProperty
Bases:
enum
- DataX = shyft.energy_market.ui._ui.ItemDataProperty.DataX
- DataY = shyft.energy_market.ui._ui.ItemDataProperty.DataY
- Decimals = shyft.energy_market.ui._ui.ItemDataProperty.Decimals
- ScaleX = shyft.energy_market.ui._ui.ItemDataProperty.ScaleX
- ScaleY = shyft.energy_market.ui._ui.ItemDataProperty.ScaleY
- Tags = shyft.energy_market.ui._ui.ItemDataProperty.Tags
- ValidationX = shyft.energy_market.ui._ui.ItemDataProperty.ValidationX
- ValidationY = shyft.energy_market.ui._ui.ItemDataProperty.ValidationY
- names = {'DataX': shyft.energy_market.ui._ui.ItemDataProperty.DataX, 'DataY': shyft.energy_market.ui._ui.ItemDataProperty.DataY, 'Decimals': shyft.energy_market.ui._ui.ItemDataProperty.Decimals, 'ScaleX': shyft.energy_market.ui._ui.ItemDataProperty.ScaleX, 'ScaleY': shyft.energy_market.ui._ui.ItemDataProperty.ScaleY, 'Tags': shyft.energy_market.ui._ui.ItemDataProperty.Tags, 'ValidationX': shyft.energy_market.ui._ui.ItemDataProperty.ValidationX, 'ValidationY': shyft.energy_market.ui._ui.ItemDataProperty.ValidationY}
- values = {256: shyft.energy_market.ui._ui.ItemDataProperty.DataX, 257: shyft.energy_market.ui._ui.ItemDataProperty.DataY, 258: shyft.energy_market.ui._ui.ItemDataProperty.Decimals, 259: shyft.energy_market.ui._ui.ItemDataProperty.ScaleX, 260: shyft.energy_market.ui._ui.ItemDataProperty.ScaleY, 261: shyft.energy_market.ui._ui.ItemDataProperty.ValidationX, 262: shyft.energy_market.ui._ui.ItemDataProperty.ValidationY, 263: shyft.energy_market.ui._ui.ItemDataProperty.Tags}
- class shyft.energy_market.ui.LayoutInfo
Bases:
instance
Provides layout information that can be leveraged by a renderer.
- __init__((LayoutInfo)arg1) None
- __init__( (LayoutInfo)self, (object)id, (object)name [, (object)json=’’]) -> None :
Construct a LayoutInfo from id, name, and json
- property id
identifying number
- Type:
int
- property json
Json-string containing layout information
- Type:
str
- property name
A descriptive name
- Type:
str
- class shyft.energy_market.ui.LayoutServer
Bases:
instance
The server-side components for layouts
- __init__((LayoutServer)self, (object)root_dir) None :
Creates a server object that serves models from root_dir. The root_dir will be create if it does not exsists.
- Parameters:
root_dir (str) – Path to the root-directory that keeps/will keep the model-files
- add_auth_tokens((LayoutServer)self, (StringVector)tokens) None :
Adds auth tokens, and activate authentication. The tokens is compared exactly to the autorization token passed in the request. Authorization should onlye be used for the https/wss, unless other measures(vpn/ssh tunnels etc.) are used to protect auth tokens on the wire
- Parameters:
() (tokens) – list of tokens, where each token is like Basic dXNlcjpwd2Q=, e.g: base64 user:pwd
- property auth_needed
returns true if the server is setup with auth-tokens, requires web-api clients to pass a valid token
- Type:
bool
- auth_tokens((LayoutServer)self) StringVector :
returns the registered authentication tokens.
- property fx
server-side callable function(lambda) that takes two parameters: name : the name of the layout fx_args: arbitrary string to pass to the server-side function The server-side fx is called when the client (or web-api) invoke the c.read_model_with_args(name,fx_args). The signature of the callback function should be fx_cb(name:str, fx_args:str)->str This feature is simply enabling the users to tailor server-side functionality in python!
Example
>>> from shyft.energy_market.ui import LayoutServer
>>> s=LayoutServer() >>> def my_fx(name:str, fx_args:str)->bool: >>> print(f'invoked with name={name} fx_args={fx_args}') >>> # note we can use captured Server s here!>>> return True >>> # and then bind the function to the callback >>> s.fx=my_fx >>> s.start_server() >>> : # later using client from anywhere to invoke the call >>> fx_result=c.fx('my_layout_id', 'my_args')
- get_listening_port((LayoutServer)self) int :
returns the port number it’s listening at for serving incoming request
- get_max_connections((LayoutServer)self) int :
returns the maximum number of connections to be served concurrently
- is_running((LayoutServer)self) bool :
true if server is listening and running
See also
start_server()
- remove_auth_tokens((LayoutServer)self, (StringVector)tokens) None :
removes auth tokens, if it matches all available tokens, then deactivate auth requirement for clients
- Parameters:
() (tokens) – list of tokens, where each token is like Basic dXNlcjpwd2Q=, e.g: base64 user:pwd
- set_listening_ip((LayoutServer)self, (object)ip) None :
set the listening port for the service
- Parameters:
ip (str) – ip or host-name to start listening on
- Returns:
nothing.
- Return type:
None
- set_listening_port((LayoutServer)self, (object)port_no) None :
set the listening port for the service
- Parameters:
port_no (int) – a valid and available tcp-ip port number to listen on.
20000 (typically it could be) –
- Returns:
nothing.
- Return type:
None
- set_max_connections((LayoutServer)self, (object)max_connect) None :
limits simultaneous connections to the server (it’s multithreaded, and uses on thread pr. connect)
- Parameters:
max_connect (int) – maximum number of connections before denying more connections
See also
get_max_connections()
- start_server((LayoutServer)self) int :
start server listening in background, and processing messages
See also
set_listening_port(port_no),is_running
- Returns:
port_no. the port used for listening operations, either the value as by set_listening_port, or if it was unspecified, a new available port
- Return type:
in
- start_web_api((LayoutServer)self, (object)host_ip, (object)port, (object)doc_root[, (object)fg_threads=2[, (object)bg_threads=4[, (object)tls_only=False]]]) None :
Start a web API for communicating with server
- Parameters:
host_ip (str) – 0.0.0.0 for any interface, 127.0.0.1 for local only, &c.
port (int) – port number to serve the web API on. Ensure it’s available
doc_root (str) – directory form which we will serve http/https documents.
fg_threads (int) – number of web API foreground threads, typically 1-4 depending on load.
bg_threads (int) – number of long running background thread workers to serve requests &c.
tls_only (bool) – default false, set to true to enforce tls sessions only.
- stop_server((LayoutServer)self[, (object)timeout=1000]) None :
stop serving connections, gracefully.
See also
start_server()
- stop_web_api((LayoutServer)self) None :
Stops any ongoing web API service.
- class shyft.energy_market.ui.LayoutClient
Bases:
instance
The client-side components for layouts
- __init__((LayoutClient)self, (object)host_port, (object)timeout_ms) None :
Creates a python client that can communicate with the corresponding server
- close((LayoutClient)self) None :
Close the connection. It will automatically reopen if needed.
- get_model_infos((LayoutClient)self, (IntVector)mids[, (UtcPeriod)created_in=[not-valid-period>]) ModelInfoVector :
returns all or selected model-info objects based on model-identifiers(mids)
- Parameters:
mids (IntVector) – empty = all, or a list of known exisiting model-identifiers
created_in (UtcPeriod) – For which period you are interested in model-infos.
- Returns:
model_infos. Strongly typed list of ModelInfo
- Return type:
- property host_port
Endpoint network address of the remote server.
- Type:
str
- property is_open
If the connection to the remote server is (still) open.
- Type:
bool
- read_model((LayoutClient)self, (object)mid) LayoutInfo :
Read and return the model for specified model-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
The resulting model from the server
- Return type:
- read_model_with_args((LayoutClient)self, (object)mid, (object)name, (object)args[, (object)store_layout=False]) LayoutInfo :
Read a layout from storage. If it is not found, it will try to generate a new layout based on provided arguments using the callback function on the server.
- Parameters:
mid (int) – Model ID of layout to read
name (str) – Name of layout, if it needs to be generated
args (str) – Json format of arguments to generate layout, if needed.
store_layout (bool) – If a new layout is generated, whether to store it on server. Defaults to False.
- Returns:
Read or generated LayoutInfo
- Return type:
- read_models((LayoutClient)self, (IntVector)mids) layoutInfoVector :
Read and return the model for specified model-identifier (mid)
- Parameters:
mids (Int64Vector) – A strongly typed list of ints, the model-identifers for the wanted models
- Returns:
The resulting model from the server
- Return type:
- property reconnect_count
Number of reconnects to the remote server that have been performed.
- Type:
int
- remove_model((LayoutClient)self, (object)mid) int :
Remove the specified model bymodel-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
ec. 0 or error-code?
- Return type:
int
- store_model((LayoutClient)self, (LayoutInfo)m, (ModelInfo)mi) int :
Store the model to backend, if m.id==0 then a new unique model-info is created and used
- property timeout_ms
Timout for remote server operations, in number milliseconds.
- Type:
int