日期:2014-05-17  浏览次数:20744 次

C#采集程序总是提示device error,无法获得两个输入通道的值
namespace MTS
{
    class DataDeal
    {
public static List<Position_Temperature> mvToTemperture(float[] x, float[] ch0, float[] ch1, double slope, double intercept,string path)
        {
        List<Position_Temperature> list_pt = new List<Position_Temperature>();
            if (x == null || ch0 == null || ch1 == null)        
            {
                MessageBox.Show("Device Error!");
                return list_pt ;
            }
            if (!x.Length.Equals(ch0.Length) || !x.Length.Equals(ch1.Length))
            {
                MessageBox.Show("数据维数不等!");
                return list_pt;//输入参数维数不等,返回//2
            }
            int length = x.Length;
            float[] y1Log = new float[length];
            float[] y2Log = new float[length];
            try
            {
                for (int i = 0; i < length; i++)
                {
     y1Log[i] = (float)System.Math.Log(Convert.ToDouble(ch0[i].ToString()), Math.E);
     y2Log[i] = (float)System.Math.Log(Convert.ToDouble(ch1[i].ToString()), Math.E);
                }
                MWArray z = null;
                datadisposeclass drClass = new datadisposeclass();
                z = drClass.data_dispose((MWArray)(MWNumericArray)x,
                                (MWArray)(MWNumericArray)ch1,
                                (MWArray)(MWNumericArray)ch0,
    &n