コード例 #1
0
 public MonitorWindowViewModel(List<HerdAgentViewModel> freeHerdAgents
     , List<Experiment> pendingExperiments, Logger.LogFunction logFunction)
 {
     evaluationPlot = new PlotViewModel("Evaluation episodes");
     experimentQueueMonitor = new ExperimentQueueMonitorViewModel(freeHerdAgents, pendingExperiments
         , evaluationPlot,logFunction);
 }
コード例 #2
0
        public void generatePlots()
        {
            List <PlotViewModel> newPlots = new List <PlotViewModel>();

            //create a new plot for each variable
            foreach (LoggedVariableViewModel variable in m_selectedVariables)
            {
                PlotViewModel newPlot = new PlotViewModel(variable.name, false);
                newPlot.parent = this;
                newPlots.Add(newPlot);
            }

            //draw data from each log
            foreach (ExperimentLogViewModel log in m_selectedLogs)
            {
                log.plotData(newPlots, m_selectedSource);
            }
            //update plots
            foreach (PlotViewModel plot in newPlots)
            {
                reports.Add(plot);
                plot.updateView();
            }

            bCanSaveReports = true;
            selectedReport  = reports[reports.Count - 1]; //select the last plot generated
        }
コード例 #3
0
 public MonitorWindowViewModel(List <HerdAgentViewModel> freeHerdAgents
                               , List <Experiment> pendingExperiments, Logger.LogFunction logFunction, string batchFilename)
 {
     evaluationPlot         = new PlotViewModel("Evaluation episodes");
     experimentQueueMonitor = new ExperimentQueueMonitorViewModel(freeHerdAgents, pendingExperiments
                                                                  , evaluationPlot, logFunction);
     m_batchFilename = batchFilename;
 }
コード例 #4
0
        public MonitoredJobViewModel(Job job, PlotViewModel evaluationPlot, CancellationToken cancelToken, Action <string> logFunction)
        {
            ConnectionState.Icon = null;

            m_evaluationPlot = evaluationPlot;
            m_cancelToken    = cancelToken;
            m_logFunction    = logFunction;

            m_model = job;
        }
コード例 #5
0
        public ReportViewModel(List <TrackGroup> queryResultTracks, LogQueryViewModel query, Report report)
        {
            Name = report.Name;

            //Create the plot
            PlotViewModel newPlot = new PlotViewModel(report.Name, "Time (s)", report.Name, false, true);
            //Create the stats
            StatsViewModel newStatGroup = new StatsViewModel(report.Name);

            foreach (TrackGroup group in queryResultTracks)
            {
                //plot data
                if (group.ConsolidatedTrack != null)
                {
                    SeriesGroup seriesGroup = group.ConsolidatedTrack.SeriesGroups[report];

                    foreach (Series series in seriesGroup.SeriesList)
                    {
                        string seriesName;
                        string description;
                        if (seriesGroup.SeriesList.Count == 1)
                        {
                            //only one series per track group, no multi-series track group
                            seriesName  = group.ConsolidatedTrack.TrackId;
                            description = group.ConsolidatedTrack.FullTrackId;
                        }
                        else
                        {
                            seriesName  = group.ConsolidatedTrack.TrackId + "-" + series.Id;
                            description = group.ConsolidatedTrack.FullTrackId + "-" + series.Id;
                        }

                        //add data to the plot
                        int lineSeriesId = newPlot.AddLineSeries(seriesName, description);
                        foreach (XYValue value in series.Values)
                        {
                            newPlot.AddLineSeriesValue(lineSeriesId, value.X, value.Y);
                        }

                        StatViewModel newStat =
                            new StatViewModel(group.ExperimentId, seriesName, series.Stats
                                              , group.ConsolidatedTrack.LogBinaryFile
                                              , group.ConsolidatedTrack.LogDescriptorFile
                                              , group.ConsolidatedTrack.ExperimentalUnitConfigFile);

                        newStatGroup.addStat(newStat);
                    }
                }
            }
            Plot  = newPlot;
            Stats = newStatGroup;
        }
コード例 #6
0
 public ExperimentBatch(string name, List<MonitoredExperimentViewModel> experiments,HerdAgentViewModel herdAgent
     ,PlotViewModel evaluationPlot,CancellationToken cancelToken, Logger.LogFunction logFunction)
 {
     m_name = name;
     m_monitoredExperiments = experiments;
     m_herdAgent = herdAgent;
     m_logFunction = logFunction;
     m_shepherd = new Shepherd();
     m_shepherd.setLogMessageHandler(logFunction);
     m_cancelToken = cancelToken;
     m_evaluationPlot = evaluationPlot;
     m_experimentSeriesId = new Dictionary<string, int>();
 }
