src.tlan.tarlanIntervals

Classes

IntervalList

Contain intervals for when data streams are enabled.

TarlanSubcycle

IntervalList which contains streams of each subcycle. These have to be

Module Contents

class src.tlan.tarlanIntervals.IntervalList(name)

Contain intervals for when data streams are enabled. Intervals may be open in contrast to TimeInterval, which must contain closed intervals

Parameters:

name (str)

name
_streams = []
__repr__()
property state: bool
Raises:

RuntimeError – if the last stream contains more than one on and off value(should never happen, but who knows…)

Returns:

state (on/off) of data stream.

Return type:

bool

property is_off: bool

If stream is turned off

Type:

bool

Return type:

bool

property is_on: bool

If stream is turned on

Type:

bool

Return type:

bool

turn_on(time, line)

Turn on data stream.

Parameters:
  • time (float) – time at which to turn on the stream

  • line (int) – line in the tlan file. Used for error handling only.

Raises:

TarlanError – if stream is on already

Return type:

None

turn_off(time, line)

Turn off data stream.

Parameters:
  • time (float) – time at which to turn off the stream

  • line (int) – line in the tlan file. Used for error handling only.

Raises:

TarlanError – if stream is off or if time is before time of switching on

property nstreams: int

Number of streams

Type:

int

Return type:

int

__len__()

Number of streams

Type:

int

Return type:

int

property intervals: src.timeInterval.TimeIntervalList

Return the on-time of the streams as a list of TimeIntervals

Type:

list[TimeInterval]

Return type:

src.timeInterval.TimeIntervalList

property last_turn_off: float

Last time when the stream was turned off

Raises:

RuntimeError – If there stream has not been turned off yet.

Return type:

float

property last_turn_on: float

Last time when the stream was turned on

Raises:

RuntimeError – If there stream has not been turned on yet.

Return type:

float

delete_open_interval()

Delete last interval with ontime if the stream is on.

class src.tlan.tarlanIntervals.TarlanSubcycle

Bases: IntervalList

IntervalList which contains streams of each subcycle. These have to be added when stream is turned off.

data_intervals = []
turn_off(time, line, datastreams)

Stop subcycle

Parameters:
  • time (float) – time at which to turn off the stream

  • line (int) – line in the tlan file. Used for error handling only.

  • datastreams (dict) – dictionary of stream name – stream IntervalList pairs

Raises:

TarlanError – if stream is off already