Exemple #1
0
 public NEUOutputVectorProperties(int id, string title, string componentVector, DOFType dofType)
 {
     this.id              = id;
     this.title           = title;
     this.componentVector = componentVector;
     this.dofType         = dofType;
 }
Exemple #2
0
        private void InitializeDOFsWhenNoRotations()
        {
            if (rotNodes[0] == null && rotNodes[1] == null)
            {
                return;
            }

            DOFType[] translationalDOFTypes = new DOFType[3] {
                DOFType.X, DOFType.Y, DOFType.Z
            };
            dofsWhenNoRotations = new DOFType[][] { translationalDOFTypes, translationalDOFTypes,
                                                    translationalDOFTypes, translationalDOFTypes, translationalDOFTypes, translationalDOFTypes,
                                                    translationalDOFTypes, translationalDOFTypes, translationalDOFTypes, translationalDOFTypes };
            noOfDOFs = 30;

            if (rotNodes[0] == null)
            {
                dofsWhenNoRotations = new DOFType[][] { nodalDOFTypes, translationalDOFTypes, translationalDOFTypes,
                                                        translationalDOFTypes, translationalDOFTypes, translationalDOFTypes };
                noOfDOFs = 21;
            }

            if (rotNodes[1] == null)
            {
                dofsWhenNoRotations = new DOFType[][] { translationalDOFTypes, nodalDOFTypes, translationalDOFTypes,
                                                        translationalDOFTypes, translationalDOFTypes, translationalDOFTypes };
                noOfDOFs = 21;
            }
        }
 public DOFDesc(string name, JointDesc description, DOFType type, float min, float max, bool isVelocityDrive,
                float defaultDriveValue)
 {
     Name              = name;
     Description       = description;
     Type              = type;
     Minimum           = min;
     Maximum           = max;
     Scale             = 100f / (max - min);
     IsVelocityDrive   = isVelocityDrive;
     DefaultDriveValue = defaultDriveValue;
 }
Exemple #4
0
 public PowerSpectrumTargetEvaluatorCoefficientsProvider(double b, double spectrumStandardDeviation, double cutoffError, int nPhi, int nptsVRF, DOFType randomFieldDirection,
                                                         double frequencyIncrement = 0.1, int frequencyIntervals = 256, double tolerance = 1e-10)
 {
     this.b = b;
     this.spectrumStandardDeviation = spectrumStandardDeviation;
     this.cutoffError          = cutoffError;
     this.nPhi                 = nPhi;
     this.randomFieldDirection = randomFieldDirection;
     this.frequencyIncrement   = frequencyIncrement;
     this.frequencyIntervals   = frequencyIntervals;
     this.nptsVRF              = nptsVRF;
     this.tolerance            = tolerance;
     Calculate();
 }
        private static string DofSign(this DOFType dof)
        {
            switch (dof)
            {
            case DOFType.Free:
                return("f");

            case DOFType.Fixed:
                return("x");

            case DOFType.FixedNegative:
                return("x⁻");

            case DOFType.FixedPositive:
                return("x⁺");

            case DOFType.Spring:
                return("e");

            case DOFType.SpringNegative:
                return("e⁻");

            case DOFType.SpringPositive:
                return("e⁺");

            case DOFType.SpringRelative:
                return("r");

            case DOFType.SpringRelativeNegative:
                return("r⁻");

            case DOFType.SpringRelativePositive:
                return("r⁺");

            case DOFType.NonLinear:
                return("n");

            case DOFType.Friction:
                return("fᵣ");

            case DOFType.Damped:
                return("d");

            case DOFType.Gap:
                return("g");

            default:
                return("-");
            }
        }
        private bool IsVelocityDrive(JointProperties jointProperties, DOFType dof)
        {
            switch (dof)
            {
            case DOFType.Twist:
                if (jointProperties.Angular != null && jointProperties.Angular.TwistDrive != null &&
                    jointProperties.Angular.TwistDrive.Mode == JointDriveMode.Velocity)
                {
                    return(true);
                }
                break;

            case DOFType.Swing1:
            case DOFType.Swing2:
                if (jointProperties.Angular != null && jointProperties.Angular.SwingDrive != null &&
                    jointProperties.Angular.SwingDrive.Mode == JointDriveMode.Velocity)
                {
                    return(true);
                }
                break;

            case DOFType.X:
                if (jointProperties.Linear != null && jointProperties.Linear.XDrive != null &&
                    jointProperties.Linear.XDrive.Mode == JointDriveMode.Velocity)
                {
                    return(true);
                }
                break;

            case DOFType.Y:
                if (jointProperties.Linear != null && jointProperties.Linear.YDrive != null &&
                    jointProperties.Linear.YDrive.Mode == JointDriveMode.Velocity)
                {
                    return(true);
                }
                break;

            case DOFType.Z:
                if (jointProperties.Linear != null && jointProperties.Linear.ZDrive != null &&
                    jointProperties.Linear.ZDrive.Mode == JointDriveMode.Velocity)
                {
                    return(true);
                }
                break;
            }

            return(false);
        }