コード例 #7
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="expUnit">The model: an instance of ExperimentalUnit</param>
        /// <param name="plot">The plot used to monitor data</param>
        public MonitoredExperimentalUnitViewModel(ExperimentalUnit expUnit, PlotViewModel plot)
        {
            StateButton.Icon = "Sending";

            TaskName = "#" + NextTaskId;
            NextTaskId++;

            m_model  = expUnit;
            PipeName = m_model.Name;
            m_plotEvaluationMonitor = plot;

            LastHeartbeat = DateTime.Now;
        }
コード例 #8
0
 public ExperimentBatch(string name, List <MonitoredExperimentViewModel> experiments, HerdAgentViewModel herdAgent
                        , PlotViewModel evaluationPlot, CancellationToken cancelToken, Logger.LogFunction logFunction)
 {
     m_name = name;
     m_monitoredExperiments = experiments;
     m_herdAgent            = herdAgent;
     m_logFunction          = logFunction;
     m_shepherd             = new Shepherd();
     m_shepherd.setLogMessageHandler(logFunction);
     m_cancelToken        = cancelToken;
     m_evaluationPlot     = evaluationPlot;
     m_experimentSeriesId = new Dictionary <string, int>();
 }
コード例 #9
0
        /// <summary>
        ///     Constructor.
        /// </summary>
        /// <param name="MainWindowViewModel.Instance.LogToFile"></param>
        /// <param name="batchFileName"></param>
        public MonitorWindowViewModel()
        {
            Plot = new PlotViewModel("", "", "")
            {
                bShowOptions = false
            };
            Plot.Properties.LegendVisible = false;

            //set timers:
            //This first timer updates each 2s the progress bar when an experiment is running
            m_progressUpdateTimer          = new System.Timers.Timer(2000);
            m_progressUpdateTimer.Elapsed += ProgressUpdateEvent;
            //This second timer checks every 5s the connection with each herd agent running experiments
            m_connectionStateTimer          = new System.Timers.Timer(5000);
            m_connectionStateTimer.Elapsed += ConnectionCheckEvent;
        }
コード例 #10
0
 public ExperimentQueueMonitorViewModel(List <HerdAgentViewModel> freeHerdAgents
                                        , List <Experiment> experiments, PlotViewModel evaluationMonitor
                                        , Logger.LogFunction logFunctionDelegate)
 {
     m_evaluationMonitor = evaluationMonitor;
     m_herdAgentList     = freeHerdAgents;
     logFunction         = logFunctionDelegate;
     foreach (Experiment exp in experiments)
     {
         MonitoredExperimentViewModel monitoredExperiment =
             new MonitoredExperimentViewModel(exp, evaluationMonitor);
         m_monitoredExperimentBatchList.Add(monitoredExperiment);
         m_pendingExperiments.Add(monitoredExperiment);
     }
     NotifyOfPropertyChange(() => monitoredExperimentBatchList);
 }
コード例 #11
0
 public ExperimentQueueMonitorViewModel(List<HerdAgentViewModel> freeHerdAgents
     , List<Experiment> experiments, PlotViewModel evaluationMonitor
     , Logger.LogFunction logFunctionDelegate)
 {
     m_evaluationMonitor = evaluationMonitor;
     m_herdAgentList = freeHerdAgents;
     logFunction = logFunctionDelegate;
     foreach (Experiment exp in experiments)
     {
         MonitoredExperimentViewModel monitoredExperiment= 
             new MonitoredExperimentViewModel(exp,evaluationMonitor);
         m_monitoredExperimentBatchList.Add(monitoredExperiment);
         m_pendingExperiments.Add(monitoredExperiment);
     }
     NotifyOfPropertyChange(() => monitoredExperimentBatchList);
 }
