Пример #1
0
        public override void AcquisitionStarting()
        {
            //connect the TCL controller over remoting network connection


            if (settings["computer"] == null)
            {
                computer = hostName;
            }
            else
            {
                computer = (String)settings["computer"];
            }

            if (settings["scannedParameter"] == null)
            {
                scannedParameter = "setpoint";
            }
            else
            {
                scannedParameter = (String)settings["scannedParameter"];
            }

            IPHostEntry hostInfo = Dns.GetHostEntry(computer);

            foreach (var addr in Dns.GetHostEntry(computer).AddressList)
            {
                if (addr.AddressFamily == AddressFamily.InterNetwork)
                {
                    name = addr.ToString();
                }
            }

            EnvironsHelper eHelper = new EnvironsHelper(computer);

            string tcpChannel = ((TCLConfig)eHelper.Hardware.GetInfo(settings["TCLConfig"])).TCPChannel.ToString();

            tclController = (TransferCavityLock2012.Controller)(Activator.GetObject(typeof(TransferCavityLock2012.Controller), "tcp://" + name + ":" + tcpChannel + "/controller.rem"));

            scanParameter = 0;

            initialVoltage  = tclController.GetLaserVoltage((string)settings["cavity"], (string)settings["channel"]);
            initialSetPoint = tclController.GetLaserSetpoint((string)settings["cavity"], (string)settings["channel"]);
            if (scannedParameter == "voltage")
            {
                tclController.UnlockLaser((string)settings["cavity"], (string)settings["channel"]);
            }

            //go gently to the correct start position
            if ((string)settings["scanMode"] == "up" || (string)settings["scanMode"] == "updown")
            {
                rampV((double)settings["start"], scannedParameter);
            }
            if ((string)settings["scanMode"] == "down" || (string)settings["scanMode"] == "downup")
            {
                rampV((double)settings["end"], scannedParameter);
            }
        }