Exemple #7
0
        /***************************************************/

        public NodeConstraint(string name, bool[] fixity, double[] values)
        {
            Name = name;
            KX   = values[0];
            KY   = values[1];
            KZ   = values[2];
            HX   = values[3];
            HY   = values[4];
            HZ   = values[5];
            UX   = (fixity[0]) ? DOFType.Fixed : (values[0] == 0) ? DOFType.Free : DOFType.Spring;
            UY   = (fixity[1]) ? DOFType.Fixed : (values[1] == 0) ? DOFType.Free : DOFType.Spring;
            UZ   = (fixity[2]) ? DOFType.Fixed : (values[2] == 0) ? DOFType.Free : DOFType.Spring;
            RX   = (fixity[3]) ? DOFType.Fixed : (values[3] == 0) ? DOFType.Free : DOFType.Spring;
            RY   = (fixity[4]) ? DOFType.Fixed : (values[4] == 0) ? DOFType.Free : DOFType.Spring;
            RZ   = (fixity[5]) ? DOFType.Fixed : (values[5] == 0) ? DOFType.Free : DOFType.Spring;
        }
Exemple #8
0
        public Quad4DisplacementOutput(Model model, Vector solution)
        {
            this.model = model;

            nodalDisplacements = new Dictionary <int, double[]>();
            foreach (int node in model.NodalDOFsDictionary.Keys)
            {
                nodalDisplacements[node] = new double[2];
            }

            foreach (int node in model.NodalDOFsDictionary.Keys)
            {
                foreach (var dofIndexPair in model.NodalDOFsDictionary[node])
                {
                    DOFType dof   = dofIndexPair.Key;
                    int     index = dofIndexPair.Value;

                    double displacement;
                    if (index < 0)
                    {
                        displacement = 0.0;            // constrained dof
                    }
                    else
                    {
                        displacement = solution[dofIndexPair.Value];  // free dof
                    }
                    if (dofIndexPair.Key == DOFType.X)
                    {
                        nodalDisplacements[node][0] = displacement;
                    }
                    else if (dofIndexPair.Key == DOFType.Y)
                    {
                        nodalDisplacements[node][1] = displacement;
                    }
                    else
                    {
                        throw new NotImplementedException();
                    }
                }
            }
        }
        public static bool IsNumericallyDependent(this DOFType dof)
        {
            switch (dof)
            {
            case DOFType.Free:
            case DOFType.Fixed:
            case DOFType.FixedNegative:
            case DOFType.FixedPositive:
                return(false);

            case DOFType.SpringNegative:
            case DOFType.SpringPositive:
            case DOFType.SpringRelative:
            case DOFType.SpringRelativeNegative:
            case DOFType.SpringRelativePositive:
            case DOFType.NonLinear:
            case DOFType.Friction:
            case DOFType.Damped:
            case DOFType.Gap:
            default:
                return(true);
            }
        }
        void AddDOF(string[] DOFNames, int which, JointDesc desc, DOFType type)
        {
            bool  isVelocityDrive   = false;
            float defaultDriveValue = 0.0f;

            float min = -180, max = 180;

            if (which < DOFNames.Length)
            {
                string[] subNames = DOFNames[which].Split('|');
                try
                {
                    if (subNames.Length > 1)
                    {
                        min = Single.Parse(subNames[1]);
                    }
                    if (subNames.Length > 2)
                    {
                        max = Single.Parse(subNames[2]);
                    }
                }
                catch
                {
                }
                if (IsVelocityDrive(desc.Joint.State, type))
                {
                    float angularVelocityLength = 0;
                    if (Math.Abs(desc.Joint.State.Angular.DriveTargetVelocity.X) > Math.Abs(angularVelocityLength))
                    {
                        angularVelocityLength = desc.Joint.State.Angular.DriveTargetVelocity.X;
                    }

                    if (Math.Abs(desc.Joint.State.Angular.DriveTargetVelocity.Y) > Math.Abs(angularVelocityLength))
                    {
                        angularVelocityLength = desc.Joint.State.Angular.DriveTargetVelocity.Y;
                    }

                    if (Math.Abs(desc.Joint.State.Angular.DriveTargetVelocity.Z) > Math.Abs(angularVelocityLength))
                    {
                        angularVelocityLength = desc.Joint.State.Angular.DriveTargetVelocity.Z;
                    }

                    if (Math.Abs(angularVelocityLength) < float.Epsilon)
                    {
                        min = -2.0f;
                        max = 2.0f;
                    }
                    else
                    {
                        min = Math.Min(-angularVelocityLength, angularVelocityLength);
                        max = Math.Max(-angularVelocityLength, angularVelocityLength);
                        defaultDriveValue = -angularVelocityLength;
                    }
                    isVelocityDrive = true;
                }
                _state.Joints.Add(subNames[0], new DOFDesc(subNames[0], desc, type, min, max, isVelocityDrive, defaultDriveValue));
            }
            else
            {
                string name = DOFNames[0];
                switch (which)
                {
                case 0: name += " Twist"; break;

                case 1: name += " Swing1"; break;

                case 2: name += " Swing2"; break;

                case 3: name += " X"; min = -2; max = 2; break;

                case 4: name += " Y"; min = -2; max = 2; break;

                case 5: name += " Z"; min = -2; max = 2; break;
                }
                _state.Joints.Add(name, new DOFDesc(name, desc, type, min, max, isVelocityDrive, defaultDriveValue));
            }
        }