<?xml version="1.0" encoding="UTF-8"?>
<sml:SensorML xmlns:sml="http://www.opengis.net/sensorML/1.0.1"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:swe="http://www.opengis.net/swe/1.0.1" xmlns:gml="http://www.opengis.net/gml"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xsi:schemaLocation="http://www.opengis.net/sensorML/1.0.1 http://schemas.opengis.net/sensorML/1.0.1/sensorML.xsd"
    version="1.0.1">
    <sml:member>
        <sml:System gml:id="ADCP_System">
            <gml:description>System Description for the ADCP deployment at MVCO, version 2.1</gml:description>
            <gml:name>ADCP System</gml:name>

            <!--~~~~~~~~~~~~~~~-->
            <!-- System Inputs -->    
            <!--~~~~~~~~~~-~~~~-->
            <sml:inputs>
                <sml:InputList>
                    <sml:input name="seaWaterPressure">
                        <swe:ObservableProperty definition="urn:MVCO:property:seaWaterPressure"/>
                    </sml:input>
                    <sml:input name="temperature">
                        <swe:ObservableProperty definition="urn:MVCO:property:seaWaterTemperature"/>
                    </sml:input>
                    <sml:input name="volumetricBackscatter">
                        <swe:ObservableProperty definition="urn:ogc:property:OGC:volumetricScatter">
                            <gml:description>doppler backscatter</gml:description>
                        </swe:ObservableProperty>
                    </sml:input>
                    <sml:input name="particleMotion">
                        <swe:ObservableProperty definition="urn:ogc:property:OGC:particleMotion">
                            <gml:description></gml:description>
                        </swe:ObservableProperty>
                    </sml:input>
                </sml:InputList>
            </sml:inputs>
            
            <!--~~~~~~~~~~~~~~~~-->
            <!-- System Outputs -->    
            <!--~~~~~~~~~~-~~-~~-->
            <sml:outputs>
                <sml:OutputList>
                    <sml:output name="systemOutputs">
                        <swe:DataRecord>
                            <swe:field name="time">
                                <swe:Time definition="urn:ogc:phenomenon:time:iso8601"/>
                            </swe:field>
                            <swe:field name="lat">
                                <swe:Quantity definition="urn:ogc:def:property:latitude">
                                    <swe:uom code="deg"/>
                                </swe:Quantity> 
                            </swe:field>
                            <swe:field name="lon">
                                <swe:Quantity definition="urn:ogc:def:property:longitude">
                                    <swe:uom code="deg"/>
                                </swe:Quantity> 
                            </swe:field>
                        </swe:DataRecord>
                    </sml:output>
                    
                    <sml:output name="Pressure_QC_ChainOutputs">
                        <swe:DataRecord>
                            <swe:field name="cleanedPressureTimeSeries">  <!-- This is optional to ADCP systems -->
                                <swe:Quantity definition="urn:MVCO:property:meanSeaWaterPressure">
                                    <swe:uom code="cm" ></swe:uom>
                                </swe:Quantity>
                            </swe:field>
                            <swe:field name="dataGapFlag">
                                <swe:Category definition="http://mmisw.org/ont/mvco/qcflag/dataGapFlag">
                                    <swe:codeSpace xlink:href="http://mmisw.org/ont/mvco/flag"/>
                                </swe:Category>
                            </swe:field> 
                            <swe:field name="aggregatePressureFlag">
                                <swe:Category definition="http://mmisw.org/ont/mvco/qcflag/aggregatePressureFlag">
                                    <swe:codeSpace xlink:href="http://mmisw.org/ont/mvco/flag"/>
                                </swe:Category>
                            </swe:field>
                        </swe:DataRecord>
                    </sml:output>
                    
                    <sml:output name="PressureObsProcessOutputs">
                        <swe:DataRecord>
                            <!-- this should be single value -->
                            <swe:field name="meanSeaWaterPressure"> 
                                <swe:Quantity definition="urn:MVCO:property:meanSeaWaterPressure">
                                    <swe:uom code="cm"></swe:uom>
                                </swe:Quantity>
                            </swe:field>
                            <swe:field name="waveHeightFromPressure">
                                <swe:Quantity definition="urn:MVCO:property:waveHeightFromPressure">
                                    <swe:uom code="cm"></swe:uom>
                                </swe:Quantity> 
                            </swe:field>
                            <swe:field name="wavePeriodFromPressure">
                                <swe:Quantity definition="urn:MVCO:property:wavePeriodFromPressure">
                                    <swe:uom code="s"></swe:uom>
                                </swe:Quantity> 
                            </swe:field>
                            <swe:field name="loCutoffFrequency">
                                <swe:Quantity definition="urn:MVCO:property:loCutoffFrequency">
                                    <swe:uom code="Hz"></swe:uom>
                                </swe:Quantity> 
                            </swe:field>
                            <swe:field name="hiCutoffFrequency">
                                <swe:Quantity definition="urn:MVCO:property:hiCutoffFrequency">
                                    <swe:uom code="Hz"/>
                                </swe:Quantity> 
                            </swe:field>
                        </swe:DataRecord>
                    </sml:output>
                    
                    <sml:output name="Velocity_QC_ChainOutputs">
                        <swe:DataRecord>
                            <swe:field name="interpolatedVelocityTimeSeries"> 
                                <swe:Quantity definition="urn:ogc:property:OGC:velocity">
                                    <swe:uom code="cm/s"></swe:uom>
                                </swe:Quantity>
                            </swe:field>
                            <swe:field name="topBinHeight">
                                <swe:Quantity definition="urn:MVCO:property:topBinHeight">
                                    <swe:uom code="cm"/>
                                </swe:Quantity> 
                            </swe:field>
                            <swe:field name="aggregateVelocityFlag">
                                <swe:Category definition="http://mmisw.org/ont/mvco/qcflag/aggregateVelocityFlag">
                                    <swe:codeSpace xlink:href="http://mmisw.org/ont/mvco/flag"/>
                                </swe:Category>
                            </swe:field>
                            <swe:field name="echoIntensityFlag">
                                <swe:Category definition="http://mmisw.org/ont/mvco/qcflag/echoIntensityFlag">
                                    <swe:codeSpace xlink:href="http://mmisw.org/ont/mvco/flag"/>
                                </swe:Category>
                            </swe:field>
                            <swe:field name="cMFlag">
                                <swe:Category definition="http://mmisw.org/ont/mvco/qcflag/cMFlag">
                                    <swe:codeSpace xlink:href="http://mmisw.org/ont/mvco/flag"/>
                                </swe:Category>
                            </swe:field>
                        </swe:DataRecord>
                    </sml:output>
                    
                    <sml:output name="VelocityObsProcessOutputs">
                        <swe:DataRecord>
                            <swe:field name="waveHeightAll">
                                <swe:Quantity definition="urn:MVCO:property:waveHeightAll">
                                    <swe:uom code="cm"></swe:uom>
                                </swe:Quantity> 
                            </swe:field>
                            <swe:field name="swell">
                                <swe:Quantity definition="urn:MVCO:property:swell">
                                    <swe:uom code="cm"></swe:uom>
                                </swe:Quantity> 
                            </swe:field>
                            <swe:field name="windWaves">
                                <swe:Quantity definition="urn:MVCO:property:windWaves">
                                    <swe:uom code="cm"></swe:uom>
                                </swe:Quantity> 
                            </swe:field>
                            <swe:field name="wavePeriodAll">
                                <swe:Quantity definition="urn:MVCO:property:wavePeriod">
                                    <swe:uom code="s"></swe:uom>
                                </swe:Quantity> 
                            </swe:field>
                            <swe:field name="swellPeriod">
                                <swe:Quantity definition="urn:MVCO:property:swellPeriod">
                                    <swe:uom code="s"></swe:uom>
                                </swe:Quantity> 
                            </swe:field>
                            <swe:field name="windPeriod">
                                <swe:Quantity definition="urn:MVCO:property:windPeriod">
                                    <swe:uom code="s"></swe:uom>
                                </swe:Quantity> 
                            </swe:field>
                            <swe:field name="dominantWaveDirection">
                                <swe:Quantity definition="urn:MVCO:property:dominantWaveDirection">
                                    <swe:uom code="deg"/>
                                </swe:Quantity> 
                            </swe:field>
                            <swe:field name="swellDirection">
                                <swe:Quantity definition="urn:MVCO:property:swellDirection">
                                    <swe:uom code="deg"/>
                                </swe:Quantity> 
                            </swe:field>
                            <swe:field name="windWaveDirection">
                                <swe:Quantity definition="urn:MVCO:property:windWaveDirection">
                                    <swe:uom code="deg"/>
                                </swe:Quantity> 
                            </swe:field>
                            <swe:field name="topBinHeight">
                                <swe:Quantity definition="urn:MVCO:property:topBinHeight">
                                    <swe:uom code="cm"/>
                                </swe:Quantity> 
                            </swe:field>
                            <swe:field name="bottomBinHeight">
                                <swe:Quantity definition="urn:MVCO:property:bottomBinHeight">
                                    <swe:uom code="cm"/>
                                </swe:Quantity>
                            </swe:field>
                            
                        </swe:DataRecord>
                    </sml:output>
                    
                </sml:OutputList>
            </sml:outputs>
            
            <!-- DO I need to list any params here?? Don't think so;  TC -->
            <sml:parameters></sml:parameters>
            
            <sml:components>
                <sml:ComponentList>
                    <sml:component name="MVCO_Workhorse" xlink:role="urn:ogc:def:process:OGC:system"  
                        xlink:href="http://vast.uah.edu/downloads/sensorML/v1.0/examples/sensors/ADCP_2.1/RDI_Workhorse_1200.xml"/>
                    <sml:component name="RDI_Workhorse" xlink:role="urn:ogc:def:process:OGC:system" 
                        xlink:href="http://vast.uah.edu/downloads/sensorML/v1.0/examples/sensors/ADCP_2.1/MVCO_Workhorse_1200.xml"/>
                    <sml:component name="Velocity_QC_Chain" xlink:role="urn:ogc:def:process:OGC:process"
                        xlink:href="http://vast.uah.edu/downloads/sensorML/v1.0/examples/sensors/ADCP_2.1/Velocity_QC_Chain.xml"/>
                    <sml:component name="Pressure_QC_Chain" xlink:role="urn:ogc:def:process:OGC:process"
                        xlink:href="http://vast.uah.edu/downloads/sensorML/v1.0/examples/sensors/ADCP_2.1/Pressure_QC_Chain.xml"/>
                    <sml:component name="PressureObservableProcess" xlink:role="urn:ogc:def:process:OGC:process" 
                        xlink:href="http://vast.uah.edu/downloads/sensorML/v1.0/examples/sensors/ADCP_2.1/Pressure_Obs_Process.xml"/>
                    <sml:component name="VelocityObservableProcess" xlink:role="urn:ogc:def:process:OGC:process" 
                        xlink:href="http://vast.uah.edu/downloads/sensorML/v1.0/examples/sensors/ADCP_2.1/Velocity_Obs_Process.xml"/>
                    <sml:component name="PUV_Analysis" xlink:role="urn:ogc:def:process:OGC:process" 
                        xlink:href="http://vast.uah.edu/downloads/sensorML/v1.0/examples/sensors/ADCP_2.1/PUV_Analysis.xml"/>
                </sml:ComponentList>
            </sml:components>
            
            <sml:connections>
                <sml:ConnectionList>
                    <!--  Workhorse connections -->
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="this/inputs/seaWaterPressure"/>
                            <sml:destination ref="RDI_Workhorse/inputs/seaWaterPressure"/> <!-- Start here !! -->
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="this/inputs/temperature"/>
                            <sml:destination ref="RDI_Workhorse/inputs/temperature"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="this/inputs/volumetricBackscatter"/>
                            <sml:destination ref="RDI_Workhorse/inputs/volumetricBackscatter"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="this/inputs/particleMotion"/>
                            <sml:destination ref="RDI_Workhorse/inputs/particleMotion"/>
                        </sml:Link>
                    </sml:connection>
                    
                    <!--  Pressure_QC_Chain connections -->
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="RDI_Workhorse/outputs/pressureTimeSeries"/>
                            <sml:destination ref="Pressure_QC_Chain/inputs/pressureTimeSeries"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="Pressure_QC_Chain/outputs/aggregatePressureFlag"/>
                            <sml:destination ref="this/outputs/flags/aggregatePressureFlag"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="Pressure_QC_Chain/outputs/cleanedPressureTimeSeries"/>
                            <sml:destination ref="PressureObservableProcess/inputs/interpolatedPressureTimeSeries"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="Pressure_QC_Chain/outputs/cleanedPressureTimeSeries"/>
                            <sml:destination ref="VelocityObservableProcess/inputs/interpolatedPressureTimeSeries"/>
                        </sml:Link>
                    </sml:connection>
                    
                    <!--  PressureObservableProcess connections -->
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="PressureObservableProcess/outputs/waveHeightFromPressure"/>
                            <sml:destination ref="this/outputs/PressureObsProcessOutputs/waveHeightFromPressure"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="PressureObservableProcess/outputs/wavePeriodFromPressure"/>
                            <sml:destination ref="this/outputs/PressureObsProcessOutputs/wavePeriodFromPressure"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="PressureObservableProcess/outputs/loCutoffFrequency"/>
                            <sml:destination ref="this/outputs/PressureObsProcessOutputs/loCutoffFrequency"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="PressureObservableProcess/outputs/hiCutoffFrequency"/>
                            <sml:destination ref="this/outputs/PressureObsProcessOutputs/hiCutoffFrequency"/>
                        </sml:Link>
                    </sml:connection>
                    
                    <!--  Velocity_QC_Chain connections -->
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="RDI_Workhorse/outputs/velocityTimeSeries"/>
                            <sml:destination ref="Velocity_QC_Chain/inputs/velocityTimeSeries"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="Velocity_QC_Chain/outputs/interpolatedVelocityTimeSeries"/>
                            <sml:destination ref="VelocityObservableProcess/inputs/interpolatedVelocityTimeSeries"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="Velocity_QC_Chain/outputs/aggregateVelocityFlag"/>
                            <sml:destination ref="this/outputs/flags/aggregateVelocityFlag"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="Velocity_QC_Chain/outputs/echoIntensityFlag"/>
                            <sml:destination ref="this/outputs/flags/echoIntensityFlag"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="Velocity_QC_Chain/outputs/correlationCoeffecientFlag"/>
                            <sml:destination ref="this/outputs/flags/correlationCoeffecientFlag"/>
                        </sml:Link>
                    </sml:connection>
                    
                    <!--  VelocityObservableProcess connections -->
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="VelocityObservableProcess/outputs/waveHeightAll"/>
                            <sml:destination ref="this/outputs/VelocityObsProcessOutputs/waveHeightAll"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="VelocityObservableProcess/outputs/swell"/>
                            <sml:destination ref="this/outputs/VelocityObsProcessOutputs/swell"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="VelocityObservableProcess/outputs/windWaves"/>
                            <sml:destination ref="this/outputs/VelocityObsProcessOutputs/windWaves"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="VelocityObservableProcess/outputs/wavePeriodAll"/>
                            <sml:destination ref="this/outputs/VelocityObsProcessOutputs/wavePeriodAll"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="VelocityObservableProcess/outputs/swellPeriod"/>
                            <sml:destination ref="this/outputs/VelocityObsProcessOutputs/swellPeriod"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="VelocityObservableProcess/outputs/windPeriod"/>
                            <sml:destination ref="this/outputs/VelocityObsProcessOutputs/windPeriod"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="VelocityObservableProcess/outputs/dominantWaveDirection"/>
                            <sml:destination ref="this/outputs/VelocityObsProcessOutputs/dominantWaveDirection"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="VelocityObservableProcess/outputs/swellDirection"/>
                            <sml:destination ref="this/outputs/VelocityObsProcessOutputs/swellDirection"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="VelocityObservableProcess/outputs/windWaveDirection"/>
                            <sml:destination ref="this/outputs/VelocityObsProcessOutputs/windWaveDirection"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="VelocityObservableProcess/outputs/topBinHeight"/>
                            <sml:destination ref="this/outputs/VelocityObsProcessOutputs/topBinHeight"/>
                        </sml:Link>
                    </sml:connection>
                    <sml:connection>
                        <sml:Link>
                            <sml:source ref="VelocityObservableProcess/outputs/bottomBinHeight"/>
                            <sml:destination ref="this/outputs/VelocityObsProcessOutputs/bottomBinHeight"/>
                        </sml:Link>
                    </sml:connection>
                    
                </sml:ConnectionList>
            </sml:connections>
            
        </sml:System>
    </sml:member>
</sml:SensorML>
