aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Examples/Diagnostics/Program.cs
blob: c783abaa1d840b98f49db5e39e69f5de89be8aa1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Drawing;
using Google.Protobuf;
using Tango.BL.Entities;
using Tango.BL.Enumerations;
using Tango.PMR.Stubs;
using Tango.PMR.Diagnostics;
using Tango.FSE.Common.Connection;
using Tango.FSE.Common.Diagnostics;
using Tango.FSE.Procedures;

namespace Tango.FSE.Procedures.Examples.Diagnostics
{
    #region Example
    public class Program
    {
        public void OnExecute(IProcedureContext context)
        {
            //Initialize a new list of dancer angle values.
            List<double> dancerValues = new List<double>();

            //Collect 100 samples of the middle dancer angle.
            for (int i = 0; i < 100; i++)
            {
                //Get the current diagnostics package. (set 'true' to block the execution until a fresh diagnostics frame arrives)
                DiagnosticsPackage package = context.GetDiagnosticsPackage(true);

                //Add the last value in the array to the list.
                dancerValues.Add(package.GetMonitorLastValue(TechMonitors.Dancer2Angle));
            }

            //Plot the dancer samples to a graph result.
            context.AddGraphResult(ResultType.Passed, "Dancer Angle", dancerValues);
        }
    }
    #endregion
}