OptrisOptrisDocumentation

Documentation/OTC SDK/Optris.Sdk — C# API referencev12.0

SimulatedProcessInterface

public sealed class SimulatedProcessInterface

The wire side of a simulated camera's process interface: what the outside world is doing to its input pins.

Obtained from ThermalCamera.AttachSimulatedProcessInterface(…). Everything above the wire is reached the ordinary way, through ThermalCamera.OpenProcessInterface: the channel table, the decoded inputs, the output read-back and the alarm signals are the shipping code, not a second implementation.

There is deliberately no setter for an output. An output is what the SDK drove, and a test that could write one could end up asserting on its own input. Read them back with ProcessInterface.ReadDigitalOutput(…) or ProcessInterface.ReadAll.

This object holds no unmanaged resource of its own: it is a view of the camera it came from, and goes away with it. Detaching the interface is SimulatedProcessInterface.Detach.

Example

await using var camera = ThermalCamera.OpenSimulated();
SimulatedProcessInterface wire =
    camera.AttachSimulatedProcessInterface(PifDeviceKind.Standard);

using ProcessInterface pif = camera.OpenProcessInterface();
pif.Configure([
    new PifChannel
    {
        Index = 0,
        Direction = PifDirection.Input,
        Signal = PifSignal.Analog,
        Kind = PifChannelKind.Emissivity,
    },
]);

wire.SetAnalogInput(0, volts: 4.0f);
pif.Poll();
Console.WriteLine(pif.ReadAnalogInput(0));

SimulatedProcessInterface: methods

public void ClearExternalProbeTemperature()

Take the probe reading away, as a frame carrying none would: a probe unplugged, or one that has stopped answering.

  • Throws FeatureNotSupportedException: The interface has been detached.
  • Throws ObjectDisposedException: The camera has been disposed.

The missing half of SimulatedProcessInterface.SetExternalProbeTemperature(…). Without it this interface could give a reading but never remove one, so the case that matters could not be reached without hardware, and the SDK held the last reading for ever.

Afterwards ProcessInterface.ExternalProbeTemperature is null, SignalField.ProbeTemperature is no longer valid, a rule on the probe goes AlarmState.Orphaned and a AlarmCompare.Invalid watchdog on it fires.

Calling it with no reading set is not an error.

public void Detach()

Unplug the interface again.

  • Throws ObjectDisposedException: The camera has been disposed.

ThermalCamera.TryOpenProcessInterface(…) then answers false as it did before. Any ProcessInterface still held on the removed controller reports that it is stale rather than dereferencing it.

public void SetAnalogInput(int index, float volts)

Drive one analog input pin, in volts.

  • index: Flat pin index, below the attached layout's SimulatedPifLayout.AnalogInputCount.

  • volts: The reading a multimeter on that pin would show, before any channel decode. What ProcessInterface.ReadAnalogInput(…) then answers depends on the channel configured over it.

  • Throws FeatureNotSupportedException: The interface has been detached.

  • Throws SdkConfigurationException: index is past the attached layout.

  • Throws ObjectDisposedException: The camera has been disposed.

public void SetDetectedKind(PifDeviceKind kind, SimulatedPifLayout? layout = null)

Connect an interface to the camera's socket, to be found by the next ProcessInterface.RedetectIdentity.

  • kind: What is now on the connector. PifDeviceKind.None models one that has been removed or powered down.

  • layout: What that interface can do, adopted as the capabilities when it is found. null for the same default ThermalCamera.AttachSimulatedProcessInterface(…) uses.

  • Throws FeatureNotSupportedException: The interface has been detached.

  • Throws ObjectDisposedException: The camera has been disposed.

This changes nothing by itself, exactly as plugging a cable in changes nothing until the camera is asked. The identity, the capabilities and the channel layout all move on the next ProcessInterface.RedetectIdentity and not before, so the sequence an application actually performs (notice the socket is empty, plug something in, press "detect again") is the sequence a test performs.

This is what attaching again cannot model. Attaching replaces the controller and makes every handle stale, which is a box swapped on the connector; an interface found on the socket that was always there is the same controller, so a ProcessInterface an application is holding stays valid and its own ProcessInterface.RedetectIdentity is the call under test.

A ProcessInterface.DeclareIdentity(…) still does not move the capabilities: that would make a test's stated layout a suggestion. This call moves them because it models the hardware changing rather than the application asserting.

public void SetDigitalInput(int index, bool high)

Drive one digital input pin.

  • index: Flat pin index, below the attached layout's SimulatedPifLayout.DigitalInputCount.

  • high: The level to put on the pin.

  • Throws FeatureNotSupportedException: The interface has been detached.

  • Throws SdkConfigurationException: index is past the attached layout.

  • Throws ObjectDisposedException: The camera has been disposed.

public void SetExternalProbeTemperature(float celsius)

Put an external temperature probe reading on the interface, in the SDK's temperature unit (Celsius unless Sdk.TemperatureUnit chose Fahrenheit), as a frame carrying one would.

  • celsius: The temperature the probe reports, in the SDK's temperature unit, whatever the parameter's name says.

  • Throws FeatureNotSupportedException: The interface has been detached.

  • Throws ObjectDisposedException: The camera has been disposed.

A probe reading does not arrive on a channel (it is decoded out of the frame's process-interface telemetry), so there is no pin to drive and this is the only way to produce one without hardware. It reads back from ProcessInterface.ExternalProbeTemperature and is published as SignalField.ProbeTemperature, so an alarm rule on the probe fires here exactly as it would on a camera with one fitted. Only on an interface attached as PifDeviceKind.TemperatureProbe, as on a real camera: on any other kind the reading is ignored and ProcessInterface.ExternalProbeTemperature stays null.

public void StepFailSafeWatchdog()

Advance the fail-safe watchdog by one check, as a passing health check on a real camera would.

  • Throws FeatureNotSupportedException: The interface has been detached.
  • Throws ObjectDisposedException: The camera has been disposed.

The fail-safe line is deliberately not driven by ProcessInterface.Poll: on a real camera it moves only when the frame watchdog says the pipeline is alive, so a line that kept alternating because an application kept polling would tell a PLC "the camera is healthy" when it means "this process is still running". A simulated camera has no such watchdog, and tying the line to synthetic frames would make the alternation a matter of timing. This is the explicit step instead: the line moves if and only if the configured period has elapsed, exactly as the real check does.