bus2RLSpec

Create reinforcement learning data specifications for elements of a Simulink bus

Syntax

specs = bus2RLSpec(busName)
specs = bus2RLSpec(busName,Name,Value)

Description

specs = bus2RLSpec(busName) creates a set of reinforcement learning data specifications from the Simulink® bus specified by busName. One specification element is created for each leaf element in the bus. Use these specifications to define actions and observations for a Simulink reinforcement learning environment.

specs = bus2RLSpec(busName,Name,Value) specifies options for creating specifications using one or more Name,Value pair arguments.

Input Arguments

collapse all

Name of Simulink bus object, specified as a string or character vector.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'DiscreteElements',{'force',[-5 0 5]} sets the 'force' bus element to be a discrete data specification with three possible values, -5, 0, and 5

Name of the Simulink model, specified as the comma-separated pair consisting of 'Model' and a string or character vector. Specify the model name when the bus object is defined in the model global workspace (for example, in a data dictionary) instead of the MATLAB® workspace.

Names of bus leaf elements for which to create specifications, specified as the comma-separated pair consisting of BusElementNames' and a string array. To create observation specifications for a subset of the elements in a Simulink bus object, specify BusElementNames. If you do not specify BusElementNames, a data specification is created for each leaf element in the bus.

Note

Do not specify BusElementNames when creating specifications for action signals. The RL Agent block must output the full bus signal.

Finite values for discrete bus elements, specified as the comma-separated pair consisting of 'DiscreteElements' and a cell array of name-value pairs. Each name-value pair consists of a bus leaf element name and an array of discrete values. The specified discrete values must be castable to the data type of the specified action signal.

If you do not specify discrete values for an element specification, the element is continuous.

Example: 'ActionDiscretElements',{'force',[-10 0 10],'torque',[-5 0 5]} specifies discrete values for the 'force' and 'torque' leaf elements of a bus action signal.

Output Arguments

collapse all

Data specifications for reinforcement learning actions or observations, returned as one of the following:

  • rlNumericSpec object for a single continuous bus element

  • rlFiniteSetSpec object for a single discrete bus element

  • Array of data specification objects for multiple bus elements

By default, all data specifications for bus elements are rlNumericSpec objects. To create a discrete specification for one or more bus elements, specify the element names using the DiscreteElements name-value pair.

Introduced in R2019a