Inheritance: Canguro.Utility.GlobalizedObject, INamed
        public float[,] GetCurvedAxis(LineElement l, AbstractCase ac, DeformationAxis component, int numPoints)
        {
            if (!model.HasResults) return null;

            /// controlPoints[i, 0]: x position on Beam, controlPoints[i, 1]: 'deflection' for x position, controlPoints[i,2]: deformation angle
            float[,] controlPoints = new float[numPoints, 3];

            float[] controlPointsX = new float[1]; // requestXCtrlPts(load);
            for (int i = 0, bufi = 0; i < numPoints; i++)
            {
                controlPoints[i, 0] = i / (numPoints - 1f);

                // Adjust control points
                if ((bufi < controlPointsX.Length) && (controlPointsX[bufi] <= controlPoints[i, 0]))
                    controlPoints[i, 0] = controlPointsX[bufi++];

                controlPoints[i, 1] = 0f; // controlPoints[i, 0] * (fdJ - fdI);

                controlPoints[i, 2] = 0.0f;
            }

            getCurvedAxis(l, ac, component, controlPoints);

            return controlPoints;
        }
        public Vector3[] GetCurve(LineElement l, AbstractCase ac, int numPoints, float deformationScale, float paintScaleFactorTranslation, out float[] xPos)
        {
            if (l == null)
            {
                xPos = null;
                return null;
            }

            Vector3 iPos, jPos;
            iPos = new Vector3(model.Results.JointDisplacements[l.I.Id, 0],
                             model.Results.JointDisplacements[l.I.Id, 1],
                             model.Results.JointDisplacements[l.I.Id, 2]);
            iPos = deformationScale * paintScaleFactorTranslation * iPos + l.I.Position;

            jPos = new Vector3(model.Results.JointDisplacements[l.J.Id, 0],
                             model.Results.JointDisplacements[l.J.Id, 1],
                             model.Results.JointDisplacements[l.J.Id, 2]);
            jPos = deformationScale * paintScaleFactorTranslation * jPos + l.J.Position;

            float[,] local2Values = GetCurvedAxis(l, model.Results.ActiveCase.AbstractCase, Analysis.LineDeformationCalculator.DeformationAxis.Local2, numPoints);
            float[,] local3Values = GetCurvedAxis(l, model.Results.ActiveCase.AbstractCase, Analysis.LineDeformationCalculator.DeformationAxis.Local3, numPoints);

            int nVertices = local2Values.GetLength(0);
            Vector3[] curve = new Vector3[nVertices];
            xPos = new float[nVertices];
            for (int i = 0; i < nVertices; i++)
            {
                xPos[i] = local2Values[i, 0];
                curve[i] = iPos + local2Values[i, 0] * (jPos - iPos) +
                    local2Values[i, 1] * deformationScale * paintScaleFactorTranslation * l.LocalAxes[1] +
                    local3Values[i, 1] * deformationScale * paintScaleFactorTranslation * l.LocalAxes[2];
            }

            return curve;
        }
