Exemplo n.º 1
0
 /// <summary>
 /// Sends new traces to Stackdriver Trace or updates existing traces. If the ID
 /// of a trace that you send matches that of an existing trace, any fields
 /// in the existing trace and its spans are overwritten by the provided values,
 /// and any new fields provided are merged with the existing trace data. If the
 /// ID does not match, a new trace is created.
 /// </summary>
 /// <param name="projectId">
 /// ID of the Cloud project where the trace data is stored.
 /// </param>
 /// <param name="traces">
 /// The body of the message.
 /// </param>
 /// <param name="cancellationToken">
 /// A <see cref="CancellationToken"/> to use for this RPC.
 /// </param>
 /// <returns>
 /// A Task containing the RPC response.
 /// </returns>
 public virtual Task PatchTracesAsync(
     string projectId,
     Traces traces,
     CancellationToken cancellationToken) => PatchTracesAsync(
     projectId,
     traces,
     CallSettings.FromCancellationToken(cancellationToken));
Exemplo n.º 2
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (Group != null)
         {
             hashCode = hashCode * 59 + Group.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (Traces != null)
         {
             hashCode = hashCode * 59 + Traces.GetHashCode();
         }
         if (BaseFrame != null)
         {
             hashCode = hashCode * 59 + BaseFrame.GetHashCode();
         }
         if (Data != null)
         {
             hashCode = hashCode * 59 + Data.GetHashCode();
         }
         if (Layout != null)
         {
             hashCode = hashCode * 59 + Layout.GetHashCode();
         }
         return(hashCode);
     }
 }
 /// <summary>
 /// Sends new traces to Stackdriver Trace or updates existing traces. If the ID
 /// of a trace that you send matches that of an existing trace, any fields
 /// in the existing trace and its spans are overwritten by the provided values,
 /// and any new fields provided are merged with the existing trace data. If the
 /// ID does not match, a new trace is created.
 /// </summary>
 /// <param name="projectId">
 /// ID of the Cloud project where the trace data is stored.
 /// </param>
 /// <param name="traces">
 /// The body of the message.
 /// </param>
 /// <param name="cancellationToken">
 /// A <see cref="st::CancellationToken"/> to use for this RPC.
 /// </param>
 /// <returns>
 /// A Task that completes when the RPC has completed.
 /// </returns>
 public virtual stt::Task PatchTracesAsync(
     string projectId,
     Traces traces,
     st::CancellationToken cancellationToken) => PatchTracesAsync(
     projectId,
     traces,
     gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
Exemplo n.º 4
0
        private void SaveTraces(IEAElement element)
        {
            //first need to identify those tracelinks that were removed and those that were added
            // currently traces do not support update and can only be added or removed
            IEAElement[] existingTraces = element.GetTracedElements().ToArray();
            // existing.except(traces) traces that have been deleted
            IEnumerable <string> removedTraces =
                existingTraces.Select(e => e.GUID).Except(Traces.Select(t => t.TracedElementGUID));

            // traces.except(existing) traces that were added
            IEnumerable <string> addedTraces =
                Traces.Select(t => t.TracedElementGUID).Except(existingTraces.Select(e => e.GUID));

            //in order to remove tracelink i need to find the correct connection that connect this and the linked element.
            foreach (string removedTrace in removedTraces)
            {
                IEAConnector connector =
                    element.GetConnectors().FirstOrDefault(c => (c.GetSupplier().GUID.Equals(removedTrace) ||
                                                                 c.GetClient().GUID.Equals(removedTrace))
                                                           &&
                                                           c.Stereotype.Equals(EAConstants.RelationTrace) &&
                                                           c.Type.Equals(EAConstants.AbstractionMetaType));
                if (null != connector)
                {
                    element.RemoveConnector(connector);
                }
            }

            foreach (string addedTrace in addedTraces)
            {
                IEAElement suppliedElement = EAMain.Repository.GetElementByGUID(addedTrace);
                element.ConnectTo(suppliedElement, EAConstants.AbstractionMetaType, EAConstants.RelationTrace);
            }
        }
        public void GenerateATrace(string strategy)
        {
            var tuple = new Tuple <Object, object>(strategy, _innerLoop);

            Traces.Add(tuple);
            _innerLoop = new List <TraceStep>();
        }
 private BufferingTraceConsumer(ITraceConsumer consumer, int bufferSize = DefaultBufferSize)
 {
     _consumer   = GaxPreconditions.CheckNotNull(consumer, nameof(consumer));
     _bufferSize = bufferSize;
     _traces     = new Traces();
     _size       = 0;
 }
 /// <summary>
 /// Sends new traces to Stackdriver Trace or updates existing traces. If the ID
 /// of a trace that you send matches that of an existing trace, any fields
 /// in the existing trace and its spans are overwritten by the provided values,
 /// and any new fields provided are merged with the existing trace data. If the
 /// ID does not match, a new trace is created.
 /// </summary>
 /// <param name="projectId">
 /// ID of the Cloud project where the trace data is stored.
 /// </param>
 /// <param name="traces">
 /// The body of the message.
 /// </param>
 /// <param name="callSettings">
 /// If not null, applies overrides to this RPC call.
 /// </param>
 /// <returns>
 /// The RPC response.
 /// </returns>
 public virtual void PatchTraces(
     string projectId,
     Traces traces,
     CallSettings callSettings = null)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 8
0
        private void Flush()
        {
            Traces traces = new Traces();

            traces.Traces_.Add(_trace);
            _consumer.Receive(traces);
        }
Exemplo n.º 9
0
 public void DeleteTrace(int traceIndex)
 {
     graph.Plots.RemoveAt(traceIndex);
     foreach (var cursor in Traces[traceIndex].Cursors)
     {
         if (graph.Children.Contains(cursor))
         {
             graph.Children.Remove(cursor);
         }
     }
     //for (int i = 0; i < Traces[traceIndex].LimitLineList.Count; i++)
     //{
     //    graph.Plots.RemoveAt(graph.Plots.Count - 1);
     //}
     Traces.RemoveAt(traceIndex);
     graph.Axes.RemoveAt(traceIndex);
     lstYxis.ItemsSource = null;
     lstYxis.ItemsSource = Traces;
     if (Traces.Count > 0)
     {
         lstYxis.SelectedIndex = 0;
     }
     else
     {
         clearData();
     }
 }
Exemplo n.º 10
0
 public void Clear()
 {
     MathItems.Clear();
     Cursors.Clear();
     Markers.Clear();
     Traces.Clear();
 }
Exemplo n.º 11
0
 public ImportableVehicleViewModel(IEnumerable <PsaTrace> model)
 {
     if (model == null)
     {
         throw new ArgumentNullException("model");
     }
     this.model = model;
     foreach (PsaTrace trace in model)
     {
         ImportablePsaTraceViewModel traceViewModel =
             new ImportablePsaTraceViewModel(trace);
         RegisterExportableChild(traceViewModel);
         Traces.Add(traceViewModel);
     }
     if (!model.AreAllVinsEqual())
     {
         throw new ArgumentException("Vins are not equal here!");
     }
     mileage = model.GetMaxMileage();
     if (Traces.Count > 0)
     {
         vin              = Traces[0].Vin;
         manufacturer     = Traces[0].Manufacturer;
         vehicleModelName = Traces[0].VehicleModelName;
     }
 }
Exemplo n.º 12
0
        public void SetTrace2Clipboard()
        {
            var selctedOne = Traces.FirstOrDefault(t => t.IsSelected);

            if (!string.IsNullOrEmpty(selctedOne.Text))
            {
                Clipboard.SetText(selctedOne.Text);
            }
        }
Exemplo n.º 13
0
        public void AddTrace(SingleTrace trace)
        {
            if (trace == null)
            {
                throw new ArgumentNullException();
            }

            Traces.Add(trace);
        }
Exemplo n.º 14
0
 public ConsoleLogger(MixedRealityExtensionApp app)
 {
     _app   = app;
     traces = new Traces();
     traces.AddTrace(new Trace()
     {
         Severity = TraceSeverity.Info, Message = null
     });
 }
Exemplo n.º 15
0
 /// <summary>
 /// remove trace i from the Traces list
 /// </summary>
 /// <param name="i">trace number to remove from list</param>
 /// <returns>true is successful</returns>
 public bool RemoveTrace(int i)
 {
     if (i >= Traces.Count)
     {
         return(false);
     }
     Traces.RemoveAt(i);
     return(true);
 }
Exemplo n.º 16
0
 /// <summary>
 /// Sends new traces to Stackdriver Trace or updates existing traces. If the ID
 /// of a trace that you send matches that of an existing trace, any fields
 /// in the existing trace and its spans are overwritten by the provided values,
 /// and any new fields provided are merged with the existing trace data. If the
 /// ID does not match, a new trace is created.
 /// </summary>
 /// <param name="projectId">
 /// ID of the Cloud project where the trace data is stored.
 /// </param>
 /// <param name="traces">
 /// The body of the message.
 /// </param>
 /// <param name="callSettings">
 /// If not null, applies overrides to this RPC call.
 /// </param>
 /// <returns>
 /// The RPC response.
 /// </returns>
 public virtual void PatchTraces(
     string projectId,
     Traces traces,
     CallSettings callSettings = null) => PatchTraces(
     new PatchTracesRequest
 {
     ProjectId = projectId,
     Traces    = traces,
 },
     callSettings);
Exemplo n.º 17
0
 /// <summary>
 /// Sends new traces to Stackdriver Trace or updates existing traces. If the ID
 /// of a trace that you send matches that of an existing trace, any fields
 /// in the existing trace and its spans are overwritten by the provided values,
 /// and any new fields provided are merged with the existing trace data. If the
 /// ID does not match, a new trace is created.
 /// </summary>
 /// <param name="projectId">
 /// ID of the Cloud project where the trace data is stored.
 /// </param>
 /// <param name="traces">
 /// The body of the message.
 /// </param>
 /// <param name="callSettings">
 /// If not null, applies overrides to this RPC call.
 /// </param>
 /// <returns>
 /// A Task containing the RPC response.
 /// </returns>
 public virtual Task PatchTracesAsync(
     string projectId,
     Traces traces,
     CallSettings callSettings = null) => PatchTracesAsync(
     new PatchTracesRequest
 {
     ProjectId = projectId,
     Traces    = traces,
 },
     callSettings);
Exemplo n.º 18
0
 private void DoPing(object state)
 {
     TraceVM[] localTraces = null;
     Dispatcher.Invoke(() => localTraces = Traces?.ToArray());
     if (localTraces != null)
     {
         Parallel.ForEach(localTraces, t => ThreadPool.QueueUserWorkItem(HttpPing, t));
     }
     Dispatcher.Invoke(SaveAll);
 }
Exemplo n.º 19
0
 /// <summary>
 /// Sends new traces to Stackdriver Trace or updates existing traces. If the ID
 /// of a trace that you send matches that of an existing trace, any fields
 /// in the existing trace and its spans are overwritten by the provided values,
 /// and any new fields provided are merged with the existing trace data. If the
 /// ID does not match, a new trace is created.
 /// </summary>
 /// <param name="projectId">
 /// ID of the Cloud project where the trace data is stored.
 /// </param>
 /// <param name="traces">
 /// The body of the message.
 /// </param>
 /// <param name="callSettings">
 /// If not null, applies overrides to this RPC call.
 /// </param>
 /// <returns>
 /// A Task containing the RPC response.
 /// </returns>
 public virtual Task PatchTracesAsync(
     string projectId,
     Traces traces,
     CallSettings callSettings = null) => PatchTracesAsync(
     new PatchTracesRequest
 {
     ProjectId = GaxPreconditions.CheckNotNullOrEmpty(projectId, nameof(projectId)),
     Traces    = GaxPreconditions.CheckNotNull(traces, nameof(traces)),
 },
     callSettings);
 /// <summary>
 /// Sends new traces to Stackdriver Trace or updates existing traces. If the ID
 /// of a trace that you send matches that of an existing trace, any fields
 /// in the existing trace and its spans are overwritten by the provided values,
 /// and any new fields provided are merged with the existing trace data. If the
 /// ID does not match, a new trace is created.
 /// </summary>
 /// <param name="projectId">
 /// ID of the Cloud project where the trace data is stored.
 /// </param>
 /// <param name="traces">
 /// The body of the message.
 /// </param>
 /// <param name="callSettings">
 /// If not null, applies overrides to this RPC call.
 /// </param>
 public virtual void PatchTraces(
     string projectId,
     Traces traces,
     gaxgrpc::CallSettings callSettings = null) => PatchTraces(
     new PatchTracesRequest
 {
     ProjectId = gax::GaxPreconditions.CheckNotNullOrEmpty(projectId, nameof(projectId)),
     Traces    = gax::GaxPreconditions.CheckNotNull(traces, nameof(traces)),
 },
     callSettings);
Exemplo n.º 21
0
 static partial void TraceDetail(Traces traces, bool newLine, string description)
 {
     if (EnabledTraces.HasFlag(traces))
     {
         if (newLine)
         {
             System.Diagnostics.Trace.WriteLine("");
         }
         System.Diagnostics.Trace.WriteLine(description);
     }
 }
Exemplo n.º 22
0
 /// <summary>
 /// add a trace to the end of the Traces list
 /// </summary>
 /// <param name="trace">add a trace</param>
 public void AddTrace(SEGYTrace trace)
 {
     if (Traces.Count == 0)
     {
         trace.positionOfTraceInFile = positionOfEndofFileHeaders;
     }
     else
     {
         trace.positionOfTraceInFile = Traces[Traces.Count - 1].positionOfTraceInFile + Traces[Traces.Count - 1].totalLengthOfTraceData;
     }
     Traces.Add(trace);
 }
        /// <inheritdoc />
        public void Flush()
        {
            Traces old;

            lock (_mutex)
            {
                old     = _traces;
                _traces = new Traces();
                _size   = 0;
            }
            _consumer.Receive(old);
        }
Exemplo n.º 24
0
        public void Receive()
        {
            Traces traces = GetTraces();

            var mockClient = new Mock <TraceServiceClient>();

            mockClient.Setup(c => c.PatchTraces(ProjectId, traces, null));
            var consumer = new GrpcTraceConsumer(mockClient.Object);

            consumer.Receive(traces.Traces_);
            mockClient.VerifyAll();
        }
Exemplo n.º 25
0
        private void AddAddress_Click(object sender, RoutedEventArgs e)
        {
            var trace  = new TraceVM();
            var window = new AddressEdittingWindow(trace);

            window.ShowDialog();
            if (!string.IsNullOrWhiteSpace(trace.Address))
            {
                Traces.Add(trace);
            }

            SaveAll();
        }
        /// <summary>Snippet for PatchTraces</summary>
        public void PatchTraces()
        {
            // Snippet: PatchTraces(string, Traces, CallSettings)
            // Create client
            TraceServiceClient traceServiceClient = TraceServiceClient.Create();
            // Initialize request argument(s)
            string projectId = "";
            Traces traces    = new Traces();

            // Make the request
            traceServiceClient.PatchTraces(projectId, traces);
            // End snippet
        }
Exemplo n.º 27
0
        private void LoadTraces(IEAElement element)
        {
            Traces.Clear();

            IEnumerable <ITraceLink> traces =
                element.FindConnectors("", EAConstants.RelationTrace)
                .Select(a => (ITraceLink) new TraceLink(this, a));

            foreach (ITraceLink trace in traces)
            {
                Traces.Add(trace);
            }
        }
        /// <summary>
        /// Sends new traces to Stackdriver Trace or updates existing traces. If the ID
        /// of a trace that you send matches that of an existing trace, any fields
        /// in the existing trace and its spans are overwritten by the provided values,
        /// and any new fields provided are merged with the existing trace data. If the
        /// ID does not match, a new trace is created.
        /// </summary>
        /// <param name="projectId">
        /// ID of the Cloud project where the trace data is stored.
        /// </param>
        /// <param name="traces">
        /// The body of the message.
        /// </param>
        /// <param name="callSettings">
        /// If not null, applies overrides to this RPC call.
        /// </param>
        /// <returns>
        /// The RPC response.
        /// </returns>
        public override void PatchTraces(
            string projectId,
            Traces traces,
            CallSettings callSettings = null)
        {
            PatchTracesRequest request = new PatchTracesRequest
            {
                ProjectId = projectId,
                Traces    = traces,
            };

            Modify_PatchTracesRequest(ref request, ref callSettings);
            _callPatchTraces.Sync(request, callSettings);
        }
        public async Task PatchTracesAsync()
        {
            // Snippet: PatchTracesAsync(string,Traces,CallSettings)
            // Additional: PatchTracesAsync(string,Traces,CancellationToken)
            // Create client
            TraceServiceClient traceServiceClient = TraceServiceClient.Create();
            // Initialize request argument(s)
            string projectId = "";
            Traces traces    = new Traces();
            // Make the request
            await traceServiceClient.PatchTracesAsync(projectId, traces);

            // End snippet
        }
Exemplo n.º 30
0
        public async Task ReceiveAsync()
        {
            Traces traces = GetTraces();

            var mockClient = new Mock <TraceServiceClient>();

            mockClient.Setup(c => c.PatchTracesAsync(
                                 ProjectId, traces, CancellationToken.None)).Returns(CommonUtils.CompletedTask);
            var consumer = new GrpcTraceConsumer(mockClient.Object);

            await consumer.ReceiveAsync(traces.Traces_, CancellationToken.None);

            mockClient.VerifyAll();
        }
        private Traces MakeData(ShewharMeasurement measurement)
        {
            var symbol = new MarkerSymbol
                             {
                                 Type = MarkerSymbolType.Circle,
                                 Visible = true
                             };

            var function = new TraceReal
                               {
                                   Pen = new System.Drawing.Pen(System.Drawing.Color.Green) { Width = 1 },
                                   Name = "Shewhart",
                                   IsGistogram = false,
                                   IsVisibleInMarker = true,
                                   Visible = true,
                                   GraphIndex = 0,
                                   Approximator = null,
                                   ArgumentQuantityType = PhysicalQuantityType.Scalar,
                                   SymbolInterval = 1,
                                   SymbolsAutoInterval = false,
                                   Symbol = symbol
                               };

            var noneSymbol = new MarkerSymbol
                                 {
                                     Type = MarkerSymbolType.None,
                                     Visible = false
                                 };

            var meanFunction = new TraceReal
                                   {
                                       Pen = new System.Drawing.Pen(System.Drawing.Color.Blue),
                                       Name = "Mean",
                                       IsGistogram = false,
                                       IsVisibleInMarker = true,
                                       Visible = true,
                                       GraphIndex = 0,
                                       Approximator = null,
                                       ArgumentQuantityType = PhysicalQuantityType.Scalar,
                                       Symbol = noneSymbol
                                   };

            var uclSymbol = new MarkerSymbol
                                {
                                    Type = MarkerSymbolType.TriangleUp,
                                    Visible = true
                                };

            var uclFunction = new TraceReal
                                  {
                                      Pen = new System.Drawing.Pen(System.Drawing.Color.Red),
                                      Name = "UCL",
                                      IsGistogram = false,
                                      IsVisibleInMarker = true,
                                      Visible = true,
                                      GraphIndex = 0,
                                      Approximator = null,
                                      ArgumentQuantityType = PhysicalQuantityType.Scalar,
                                      Symbol = noneSymbol
                                  };

            var cUpFunction = new TraceReal
                                  {
                                      Pen = new System.Drawing.Pen(System.Drawing.Color.FromArgb(255, 192, 192)) { DashPattern = new[] { 4.0F, 8.0F } },
                                      Name = "C above mean",
                                      Visible = true,
                                      GraphIndex = 0,
                                      Approximator = null,
                                      ArgumentQuantityType = PhysicalQuantityType.Scalar,
                                      Symbol = noneSymbol
                                  };

            var bUpFunction = new TraceReal
                                  {
                                      Pen = new System.Drawing.Pen(System.Drawing.Color.FromArgb(255, 128, 128)) { DashPattern = new[] { 4.0F, 8.0F } },
                                      Name = "B above mean",
                                      Visible = true,
                                      GraphIndex = 0,
                                      Approximator = null,
                                      ArgumentQuantityType = PhysicalQuantityType.Scalar,
                                      Symbol = noneSymbol
                                  };

            var lclSymbol = new MarkerSymbol
                                {
                                    Type = MarkerSymbolType.TriangleDown,
                                    Visible = true
                                };

            var lclFunction = new TraceReal
                                  {
                                      Pen = new System.Drawing.Pen(System.Drawing.Color.Red),
                                      Name = "LCL",
                                      IsGistogram = false,
                                      IsVisibleInMarker = true,
                                      Visible = true,
                                      GraphIndex = 0,
                                      Approximator = null,
                                      ArgumentQuantityType = PhysicalQuantityType.Scalar,
                                      Symbol = noneSymbol
                                  };

            var cDownFunction = new TraceReal
                                    {
                                        Pen = new System.Drawing.Pen(System.Drawing.Color.FromArgb(255, 192, 192)) { DashPattern = new[] { 4.0F, 8.0F } },
                                        Name = "C below mean",
                                        Visible = true,
                                        GraphIndex = 0,
                                        Approximator = null,
                                        ArgumentQuantityType = PhysicalQuantityType.Scalar,
                                        Symbol = noneSymbol
                                    };

            var bDownFunction = new TraceReal
                                    {
                                        Pen = new System.Drawing.Pen(System.Drawing.Color.FromArgb(255, 128, 128)) { DashPattern = new[] { 4.0F, 8.0F } },
                                        Name = "B below mean",
                                        Visible = true,
                                        GraphIndex = 0,
                                        Approximator = null,
                                        ArgumentQuantityType = PhysicalQuantityType.Scalar,
                                        Symbol = noneSymbol
                                    };

            var minSpecFunction = new TraceReal
                                      {
                                          Pen = new System.Drawing.Pen(System.Drawing.Color.FromArgb(64, 64, 64)),
                                          Name = "Min spec",
                                          Visible = true,
                                          GraphIndex = 0,
                                          Approximator = null,
                                          ArgumentQuantityType = PhysicalQuantityType.Scalar,
                                          Symbol = noneSymbol
                                      };

            var maxSpecFunction = new TraceReal
                                      {
                                          Pen = new System.Drawing.Pen(System.Drawing.Color.FromArgb(64, 64, 64)),
                                          Name = "Max spec",
                                          Visible = true,
                                          GraphIndex = 0,
                                          Approximator = null,
                                          ArgumentQuantityType = PhysicalQuantityType.Scalar,
                                          Symbol = noneSymbol
                                      };

            var nominalSpecFunction = new TraceReal
                                          {
                                              Pen = new System.Drawing.Pen(System.Drawing.Color.Black),
                                              Name = "Nominal spec",
                                              Visible = true,
                                              GraphIndex = 0,
                                              Approximator = null,
                                              ArgumentQuantityType = PhysicalQuantityType.Scalar,
                                              Symbol = noneSymbol
                                          };

            var functionDataSector = new GraphDataSectorReal();
            var meanDataSector = new GraphDataSectorReal();
            var uclDataSector = new GraphDataSectorReal();
            var cUpDataSector = new GraphDataSectorReal();
            var bUpDataSector = new GraphDataSectorReal();
            var lclDataSector = new GraphDataSectorReal();
            var cDownDataSector = new GraphDataSectorReal();
            var bDownDataSector = new GraphDataSectorReal();
            var minSpecDataSector = new GraphDataSectorReal();
            var maxSpecDataSector = new GraphDataSectorReal();
            var nominalSpecDataSector = new GraphDataSectorReal();

            var values = new List<double> {378, 376, 375, 370, 371, 388, 389, 390, 388, 400, 391, 392, 386, 382, 378, 374, 370, 380, 381, 387};
            var meanvalue = 382.3;
            var sigma = 8.25;
            var uclValue = meanvalue + 3*sigma;
            var bUpValue = meanvalue + 2*sigma;
            var cUpValue = meanvalue + sigma;
            var lclValue = meanvalue - 3*sigma;
            var bDownValue = meanvalue - 2*sigma;
            var cDownValue = meanvalue - sigma;

            double? usersMinSpec = 340;
            double? usersMaxSpec = 420;
            double? usersNominalSpec = 380;

            for (int i = 0; i < values.Count; i++)
            {
                functionDataSector.Add(new PointValueReal(i, values[i]));
                meanDataSector.Add(new PointValueReal(i, meanvalue));
                uclDataSector.Add(new PointValueReal(i, uclValue));
                bUpDataSector.Add(new PointValueReal(i, bUpValue));
                cUpDataSector.Add(new PointValueReal(i, cUpValue));
                lclDataSector.Add(new PointValueReal(i, lclValue));
                bDownDataSector.Add(new PointValueReal(i, bDownValue));
                cDownDataSector.Add(new PointValueReal(i, cDownValue));

                if (usersMinSpec.HasValue)
                    minSpecDataSector.Add(new PointValueReal(i, usersMinSpec.Value));

                if (usersMaxSpec.HasValue)
                    maxSpecDataSector.Add(new PointValueReal(i, usersMaxSpec.Value));

                if (usersNominalSpec.HasValue)
                    nominalSpecDataSector.Add(new PointValueReal(i, usersNominalSpec.Value));
            }

            function.Add(functionDataSector);
            meanFunction.Add(meanDataSector);
            uclFunction.Add(uclDataSector);
            bUpFunction.Add(bUpDataSector);
            cUpFunction.Add(cUpDataSector);
            lclFunction.Add(lclDataSector);
            bDownFunction.Add(bDownDataSector);
            cDownFunction.Add(cDownDataSector);
            minSpecFunction.Add(minSpecDataSector);
            maxSpecFunction.Add(maxSpecDataSector);
            nominalSpecFunction.Add(nominalSpecDataSector);

            var result = new Traces();

            result.RealFunctions.Add(uclFunction);
            result.RealFunctions.Add(bUpFunction);
            result.RealFunctions.Add(cUpFunction);
            result.RealFunctions.Add(meanFunction);
            result.RealFunctions.Add(cDownFunction);
            result.RealFunctions.Add(bDownFunction);
            result.RealFunctions.Add(lclFunction);
            result.RealFunctions.Add(maxSpecFunction);
            result.RealFunctions.Add(nominalSpecFunction);
            result.RealFunctions.Add(minSpecFunction);
            result.RealFunctions.Add(function);

            var points = new List<PointValueReal>();
            foreach (var sector in function)
            {
                foreach (var pointValueBase in sector)
                {
                    points.Add((PointValueReal) pointValueBase);
                }
            }

            measurement.TrendManager.SetData(points.ToArray(), sigma, meanvalue);

            var Cp = (usersMaxSpec.Value - usersMinSpec.Value)/(6*sigma);

            var Cpk = Math.Min((usersMaxSpec.Value - meanvalue)/(3*sigma),
                                   (meanvalue - usersMinSpec.Value)/(3*sigma));

            _graphPlotControl.GraphTitle += "\nCp = " + Cp;
            _graphPlotControl.GraphTitle += "\nCpk = " + Cpk;

            return result;
        }
        private Traces MakeData()
        {
            var function = new TraceReal
                               {
                                   Pen = new System.Drawing.Pen(System.Drawing.Color.SkyBlue),
                                   Name = "Ft, C2, Transistor, T240",
                                   IsGistogram = true,
                                   IsVisibleInMarker = true,
                                   Visible = true,
                                   GraphIndex = 0,
                                   CoordinateSystemType = CoordinateSystemType.Rectangle,
                                   ArgumentQuantityType = PhysicalQuantityType.Frequencies
                               };

            var symbol = new MarkerSymbol
            {
                Type = MarkerSymbolType.Circle,
                Visible = false
            };

            function.Symbol = symbol;
            function.SymbolInterval = 1;
            function.SymbolsAutoInterval = false;

            var values = new[] { 38603499999.999992, 32817999999.999996, 36808000000.0, 40000000000.0, 31820499999.999996, 40000000000.0, 32817999999.999996, 40000000000.0, 40000000000.0, 40000000000.0, 37606000000.0, 40000000000.0, 40000000000.0, 40000000000.0, 40000000000.0, 40000000000.0, 32418999999.999996, 40000000000.0, 40000000000.0, 27431500000.0 };

            var gistogram = Calculations.Gistogram(values);

            if (gistogram.Keys.Count == 1)
            {
                var dataSector = new GraphDataSectorReal
                                     {
                                         new PointValueReal(gistogram.Keys.ElementAt(0),
                                                            gistogram[gistogram.Keys.ElementAt(0)])
                                     };

                function.Add(dataSector);
            }
            else
            {
                for (int i = 0; i < gistogram.Keys.Count - 1; i++)
                {
                    var dataSector = new GraphDataSectorReal();

                    dataSector.Add(new PointValueReal(gistogram.Keys.ElementAt(i),
                                                      gistogram[gistogram.Keys.ElementAt(i + 1)]));

                    dataSector.Add(new PointValueReal(gistogram.Keys.ElementAt(i + 1),
                                                      gistogram[gistogram.Keys.ElementAt(i + 1)]));

                    function.Add(dataSector);
                }
            }

            var result = new Traces();

            result.RealFunctions.Add(function);

            var meanFunction = new TraceReal
            {
                Pen = new System.Drawing.Pen(System.Drawing.Color.Green),
                Name = "Mean Ft, C2, Transistor, T240",
                IsGistogram = true,
                IsVisibleInMarker = true,
                Visible = true,
                GraphIndex = 0,
                CoordinateSystemType = CoordinateSystemType.Rectangle,
                ArgumentQuantityType = PhysicalQuantityType.Frequencies
            };

            var meanSymbol = new MarkerSymbol
            {
                Type = MarkerSymbolType.Circle,
                Visible = true
            };

            meanFunction.Symbol = meanSymbol;
            meanFunction.SymbolInterval = 1;
            meanFunction.SymbolsAutoInterval = false;

            var meanValue = Calculations.MeanValue(values);
            var maxDiapason = Calculations.MaxDiapasonValue(values);

            var meanDataSector = new GraphDataSectorReal
                                 {
                                     new PointValueReal(meanValue, maxDiapason)
                                 };

            meanFunction.Add(meanDataSector);

            result.RealFunctions.Add(meanFunction);

            var sigmaFunction = new TraceReal
            {
                Pen = new System.Drawing.Pen(System.Drawing.Color.Blue),
                Name = "3 sigma Ft, C2, Transistor, T240",
                IsGistogram = true,
                IsVisibleInMarker = true,
                Visible = true,
                GraphIndex = 0,
                CoordinateSystemType = CoordinateSystemType.Rectangle,
                ArgumentQuantityType = PhysicalQuantityType.Frequencies
            };

            sigmaFunction.Symbol = meanSymbol;
            sigmaFunction.SymbolInterval = 1;
            sigmaFunction.SymbolsAutoInterval = false;

            var sigma = Calculations.Sigma(values);

            var sigmaDataSector = new GraphDataSectorReal
                                 {
                                     new PointValueReal(meanValue - 3 * sigma, maxDiapason)
                                 };

            sigmaFunction.Add(sigmaDataSector);

            sigmaDataSector = new GraphDataSectorReal
                                 {
                                     new PointValueReal(meanValue + 3 * sigma, maxDiapason)
                                 };

            sigmaFunction.Add(sigmaDataSector);

            result.RealFunctions.Add(sigmaFunction);

            var gausFunction = new TraceReal
            {
                Pen = new System.Drawing.Pen(System.Drawing.Color.Red),
                Name = "Gaus Ft, C2, Transistor, T240",
                IsGistogram = false,
                IsVisibleInMarker = true,
                Visible = true,
                GraphIndex = 0,
                CoordinateSystemType = CoordinateSystemType.Rectangle,
                ArgumentQuantityType = PhysicalQuantityType.Frequencies
            };

            gausFunction.Symbol = symbol;
            gausFunction.SymbolInterval = 1;
            gausFunction.SymbolsAutoInterval = false;

            var gausDataSector = new GraphDataSectorReal();
            var gaus = Calculations.Gaussian(values);
            foreach (var valueReal in gaus)
            {
                gausDataSector.Add(valueReal);
            }

            gausFunction.Add(gausDataSector);

            result.RealFunctions.Add(gausFunction);

            return result;
        }
Exemplo n.º 33
0
 /// <summary>
 /// Deserializes traces from an XML Error file.
 /// </summary>
 /// <param name="reader">XML Error file.</param>
 /// <param name="traces">Traces to obtain, if isn't null new elements are added.</param>
 /// <returns>Traces.</returns>
 public static Traces Deserialize(XmlReader reader, Traces traces)
 {
     if (reader.IsStartElement(DTD.Error.TagErrorTrace))
     {
         if (traces == null)
         {
             traces = new Traces();
         }
         if (!reader.IsEmptyElement)
         {
             reader.ReadStartElement();
             // For each sub-Node.
             do
             {
                 // Only ErrorTraceItem Nodes.
                 if (reader.IsStartElement(DTD.Error.ErrorTrace.TagErrorTraceItem))
                 {
                     traces.Add(XMLErrorTraceSerialize.Deserialize(reader.ReadSubtree(), null));
                 }
                 else
                 {
                     reader.Skip();
                     if (reader.NodeType == XmlNodeType.None)
                     {
                         break;
                     }
                     else
                     {
                         continue;
                     }
                 }
             } while (reader.Read());
         }
         else
         {
             reader.Skip();
         }
     }
     return traces;
 }
Exemplo n.º 34
0
        private Traces MakeData()
        {
            var ft_row1 = new GraphDataSectorComplex
                           {
                               new PointValueComplex(38603000000, new Complex(1, 1))
                                    {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                               new PointValueComplex(32818000000, new Complex(1, 2))
                                    {SourceName = "T240_A01_3V_16mA_-0V5.s2p"}
                           };

            var s21_row1 = new GraphDataSectorComplex
                               {
                                   new PointValueComplex(9.3146, new Complex(1, 1))
                                       {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                   new PointValueComplex(8.002, new Complex(1, 2))
                                       {SourceName = "T240_A01_3V_16mA_-0V5.s2p"}
                               };

            var ft_row2 = new GraphDataSectorComplex
                              {
                                  new PointValueComplex(38808000000, new Complex(2, 1))
                                      {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                  new PointValueComplex(40000000000, new Complex(2, 2))
                                      {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                  new PointValueComplex(31820000000, new Complex(2, 3))
                                      {SourceName = "T240_A01_3V_16mA_-0V5.s2p"}
                              };

            var s21_row2 = new GraphDataSectorComplex
                               {
                                   new PointValueComplex(9.0279, new Complex(2, 1))
                                       {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                   new PointValueComplex(10.318, new Complex(2, 2))
                                       {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                   new PointValueComplex(5.3264, new Complex(2, 3))
                                       {SourceName = "T240_A01_3V_16mA_-0V5.s2p"}
                               };

            var ft_row3 = new GraphDataSectorComplex
                              {
                                  new PointValueComplex(40000000000, new Complex(3, 1))
                                      {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                  new PointValueComplex(32818000000, new Complex(3, 2))
                                      {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                              };

            var s21_row3 = new GraphDataSectorComplex
                               {
                                   new PointValueComplex(10.38, new Complex(3, 1))
                                       {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                   new PointValueComplex(8.2851, new Complex(3, 2))
                                       {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                               };

            var ft_row4 = new GraphDataSectorComplex
                              {
                                  new PointValueComplex(40000000000, new Complex(4, 1))
                                      {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                  new PointValueComplex(40000000000, new Complex(4, 2))
                                      {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                  new PointValueComplex(40000000000, new Complex(4, 3))
                                      {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                  new PointValueComplex(37606000000, new Complex(4, 4))
                                      {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                              };

            var s21_row4 = new GraphDataSectorComplex
                               {
                                   new PointValueComplex(9.9512, new Complex(4, 1))
                                       {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                   new PointValueComplex(10.44, new Complex(4, 2))
                                       {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                   new PointValueComplex(10.258, new Complex(4, 3))
                                       {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                   new PointValueComplex(8.3711, new Complex(4, 4))
                                       {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                               };

            var ft_row5 = new GraphDataSectorComplex
                              {
                                  new PointValueComplex(40000000000, new Complex(5, 1))
                                      {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                  new PointValueComplex(40000000000, new Complex(5, 2))
                                      {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                  new PointValueComplex(40000000000, new Complex(5, 3))
                                      {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                  new PointValueComplex(40000000000, new Complex(5, 4))
                                      {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                      new PointValueComplex(40000000000, new Complex(5, 5))
                                      {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                      new PointValueComplex(32419000000, new Complex(5, 6))
                                      {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                              };

            var s21_row5 = new GraphDataSectorComplex
                               {
                                   new PointValueComplex(10.049, new Complex(5, 1))
                                       {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                   new PointValueComplex(9.4842, new Complex(5, 2))
                                       {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                   new PointValueComplex(7.1313, new Complex(5, 3))
                                       {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                   new PointValueComplex(9.9078, new Complex(5, 4))
                                       {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                        new PointValueComplex(10.931, new Complex(5, 5))
                                       {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                        new PointValueComplex(5.3135, new Complex(5, 6))
                                       {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                               };

            var ft_row6 = new GraphDataSectorComplex
                              {
                                  new PointValueComplex(40000000000, new Complex(6, 1))
                                      {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                  new PointValueComplex(40000000000, new Complex(6, 2))
                                      {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                  new PointValueComplex(double.NaN, new Complex(6, 3))
                                      {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                  new PointValueComplex(27432000000, new Complex(6, 4))
                                      {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},

                              };

            var s21_row6 = new GraphDataSectorComplex
                               {
                                   new PointValueComplex(11.923, new Complex(6, 1))
                                       {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                   new PointValueComplex(9.4732, new Complex(6, 2))
                                       {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                   new PointValueComplex(double.NaN, new Complex(6, 3))
                                       {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                                   new PointValueComplex(5.4425, new Complex(6, 4))
                                       {SourceName = "T240_A01_3V_16mA_-0V5.s2p"},
                               };

            var ft = new TraceComplex
                         {
                             Visible = true,
                             IsVisibleInMarker = true,
                             Name = "Ft, C2, Transistor, T240",
                             Pen = new System.Drawing.Pen(System.Drawing.Color.Black),
                             GraphIndex = 0,
                             //CoordinateSystemType = megaMeasurement.StatisticType.CoordianatSystem,
                             ArgumentQuantityType = PhysicalQuantityType.Frequencies
                         };

            var s21 = new TraceComplex
                         {
                             Visible = false,
                             IsVisibleInMarker = true,
                             Name = "DB(|S[2,1]|) @10 GHz, C2, Transistor, T240",
                             Pen = new System.Drawing.Pen(System.Drawing.Color.Black),
                             GraphIndex = 0,
                             //CoordinateSystemType = megaMeasurement.StatisticType.CoordianatSystem,
                             ArgumentQuantityType = PhysicalQuantityType.Scalar
                         };

            ft.AddRange(new[] { ft_row1, ft_row2, ft_row3, ft_row4, ft_row5, ft_row6 });
            s21.AddRange(new[] {s21_row1, s21_row2, s21_row3, s21_row4, s21_row5, s21_row6});
            var result = new Traces();
            result.ComplexFunctions.Add(ft);
            result.ComplexFunctions.Add(s21);

            return result;
        }