virtualpump

This module can be used to simulate the I/O behaviour of a TURBOVAC pump and thus enable testing the program without access to an actual pump.

class turboctl.virtualpump.virtualpump.VirtualPump

This class simulates a TURBOVAC pump and tries to respond to signals the same way a physical pump would. This makes it possible to test the turboctl package without connecting to a physical pump.

connection

Simulates the serial connection.

Type:

VirtualConnection

parameter_component

Handles access to pump parameters.

Type:

ParameterComponent

hardware_component

Simulates pump hardware.

Type:

HardwareComponent

__init__()

Initialize a new VirtualPump.

__enter__()

Called at the beginning of a with block; returns self.

__exit__(type_, value, traceback)

Called upon exiting a with block; calls stop().

stop()

Close parallel threads by calling connection.close() and hardware_component.stop().

process(bytes_in)

Process incoming data.

This function processes the data sent to the virtual pump by interpreting it as a telegram and performing any commands specified by it (such as changing parameter values). A reply telegram is then formed and its contents returned.

Parameters:

bytes_in – The telegram sent to the pump as a bytes object.

Returns:

The telegram sent back from the pump as a bytes object. If bytes_in cannot be interpreted as a valid telegram, the return value will be an empty bytes object.