コード例 #12
0
        public ReportViewModel(List <TrackGroup> queryResultTracks, LogQueryViewModel query, Report report)
        {
            Name = report.Name;

            //Create the plot
            PlotViewModel newPlot = new PlotViewModel(report.Name, "Time (s)", report.Name, false, true);

            if (!query.AverageSelectedTracks)
            {
                //Create the stats
                StatsViewModel newStatGroup = new StatsViewModel(report.Name);

                //Regular line series
                foreach (TrackGroup group in queryResultTracks)
                {
                    if (group.ConsolidatedTrack != null)
                    {
                        SeriesGroup seriesGroup = group.ConsolidatedTrack.SeriesGroups[report];

                        foreach (Series series in seriesGroup.SeriesList)
                        {
                            string seriesName;
                            string description;
                            if (seriesGroup.SeriesList.Count == 1)
                            {
                                //only one series per track group, no multi-series track group
                                seriesName  = group.ConsolidatedTrack.TrackId;
                                description = group.ConsolidatedTrack.FullTrackId;
                            }
                            else
                            {
                                seriesName  = group.ConsolidatedTrack.TrackId + "-" + series.Id;
                                description = group.ConsolidatedTrack.FullTrackId + "-" + series.Id;
                            }

                            //add data to the plot
                            int lineSeriesId = newPlot.AddLineSeries(seriesName, description);

                            //force resampling if point count is over 100
                            if (series.Values.Count > 100)
                            {
                                series.Resample(100);
                            }

                            foreach (XYValue value in series.Values)
                            {
                                newPlot.AddLineSeriesValue(lineSeriesId, value.X, value.Y);
                            }

                            StatViewModel newStat =
                                new StatViewModel(group.ExperimentId, seriesName, series.Stats
                                                  , group.ConsolidatedTrack.LogBinaryFile
                                                  , group.ConsolidatedTrack.LogDescriptorFile
                                                  , group.ConsolidatedTrack.ExperimentalUnitConfigFile);

                            newStatGroup.addStat(newStat);
                        }
                    }
                }
                Stats = newStatGroup;
            }
            else
            {
                List <Series> originalSeries = new List <Series>();
                foreach (TrackGroup group in queryResultTracks)
                {
                    //Averaged line series: we need to average all the track groups
                    SeriesGroup seriesGroup = group.ConsolidatedTrack.SeriesGroups[report];

                    //take the first series
                    originalSeries.Add(seriesGroup.SeriesList[0]);
                }

                Series.AverageSeriesList(originalSeries, out Series averages, out Series minimums, out Series maximums);

                //only one series per track group, no multi-series track group
                string seriesName  = "Averaged series";
                string description = "Averaged series";

                //add a line series to the plot
                int lineSeriesId = newPlot.AddLineSeries(seriesName, description);
                int areaSeriesId = newPlot.AddAreaSeries(seriesName, description);

                //all three output series must have the same number of elements
                int sampleCount = averages.Values.Count;
                for (int sample = 0; sample < sampleCount; sample++)
                {
                    newPlot.AddLineSeriesValue(lineSeriesId, averages.Values[sample].X, averages.Values[sample].Y);
                    newPlot.AddAreaSeriesValue(areaSeriesId, averages.Values[sample].X, minimums.Values[sample].Y, maximums.Values[sample].Y);
                }
            }

            Plot = newPlot;
        }
コード例 #13
0
 public MonitoredExperimentViewModel(Experiment experiment,PlotViewModel plot)
 {
     evaluationMonitor = plot;
     m_experiment = experiment;
 }
コード例 #14
0
        public void generatePlots()
        {
            List<PlotViewModel> newPlots = new List<PlotViewModel>();
            //create a new plot for each variable
            foreach(LoggedVariableViewModel variable in m_selectedVariables)
            {
                PlotViewModel newPlot = new PlotViewModel(variable.name, false);
                newPlot.parent = this;
                newPlots.Add(newPlot);
            }

            //draw data from each log
            foreach (ExperimentLogViewModel log in m_selectedLogs)
            {
                log.plotData(newPlots, m_selectedSource);
            }
            //update plots
            foreach (PlotViewModel plot in newPlots)
            {
                plots.Add(plot);
                plot.update();
            }
            //plot tabs can't be closed yet, so we can simplify it for now
            bCanSavePlots = true;
            selectedPlot = plots[plots.Count - 1]; //select the last plot generated
        }
コード例 #15
0
 public void close(PlotViewModel plot)
 {
     plots.Remove(plot);
 }
コード例 #16
0
 public MonitoredExperimentViewModel(Experiment experiment, PlotViewModel plot)
 {
     evaluationMonitor = plot;
     m_experiment      = experiment;
 }