SetOfVariables

class sharpy.io.inout_variables.SetOfVariables[source]

Iterable class containing the input and output variables

variables

List of Variable

Type

list(Variable)

encode()[source]

Encode output variables in binary format with little-endian byte ordering.

The signal consists of a 5-byte header RREF0 followed by 8 bytes per variable. Of those 8 bytes allocated to each variable, the first 4 are the integer value of the variable index and the last 4 are the single precision float value.

Returns

Encoded message of length 5 + num_var * 8.

Return type

bytes

get_value(data, timestep_index=- 1)[source]

Gets the value from the data structure for output variables

Parameters
  • data (sharpy.presharpy.PreSharpy) – the standard SHARPy class

  • timestep_index (int (optional)) – Integer representing the time step value. Defaults to -1 i.e. the last one available.

set_value(values)[source]

Sets the values of the input variables.

Parameters

values (list(tuple)) – List of tuples containing the index and value of the respective input variables.