Documentation Home Page OPAL-RT Dashboard Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »


class opalone._internal.datapoints.Datapoint(datapoint_id, project_id, datapoint_type, data_type, path)

Bases: Resource, ABC

Base class for all datapoints. Cannot be instantiated, must use subclass.

A data point is an element contained in an entity, for example, a Model, which can be probed and have its value set by or sent to another simulation component.

Parameters:
  • datapoint_id (str) – The ID of the datapoint.

  • project_id (str) – The ID of the Project that owns the datapoint.

  • datapoint_type (str | DatapointType) – The type of datapoint.

  • data_type (Data) – A data value holder.

Raises:

TypeError – If the data value holder is not of the correct type.

connect_to(datapoint, is_enabled=True, force_enable=False)

Connect the current datapoint to another datapoint.

If the connection to create is enabled, i.e. is_enabled=True, and any datapoint in this new connection is actively connected to another datapoint, then some connection rules will apply and the new connection might be declared invalid. If force_enable=True, conflicting connections will be disabled in favor of the new connection.

Some data types are incompatibles between one another, so that might result in an invalid connection. For example, a STRING data type cannot connect to a NUMERIC data type.

If the backend reports the connection to be invalid, this method will attempt to connect the other way around. For example, if A.connect_to(B) fails on the backend, this method will attempt the equivalent of B.connect_to(A). If this connection also fails, the first failure will be reported to the user.

Parameters:
  • datapoint (str | Datapoint) – The datapoint to connect to, either an ID or a datapoint object..

  • is_enabled (bool) – A flag to enable (True) or disable (False) the connection to create.

  • force_enable (bool) – A flag to drop (True) or not (False) any conflicting connections that already exist in the system.

Returns:

A new connection instance

Return type:
delete()

Delete the current resource, which is done by suppressing its ID.

to_json(fields, values)

Convert this resource to a serialized JSON representation.

Parameters:
  • fields (tuple[str] | list[str]) – Fields to include.

  • values (tuple[object] | list[object]) – The value of each field

Returns:

The serialized JSON representation.

Return type:

str

property connections: tuple[Connection]

The connections going to this datapoint.

A connection allows describing a transfer of data between two datapoints.

property data_type: DataType

The data type of the datapoint.

This property is read-only, it cannot be modified.

property default_value: bool | str | float | dict

The default value of this datapoint.

The default value’s type is determined at runtime and depends on the Data type of the datapoint.

This property is read-only, it cannot be modified.

property id: str

The ID of the resource.

This property is read-only, it cannot be modified.

property is_displayed_on_canvas: bool

Indicates if this datapoint is displayed on canvas (True) or not (False). If True, the datapoint and its value are displayed on the UI next to the block.

property is_favorite: bool

Indicates if this datapoint is a favorite (True) or not (False). If True, the datapoint is displayed in the favorite section in the UI.

property is_visible: bool

Indicates if this datapoint is visible (True) or not (False).

This property is read-only, it cannot be modified.

property name: str

The name of the datapoint.

This property is read-only, it cannot be modified.

property path: str

Path of a Datapoint in the model, seperated with “/”

property ref_id: str

The reference ID of the datapoint.

This ID is only useful to lookup the datapoint’s library data.

This property is read-only, it cannot be modified.

property size: tuple[int]

Array of values describing the size of multidimensional datapoints. Equals to (1) for scalars, (1, N) for row vectors, (M, 1) for column vectors, (M, N) for matrices and (D1, D2…, Dn) more generally.

This property is read-only, it cannot be modified.

property type: DatapointType

The type of the datapoint.

This property is read-only, it cannot be modified.

property unit: str

The units of the datapoint.

Example units: Volts, Amperes, seconds, etc.

This property is read-only, it cannot be modified.

abstract property value: object

The current value for this parameter.

The value’s type is determined at runtime and depends on the Data type of the datapoint.

  • No labels