﻿<?xml version="1.0" encoding="utf-8"?>
<!--
 baseName defines the (starting) name part used in ui-tabs per chamber
 dtPattern is the date/time pattern used in the output log files. 
-->
<ekConfiguration xmlns="http://olfasense.com/ek250/Schema" dtPattern="yyyy-MM-dd HH:mm:ss" baseName="EK250">

    <!-- list of available connectors -->
    <connectors>

        <!-- 
            'name' - human readable label,
            'type' - some unique id, see below
            
            NOTE: the label on some quantities is used to locate certain sensors/devices for the
            conditioning dialog/mode. These are: Flow, (starts with Abs. Hum.) and (starts with Rel. Hum.)
            
            'protocol' - currently, either 'modbus' or 'custom', required        
            'driver' - if custom is specified above, this names the class handling custom communication, optional             
        -->
        
        <connector name="Inlet Flow" type="azbilMFC" protocol="Modbus">

            <!-- 
                each connector instance defines how it connects to the actual device. currently only serial
                is supported, but network or something might work as well
             -->

            <serial baud="9600" stopBits="Two" parity="None"/>

            <!--
            optional element, only applies to modbus (not! optional for modbus connectors)
            'singleWrite' - true/false (default), modbus specific, certain devices only allow to write one register at a time (ENDA)
            'slaveAddress' - defaults to 1, modbus specific (necessary once you have multiple sensors on one port or
                             a device cannot be configured to use address 1. 
            -->
            <modbus slaveAddress="1" singleWrite="false"/>

            <!-- 
              each connector lists one or more quantities it can measure/read and potentially set/write
              each such quantity defines: (attribute names in quotes)
              * an unique 'id' (across all quantities from all connectors)
              * human readable 'label'
              * human readable 'unit' label
              * whether or not the quantity is read only ('readonly')
              * 'formatString' to e.g. allow a fixed amount of decimal places
              * 'minSetPoint' and 'maxSetPoint' for the allowed range of the set point                        
              * 'readSetPointOnConnect' whether or not to read the current set point from the device upon connecting to it
              * 'warnLimits' - true/false, warn use when setting set point above or below certain values
              * 'warnLow' and 'warnHigh', thresholds to issue warnings for potentially damaging set points (see warnLimits)
            -->

            <quantities>
                <quantity label="Flow" readonly="false" unit="l/min" formatString="0.00" minSetPoint="0"
                          maxSetPoint="12" readSetPointOnConnect="true" dataType="Integer16" factor="0.01">
                    <!--
                      * for Modbus devices/sensor, a sub element (named modbus) defining the modbus related properties:
                      * 'source' register the process value is read from
                      * 'sink' register the set point is written to
                      * 'dataType' one of "Float32", "Integer16" or "Integer32"
                      * 'conversionRule' one of: 
                              - Identity (data read is logged unaltered)
                              - Reverse (bytes are reversed before converting to number)
                              - FlipWords (flip bytes positions per 16-Bit, hex: A39E -> 3AE9
                              - ReverseFlip (flip then reverse) 
                    -->
                    <modbus source="1207" sink="1401" />
                </quantity>
            </quantities>
        </connector>

        <connector name="Chamber Conditions (RE92)" type="PCE-RE92" protocol="Modbus">
            
            <serial baud="9600" stopBits="Two" parity="None"/>
            <modbus slaveAddress="1" singleWrite="false"/>
            <quantities>

                <quantity label="Abs. Hum. Inlet" readonly="false" unit="PU" formatString="0.0" minSetPoint="0"
                          maxSetPoint="30" readSetPointOnConnect="true" dataType="Float32">
                    <modbus source="7006" sink="7246" />
                </quantity>
                <quantity label="Rel. Hum. Chamber" readonly="true" unit="% r.h." formatString="0.0"
                          readSetPointOnConnect="true" dataType="Float32"
                          minSetPoint="20" maxSetPoint="100">
                    <modbus source="7014" />
                </quantity>
                <quantity label="Temp. Chamber" readonly="true" unit="°C" formatString="0.0"
                          readSetPointOnConnect="true" dataType="Float32"
                          minSetPoint="20" maxSetPoint="80">
                    <modbus source="7004" />
                </quantity>
            </quantities>
        </connector>

        
        <connector name="Incubator (Binder)" type="RD3" protocol="Modbus">


            <serial baud="9600" parity="None" stopBits="One"/>
            <modbus slaveAddress="1" singleWrite="false"/>

            <quantities>
                <quantity warnLimits="true" warnLow="0" warnHigh="69" label="Temp. Incub." readonly="false"
                          unit="°C" formatString="0.0" minSetPoint="0" maxSetPoint="215" dataType="Float32"
                           readSetPointOnConnect="true">
                    <modbus source="64" sink="835" conversionRule="FlipWords" />
                </quantity> 
                <quantity label="Incub. Fan" readonly="false" unit="%" formatString="0" minSetPoint="0"
                          maxSetPoint="100" readSetPointOnConnect="true" dataType="Float32">
                    <modbus source="80" sink="839"  conversionRule="FlipWords"/>
                </quantity>
            </quantities>
        </connector>



    </connectors>

</ekConfiguration>