start_capture

typhoon.test.capture.start_capture(duration, offset_absolute=0, offset_relative=None, rate='Max', signals=(), trigger_source='Forced', trigger_threshold=None, trigger_edge=None, trigger_use_first_occurence=True, fileName='', executeAt=None, timeout=None, absolute_time=False)

Sets up capture settings and start capture.

It is a simplified version of regular Typhoon HIL API start_capture() function, with all the settings in just one function. It also omits some arguments that could be derived automatically.

For more details refer to HIL API documentation.

Parameters:
  • duration – Total capture duration, in seconds, including offset

  • offset_absolute – Duration in seconds of the data captured before the trigger. Can’t be greater than duration.

  • offset_relative

    Relative duration, in percentage, of the data capture before the trigger. Can’t be greater than 100.

    Note

    Users should only use either offset_absolute or offset_relative. If both are defined, offset_relative will be used.

  • rate

    Sampling rate in samples per second

    Note

    The sampling rate and duration can be arbitrarily defined, however they might not be valid depending on HIL constraints. When this is the case, the closest possible settings will be used, showed as a warning and returned from the function call.

  • signals

    List of signals to be captured. No distinction is made between analog or digital as there cannot exist two signals with the same name

    Note

    At least one signal must be defined in signals list.

  • trigger_source

    Signal to be used to trigger the capture

    Note

    trigger_source defaults to “Forced” if not defined. If defined with a value other than that, trigger_threshold and trigger_edge should be defined too.

  • trigger_threshold – Level the trigger_source signal should attain to start capture

  • trigger_edge – Direction of the trigger_source signal should have, when attaining trigger_threshold, to start capture. Can be “rising” or “falling”.

  • trigger_use_first_occurence

    If offset duration is larger than available before trigger, to consider only the amount available (setting to True) or ignore trigger and look for another one later on (setting to False).

    Note

    trigger_use_first_occurence should only be used as False when dealing with pure periodic signals and when offset should be strictly respected.

  • fileName

    File name to save captured data

  • executeAt – If set, simulation time when this start_capture will take effect

  • timeout – Maximum allowed time to wait before a trigger

  • absolute_time – If True, time index of capture time is real time

Returns:

  • namedtuple – With the following attributes:

  • t (Timedelta) – The time of the capture start

  • duration (float) – Adjusted capture duration

  • rate (float) – Rate based on system constraints.

Examples

Forced capture start, printing returned values:

>>> from typhoon.test.capture import start_capture
>>> capture_info = start_capture(duration=10, rate=10000)
>>> print(capture_info.t)
>>> print(capture_info.duration)
>>> print(capture_info.rate)

No offset, using analog signal as trigger:

>>> start_capture(duration=rtspec.duration+2,
                  rate=500,
                  signals=["Probe val", "enable inv", "enable ref"],
                  trigger_source="Probe val",
                  trigger_edge="Rising edge"
                  trigger_threshold=277
                  timeout=10)

Using absolute offset and trigger on digital signal:

>>> start_capture(duration=4,
                  offset_absolute=2,
                  rate=500,
                  signals=["P", "operating"],
                  trigger_source="operating",
                  trigger_threshold=0.5,
                  trigger_edge="Rising edge",
                  timeout=10)