Exemplo n.º 1
0
 void IDataConsumer.UpdateChildrenData()
 {
     /* foreach (IMeasurements m in dependent)
      * {
      *   m.IsUpdated = false;
      *   m.UpdateMeasurements();
      * }*/
     runtime.UpdateAll();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Calculates parameters
        /// </summary>
        /// <param name="x">Input</param>
        /// <param name="selection">Selection</param>
        /// <param name="y">Output</param>
        public void Calculate(double[] x, IStructuredSelection selection, double?[] y)
        {
            double a = 0;

            for (int i = 0; i < x.Length; i++)
            {
                aliases[i].Value = x[i];
            }

            /*!!!/// TEMP ====================
             *
             *  UpdateChildrenData();
             *  if (DataPerformer.Portable.StaticExtensionDataPerformerPortable.Factory != null)
             *  {
             *      runtime.UpdateAll();
             *  }
             *  this.FullReset();
             *  UpdateChildrenData();
             *
             *  ///=============*/
            //         runtime.StartAll(0);
            runtime.UpdateAll();
            int n = 0;

            for (int i = 0; i < measurementsDitcionary.Count; i++)
            {
                IMeasurement m = measurementsDitcionary[i] as IMeasurement;
                object       t = m.Type;
                if (t.Equals(a))
                {
                    y[n] = (double)m.Parameter();
                    ++n;
                    continue;
                }
                else
                {
                    Array ar = m.Parameter() as Array;
                    for (int j = 0; j < ar.GetLength(0); j++)
                    {
                        y[n] = (double)ar.GetValue(j);
                        ++n;
                    }
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Sets positions
        /// </summary>
        protected void SetPositions()
        {
            positions.Clear();
            if (measures.Count < 3)
            {
                return;
            }
            measuresData.Clear();
            IDataConsumer c = this;

            foreach (string ms in measures)
            {
                for (int i = 0; i < c.Count; i++)
                {
                    IMeasurements     m  = c[i];
                    IAssociatedObject ao = m as IAssociatedObject;
                    string            on = this.GetRelativeName(ao) + ".";

                    for (int j = 0; j < m.Count; j++)
                    {
                        IMeasurement mea = m[j];
                        string       s   = on + mea.Name;
                        if (s.Equals(ms))
                        {
                            measuresData.Add(mea);
                        }
                    }
                }
            }
            List <IIterator> iterators = new List <IIterator>();

            c.GetIterators(iterators);
            foreach (IIterator it in iterators)
            {
                it.Reset();
            }
            IDataConsumer consumer = this;
            IDataRuntime  rt       = consumer.CreateRuntime(StaticExtensionDataPerformerInterfaces.Calculation);

            while (true)
            {
                rt.UpdateAll();
                object[] ob = new object[measuresData.Count];
                for (int i = 0; i < measuresData.Count; i++)
                {
                    object o = measuresData[i].Parameter();
                    if (o is DBNull | o == null)
                    {
                        goto iterate;
                    }
                    ob[i] = o;
                }
                IPosition position = factory.Create(ob);
                if (position != null)
                {
                    positions.Add(position);
                }
iterate:
                foreach (IIterator it in iterators)
                {
                    if (!it.Next())
                    {
                        goto fin;
                    }
                }
            }
fin:
            Parent = parent;
            return;
        }