package autochanger

import org.lsst.ccs.subsystems.fcs.*
import org.lsst.ccs.subsystems.fcs.testbench.*
import org.lsst.ccs.subsystems.fcs.common.*
import org.lsst.ccs.subsystems.fcs.common.EPOSControllerWithBrake
import org.lsst.ccs.subsystems.fcs.simulation.*
import org.lsst.ccs.subsystems.fcs.drivers.*
import org.lsst.ccs.monitor.Channel
import org.lsst.ccs.monitor.Device
import org.lsst.ccs.description.groovy.CCSBuilder



def acPlutoGatewayName = "acSensorsGateway" // to monitor the autochanger sensors

CCSBuilder builder = ["autochanger-standalone"]

builder.
    main (AutochangerMain, bridge:ref("tcpProxy"), carousel:ref("carousel"),loader:ref("loader"),
        nodeTags:["monitor-update/taskPeriodMillis":-1,"monitor-publish/taskPeriodMillis":-1, "monitor-check/taskPeriodMillis":-1]) {
    //begin description of Main submodules
    //-------------------------
    // BEGIN Filter Manager description
    
    filterManager(FilterManager) {//begin description of filter manager's children
        filterU (Filter,filterID:1, weight:38, socketName:"socket1")
        filterG (Filter,filterID:2, weight:33, socketName:"socket2")
        filterR (Filter,filterID:3, weight:30, socketName:"socket3")
        filterI (Filter,filterID:4, weight:28, socketName:"socket4")
        filterZ (Filter,filterID:5, weight:28, socketName:"socket5")
        filterY (Filter,filterID:6, weight:22.5,socketName:"OUT")
        dummyFilter (Filter,filterID:45,weight:44.5,socketName:"OUT")
    }//end description of filter manager's children
    // END Filter Manager description
    // ------------------------------
    
    // tcp Proxy
    tcpProxy (CanOpenProxy, hardwareBootTimeout:5000) {
        
        canInterface(FcsTcpProxy, clientName:"TestBench", portNumber:50000, fieldBusTimeout:2000)
        
        // can open devices
        //sensors gateway
        "$acPlutoGatewayName" (CanOpenPlutoGateway, nodeID:0x3a,serialNB:"3269")
             
        brakeSystemGateway (CanOpenPlutoGateway, nodeID:0x2b,serialNB:"2071")
        
        tempSensorsDevice (CanOpenSystecIO, nodeID: 0x20, serialNB:"4bb6b")
        
        proximitySensorsDevice (CanCBXAI420, nodeID: 0x22, serialNB:"c7c60331")
        
        onlineClampGauge (CanOpenStrainGauge, nodeID: 0x21, serialNB:"0")
        
        // can open devices
        linearRailMasterController (CanOpenEPOSLinearRailTruck, 
            nodeID:0x2a,serialNB:"80001881",
            paramsForCurrent:[
                MotorType:10, PositionSensorType:260,PolePairNumber:1,
                ContinuousCurrentLimit:7200,OutputCurrentLimit:14400,
                ThermalTimeConstantWinding:187,
                MaxSpeedInCurrentMode:9140],
            paramsForProfilePosition:[
                ProfileAcceleration:310, ProfileDeceleration:310,
                MaxProfileVelocity:322, QuickStopDeceleration:310,
                MaxFollowingError:999999,//on verra plus tard
                ProfileVelocity:310,
                MotionProfileType:0],
            paramsForHoming:[HomeOffset:0],
            encoderRibbonMinValue:8161299,
        )

        // can open devices
        linearRailSlaveController (CanOpenEPOSLinearRailTruck,
            nodeID:0x2c,serialNB:"80008572",
            paramsForCurrent:[
                MotorType:10, PositionSensorType:1,PolePairNumber:1,
                ContinuousCurrentLimit:7200,OutputCurrentLimit:14400,
                ThermalTimeConstantWinding:187,MaxSpeedInCurrentMode:9140],
            paramsForProfilePosition:[
                ProfileAcceleration:310,
                ProfileDeceleration:310,
                ProfileVelocity:310,
                QuickStopDeceleration:10000,
                MaxFollowingError:7000,
                MotionProfileType:0],
            paramsForHoming:[HomeOffset:0],
            encoderRibbonMinValue:7449994,
        )     

        latchXminusController (CanOpenEPOS,  //CanOpenEPOS24-3
            nodeID:0xf,serialNB:"84004735",
            paramsForCurrent: [
                MotorType:1, PositionSensorType:0,PolePairNumber:2,
                ContinuousCurrentLimit:400,OutputCurrentLimit:400,
                ThermalTimeConstantWinding:40,
                MaxSpeedInCurrentMode:100],
            paramsForProfilePosition: [MotionProfileType:0],
            paramsForHoming:[HomeOffset:0]
        )

        // can open devices
        latchXplusController (CanOpenEPOS,  //CanOpenEPOS24-3
            nodeID:0xe, serialNB:"84004711",
            paramsForCurrent: [
                MotorType:1, PositionSensorType:0,PolePairNumber:2,
                ContinuousCurrentLimit:400,OutputCurrentLimit:400,
                ThermalTimeConstantWinding:40,
                MaxSpeedInCurrentMode:100],
            paramsForProfilePosition: [MotionProfileType:0],
            paramsForHoming:[HomeOffset:0]
        )

        // can open devices
        onlineClampXminusController (CanOpenEPOSOnlineClamp, 
            nodeID:0x31,serialNB:"79011618",
            paramsForCurrent: 
            [MotorType:1, PositionSensorType:0,PolePairNumber:1,
                ContinuousCurrentLimit:3200,OutputCurrentLimit:4000,
                ThermalTimeConstantWinding:419, //160?
                MaxSpeedInCurrentMode:25000],
            paramsForProfilePosition:[MotionProfileType:0],
            paramsForHoming:[HomeOffset:0],
        )
        // can open devices
        onlineClampXplusController (CanOpenEPOSOnlineClamp, 
            nodeID:0x30, serialNB:"79011616",
            paramsForCurrent: 
            [MotorType:1, PositionSensorType:0,PolePairNumber:1,
                ContinuousCurrentLimit:5000,OutputCurrentLimit:4000,
                ThermalTimeConstantWinding:419, //160?
                MaxSpeedInCurrentMode:25000],
            paramsForProfilePosition:[MotionProfileType:0],
            paramsForHoming:[HomeOffset:0],
        )
        // can open devices
        onlineClampYminusController (CanOpenEPOSOnlineClamp, 
            nodeID:0x32, serialNB:"79011243",
            paramsForCurrent: 
            [MotorType:1, PositionSensorType:0,PolePairNumber:1,
                ContinuousCurrentLimit:5000,OutputCurrentLimit:4000,
                ThermalTimeConstantWinding:419, //160?
                MaxSpeedInCurrentMode:25000],
            paramsForProfilePosition:[MotionProfileType:0],
            paramsForHoming:[HomeOffset:0],
        )
    //************************************//            
    }//end description of bridge's children
    //************************************//
    //**************************************************************************//
    // end of Bridge
    //**************************************************************************//
    
    //-------------------------
    // BEGIN Filter Identificator description
    filterIdentificator(FilterIdentificator,plutoGateway: ref("$acPlutoGatewayName"))
    {//begin description of filter Identificator's children
        filterIDSensor0 ( DigitalSensor,
            dioName:acPlutoGatewayName,inputNumero:0,byteNumero:4)
        
        filterIDSensor1 ( DigitalSensor,
            dioName:acPlutoGatewayName,inputNumero:1,byteNumero:4)
        
        filterIDSensor2 ( DigitalSensor,
            dioName:acPlutoGatewayName,inputNumero:2,byteNumero:4)
        
        filterIDSensor3 ( DigitalSensor,
            dioName:acPlutoGatewayName,inputNumero:3,byteNumero:4)
        
        filterIDSensor4 ( DigitalSensor,
            dioName:acPlutoGatewayName,inputNumero:4,byteNumero:4)
        
        filterIDSensor5 ( DigitalSensor,
            dioName:acPlutoGatewayName,inputNumero:5,byteNumero:4)
    }//end description of filter identificator's children
    // END Filter Identificator description

    // ------ Monitoring 
    systec(SystecIO_X5, tempSensorsDevice:ref("tempSensorsDevice"))
    
    // Channels read as a group with getADCValues
    tempLinearRailMotorXplus(Channel, devcName:"systec", hwChan:1, units:"\u00b0C", format:".1f", type:"C", subtype:"", checkLo:"flag", limitLo:-20.0, alarmLo:null, checkHi:"flag", limitHi:100.0, alarmHi:null)
    tempLinearRailMotorXminus(Channel, devcName:"systec", hwChan:2, units:"\u00b0C", format:".1f", type:"C", subtype:"", checkLo:"flag", limitLo:-20.0, alarmLo:null, checkHi:"flag", limitHi:100.0, alarmHi:null)
    tempClampMotorXplus(Channel, devcName:"systec", hwChan:3, units:"\u00b0C", format:".1f", type:"C", subtype:"", checkLo:"flag", limitLo:-20.0, alarmLo:null, checkHi:"flag", limitHi:100.0, alarmHi:null)
    tempClampMotorYminus(Channel, devcName:"systec", hwChan:4, units:"\u00b0C", format:".1f", type:"C", subtype:"", checkLo:"flag", limitLo:-20.0, alarmLo:null, checkHi:"flag", limitHi:100.0, alarmHi:null)
    tempClampMotorXminus(Channel, devcName:"systec", hwChan:5, units:"\u00b0C", format:".1f", type:"C", subtype:"", checkLo:"flag", limitLo:-20.0, alarmLo:null, checkHi:"flag", limitHi:100.0, alarmHi:null)
    tempFrontBox(Channel, devcName:"systec", hwChan:6, units:"\u00b0C", format:".1f", type:"C", subtype:"", checkLo:"flag", limitLo:-20.0, alarmLo:null, checkHi:"flag", limitHi:100.0, alarmHi:null)
    tempRearBox(Channel, devcName:"systec", hwChan:7, units:"\u00b0C", format:".1f", type:"C", subtype:"", checkLo:"flag", limitLo:-20.0, alarmLo:null, checkHi:"flag", limitHi:100.0, alarmHi:null)
    tempCellXminus(Channel, devcName:"systec", hwChan:8, units:"\u00b0C", format:".1f", type:"C", subtype:"", checkLo:"flag", limitLo:-20.0, alarmLo:null, checkHi:"flag", limitHi:100.0, alarmHi:null)
    
    /**********************************************************************/
    /*                FAKE CAROUSEL DESCRIPTION                       */
    /**********************************************************************/
    //in the autochanger standalone subsystem the fake carousel is a switch which
    //simulates that carousel holds a filter at STANDBY 
    
    carousel(FakeFilterHolder,
        plutoGateway:ref("$acPlutoGatewayName"), 
        holdingFilterSensor:ref("carouselHoldingFilterSensors"),
    ) {//begin description of fakeCarousel's children 
        carouselHoldingFilterSensors (ComplementarySensors,
            sensor:ref("carouselHoldingFilterSensor0"),
            sensorC:ref("carouselHoldingFilterSensor1")
        ){		
            carouselHoldingFilterSensor0(DigitalSensor ,		
                dioName:acPlutoGatewayName, inputNumero:6,byteNumero:3)		
            carouselHoldingFilterSensor1(DigitalSensor ,		
                dioName:acPlutoGatewayName, inputNumero:7,byteNumero:3)		
        }
    }//end description of fakeCarousel's children
    
        /**********************************************************************/
        /*                END of FAKE CAROUSEL DESCRIPTION                 */
        /**********************************************************************/

        /**********************************************************************/
        /*                FAKE LOADER DESCRIPTION                       */
        /**********************************************************************/
        //in the autochanger standalone subsystem the fake loader is couple of complementary sensors
        //simulate that loader holds a filter at HANDOFF 

    loader(FakeFilterHolder, plutoGateway:ref("$acPlutoGatewayName"), 
        holdingFilterSensor:ref("loaderHoldingFilterSensors")) {
        //begin description of fakeAutochanger's children 
        loaderHoldingFilterSensors (ComplementarySensors,
            sensor:ref("loaderHoldingFilterSensor0"),
            sensorC:ref("loaderHoldingFilterSensor1")) {		
            loaderHoldingFilterSensor0(DigitalSensor ,		
                dioName:acPlutoGatewayName, inputNumero:6, byteNumero:2)		
            loaderHoldingFilterSensor1(DigitalSensor ,		
                dioName:acPlutoGatewayName, inputNumero:7, byteNumero:2)    		
        }
    }//end description of fakeLoader's children
    
    /**********************************************************************/
    /*                END of FAKE AUTOCHANGER DESCRIPTION                 */
    /**********************************************************************/
    
    //**************************************************************************//
    //**************************************************************************//
    // autochanger
    //**************************************************************************//
    //**************************************************************************//
    autochanger(Autochanger, plutoGateway:ref("$acPlutoGatewayName")) {
        ////begin description of autochanger children
        loaderConnectedSensors (ComplementarySensors,
            sensor:ref("loaderConnectedSensor"),
            sensorC:ref("loaderConnectedSensorC")) {
            loaderConnectedSensor ( DigitalSensor ,		
                dioName:acPlutoGatewayName, inputNumero:4, byteNumero:2)		
            loaderConnectedSensorC ( DigitalSensor ,		
                dioName:acPlutoGatewayName, inputNumero:5, byteNumero:2)		
        }//end description of autochanger loaderConnectedSensors children
        //end description of autochanger loaderConnectedSensors children
        //**************************************************************************//
        // autochanger trucks description
        //**************************************************************************//
        autochangerTrucks (AutochangerTwoTrucks, 
            truckXminus:ref("acTruckXminus"), truckXplus:ref("acTruckXplus"),
            linearRailMasterController:ref("linearRailMasterController"),
            linearRailSlaveController:ref("linearRailSlaveController")) {
            //begin description of autochanger trucks children
            acTruckXminus (AutochangerTruck, 
                controller:ref("linearRailMasterController"),
                handoffPositionSensors:ref("handoffPositionSensorsXminus"),
                onlinePositionSensors:ref("onlinePositionSensorsXminus"),
                standbyPositionSensors:ref("standbyPositionSensorsXminus"),
            )
            {//begin description of autochanger truckXminus children
                handoffPositionSensorsXminus ( ComplementarySensors,
                    sensor: ref("handoffPositionSensorXminus"),
                    sensorC: ref("handoffPositionSensorBXminus"),
                )
                {
                    handoffPositionSensorXminus ( DigitalSensor ,
                        dioName:acPlutoGatewayName, inputNumero:0, byteNumero:1)
                    
                    handoffPositionSensorBXminus ( DigitalSensor ,
                        dioName:acPlutoGatewayName, inputNumero:1, byteNumero:1)
                }
                onlinePositionSensorsXminus ( ComplementarySensors,
                    sensor: ref("onlinePositionSensorXminus"),
                    sensorC: ref("onlinePositionSensorBXminus"),
                )
                {
                    onlinePositionSensorXminus ( DigitalSensor ,
                        dioName:acPlutoGatewayName, inputNumero:2, byteNumero:1)
                    
                    onlinePositionSensorBXminus ( DigitalSensor ,
                        dioName:acPlutoGatewayName,inputNumero:3, byteNumero:1)
                }
                standbyPositionSensorsXminus ( ComplementarySensors,
                    sensor: ref("standbyPositionSensorXminus"),
                    sensorC: ref("standbyPositionSensorBXminus"),
                )
                {
                    standbyPositionSensorXminus ( DigitalSensor ,
                        dioName:acPlutoGatewayName, inputNumero:6, byteNumero:0)
                    
                    standbyPositionSensorBXminus ( DigitalSensor ,
                        dioName:acPlutoGatewayName, inputNumero:7, byteNumero:0)
                }
            }//end description of autochanger acTruckXminus children
            acTruckXplus (AutochangerTruck, 
                controller:ref("linearRailSlaveController"),
                handoffPositionSensors:ref("handoffPositionSensorsXplus"),
                onlinePositionSensors:ref("onlinePositionSensorsXplus"),
                standbyPositionSensors:ref("standbyPositionSensorsXplus"),
            )
            {//begin description of autochanger truckXplus children
                handoffPositionSensorsXplus (ComplementarySensors,
                     sensor: ref("handoffPositionSensorXplus"),
                     sensorC: ref("handoffPositionSensorBXplus"),
                 )
                 {
                     handoffPositionSensorXplus ( DigitalSensor ,
                         dioName:acPlutoGatewayName, inputNumero: 0, byteNumero:9)                                    
                     handoffPositionSensorBXplus ( DigitalSensor ,
                         dioName:acPlutoGatewayName, inputNumero:1, byteNumero:9)
                 }
                 onlinePositionSensorsXplus (ComplementarySensors,
                     sensor: ref("onlinePositionSensorXplus"),
                     sensorC: ref("onlinePositionSensorBXplus"),
                 )
                 {
                     onlinePositionSensorXplus ( DigitalSensor ,
                         dioName:acPlutoGatewayName, inputNumero:2, byteNumero:9)
                     onlinePositionSensorBXplus ( DigitalSensor ,
                         dioName:acPlutoGatewayName, inputNumero:3, byteNumero:9)
                 }
                 standbyPositionSensorsXplus (ComplementarySensors,
                     sensor: ref("standbyPositionSensorXplus"),
                     sensorC: ref("standbyPositionSensorBXplus"),
                 )
                 {
                     standbyPositionSensorXplus( DigitalSensor ,
                         dioName:acPlutoGatewayName, inputNumero:6, byteNumero:8)
                     standbyPositionSensorBXplus ( DigitalSensor ,
                         dioName:acPlutoGatewayName, inputNumero:7, byteNumero:8)
                 }
            }//end description of autochanger acTruckXplus children
            
        }//end description of autochanger trucks children            
        //**************************************************************************//
        // end of autochanger trucks description
        //**************************************************************************//
        
        //**************************************************************************//
        // autochanger latches description
        //**************************************************************************//
        latches (AutochangerTwoLatches, latchXminus:ref("latchXminus"), latchXplus:ref("latchXplus"))
        {//begin description of autochanger latches children
            //*************************************//
            // autochanger latchXminus description
            //*************************************//
            latchXminus (AutochangerLatch,
                latchController:ref("latchXminusController"),
                closeSensors:ref("closeSensorsLatchXminus"),
                openSensors:ref("openSensorsLatchXminus"),
                filterEngagedSensors:ref("filterEngagedSensorsLatchXminus"),
            )
            {//begin description of autochanger latchXminus children
                closeSensorsLatchXminus ( ComplementarySensors,
                    sensor:ref("closeSensorLatchXminus"),
                    sensorC:ref("closeSensorBLatchXminus")
                )
                {//begin description of autochanger lockSensorslatchXminus children
                    closeSensorLatchXminus ( DigitalSensor,
                        dioName:acPlutoGatewayName, inputNumero:0, byteNumero:0)
                    closeSensorBLatchXminus ( DigitalSensor,
                        dioName:acPlutoGatewayName, inputNumero:1, byteNumero:0)
                }//end description of autochanger lockSensorslatchXminus children                
                
                openSensorsLatchXminus ( ComplementarySensors,
                    sensor:ref("openSensorLatchXminus"),
                    sensorC:ref("openSensorBLatchXminus")
                ) {//begin description of autochanger unlockSensorslatchXminus children
                    openSensorLatchXminus ( DigitalSensor,
                        dioName:acPlutoGatewayName, inputNumero:2, byteNumero:0)
                    openSensorBLatchXminus ( DigitalSensor,
                        dioName:acPlutoGatewayName, inputNumero:3, byteNumero:0)
                }//end description of autochanger unlockSensorslatchXminus children
                
                filterEngagedSensorsLatchXminus ( ComplementarySensors,
                    sensor:ref("filterEngagedSensorLatchXminus"),
                    sensorC:ref("filterEngagedSensorBLatchXminus")
                )
                {//begin description of autochanger filterEngagedSensorslatchXminus children
                    filterEngagedSensorLatchXminus ( DigitalSensor,
                        dioName:acPlutoGatewayName, inputNumero:4, byteNumero:0)
                    filterEngagedSensorBLatchXminus ( DigitalSensor,
                        dioName:acPlutoGatewayName, inputNumero:5, byteNumero:0)
                }//end description of autochanger filterEngagedSensorslatchXminus children
            }//end description of autochanger latchXminus children
            //**********************************************//
            // end of autochanger latchXminus description   //
            //**********************************************//
            //*************************************//
            // autochanger latchXplus description
            //*************************************//
            latchXplus (AutochangerLatch,
                latchController:ref("latchXplusController"),
                closeSensors:ref("closeSensorsLatchXplus"),
                openSensors:ref("openSensorsLatchXplus"),
                filterEngagedSensors:ref("filterEngagedSensorsLatchXplus"),
            )
            {//begin description of autochanger latchXplus children

                closeSensorsLatchXplus ( ComplementarySensors,
                    sensor:ref("closeSensorLatchXplus"),
                    sensorC:ref("closeSensorBLatchXplus")
                )
                {//begin description of autochanger lockSensorslatchXplus children
                    closeSensorLatchXplus ( DigitalSensor,
                        dioName:acPlutoGatewayName, inputNumero:0, byteNumero:8)
                    closeSensorBLatchXplus ( DigitalSensor,
                        dioName:acPlutoGatewayName, inputNumero:1, byteNumero:8)
                }//end description of autochanger lockSensorslatchXplus children
                openSensorsLatchXplus ( ComplementarySensors,
                     sensor:ref("openSensorLatchXplus"),
                     sensorC:ref("openSensorBLatchXplus")
                 )     
                 {//begin description of autochanger unlockSensorslatchXplus children
                     openSensorLatchXplus ( DigitalSensor,
                         dioName:acPlutoGatewayName, inputNumero:2, byteNumero:8)
                     openSensorBLatchXplus ( DigitalSensor,
                         dioName:acPlutoGatewayName, inputNumero:3, byteNumero:8)
                 }//end description of autochanger unlockSensorslatchXplus children
 
                 filterEngagedSensorsLatchXplus ( ComplementarySensors,
                     sensor:ref("filterEngagedSensorLatchXplus"),
                     sensorC:ref("filterEngagedSensorBLatchXplus")
                 )
                 {//begin description of autochanger filterEngagedSensorslatchXplus children
                     filterEngagedSensorLatchXplus ( DigitalSensor,
                         dioName:acPlutoGatewayName, inputNumero:4, byteNumero:8)
                     filterEngagedSensorBLatchXplus ( DigitalSensor,
                         dioName:acPlutoGatewayName, inputNumero:5, byteNumero:8)
                }//end description of autochanger filterEngagedSensorslatchXplus children

            }//end description of autochanger latchXplus children
            //**********************************************//
            // end of autochanger latchXplus description   //
            //**********************************************//
        }//end description of autochanger latches children
        //*****************************************************************************//
        // end of autochanger latches description
        //*****************************************************************************//
        
        //**************************************************************************//
        //**************************************************************************//
        // autochanger onlineClamps description
        //**************************************************************************//
        //**************************************************************************//
        onlineClamps (AutochangerThreeOnlineClamps, 
            onlineClampXminus:ref("onlineClampXminus"), 
            onlineClampXplus:ref("onlineClampXplus"), 
            onlineClampYminus:ref("onlineClampYminus")) 
        {//begin description of autochanger onlineClamps children
            
            onlineClampXminus(AutochangerOnlineClamp ,
                controller:ref("onlineClampXminusController"),
                closeSensors:ref("onlineClampXminusCloseSensors"),
                openSensors:ref("onlineClampXminusOpenSensors"),
            )
            {//begin description of autochanger onlineClampXminus children
                onlineClampXminusCloseSensors ( ComplementarySensors,
                    sensor:ref("onlineClampXminusCloseSensor"),
                    sensorC:ref("onlineClampXminusCloseSensorC")
                )
                {//begin description of autochanger onlineClampXminusCloseSensors children
                    onlineClampXminusCloseSensor ( DigitalSensor,
                        dioName:acPlutoGatewayName, inputNumero:6, byteNumero:1)
                    onlineClampXminusCloseSensorC ( DigitalSensor,
                        dioName:acPlutoGatewayName, inputNumero:7, byteNumero:1)
                }//end description of autochanger onlineClampXminusCloseSensors children
                
                onlineClampXminusOpenSensors ( ComplementarySensors,
                    sensor: ref("onlineClampXminusOpenSensor"),
                    sensorC: ref("onlineClampXminusOpenSensorC")
                )
                {
                    onlineClampXminusOpenSensor ( DigitalSensor,
                        dioName:acPlutoGatewayName, inputNumero: 4, byteNumero: 1)
                    onlineClampXminusOpenSensorC ( DigitalSensor,
                        dioName:acPlutoGatewayName, inputNumero: 5, byteNumero: 1)  
                }
            }//end of  description of autochanger onlineClampXminus children
            
            onlineClampXplus(AutochangerOnlineClamp ,
                controller:ref("onlineClampXplusController"),
                closeSensors:ref("onlineClampXplusCloseSensors"),
                openSensors:ref("onlineClampXplusOpenSensors"),
            )
            {//begin description of autochanger onlineClampXplus children
                onlineClampXplusCloseSensors ( ComplementarySensors,
                    sensor: ref("onlineClampXplusCloseSensor"),
                    sensorC: ref("onlineClampXplusCloseSensorC"),
                )
                {
                    onlineClampXplusCloseSensor ( DigitalSensor,
                        dioName:acPlutoGatewayName, inputNumero: 6, byteNumero: 9)
                    onlineClampXplusCloseSensorC ( DigitalSensor,
                        dioName:acPlutoGatewayName, inputNumero: 7, byteNumero: 9)
                }
                
                onlineClampXplusOpenSensors ( ComplementarySensors,
                    sensor: ref("onlineClampXplusOpenSensor"),
                    sensorC: ref("onlineClampXplusOpenSensorC"),
                )
                {
                    onlineClampXplusOpenSensor ( DigitalSensor,
                        dioName:acPlutoGatewayName,inputNumero: 4, byteNumero: 9)
                    onlineClampXplusOpenSensorC ( DigitalSensor,
                        dioName:acPlutoGatewayName, inputNumero: 5, byteNumero: 9)
                }
            }//end of  description of autochanger onlineClampXplus children
            
            onlineClampYminus(AutochangerOnlineClamp ,
                controller:ref("onlineClampYminusController"),
                closeSensors:ref("onlineClampYminusCloseSensors"),
                openSensors:ref("onlineClampYminusOpenSensors"),
            )
            {//begin description of autochanger onlineClampYminus children
                onlineClampYminusCloseSensors ( ComplementarySensors,
                    sensor: ref("onlineClampYminusCloseSensor"),
                    sensorC: ref("onlineClampYminusCloseSensorC"),
                )
                {
                    onlineClampYminusCloseSensor ( DigitalSensor,
                        dioName:acPlutoGatewayName, inputNumero: 2, byteNumero: 2)
                    onlineClampYminusCloseSensorC ( DigitalSensor,
                        dioName:acPlutoGatewayName, inputNumero: 3, byteNumero: 2)
                }
                onlineClampYminusOpenSensors ( ComplementarySensors,
                    sensor: ref("onlineClampYminusOpenSensor"),
                    sensorC: ref("onlineClampYminusOpenSensorC"),
                )
                {
                    onlineClampYminusOpenSensor ( DigitalSensor,
                        dioName:acPlutoGatewayName, inputNumero: 0, byteNumero: 2)
                    onlineClampYminusOpenSensorC ( DigitalSensor,
                        dioName:acPlutoGatewayName, inputNumero: 1, byteNumero: 2)
                }
            }//end of  description of autochanger onlineClampYminus children
        }//end of  description of autochanger onlineClamps children
        //**************************************************************************//
        // end of autochanger onlineClamps description
        //**************************************************************************//
        inclinometerXminus (Inclinometer, plutoGateway: ref("$acPlutoGatewayName"), byteNumero: 6)
        inclinometerXplus (Inclinometer, plutoGateway: ref("$acPlutoGatewayName"), byteNumero: 12)


    }//end description of autochanger children
    //*****************************************************************************//
    //*****************************************************************************//
    // end of autochanger description
    //*****************************************************************************//
    //*****************************************************************************//
    
}    // main
