Example #1
0
        /// <summary>
        /// Starts all components
        /// </summary>
        /// <param name="time">Start time</param>
        public virtual void StartAll(double time)
        {
            provider.Time = time;
            List <IStarted> ls = new List <IStarted>();

            collection.ForEach <IStarted>((IStarted s) => { ls.Add(s); s.Start(time); });
            IStep st = this;

            st.Step = -1;
            IDifferentialEquationProcessor pr = DifferentialEquationProcessor.Processor;

            if (pr == null)
            {
                return;
            }
            ICollection <IDifferentialEquationSolver> de = pr.Equations;

            foreach (IDifferentialEquationSolver deq in de)
            {
                if (deq is IStarted)
                {
                    IStarted s = deq as IStarted;
                    if (!ls.Contains(s))
                    {
                        s.Start(time);
                    }
                }
            }
            dynamical.ForEach((IDynamical dyn) => { dyn.Time = time; });
        }
        /// <summary>
        /// Initialization
        /// </summary>
        protected virtual void Init()
        {
            List <IAggregableMechanicalObject> lo = new List <IAggregableMechanicalObject>();

            foreach (AggregableWrapper aw in aggrWrappres)
            {
                lo.Add(aw.Aggregate);
            }
            aggregates = lo.ToArray();
            indexes    = new int[aggrWrappres.Length];
            int kn = 0;
            int nn = 0;

            for (int i = 0; i < indexes.Length; i++)
            {
                int dd = aggrWrappres[i].Aggregate.Dimension;
                indexes[i] = kn;
                kn        += aggrWrappres[i].Aggregate.Dimension;
                nn        += dd;
            }
            derivations = new double[nn, 2];
            foreach (IAggregableMechanicalObject amo in aggregates)
            {
                if (amo is IStarted)
                {
                    IStarted st = amo as IStarted;
                    st.Start(0);
                }
            }
            IDifferentialEquationSolver s = this;

            Set(ref measures, derivations);
            s.CalculateDerivations();
        }
Example #3
0
        //*/

        #region IStarted Members

        void IStarted.Start(double time)
        {
            foreach (IMeasurements m in mea)
            {
                if (m is IStarted)
                {
                    IStarted st = m as IStarted;
                    st.Start(time);
                }
            }
        }
Example #4
0
 private void start(double time)
 {
     foreach (object o in dep)
     {
         if (o is IStarted)
         {
             IStarted s = o as IStarted;
             s.Start(time);
         }
     }
 }
        void IStarted.Start(double time)
        {
            Reset();
            if (aggregate is IStarted)
            {
                IStarted s = aggregate as IStarted;
                s.Start(time);
            }

            Normalize(aggregate);
            IDifferentialEquationSolver so = this;

            so.CalculateDerivations();
        }
Example #6
0
 /// <summary>
 /// Starts all components
 /// </summary>
 /// <param name="time">Start time</param>
 public override void StartAll(double time)
 {
     base.StartAll(time);
     if (coll != null)
     {
         foreach (IDifferentialEquationSolver so in coll)
         {
             if (so is IStarted)
             {
                 IStarted s = so as IStarted;
                 s.Start(time);
             }
         }
     }
     frames.UpdateFrames();
     if (frames.Count == 0)
     {
         updateInternal = base.UpdateAll;
     }
     else
     {
         updateInternal = UpdateWithFrames;
     }
 }