ScEpTIC.emulator.energy.mcu_peripheral package

Subpackages

Submodules

ScEpTIC.emulator.energy.mcu_peripheral.SGP40 module

class ScEpTIC.emulator.energy.mcu_peripheral.SGP40.SGP40

Bases: VoltageDrawner

Energy model of a SGP40 VOC sensor https://sensirion.com/media/documents/296373BB/6203C5DF/Sensirion_Gas_Sensors_Datasheet_SGP40.pdf

STATES = ['measuring', 'off', 'idle']
attach_system_model(system_model)
datasheet_e = {'idle': {'I_max': '105u', 'I_min': '34u', 'V': 3.3}, 'measuring': {'I_max': '3.0m', 'I_min': '2.6m', 'V': 3.3}}
datasheet_t = {'idle': {'max': '0.6m', 'min': '0.4m'}, 'measuring': '30m'}
get_drained_energy(t)

Calculates the energy consumed by the component. :param t: elapsed time :return: the consumed energy

set_state(state)

Set state (off, on)

simulate_read()
simulate_set_state(state)

ScEpTIC.emulator.energy.mcu_peripheral.SHT85 module

class ScEpTIC.emulator.energy.mcu_peripheral.SHT85.SHT85

Bases: VoltageDrawner

Energy model of a SHT85 digital temperature humidity sensor https://sensirion.com/media/documents/4B40CEF3/640B2346/Sensirion_Humidity_Sensors_SHT85_Datasheet.pdf

CC_READ_COMMAND = 1
CC_READ_DATA = 2
STATES = ['on', 'off']
attach_system_model(system_model)
datasheet = {'I_max': '1500u', 'I_min': '600u', 'V': 3.3}
get_drained_energy(t)

Calculates the energy consumed by the component. :param t: elapsed time :return: the consumed energy

set_state(state)

Set state (off, on)

simulate_read()
simulate_set_state(state)
t_read = '15.5m'
t_wakeup = '1.5m'

ScEpTIC.emulator.energy.mcu_peripheral.camera_0V7620 module

class ScEpTIC.emulator.energy.mcu_peripheral.camera_0V7620.Camera0V7620Model

Bases: VoltageDrawner

Energy model of a OV7620 camera.

CC_READ = 1
CC_SET = 1
READ_DATA = 2000
STATES = ['on', 'off']
attach_system_model(system_model)
get_drained_energy(t)

Calculates the energy consumed by the component. :param t: elapsed time :return: the consumed energy

resistance = '42'
set_state(state)

Set state (off, on)

simulate_read(word_size)
simulate_set_state(state)
t_ready = '350m'
t_wakeup = '200m'

ScEpTIC.emulator.energy.mcu_peripheral.cc1101 module

class ScEpTIC.emulator.energy.mcu_peripheral.cc1101.CC1101Model

Bases: VoltageDrawner

Energy model of the CC1101 radio

BAUD_RATE = 500000
HEADER_BYTES = 10
PACKET_SIZE = 64
STATES = ['active', 'inactive', 'off']
attach_system_model(system_model)
data = {'active': {'I': '29.2m', 'V': 1.8}, 'inactive': {'I': '200n', 'V': 1.8}}
get_drained_energy(t)

Calculates the energy consumed by the component. :param t: elapsed time :return: the consumed energy

get_transmission_cycles(bytes)

Returns transmission cycles

get_wait_cycles(state)

Returns the MCU wait cycles required to get from self.state to state

get_wakeup_time(state)

Returns the time required to get from self.state to state

set_state(state)

Set radio state (off, inactive, active)

simulate_set_state(state)
simulate_transmit(bytes, word_bytes=2)
t_wakeup = {'inactive': {'active': '240u'}, 'off': {'active': '390u', 'inactive': '150u'}}

ScEpTIC.emulator.energy.mcu_peripheral.external_nvm module

class ScEpTIC.emulator.energy.mcu_peripheral.external_nvm.ExternalNVM(chip_name)

Bases: MCUPeripheral

External NVM chip

attach_voltage_source(source)
Parameters:

source – a voltage source

execute_action(operation_code, system_model, n_bytes=0, additional_op_mode_name=None)

Executes a peripheral action :param operation_code: the operation code (ExternalNVMProtocolAction) :param system_model: the system model :param n_bytes: the number of bytes, if the operation code is READ_BYTE or WRITE_BYTE :param additional_op_mode_name: additional operation mode name for metrics collection :return: the number of executed clock cycles

get_min_v()
Returns:

the minimum voltage required by the external NVM to operate

get_power_state_events()
Returns:

a list of PowerStateEvent events that are occurring

get_state()
Returns:

the power state and the current state

get_wait_cycles()
Returns:

the cycles the MCU needs to wait to send the next command / bit

set_power_state(power_state)

Sets the NVM power state (ON / OFF) :param power_state: the NVM power state (instance of NVMPowerState)

set_state(state)

Sets the NVM state (STANDBY / OPERATING) :param state: the NVM state (instance of ExternalNVMState)

ScEpTIC.emulator.energy.mcu_peripheral.generic_sensor module

class ScEpTIC.emulator.energy.mcu_peripheral.generic_sensor.GenericADCSensorModel

Bases: VoltageDrawner

Energy model of a generic ADC sensor model

CC_SET = 1
STATES = ['on', 'off']
attach_system_model(system_model)
data = {'I': '4.5u', 'V': '5'}
get_drained_energy(t)

Calculates the energy consumed by the component. :param t: elapsed time :return: the consumed energy

set_state(state)

Set state (off, on)

simulate_read(n_samples)
simulate_set_state(state)

ScEpTIC.emulator.energy.mcu_peripheral.options module

class ScEpTIC.emulator.energy.mcu_peripheral.options.ExternalNVMState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Enum specifying the NVM chip state

OPERATING = 'OPERATING'
STANDBY = 'STANDBY'
class ScEpTIC.emulator.energy.mcu_peripheral.options.MCUPeripheralPowerStateBehaviour(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Enum specifying the behaviour of the peripheral’s power state

ALWAYS_ON = 'ALWAYS_ON'
FOLLOW_MCU = 'FOLLOW_MCU'
class ScEpTIC.emulator.energy.mcu_peripheral.options.NVMPowerState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Enum indicating the MCU state

OFF = 'OFF'
ON = 'ON'

Module contents

class ScEpTIC.emulator.energy.mcu_peripheral.MCUPeripheral

Bases: VoltageDrawner

Generic peripheral that attaches to the MCU

attach_mcu(mcu)

Attaches the mcu to the peripheral :param mcu: the MCU energy model

get_drained_energy(t)

Calculates the energy consumed by the component and follows MCU power state. :param t: elapsed time :return: the consumed energy

get_power_state_events()
Returns:

a list of PowerState events that are occurring

set_power_state_behaviour(behaviour)

Sets the power-state behaviour of the peripheral :param behaviour: a MCUPeripheralPowerStateBehaviour enum