Ejemplo n.º 1
0
        private void ConvertToRealValue(double x)
        {
            //string disData;
            //位移传感器
            Sensor disSensor;

            disSensor = new Sensor(SensorType.displaceSensor, 4, 20, 29.8, 100, 20);

            disSensor.readValue = x;
            f = new FrontPivot(4, disSensor);
            v = f.GetDisplace();
            v = Math.Round(v, 1);
            //转成实际值
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 增加模块,只需要改变这个方法中的算法就行了。
        /// </summary>
        private void ConvertToRealValue()
        {
            Dictionary <int, string> tempDic;
            string forceData;
            string disData;
            Sensor forceSensor;
            Sensor disSensor;

            for (int i = 0; i < adamList.Count; i++)
            {
                allDataDic.TryGetValue(adamList[i].id, out tempDic);

                if (i == 0)
                {
                    ////读取模块192.168.1.3数据,吊杆位移0,1,2,3与吊杆力4,5,6,7通道
                    //若更换 ?。;j=0 标号 17080383 空载 4.026mA
                    forceSensor = new Sensor(SensorType.forceSensor, 4, 20, 300, 1, 0);
                    tempDic.TryGetValue(4, out forceData);
                    forceSensor.readValue = double.Parse(forceData);
                    disSensor             = new Sensor(SensorType.displaceSensor, 4, 20, 29.8, 100, 20);
                    tempDic.TryGetValue(0, out disData);
                    disSensor.readValue = double.Parse(disData);
                    Steeve steeve0 = new Steeve(0, forceSensor, disSensor);
                    steeveDic[steeve0.id] = steeve0;
                    //j=1标号17110130空载3.992mA
                    forceSensor = new Sensor(SensorType.forceSensor, 4, 20, 300, 1, 0);
                    tempDic.TryGetValue(5, out forceData);
                    forceSensor.readValue = double.Parse(forceData);
                    disSensor             = new Sensor(SensorType.displaceSensor, 4, 20, 29.8, 100, 20);
                    tempDic.TryGetValue(1, out disData);
                    disSensor.readValue = double.Parse(disData);
                    Steeve steeve1 = new Steeve(1, forceSensor, disSensor);
                    steeveDic[steeve1.id] = steeve1;
                    //j=2 17080285 空载 4.012mA
                    forceSensor = new Sensor(SensorType.forceSensor, 4, 20, 300, 1, 0);
                    tempDic.TryGetValue(6, out forceData);
                    forceSensor.readValue = double.Parse(forceData);
                    disSensor             = new Sensor(SensorType.displaceSensor, 4, 20, 29.8, 100, 20);
                    tempDic.TryGetValue(2, out disData);
                    disSensor.readValue = double.Parse(disData);
                    Steeve steeve2 = new Steeve(2, forceSensor, disSensor);
                    steeveDic[steeve2.id] = steeve2;
                    //j=3 17080386 空载4.014mA
                    forceSensor = new Sensor(SensorType.forceSensor, 4, 20, 300, 1, 0);
                    tempDic.TryGetValue(7, out forceData);
                    forceSensor.readValue = double.Parse(forceData);
                    disSensor             = new Sensor(SensorType.displaceSensor, 4, 20, 29.8, 100, 20);
                    tempDic.TryGetValue(3, out disData);
                    disSensor.readValue = double.Parse(disData);
                    Steeve steeve3 = new Steeve(3, forceSensor, disSensor);
                    steeveDic[steeve3.id] = steeve3;
                }


                else if (i == 1)
                {
                    int j = 0;
                    // int count = 0;

                    for (j = 0; j < 3; j++)                                                     //前支架位移电流
                    {
                        disSensor = new Sensor(SensorType.displaceSensor, 4, 20, 1.2, 1000, 0); //传感器量程0.2-4 m;//单位mm
                        tempDic.TryGetValue(j, out disData);
                        disSensor.readValue = double.Parse(disData);
                        FrontPivot pivot = new FrontPivot(j, disSensor);
                        frontPivotDic[pivot.id] = pivot;
                    }
                    disSensor = new Sensor(SensorType.displaceSensor, 4, 20, 1.2, 1000, 0);//传感器量程0.2-4 m;
                    tempDic.TryGetValue(3, out disData);
                    disSensor.readValue = double.Parse(disData);
                    FrontPivot pivot1 = new FrontPivot(3, disSensor);
                    frontPivotDic[pivot1.id] = pivot1;

                    #region 锚杆力,接收但不显示,不保存,不后台报警
                    //  for (j = 4; j < 8; j++)//锚杆力

                    forceSensor = new Sensor(SensorType.forceSensor, 4, 20, 300, 1, 0);
                    tempDic.TryGetValue(4, out forceData);
                    forceSensor.readValue = double.Parse(forceData);

                    Anchor anchor0 = new Anchor(0, forceSensor);
                    anchorDic[anchor0.id] = anchor0;

                    forceSensor = new Sensor(SensorType.forceSensor, 4, 20, 300, 1, 0);
                    tempDic.TryGetValue(5, out forceData);
                    forceSensor.readValue = double.Parse(forceData);

                    Anchor anchor1 = new Anchor(1, forceSensor);
                    anchorDic[anchor1.id] = anchor1;

                    forceSensor = new Sensor(SensorType.forceSensor, 4, 20, 300, 1, 0);
                    tempDic.TryGetValue(6, out forceData);
                    forceSensor.readValue = double.Parse(forceData);
                    Anchor anchor2 = new Anchor(2, forceSensor);
                    anchorDic[anchor2.id] = anchor2;

                    forceSensor = new Sensor(SensorType.forceSensor, 4, 20, 300, 1, 0);
                    tempDic.TryGetValue(7, out forceData);
                    forceSensor.readValue = double.Parse(forceData);

                    Anchor anchor3 = new Anchor(3, forceSensor);
                    anchorDic[anchor3.id] = anchor3;
                    #endregion
                }
            }
        }