Esempio n. 3
0
 /// <summary>
 /// Constructora que asigna el par caso-factor.
 /// Se llama a las propiedades para asegurar consistencia.
 /// </summary>
 /// <param name="abstractCase"></param>
 /// <param name="factor"></param>
 public AbstractCaseFactor(AbstractCase abstractCase, float factor)
 {
     aCase       = abstractCase;
     this.factor = factor;
     Case        = abstractCase;
     Factor      = factor;
 }
 /// <summary>
 /// Constructora que asigna el par caso-factor.
 /// Se llama a las propiedades para asegurar consistencia.
 /// </summary>
 /// <param name="abstractCase"></param>
 /// <param name="factor"></param>
 public AbstractCaseFactor(AbstractCase abstractCase, float factor)
 {
     aCase = abstractCase;
     this.factor = factor;
     Case = abstractCase;
     Factor = factor;
 }
        private void getDeformationAt(AreaElement area, AbstractCase abstractCase, Vector3 request, ref Vector3 deformation)
        {
            Random myRandomizer = new Random(0);

            float max = 0.5f;

            deformation.X += max * (float)myRandomizer.NextDouble();
            deformation.Y += max * (float)myRandomizer.NextDouble();
            deformation.Z += max * (float)myRandomizer.NextDouble();
        }
        public void getForcesDiagram(AbstractCase ac, LineElement line, LineForceComponent component, float[,] controlPoints, out float fI, out float fJ)
        {
            Vector3 vI, vJ;
            switch (component)
            {
                case LineForceComponent.Axial:
                case LineForceComponent.Shear22:
                case LineForceComponent.Shear33:
                    vI = new Vector3(model.Results.ElementJointForces[line.Id, 0, 0],
                                     model.Results.ElementJointForces[line.Id, 0, 1],
                                     model.Results.ElementJointForces[line.Id, 0, 2]);
                    vJ = new Vector3(model.Results.ElementJointForces[line.Id, 1, 0],
                                     model.Results.ElementJointForces[line.Id, 1, 1],
                                     model.Results.ElementJointForces[line.Id, 1, 2]);
                    break;
                default:
                    vI = new Vector3(model.Results.ElementJointForces[line.Id, 0, 3],
                                     model.Results.ElementJointForces[line.Id, 0, 4],
                                     model.Results.ElementJointForces[line.Id, 0, 5]);
                    vJ = new Vector3(model.Results.ElementJointForces[line.Id, 1, 3],
                                     model.Results.ElementJointForces[line.Id, 1, 4],
                                     model.Results.ElementJointForces[line.Id, 1, 5]);
                    break;
            }

            // Transform to the line's local coordinate system
            // From the global system
            // (WARNING: This is supposed to come in the joint's local coordinate system)
            vI = toLocal(line, vI);
            vJ = toLocal(line, vJ);

            switch (component)
            {
                case LineForceComponent.Axial:
                case LineForceComponent.Torsion:
                    fI = vI.X;
                    fJ = vJ.X;
                    break;
                case LineForceComponent.Shear22:
                case LineForceComponent.Moment22:
                    fI = vI.Y;
                    fJ = vJ.Y;
                    break;
                default:
                    fI = vI.Z;
                    fJ = vJ.Z;
                    break;
            }

            //float fI = model.Results.ElementJointForces[line.Id, 0, (int)component];
            //float fJ = model.Results.ElementJointForces[line.Id, 1, (int)component];

            // Add Isostatic curves if there's a load on the LineElement
            addToShearMomentDiagram(ac, line, controlPoints, component, 1f);
        }
        public bool GetDeformationVectors(AreaElement area, Vector3[] localAxes, AbstractCase abstractCase, Vector3[] ctrlPoints, Vector3[] deformations)
        {
            // Dummy routine

            int verticesInList= ctrlPoints.Length;

            for (int i = 0; i < verticesInList; ++i)
                getDeformationAt(area, abstractCase, ctrlPoints[i], ref deformations[i]);

            return true;
        }
Esempio n. 8
0
 private void editAnalysisCaseButton_Click(object sender, EventArgs e)
 {
     Canguro.Model.Load.AbstractCase aCase = analysisCasesCheckedListBox.SelectedItem
                                             as Canguro.Model.Load.AbstractCase;
     if (aCase != null)
     {
         try
         {
             services.GetProperties(Culture.Get("edit"), aCase, false);
             UpdateDialog();
         }
         catch (Canguro.Controller.CancelCommandException) { }
     }
 }
        public float[] GetForceAtPoint(AbstractCase ac, LineElement line, LineForceComponent component, float xPos)
        {
            if (!model.HasResults) return null;

            float[,] controlPoints = new float[1, 2];
            controlPoints[0, 0] = xPos;
            controlPoints[0, 1] = 0f;

            float fI, fJ;
            getForcesDiagram(ac, line, component, controlPoints, out fI, out fJ);

            // Los valores en los nodos se encuentran volteados. Del lado izquierdo positivo
            // es arriba, mientras del lado derecho positivo es abajo, por lo que si se tienen
            // dos valores positivos se debería pintar una recta con pendiente negativa y si
            // se tienen dos negativos al revés. DeltaY = Y1 + Y2 (por el cambio de signo).
            controlPoints[0, 1] += controlPoints[0, 0] * (fI + fJ) - fI;

            // Copy to 1-dimensional array
            float[] ret = new float[2];
            for (int i = 0; i < 2; i++)
                ret[i] = controlPoints[0, i];

            return ret;
        }
 public float[] GetCurvedPoint(AreaElement area, AbstractCase ac, DeformationAxis component, float xPos)
 {
     return null;
 }
 public float[,] GetCurvedAxis(AreaElement area, AbstractCase ac, DeformationAxis component, int numPoints)
 {
     return null;
 }
 public Vector3[] GetCurve(AreaElement area, AbstractCase ac, int numPoints, float deformationScale, float paintScaleFactorTranslation, out float[] xPos)
 {
     xPos = null;
     return null;
 }
