AlphasenseOpcN3

Description

The AlphasenseOpcN3 object implements a driver for the USB-ISS-based Alphasense OPC-N3 sensor.

› Inherits:SerialPortBusNode

Properties

binCounts

This property holds the number of particles in the individual bins.

› Type:List
› Signal:binCountsChanged()
› Attributes:Readonly

deviceInformation

This property holds a device information string containing hardware and software information.

› Type:String
› Signal:deviceInformationChanged()
› Attributes:Readonly, Requires Polling

error

This property holds the most recently occurred error or AlphasenseOpcN3.NoError if no error occurred. If the same error occurs multiple times this property does not change. Use the errorOccurred() signal to detect multiple occurrences of the same error.

› Type:Error
› Signal:errorChanged()
› Attributes:Readonly

errorString

This property holds the current human readable error string corresponding to the current value in the error property. It may include additional information such as failure reasons or locations.

› Type:String
› Signal:errorStringChanged()
› Attributes:Readonly

fan

This property holds the status of the fan inside the OPC-N3 sensor.

› Type:Boolean
› Default:false
› Signal:fanChanged()
› Attributes:Writable

initialized

This property holds whether the communication with the OPC-N3 sensor has been initialized successfully.

› Type:Boolean
› Signal:initializedChanged()
› Attributes:Readonly

laser

This property holds the status of the laser inside the OPC-N3 sensor.

› Type:Boolean
› Default:false
› Signal:laserChanged()
› Attributes:Writable

massPM10

This property holds the mass concentration PM10 in μg/m³.

› Type:Float
› Signal:massPM10Changed()
› Attributes:Readonly

massPM1_0

This property holds the mass concentration PM1.0 in μg/m³.

› Type:Float
› Signal:massPM1_0Changed()
› Attributes:Readonly

massPM2_5

This property holds the mass concentration PM2.5 in μg/m³.

› Type:Float
› Signal:massPM2_5Changed()
› Attributes:Readonly

mtof

This property holds represents the average amount of time that particles sized in the stated bin took to cross the OPS’s laser beam. Each value is in 1/3 µs. i.e. a value of 10 would represent 3.33 µs.

› Type:List
› Signal:mtofChanged()
› Attributes:Readonly

pollMassConcentrationsOnly

This property holds whether to poll the mass concentrations massPM1_0, massPM2_5 and massPM10 only when polling the values property. This reduces both communication traffic with the sensor and the CPU load of the device. Set to false if any other measurements such as binCounts or temperature are required.

› Type:Boolean
› Signal:pollMassConcentrationsOnlyChanged()
› Attributes:Readonly

relativeHumidity

This property holds the measured relative humidity.

› Type:Float
› Signal:relativeHumidityChanged()
› Attributes:Readonly

samplingFlowRate

This property holds represents the sample flow rate in ml/s x100

› Type:SignedInteger
› Signal:samplingFlowRateChanged()
› Attributes:Readonly

samplingPeriod

This property holds the measure of the histogram’s actual sampling period in seconds x100

› Type:SignedInteger
› Signal:samplingPeriodChanged()
› Attributes:Readonly

serialNumber

This property holds the serial number of the sensor.

› Type:String
› Signal:serialNumberChanged()
› Attributes:Readonly, Requires Polling

temperature

This property holds the measured temperature.

› Type:Float
› Signal:temperatureChanged()
› Attributes:Readonly

values

This property holds all available values provided for convenience in the following order:

If pollMassConcentrationsOnly is set to false the following properties are appended additionally:

› Type:List
› Signal:valuesChanged()
› Attributes:Readonly, Requires Polling

Methods

pollDeviceInformation()

This method polls the deviceInformation property. It is called automatically when using a Polling property modifier on this property and usually does not have to be called manually.

pollSerialNumber()

This method polls the serialNumber property. It is called automatically when using a Polling property modifier on this property and usually does not have to be called manually.

pollValues()

This method polls the values property. It is called automatically when using a Polling property modifier on this property and usually does not have to be called manually.

reset()

This method resets the communication with the OPC-N3 sensor and reloads all parameters and properties. This method should be called on communication errors.

Signals

errorOccurred()

This signal is emitted whenever an error has occurred, regardless of whether the error property has changed or not. In contrast to the change notification signal of the error property this signal is also emitted several times if a certain error occurs several times in succession.

Enumerations

Error

This enumeration describes all errors which can occur in AlphasenseOpcN3 objects. The most recently occurred error is stored in the error property.

Name Value Description
AlphasenseOpcN3.NoError 0 No error occurred or was detected.
AlphasenseOpcN3.InvalidSerialPort 1 No serial port has been specified.
AlphasenseOpcN3.SerialPortOpenError 2 Could not open or configure specified serial port.
AlphasenseOpcN3.CommunicationError 3 Error while communicating with the Alphasense OPC-N3 sensor.
AlphasenseOpcN3.ResponseTimeoutError 4 Did not receive response to request within 5000 ms.

Example

import InCore.Foundation 2.5
import InCore.IO 2.5

Application {

    AlphasenseOpcN3 {
        id: primarySensor
        serialPort: SerialPort { portName: "ttyACM0" }
        onSerialNumberChanged: console.log(serialNumber)
        onDeviceInformationChanged: console.log(deviceInformation)
        Polling on values { interval: 1000 }
        onValuesChanged: console.log(values)
        pollMassConcentrationsOnly: false
    }

    // mockup for multi-device configuration by serial number

    property list<SerialPort> availableDevices
    property list<AlphasenseOpcN3> devices

    Gather on availableDevices {
        source: SerialPortManager { }
        expressionFilter: item.vendorIdentifier === 0x04d8 && item.productIdentifier === 0xffee
    }

    Repeater on devices {
        model: config.objects
        AlphasenseOpcN3 {
            Select on serialPort {
                source: availableDevices
                select: item.serialNumber === modelData.serialNumber.data
            }
        }
    }

    property var config: Configuration {
        name: "Alphasense OPC-N3 devices"
        objectId: "opcN3Devices"
        id: config

        Repeater on objects {
            model: 3

            ConfigurationObject {
                id: configObject
                objectId: ("opcN3Device%1").arg(("0"+(index+1)).slice(-2))
                property int orderIndex: index

                property var enabled: ConfigurationItem {
                    id: enabled;
                    name: "Enabled"
                    data: false
                    dataType: ConfigurationItem.Boolean;
                    view: DataObjectView { widget: DataObjectView.Switch; orderIndex: 1 }
                }

                property var name: ConfigurationItem {
                    id: name;
                    name: "Name"
                    data: ("OPC-N3 %1").arg(index+1)
                    dataType: ConfigurationItem.String;
                    view: DataObjectView { widget: DataObjectView.TextInput; orderIndex: 2 }
                }

                property var serialNumber: ConfigurationItem {
                    id: serialNumber;
                    name: "Modbus device ID"
                    dataType: ConfigurationItem.UnsignedInteger;
                    data: 0
                    view: DataObjectView {
                        widget: DataObjectView.Combobox;
                        orderIndex: 3;
                        widgetData: {
                            var map = {};
                            for( var i = 0; i < availableDevices.length; ++i )
                            {
                                map[availableDevices.serialNumber] = "OPC-N3 " + availableDevices.serialNumber;
                            }
                            return map;
                        }
                    }
                }
            }
        }
    }
}