simprocesd.model.sensors package

Submodules

simprocesd.model.sensors.part_sensor module

class simprocesd.model.sensors.part_sensor.OutputPartSensor(machine, part_probes, sensing_interval=0, name=None, data_capacity=inf, value=0)

Bases: Sensor

Sensor for measuring a Machine’s processed Parts.

Will measure Parts that the Machine finished processing, Part does have to pass downstream before it is measured.

Parameters
  • machine (Machine) – A Machine whose produced parts will be measured.

  • sensing_interval (int, default=0) – How many Parts to skip after last measured Part. Setting this to 0 means every part will be checked. First Part is always measured.

  • name (str, default=None) – Name of the object. If name is None then the object’s name will be changed to OutputPartSensor_<id>

  • data_capacity (int, optional) – Number of most recent entries to store. Limits the object’s maximum memory usage.

  • value (float, default=0) – Starting value of the OutputPartSensor.

initialize(env)

Prepare Asset for simulation and reset attributes to starting values.

In most cases this is called automatically by the System. Needs to be called manually if the Asset was initialized with is_transitory set to True.

Parameters

env (Environment) – Environment used by the simulating System.

simprocesd.model.sensors.sensor module

class simprocesd.model.sensors.sensor.AttributeProbe(attribute_name, target)

Bases: Probe

A probe that measures an object’s attribute.

Parameters
  • attribute_name (str) – Name of the attribute to be measured.

  • target (object) – Target of the probe.

class simprocesd.model.sensors.sensor.PeriodicSensor(interval, probes, name=None, data_capacity=inf, value=0)

Bases: Sensor

Sensor that takes a periodic measurement.

First measurement is made at simulation time <interval>

Parameters
  • interval (float) – Duration of time between measurements. Measured in simulation time.

  • probes (list) – List of probes to use for measurements.

  • name (str, optional) – Name of the Sensor. If name is None then the Sensor’s name will be changed to Sensor_<id>

  • data_capacity (int, optional) – Number of most recent entries to store. Limits the Sensor’s maximum memory usage.

  • value (float, default=0) – Starting value of the Sensor.

initialize(env)

Prepare Asset for simulation and reset attributes to starting values.

In most cases this is called automatically by the System. Needs to be called manually if the Asset was initialized with is_transitory set to True.

Parameters

env (Environment) – Environment used by the simulating System.

class simprocesd.model.sensors.sensor.Probe(get_data, target)

Bases: object

Measuring component of a Sensor.

Parameters
  • get_data (function) – A function that represents taking a measurement. Function signature is get_data(target) and it must return the measurement data.

  • target (object) – Target of the probe.

probe()

Take a measurement with this Probe.

Returns

Measurement data.

Return type

object

class simprocesd.model.sensors.sensor.Sensor(probes, name=None, data_capacity=inf, value=0)

Bases: Asset

A Sensor uses Probes to collect data and store that data.

When a measurement is taken the Sensor will use all provided Probes and record that data.

Parameters
  • probes (list) – List of probes to use for measurements.

  • name (str, optional) – Name of the Sensor. If name is None then the Sensor’s name will be changed to Sensor_<id>

  • data_capacity (int, optional) – Number of most recent entries to store. Limits the Sensor’s maximum memory usage.

  • value (float, default=0) – Starting value of the Sensor.

data

Key: probe object. Value: list of probe data in the order the measurements were taken.

Type

dictionary

add_on_sense_callback(callback)

Register a function to be called every time sensor makes a measurement.

The callback function will be called with:
time: float
Current simulation time.
sense_data: list
List of probe data [probe1_data, probe2_data, …]
Parameters

callback (function) – callback(sensor, time, sense_data)

initialize(env)

Prepare Asset for simulation and reset attributes to starting values.

In most cases this is called automatically by the System. Needs to be called manually if the Asset was initialized with is_transitory set to True.

Parameters

env (Environment) – Environment used by the simulating System.

property last_sense

List of Probe measurement data from the last measurement or an empty list if no measurement has been made yet.

property probes

List of Sensor’s Probes.

sense()

Make Sensor take a measurement with all of its probes and record the data.

Module contents