ops.simulation — Simulates communication with the production system

This module contains the SimulatedDeviceInterface class.

The SimulatedDeviceInterface Class

class ops.simulation.SimulatedDeviceInterface
A drop-in replacement for DeviceInterface that simulates communication with an FCI-7011 fiber coupler production system, so that the application can be tested without access to an actual system.

Simulation Parameters

SimulatedDeviceInterface.finalTemperatureFromCurrent
An instance of numpy.poly1d that determines the temperature (in °C) the simulated device’s heater will reach, but not exceed, for a given heating current (in mA).
SimulatedDeviceInterface.voltageFromTemperature
An instance of numpy.poly1d that determines the simulated device’s temperature sensor voltage (in V) for the given heating temperature (in °C).
SimulatedDeviceInterface.tau
A time constant used to control the speed the simulated device’s heating temperature changes. Inversely proportional to that speed.
SimulatedDeviceInterface.heaterMovementRate

The speed the simulated device’s heater can move at, expressed as the fraction of the distance from its rearmost position to its foremost position it covers in one second. (Values greater than 1.0 are possible if the heater can cover that distance in less than one second.)

This assumes that the heater can accelerate and decelerate instantly, which is unrealistic but should suffice for simulation purposes.

Heating

SimulatedDeviceInterface.heatingCurrent
The simulated device’s heating current, in mA. Read-only. To change the heating current, use the startHeatingWithCurrent() method.
SimulatedDeviceInterface.temperatureSensorVoltage

The simulated system’s temperature sensor’s voltage, in V. Read-only.

Note

The value of this property assumes that the temperature sensor is able to get an accurate temperature reading, which will not always be the case for an actual device.

The temperature sensor voltage is calculated from temperature each time this property is accessed. As a result, it may be distorted by changes to the system clock and by leap seconds.

SimulatedDeviceInterface.temperature

The simulated system’s heating temperature temperature, in °C. Read-only.

Note

This property exists for testing purposes only. It is not provided by the real DeviceInterface class, since an actual device’s heating temperature is not readily available (but see the temperature property of ProductionSystem.)

The temperature is calculated from the time the heating current was last changed and the temperature at that time each time this property is accessed. As a result, it may be distorted by changes to the system clock and by leap seconds.

SimulatedDeviceInterface.startHeatingWithCurrent(current)
Sets the simulated device’s heating current to current, in mA.

Heater Movement

SimulatedDeviceInterface.heaterPosition

The position of the simulated device’s heater, as a fraction of the distance between rearmost position (0.0) and foremost position (1.0). Read-only. To move the heater to another position, use the startHeaterMovement() method.

The position is calculated from the time the last movement command was issued and the position of the heater at that time each time this property is accessed. As a result, it may be distorted by changes to the system clock and by leap seconds.

SimulatedDeviceInterface.heaterTargetPosition

The position the heater is supposed to be at, as a fraction of the distance between rearmost position (0.0) and foremost position (1.0).

If heaterTargetPosition is not equal to heaterPosition, the heater is still moving to its target position.

Read-only. To change the heater’s target position, use the startHeaterMovement() method.

SimulatedDeviceInterface.startHeaterMovement(targetPosition)

Moves the heater to the given position, expressed as a fraction of the distance between rearmost position (0.0) and foremost position (1.0).

This method is asynchronous. Moving the heater can take several seconds, but this method returns immediately.

To check which position the heater is currently moving to, use heaterTargetPosition; to get its actual position use heaterPosition.

Testing

SimulatedDeviceInterface.isSimulation
Indicates whether this class just simulates communication with a device. (It does.) Immutable.
SimulatedDeviceInterface.speedFactor
The factor by which the simulation is sped up. Setting this property to, say, 5.0 greatly reduces the time required to test the application. Needless to say, the property is not provided by the real DeviceInterface class. Mutable.