device.mockup module

class device.mockup.Discharge(duration, peak_power, t_rise=5, t_tail=3)[source]

Bases: object

commentary()[source]

Fancy messages that are triggered during the discharge. Returns None when no new message is availible

measure_power()[source]

Fancy time evolution of “power output” during a discharge. Returns a tuple (time, power).

property phase
start()[source]
property time
class device.mockup.MockupDevice(constants=None, **kwargs)[source]

Bases: HardwareBase

A mockup class to demonstrate HardwareBase functionalities and the integration with DeviceClient.

HardwareBase features:
  • Manual connect, disconnect or automatic via calling is_ready

  • Manual command interrupt

  • Automatic safety kill-switch called in the case of interrupt or error

  • Thread-safety = only one command at a time (via @base_command, …)

    => this is required for calls made by DeviceClient

  • Info, warning, error logging (to console and file)

DeviceClient features:
  • Autoconnect and check connection via calls to is_ready

  • Run user commands with parameters

  • Run custom periodic commands in background

  • Display info messages

  • Display a graph

emit_mockfile(device_client)[source]
initiate_discharge(device_client, duration)[source]

Simulated: Discharge with a specified time duration. It just reads power output from device and emits some meassages (‘commands’).

is_some_switched_on()[source]
raw_command(command)[source]

Simulated: Send a command to the device.

read_power_output()[source]

Simulated: Measure power output, returns tuple (time, power).

set_some_switch(enabled)[source]

See: toggle_connection_stability()

toggle_connection_stability()[source]

Simulated: Trigger someone-is-messing-with-the-cable problems.

update_frontend(device_client)[source]

Update displayed power output data.