Class RecorderModule
Represents a module for recording IRecordable.
Implements
Inherited Members
Namespace: Loehnert.Lisrt.IO.Beckhoff.Recording
Assembly: Loehnert.Lisrt.IO.Beckhoff.dll
Syntax
public class RecorderModule : LisrtModule, INotifyPropertyChangedEx, ILisrtModule, INotifyPropertyChanged, IHasServiceView
Examples
This example shows the usage of the RecorderModule
// Create an ADS-IO Master and add an oversampling terminal for 100 kS/s
// and an analog input terminal for current.
var ioMaster = new EthercatAdsIOMasterModule("AdsMaster");
var oversamplingTerminal = new EL3702(samplesCount: 100, sampleCycleTimeInMicroSeconds: 10.0);
oversamplingTerminal.Inputs[0].Name = "Voltage1";
var analogInputTerminal = new EL3024();
analogInputTerminal.Inputs[2].Name = "Current1";
// Analog and digital non-oversampling inputs must be activated
analogInputTerminal.Inputs[2].IsRecordable = true;
ioMaster.Terminals.Add(new EK1200());
ioMaster.Terminals.Add(oversamplingTerminal);
ioMaster.Terminals.Add(analogInputTerminal);
// Create a recorder for the two required inputs
var channelsToRecord = new IRecordable[]
{
oversamplingTerminal.Inputs[0],
analogInputTerminal.Inputs[2],
};
var recorder = new RecorderModule("Recorder", channelsToRecord);
// Record 1000 milliseconds
var recordingTask = recorder.RecordAsync(recordTimeInMS: 1000);
var recordedWaveforms = recordingTask.Result;
IWaveform voltage1 = recordedWaveforms["Voltage1"];
This example shows how to record
var recordingTask = recorder.RecordAsync(recordTimeInMS: 1000);
// Do some stuff
recorder.Stop(); // only required if you want to stop before the record time elapsed
var waveformsByKey = recordingTask.Result;
// Do anything with the record. E. g. plot it into a window.
Plotter.Plot(waveformsByKey.Values);
Constructors
RecorderModule(String, IEnumerable<IRecordable>)
Initializes a new instance of the RecorderModule class.
Declaration
public RecorderModule(string name, IEnumerable<IRecordable> recordables)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of the module. |
IEnumerable<IRecordable> | recordables | Recordable objects. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
System.ArgumentException | Thrown when an item of |
Properties
Icon
Gets an icon which is representative for the module.
Declaration
public override Uri Icon { get; }
Property Value
Type | Description |
---|---|
Uri |
Overrides
Methods
RecordAsync(Int32)
Asynchronously records the recordables.
Declaration
public async Task<IReadOnlyDictionary<string, IWaveform>> RecordAsync(int recordTimeInMS)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | recordTimeInMS | Time for recording in milliseconds. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyDictionary<String, IWaveform>> | A System.Threading.Tasks.Task representing the asynchronous recording. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown when |
System.InvalidOperationException | Thrown when the recorder is still recording. |
System.OperationCanceledException | Thrown when the task is canceled. |
TimeBetweenPointsDiffersException | Thrown when the time spans between the points of a waveform aren't equal. This occurs, for example, if timing configuration of an oversampling input terminal (e.g. EL3702) is wrong. |
RecordAsync(Int32, CancellationToken)
Asynchronously records the recordables.
Declaration
public async Task<IReadOnlyDictionary<string, IWaveform>> RecordAsync(int recordTimeInMS, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | recordTimeInMS | Time for recording in milliseconds. |
System.Threading.CancellationToken | cancellationToken | A cancellation token for canceling the recording task. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyDictionary<String, IWaveform>> | A System.Threading.Tasks.Task representing the asynchronous recording. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown when |
System.InvalidOperationException | Thrown when the recorder is still recording. |
System.OperationCanceledException | Thrown when the task is canceled. |
TimeBetweenPointsDiffersException | Thrown when the time spans between the points of a waveform aren't equal. This occurs, for example, if timing configuration of an oversampling input terminal (e.g. EL3702) is wrong. |
ShowServiceView()
Shows the service window.
Declaration
public void ShowServiceView()
Stop()
Stops recording.
Declaration
public void Stop()
Remarks
This method doesn't wait for the recording to finish. To await the recording use for example System.Threading.Tasks.Task.Wait or Result of the task returned by RecordAsync(Int32).