Esempio n. 13
0
 private void store(OleDbConnection cn, AbstractCase obj, Canguro.Model.Model model)
 {
     if (obj is AnalysisCase && obj.IsActive)
         store(cn, (AnalysisCase)obj);
     else if (obj is LoadCombination && obj.IsActive)
         store(cn, (LoadCombination)obj, model);
 }
        public float[] GetCurvedPoint(LineElement l, AbstractCase ac, DeformationAxis component, float xPos)
        {
            if (!model.HasResults) return null;

            /// controlPoints[i, 0]: x position on Beam, controlPoints[i, 1]: 'deflection' for x position, controlPoints[i,2]: deformation angle
            float[,] controlPoints = new float[1, 3];
            controlPoints[0, 0] = xPos;
            controlPoints[0, 1] = 0f;
            controlPoints[0, 2] = 0.0f;

            getCurvedAxis(l, ac, component, controlPoints);

            // Copy to 1-dimensional array
            float[] ret = new float[3];
            for (int i = 0; i < 3; i++)
                ret[i] = controlPoints[0, i];

            return ret;
        }
        private void addToShearMomentDiagram(AbstractCase ac, LineElement line, float[,] controlPoints, LineForceComponent component, float scale)
        {
            if (ac == null) return;

            if (ac is LoadCombination)
            {
                foreach (AbstractCaseFactor acf in ((LoadCombination)ac).Cases)
                    addToShearMomentDiagram(acf.Case, line, controlPoints, component, acf.Factor);
            }
            else if (ac is AnalysisCase)
            {
                if (((AnalysisCase)ac).Properties is StaticCaseProps)
                {
                    foreach (StaticCaseFactor staticCase in ((StaticCaseProps)((AnalysisCase)ac).Properties).Loads)
                    {
                        if (staticCase.AppliedLoad is LoadCase)
                        {
                            LoadCase lc = staticCase.AppliedLoad as LoadCase;
                            if (line.Loads[lc] != null)
                            {
                                foreach (Load load in line.Loads[lc])
                                    if (load is DirectionalLineLoad)
                                        addToShearMomentDiagram(line, load as DirectionalLineLoad, controlPoints, component, scale);
                            }

                            if (lc.SelfWeight > 0f)
                            {
                                if (line.Properties is StraightFrameProps)
                                {
                                    StraightFrameProps frameProps = line.Properties as StraightFrameProps;
                                    selfWeight.La = selfWeight.Lb = frameProps.Section.Area * frameProps.Section.Material.UnitWeight;
                                    addToShearMomentDiagram(line, selfWeight, controlPoints, component, lc.SelfWeight * scale);
                                }
                            }
                        }
                    }
                }
            }
        }
 /// <summary>
 /// Constructora que asigna el valor default 1 como factor.
 /// </summary>
 /// <param name="abstractCase"></param>
 public AbstractCaseFactor(AbstractCase abstractCase)
     : this(abstractCase, 1)
 {
 }
