Ejemplo n.º 1
0
        private void ResponseToInitialConditionsCalculate()
        {
            if (ResponseNeedsToRecalculate)
            {
                if (ResponseToInitialConditions == null)
                {
                    ResponseToInitialConditions = new List <double>();
                }

                ResponseToInitialConditions.Clear();

                // DateTime time = DateTime.Now;

                if (InitialDisplacement == 0.0 && InitialVelocity == 0.0)
                {
                    foreach (double item in TimeIntervals)
                    {
                        ResponseToInitialConditions.Add(0.0);
                    }
                }

                else
                {
                    foreach (double item in TimeIntervals)
                    {
                        if (DampingRatio < 1.0)
                        {
                            double C1 = InitialDisplacement;
                            double C2 = (InitialVelocity + (DampingRatio * NaturalFrequencyRad * InitialDisplacement)) / DampedNaturalFrequency;
                            //double X = Math.Sqrt(Math.Pow(C1, 2) + Math.Pow(C2, 2));
                            double Phy = Math.Atan((DampedNaturalFrequency * InitialDisplacement) / (InitialVelocity + (DampingRatio * NaturalFrequencyRad * InitialDisplacement)));
                            //double X = InitialDisplacement / Math.Sin(Phy);

                            double x = Math.Exp(-DampingRatio * NaturalFrequencyRad * item) * ((C1 * Math.Cos(DampedNaturalFrequency * item)) + (C2 * Math.Sin(DampedNaturalFrequency * item)));
                            //double x = X * Math.Exp(-DampingRatio * NaturalFrequencyRad * item) * Math.Cos((DampedNaturalFrequency * item) - Phy);
                            ResponseToInitialConditions.Add(x);
                        }

                        else if (DampingRatio == 1.0)
                        {
                            double C1 = InitialDisplacement;
                            double C2 = InitialVelocity + (NaturalFrequencyRad * InitialDisplacement);

                            double x = (C1 + (C2 * item)) * Math.Exp(-NaturalFrequencyRad * item);
                            ResponseToInitialConditions.Add(x);
                        }

                        else if (DampingRatio > 1.0)
                        {
                            double C1 = (InitialDisplacement * NaturalFrequencyRad * (DampingRatio + Math.Sqrt(Math.Pow(DampingRatio, 2) - 1)) + InitialVelocity) / (2 * NaturalFrequencyRad * Math.Sqrt(Math.Pow(DampingRatio, 2) - 1));
                            double C2 = (-InitialDisplacement * NaturalFrequencyRad * (DampingRatio - Math.Sqrt(Math.Pow(DampingRatio, 2) - 1)) - InitialVelocity) / (2 * NaturalFrequencyRad * Math.Sqrt(Math.Pow(DampingRatio, 2) - 1));

                            double x = (C1 * Math.Exp((-DampingRatio + Math.Sqrt(Math.Pow(DampingRatio, 2) - 1)) * NaturalFrequencyRad * item)) + (C2 * Math.Exp((-DampingRatio - Math.Sqrt(Math.Pow(DampingRatio, 2) - 1)) * NaturalFrequencyRad * item));
                            ResponseToInitialConditions.Add(x);
                        }
                    }
                }
            }
            //_tResponseToInitialConditions = (DateTime.Now - time).TotalMilliseconds;
        }
Ejemplo n.º 2
0
        private void InitialConditionDisplacementCalculate()
        {
            if (VehicleDataNeedsToRecalculate)
            {
                if (ResponseToInitialConditions == null)
                {
                    ResponseToInitialConditions = new List <double>();
                }
            }

            ResponseToInitialConditions.Clear();

            if (InitialDisplacement == 0 && InitialVelocity == 0)
            {
                foreach (double item in TimeIntervals)
                {
                    double x = 0.0 * item;
                    ResponseToInitialConditions.Add(x);
                }
            }

            else
            {
                foreach (double item in TimeIntervals)
                {
                    if (DampingRatio < 1)
                    {
                        double C1  = InitialDisplacement;
                        double C2  = (InitialVelocity + (DampingRatio * NaturalFrequencyRad * InitialDisplacement)) / DampedNaturalFrequency;
                        double X   = Math.Sqrt(Math.Pow(C1, 2) + Math.Pow(C2, 2));
                        double Phy = Math.Atan(C2 / C1);

                        double x = -X *Math.Exp(-DampingRatio *NaturalFrequencyRad *item) * Math.Cos((DampedNaturalFrequency * item) - Phy);

                        ResponseToInitialConditions.Add(x);
                    }

                    else if (DampingRatio == 1)
                    {
                        double C1 = InitialDisplacement;
                        double C2 = InitialVelocity + (NaturalFrequencyRad * InitialDisplacement);

                        double x = (C1 + (C2 * item)) * Math.Exp(-NaturalFrequencyRad * item);
                        ResponseToInitialConditions.Add(x);
                    }

                    else if (DampingRatio > 1)
                    {
                        double C1 = (InitialDisplacement * NaturalFrequencyRad * (DampingRatio + Math.Sqrt(Math.Pow(DampingRatio, 2) - 1)) + InitialVelocity) / (2 * NaturalFrequencyRad * Math.Sqrt(Math.Pow(DampingRatio, 2) - 1));
                        double C2 = (-InitialDisplacement * NaturalFrequencyRad * (DampingRatio - Math.Sqrt(Math.Pow(DampingRatio, 2) - 1)) - InitialVelocity) / (2 * NaturalFrequencyRad * Math.Sqrt(Math.Pow(DampingRatio, 2) - 1));

                        double x = (C1 * Math.Exp((-DampingRatio + Math.Sqrt(Math.Pow(DampingRatio, 2) - 1)) * NaturalFrequencyRad * item)) + (C2 * Math.Exp((-DampingRatio - Math.Sqrt(Math.Pow(DampingRatio, 2) - 1)) * NaturalFrequencyRad * item));
                        ResponseToInitialConditions.Add(x);
                    }
                }
            }
        }