Esempio n. 1
0
 private void btGenGraph(object sender, EventArgs e)
 {
     if ((ChangedStrings() == false) && (MyApp.ProgramCurrentStep == 3) && CheckSavedStrings() == true)
     {
         MessageBox.Show("Please modify a configuration.");
     }
     else
     {
         bool test = CheckSavedStrings();
         if ((MyApp.ProgramCurrentStep >= 2) && (CheckSavedStrings() == true))
         {
             ProcessParameters();
             SaveParamStrings();
             MyApp.ProgramCurrentStep = 3;
             MyApp.GenerateGhaphic(param1, param2, param3, param4);
             if (MyApp.RFunction == "PI Regular Correlation")
             {
                 MessageBox.Show("Correlation coefficient = " + MyApp.ValueToBeShown);
             }
             tsProgressBar.Value = 100;
         }
         else
         {
             MessageBox.Show("Please click first on \"Get Data\" button");
         }
     }
 }
        public IHttpActionResult Execute()
        {
            REngine           _engine        = REngine.GetInstance(null, true, null, null);
            SvgGraphicsDevice GraphicsDevice = new SvgGraphicsDevice(new SvgContextMapper(700, 700, SvgUnitType.Pixel, null));

            _engine.Initialize();
            _engine.Install(GraphicsDevice);
            RApplication app = new RApplication(_engine);

            app.DataAccessMethod = "PIAFSDK";
            app.Connect("MARC-PI2016");
            app.RFunction = "PI Histogram";
            app.NumTags   = 1;
            app.Mode      = "Interpolated";
            var tag1 = "FAC.OAK.Weather-Outside_Temperature-Val.PV";
            var tag2 = "FAC.OAK.Weather-Inside_Temperature-Val.PV";
            var tag3 = "FAC.OAK.Weather-Inside_Humidity-Val.PV";
            var tag4 = "FAC.OAK.Weather-Outside_Humidity-Val.Pv";
            var tag5 = "FAC.OAK.Power-Total_Demand_Calc.PV";

            app.GetPIData(tag1, tag2, tag3, tag4, tag5, "1-Oct-2012", "1-Nov-2012", "1h");
            app.GenerateGhaphic("5", "0", "1", "");

            //GraphicsDevice.ClearImages();
            //var evaluated = statements.Select(_engine.Evaluate).ToList();
            var plots = GraphicsDevice.GetImages().Select(RenderSvg).ToList();

            return(Ok(plots));
        }