Exemple #1
0
        /*
         * public ObservableCollection<KeyValuePair<float, float>> GetNormalPointsByFeature(string feature)
         * {
         * ObservableCollection<KeyValuePair<float, float>> temp = new ObservableCollection<KeyValuePair<float, float>>();
         *
         * //regularPoint.Add(new KeyValuePair<float, float>(5, 3));
         * //anomalyFlightDict[feauture].GetRange(lastData, 10).ToArray();
         * if (correlatedFeatures != null)
         * {
         *     string cor = correlatedFeatures[feature];
         *     int lastData = CurrentLinePlaying - 300;
         *
         *     if (lastData > 0)
         *     {
         *         Dictionary<int, KeyValuePair<float, float>> good;
         *         Tuple<string, string> t1 = new Tuple<string, string>(feature, cor);
         *         Tuple<string, string> t2 = new Tuple<string, string>(cor, feature);
         *         try
         *         {
         *             good = regular[t1];
         *         }
         *         catch (KeyNotFoundException e)
         *         {
         *             good = regular[t2];
         *         }
         *         for (int i=lastData; i < CurrentLinePlaying; i++)
         *         {
         *             temp
         *         }
         *
         *     }
         *
         * }
         * return temp;
         * }*/
        public void setAlgo(String path)
        {
            dllPath = path;
            pDll    = NativeMethods.LoadLibrary(@dllPath); //load dll address
            ///now - this pDLL holds the dll's path
            ///here- load enter the desired function name:
            pAddressOfFunctionToCall = NativeMethods.GetProcAddress(pDll, "CreateDetector"); //get address of function
            CreateDetector DetectorCreator = (CreateDetector)Marshal.GetDelegateForFunctionPointer(pAddressOfFunctionToCall, typeof(CreateDetector));

            AnomalyDetector = DetectorCreator();
            Switched        = true;
            return;
        }
Exemple #2
0
        public FlightSimulator()
        {
            dllPath  = Directory.GetParent(dllPath).FullName;
            dllPath  = Directory.GetParent(dllPath).FullName;
            dllPath += "\\Plugins\\LinearRegression.dll";
            pDll     = NativeMethods.LoadLibrary(@dllPath); //load dll address

            ///now - this pDLL holds the dll's path
            ///here- load enter the desired function name:
            pAddressOfFunctionToCall = NativeMethods.GetProcAddress(pDll, "CreateDetector"); //get address of function
                                                                                             //now 'pAddressOfFunctionToCall' holds the function's address
            CreateDetector DetectorCreator = (CreateDetector)Marshal.GetDelegateForFunctionPointer(pAddressOfFunctionToCall, typeof(CreateDetector));

            AnomalyDetector = DetectorCreator();


            Console.WriteLine(dllPath);//test
            pathToXML  = Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory);
            pathToXML  = Directory.GetParent(pathToXML).FullName;
            pathToXML  = Directory.GetParent(pathToXML).FullName;
            pathToXML += "\\resources\\playback_small.xml";
            parseXML();

            playbackSpeed = 10;
            stop          = false;
            pause         = false;
            // starting to play the data 10 lines in a second
            ticks = 100;
            playTimer.Interval = 100;
            CurrentLinePlaying = 0;

            client = new Client();

            playTimer.Elapsed += (s, e) =>
            {
                if (playTimer.Enabled)
                {
                    OnTimedEvent(s, e);
                }
            };
        }