GetAccel() публичный Метод

public GetAccel ( string channel ) : double
channel string
Результат double
Пример #1
0
        private string WriteSensorData(MyTag tag)
        {
            string temp = "";
            switch (tag.GetTagType())
            {
                case TagType.WISP_ACCELEROMETER:
                    temp = temp + "";
                    temp = temp + tag.GetAccel("x");

                    temp = temp + "\t";
                    temp = temp + tag.GetAccel("y");

                    temp = temp + "\t";
                    temp = temp + tag.GetAccel("z");

                    break;
                case TagType.WISP_TEMPERATURE:

                    temp = temp + "Temp= ";
                    temp = temp + tag.GetTemperature();

                    break;
                case TagType.WISP_SOC:
                    if (tag.GetAccessResultData().Length > 0)
                    {
                        int[] data = tag.GetSOCData();
                        for (int i = 0; i < data.Length; i++)
                        {
                            temp = temp + "ADC,";
                            temp = temp + data[i] + ",";

                            temp = temp + "temp,";
                            temp = temp + tag.socFilteredTemperature + ",";
                        }
                    }

                    break;
                default:
                    // no action for now...
                    // this could be commercial tags, etc.
                    break;
            }
            return temp;
        }
Пример #2
0
        private void HandleAccelTagStats(MyTag tag)
        {
            double alpha = accelInfo.alpha;
            // Get value from filter

            // todo this causes exception

            
            if (accelInfo.filterChkd)
            {
                //alpha = tbarLPFilter.Value;
                alpha = alpha / 100.0;
                if (alpha > 1 || alpha < 0)
                {
                    alpha = 0.2;
                    Trace.WriteLine("alpha out of bounds");
                }
            }
            else
            {
                alpha = 0.0;
            }
             

            double xac, yac, zac;
            // First work with the scaled values
            xac = tag.GetAccel("x");
            yac = tag.GetAccel("y");
            zac = tag.GetAccel("z");

            currentX = currentX * alpha + xac * (1 - alpha);
            currentY = currentY * alpha + yac * (1 - alpha);
            currentZ = currentZ * alpha + zac * (1 - alpha);

            // Now work with the raw adc values
            xac = tag.GetRawAccel("x");
            yac = tag.GetRawAccel("y");
            zac = tag.GetRawAccel("z");

            if (xac > xMax) xMax = xac;
            if (yac > yMax) yMax = yac;
            if (zac > zMax) zMax = zac;

            if (xac < xMin) xMin = xac;
            if (yac < yMin) yMin = yac;
            if (zac < zMin) zMin = zac;

            deltaX = xMax - xMin;
            deltaY = yMax - yMin;
            deltaZ = zMax - zMin;
        }