Esempio n. 17
0
 /// <summary>
 /// Constructora que asigna el valor default 1 como factor.
 /// </summary>
 /// <param name="abstractCase"></param>
 public AbstractCaseFactor(AbstractCase abstractCase)
     : this(abstractCase, 1)
 {
 }
        //public Vector3 GetPoint(LineElement l, AbstractCase ac, float xPos, float deformationScale, float paintScaleFactorTranslation)
        //{
        //    if (l == null)
        //    {
        //        return Vector3.Empty;
        //    }
        //    Vector3 iPos, jPos;
        //    iPos = new Vector3(model.Results.JointDisplacements[l.I.Id, 0],
        //                     model.Results.JointDisplacements[l.I.Id, 1],
        //                     model.Results.JointDisplacements[l.I.Id, 2]);
        //    iPos = deformationScale * paintScaleFactorTranslation * iPos + l.I.Position;
        //    jPos = new Vector3(model.Results.JointDisplacements[l.J.Id, 0],
        //                     model.Results.JointDisplacements[l.J.Id, 1],
        //                     model.Results.JointDisplacements[l.J.Id, 2]);
        //    jPos = deformationScale * paintScaleFactorTranslation * jPos + l.J.Position;
        //    float[,] local2Values = GetCurvedPoint(l, model.Results.ActiveCase.AbstractCase, Analysis.LineDeformationCalculator.DeformationAxis.Local2, xPos);
        //    float[,] local3Values = GetCurvedPoint(l, model.Results.ActiveCase.AbstractCase, Analysis.LineDeformationCalculator.DeformationAxis.Local3, xPos);
        //    Vector3 point = iPos + local2Values[0, 0] * (jPos - iPos) +
        //        local2Values[0, 1] * deformationScale * paintScaleFactorTranslation * l.LocalAxes[1] +
        //        local3Values[0, 1] * deformationScale * paintScaleFactorTranslation * l.LocalAxes[2];
        //    return point;
        //}
        private void getCurvedAxis(LineElement l, AbstractCase ac, DeformationAxis component, float[,] controlPoints)
        {
            Vector3 vI, vJ, mI, mJ, dI, dJ;

            vI = new Vector3(model.Results.ElementJointForces[l.Id, 0, 0],
                             model.Results.ElementJointForces[l.Id, 0, 1],
                             model.Results.ElementJointForces[l.Id, 0, 2]);

            vJ = new Vector3(model.Results.ElementJointForces[l.Id, 1, 0],
                             model.Results.ElementJointForces[l.Id, 1, 1],
                             model.Results.ElementJointForces[l.Id, 1, 2]);

            mI = new Vector3(model.Results.ElementJointForces[l.Id, 0, 3],
                             model.Results.ElementJointForces[l.Id, 0, 4],
                             model.Results.ElementJointForces[l.Id, 0, 5]);

            mJ = new Vector3(model.Results.ElementJointForces[l.Id, 1, 3],
                             model.Results.ElementJointForces[l.Id, 1, 4],
                             model.Results.ElementJointForces[l.Id, 1, 5]);

            dI = l.I.Position + new Vector3(model.Results.JointDisplacements[l.I.Id, 0],
                                            model.Results.JointDisplacements[l.I.Id, 1],
                                            model.Results.JointDisplacements[l.I.Id, 2]);

            dJ = l.J.Position + new Vector3(model.Results.JointDisplacements[l.J.Id, 0],
                                            model.Results.JointDisplacements[l.J.Id, 1],
                                            model.Results.JointDisplacements[l.J.Id, 2]);

            // Transform to the line's local coordinate system
            // From the global system
            // (WARNING: This is supposed to come in the joint's local coordinate system)
            vI = toLocal(l, vI);
            vJ = toLocal(l, vJ);

            mI = toLocal(l, mI);
            mJ = toLocal(l, mJ);

            dI = toLocal(l, dI);
            dJ = toLocal(l, dJ);

            float fI = 0f, fJ = 0f, fmI = 0f, fmJ = 0f, fdI = 0f, fdJ = 0f;
            float EI = ((StraightFrameProps)l.Properties).Section.Material.TypeProperties.E;
            float lineLength = l.Length;

            switch (component)
            {
                case DeformationAxis.Local2:
                    fI = vI.Y; fmI = -mI.Z; fdI = dI.Y;
                    fJ = vJ.Y; fmJ = -mJ.Z; fdJ = dJ.Y;

                    EI *= ((StraightFrameProps)l.Properties).Section.I33;
                    break;
                case DeformationAxis.Local3:
                    fI = vI.Z; fmI = mI.Y; fdI = dI.Z;
                    fJ = vJ.Z; fmJ = mJ.Y; fdJ = dJ.Z;

                    EI *= ((StraightFrameProps)l.Properties).Section.I22;
                    break;
            }

            addLoadDeflection(ac, l, lineLength, controlPoints, component, 1.0f, EI);
            addMomentDeflection(fmI, lineLength, controlPoints, EI, -1);
            addMomentDeflection(fmJ, lineLength, controlPoints, EI, 1);
        }
