Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Page Content

Table of Contents
minLevel1
maxLevel3
include
outlinefalse
indent
excludePage Content
typelist
class
printablefalse

class DataloggerApi.Frame

...

A frame may be incomplete when retrieved from a running model.

Attributes (private):

  • timestamps (tuple of float): the timestamps (in nanoseconds) of the recorded data.

  • signals_data (tuple of tuple of float): list of values per recorded signal present in the frame.

  • signal_count (int): number of signals returned.

  • step_count (int): number of steps filled (corresponds to the number of values returned for each signal).

  • time_step_ns (int): step duration in nanoseconds.

  • is_complete True when this is the last (or only) part of the frame, False otherwise.

get_signal_count()

Returns signal count.

...

Related methods: SignalGroup.get_frame_config() SignalGroup.configure_frame()

Args:

  • signal_names (tuple of str): list of signals for which the values must be retrieved.

  • start_time_ns (int): start time of the frame in nanoseconds (file interface only).

  • frame_size_ns (int): frame size in nanoseconds. 0 (default): the frame is auto-sized.

  • step_count (int): number of steps per frame.

get_frame_size()

Returns the frame size (nanoseconds).

...

Set frame size (nanoseconds).

Args:

  • frame_size_ns (int): the required frame size in nanoseconds.

Background Colorinfo
color#D3D3D3

Note: This size must not be greater than the one defined with the GUI when interacting with a running model.

set_signals(signal_names)

...

Defines the list of signals that must be recorded.

Args:

  • signal_names (tuple of str): tuple containing the names of the signals to record.

#D3D3D3
Background Color
color
Info

Note: The signal source from the SignalInfo class may be used to build the list of signal names. The SignalGroup.get_signals_info() method returns the signal group’s list of signal infos.

set_start_time(start_time_ns)

Set the frame start time (in nanoseconds).

Args:

  • start_time_ns (int): start time of the frame (file interface only).

set_step_count(step_count)

Set the number of steps in the frame.

Args:

  • step_count (int): number of steps in the frame.

set_step_count_from_duration(duration_ns, time_step_ns)

...

Utility method to simplify call to set_step_count().

Args:

  • duration_ns (int): duration of the frame in nanoseconds.

  • time_step_ns (int): time step of the frame in nanoseconds.

DataloggerApi.RecordingStatus

...

SignalGroup can be connected to a dedicated signal group or to a .oprec file.

Args:

  • arg1 (str): IP address (live streaming) or file name (file streaming).

  • arg2 (str or int): connection port or signal group name (live streaming) or default value (file streaming).

clear_trigger()

Removes a previously defined trigger.

#D3D3D3
Background Color
color
Info

Note: Only available for file streaming.

close()

Close the connection to the DataLoggerTool.

...

This function MUST be called before any call to get_frame().

Args:

  • frame_config (FrameConfig): frame configuration parameters.

configure_trigger(trigger_config)

Updates trigger configuration.

Args:

  • trigger_config (TriggerConfig): trigger configuration with the following attributes set appropriately: trigger_level, trigger_type, trigger_holdoff.

get_file_name()

Retrieves the recording file name.

...

Returns: (Frame) filled with the values of the configured signals.

Raises:

  • DataloggerApi.dlogutillib_no_data_available: No data are available, try later to get next frame data (live streaming only).

get_timestamp_range()

Retrieves information about the timestamps (min and max).

...

Converts current instance to other file type and save it to the file system.

#D3D3D3
Background Color
color
Info

Notes:

  • Only file related signal group may be converted to other file type. Stream based signal group cannot be converted yet.

  • Configure a frame (start time + step count) to convert a subset of the file.

  • See FileType class for the list of types (opal/convert/file_type.py)

    Code Block
    languagepy
    from opal.convert.file_type import FileType
    signal_group.save_as(FileType.csv)

Args:

  • dest_type (FileType): the type to convert to.

  • dest_file_path (str): full path to the destination file. If not specified, the current file path is used with the file extension replaced.

Returns: (str): generated output file path.

...

set_trigger(trigger_config)

Set new trigger.

Args:

  • trigger_config (TriggerConfig): trigger configuration with the following attributes set appropriately: signal_name, trigger_type, trigger_level, offset_sec.

Background Colorinfo
color#D3D3D3

Note: Only available for file streaming.

start_recording(file_name=”)

Starts the recording of the .oprec file.

Args:

  • file_name (str): the file name used to store signals’ values. When not specified, the preconfigured file name is used along with integer id. This id is incremented for each started record.

stop_recording()

Stops the recording of the .oprec file.

...

This class is instantiated by the get_signal_groups_info() function.

Args:

  • id (str): unique recorder identifier.

  • recorderName (str): Recorder name as seen in UI.

  • name (str): signal group name.

  • filename (str): file name defined for the signal group.

  • port (int): TCP/IP port used to communicate with the signal group.

get_filename()

Returns the file name associated with the signal group.

...

class DataloggerApi.SignalInfo(source=”, type=”, destination=”, id=”, direction=”, label=”, alias=”)

Detailled Detailed information on a signal.

This class is instantiated by SignalGroup.get_signals_info().

Args:

  • source (str): Connection point name in the model. This is the name used to configure the frame (see FrameConfig.set_signals()).

  • type (str): Type of connection point (the source).

  • destination (str): Connection point name in the Datalogger.

  • id (str): Unique identifier of the connection between model and Datalogger.

  • direction (str): Direction of

    datalogged

    recorded data.

  • label (str): Signal’s label.

  • alias (str): Alias set by user on the signal.

get_alias()

Returns signal alias.

...

This class is instantiated by SignalGroup.get_step_info()

Args:

  • time_step_ns (int): time step in nanoseconds.

get_time_step()

Returns time step in nanoseconds.

...

Range of timestamps.

Args:

  • min_timestamp_ns (int): minimum timestamp of the range in nanoseconds.

  • max_timestamp_ns (int): maximum timestamp of the range in nanoseconds.

get_max_time()

Returns max timestamp (in nanoseconds).

...

Related methods: SignalGroup.set_trigger() SignalGroup.get_trigger_config() SignalGroup.configure_trigger()

Args:

  • signal_name (str): Trigger signal name (file trigger only).

  • type (TriggerConfig.type): Trigger type.

  • level (float): Reference value activating the trigger.

  • holdoff_steps (int): Percentage of the record length allocated to the values before the trigger

  • event occurs (live trigger only).

  • offset_sec (float): Offset in seconds (file trigger only).

get_holdoff()

Returns trigger holdoff.

...

get_type()

Returns trigger type.

color
Background Color
Info
#D3D3D3

Note: See TriggerConfig.type for available type values.

set_holdoff(trigger_holdoff)

Set trigger holdoff (in computation steps).

Args:

  • trigger_holdoff (int): number of steps before re-arming the trigger.

set_level(trigger_level)

Set trigger level.

Args:

  • trigger_level (float): reference value used for the trigger.

set_offset(offset_sec)

Set offset (in seconds).

Useful when working on OPREC files.

Args:

  • offset_sec (float): defines starting point from which to take the trigger into account.

set_signal(signal_name)

Set signal name.

Args:

  • signal_name (str): name of the signal used for the trigger.

set_type(trigger_type)

Set trigger type.

Args:

  • trigger_type (TriggerConfig.type): defines the type of trigger (

    egde

    edge rising/falling or level high/low).

type

  • alias of Enum

DataloggerApi.enum(**enums)

...

Retrieves information about signal groups.

Args:

  • ip (str): IP address to query for available data loggers.

Returns: (tuple of SignalGroup) tuple of SignalGroup objects.