Esempio n. 19
0
 /// <summary>
 /// Repairs the IsActive state of the abstract cases so that no active case depends upon an unactive case
 /// </summary>
 /// <param name="changedAc">The last abstract case that has changed</param>
 public void RepairAbstractCases(AbstractCase changedAc)
 {
     if (!changedAc.IsActive)
     {
         // If IsActive == false then deactivate all dependant cases
         Dictionary<AbstractCase, LinkedList<AbstractCase>> adjacency = BuildAnalysisCaseAdjacency();
         repairAbstractCases(changedAc, adjacency);
     }
 }
        private void addLoadDeflection(AbstractCase ac, LineElement line, float lineLength, float[,] controlPoints, DeformationAxis component, float scale, float EI)
        {
            if (ac == null) return;

            if (ac is LoadCombination)
            {
                foreach (AbstractCaseFactor acf in ((LoadCombination)ac).Cases)
                    addLoadDeflection(acf.Case, line, lineLength, controlPoints, component, acf.Factor, EI);
            }
            else if (ac is AnalysisCase)
            {
                if (((AnalysisCase)ac).Properties is StaticCaseProps)
                {
                    foreach (StaticCaseFactor staticCase in ((StaticCaseProps)((AnalysisCase)ac).Properties).Loads)
                    {
                        if (staticCase.AppliedLoad is LoadCase)
                        {
                            LoadCase lc = staticCase.AppliedLoad as LoadCase;
                            if (line.Loads[lc] != null)
                            {
                                foreach (Load load in line.Loads[lc])
                                {
                                    //addUniformLoadDeflection(line, lineLength, load as LineLoad, controlPoints, component, scale, EI);
                                    //addTriangularLoadDeflection(line, lineLength, load as LineLoad, controlPoints, component, scale, EI);
                                    if (load is DirectionalLineLoad)
                                        addLoadDeflection(line, lineLength, load as DirectionalLineLoad, controlPoints, component, scale, EI);
                                }
                            }
                            if (lc.SelfWeight > 0f)
                            {
                                if (line.Properties is StraightFrameProps)
                                {
                                    StraightFrameProps frameProps = line.Properties as StraightFrameProps;
                                    selfWeight.La = selfWeight.Lb = frameProps.Section.Area * frameProps.Section.Material.UnitWeight;
                                    //addUniformLoadDeflection(line, lineLength, selfWeight, controlPoints, component, lc.SelfWeight * scale, EI);
                                    addLoadDeflection(line, lineLength, selfWeight, controlPoints, component, lc.SelfWeight * scale, EI);
                                }
                            }
                        }
                    }
                }
            }
        }
 private void getCurvedAxis(AreaElement area, AbstractCase ac, DeformationAxis component, float[,] controlPoints)
 {
 }
        public float[,] GetForcesDiagram(AbstractCase ac, LineElement line, LineForceComponent component, int numPoints)
        {
            if (!model.HasResults) return null;

            float[,] controlPoints = new float[numPoints, 2];

            float[] controlPointsX = new float[1]; // requestXCtrlPts(load);
            for (int i = 0, bufi = 0; i < numPoints; i++)
            {
                controlPoints[i,0] = i / (numPoints - 1f);

                // Adjust control points
                if ((bufi < controlPointsX.Length) && (controlPointsX[bufi] <= controlPoints[i, 0]))
                    controlPoints[i, 0] = controlPointsX[bufi++];

                controlPoints[i, 1] = 0f; // controlPoints[i, 0] * (fdJ - fdI);
            }

            float fI, fJ;
            getForcesDiagram(ac, line, component, controlPoints, out fI, out fJ);

            for (int i = 0, bufi = 0; i < numPoints; i++)
            {
                // Los valores en los nodos se encuentran volteados. Del lado izquierdo positivo
                // es arriba, mientras del lado derecho positivo es abajo, por lo que si se tienen
                // dos valores positivos se debería pintar una recta con pendiente negativa y si
                // se tienen dos negativos al revés. DeltaY = Y1 + Y2 (por el cambio de signo).
                controlPoints[i, 1] += controlPoints[i, 0] * (fI + fJ) - fI;
            }

            return controlPoints;
        }
Esempio n. 23
0
 private void repairAbstractCases(AbstractCase changedAc, Dictionary<AbstractCase, LinkedList<AbstractCase>> adjacency)
 {
     if (adjacency.ContainsKey(changedAc))
     {
         foreach (AbstractCase ac in adjacency[changedAc])
         {
             if (ac.IsActive)
             {
                 ac.IsActive = false;
                 repairAbstractCases(ac, adjacency);
             }
         }
     }
 }