public void Solve(TypeOfFixation type, IBoundaryCondition conditions, ILoad load)
        {
            globalMatrix = solver.GlobalMatrix;
            results      = new double[length];


            SetLoads(load);
            SetBoundaryConditions(type, conditions, globalMatrix);

            var           storage     = globalMatrix.Storage as SparseCompressedRowMatrixStorage <double>;
            List <double> nonZeroRows = globalMatrix.Storage.EnumerateNonZero().ToList();

            //CudaSolveSparse sp = new CudaSolveSparse();
            //CudaSparseMatrixDescriptor matrixDescriptor = new CudaSparseMatrixDescriptor();
            //        sp.CsrlsvluHost(globalMatrix.RowCount, nonZeroRows.Count, matrixDescriptor, nonZeroRows.ToArray(),
            //storage.RowPointers, storage.ColumnIndices, loads, ACCURACY, 0, results);

            for (int i = 0; i < results.Length; i++)
            {
                if (globalMatrix[i, i] == 1.0)
                {
                    results[i] = 0.0;
                }
            }
        }
示例#2
0
        public void Load()
        {
            while (this.loaders.Count > 0)
            {
                Disposer disposer = this.loaders.Dequeue();
                if (disposer.Id == 0)
                {
                    continue;
                }

                if (!this.disposerEvents.TryGetValue(disposer.GetType(), out IObjectEvent objectEvent))
                {
                    continue;
                }

                this.loaders2.Enqueue(disposer);

                ILoad iLoad = objectEvent as ILoad;
                if (iLoad == null)
                {
                    continue;
                }
                objectEvent.Set(disposer);
                try
                {
                    iLoad.Load();
                }
                catch (Exception e)
                {
                    Log.Error(e.ToString());
                }
            }

            ObjectHelper.Swap(ref this.loaders, ref this.loaders2);
        }
示例#3
0
        public RecProfile(double h, double b, IMaterial material, IBeam beam, ILoad load)
        {
            _height = h;
            _widht  = b;

            if (h * b > _max_area)
            {
                _area = 0; throw new TooLargeArea(_max_area);
            }
            else
            {
                _area = h * b;
                if (_area == 0)
                {
                    throw new WrongDimensions();
                }
            }
            _momentOFInertia = (b * Math.Pow(h, 3)) / 12;
            _weight          = _area * material.Density;
            _fle_tension     = (beam.maxMoment(load) + ((_weight * (Math.Pow(beam.Lenght, 2))) / 8)) / (_momentOFInertia / (h / 2));
            _she_tension     = (beam.maxForce(load) + beam.Lenght * _weight) * (1.5 * _height);
            _fle_effort      = _fle_tension / material.FlexuralStrenght;
            _strenght        = material.FlexuralStrenght;
            _she_effort      = _she_tension / material.ShearStrenght;
        }
示例#4
0
        /***************************************************/
        /****       Helper Methods                      ****/
        /***************************************************/

        private void SetDirection(ILoad load, int dir, string cSys)
        {
            if (cSys != "Global" && cSys != "Local")
            {
                Engine.Base.Compute.RecordWarning($"Custom coordinatesystem {cSys} for loads have been set as Global");
            }

            int type = (int)Math.Floor((double)((dir - 1) / 3));

            switch (type)
            {
            case 0:
                load.Axis      = LoadAxis.Local;
                load.Projected = false;
                break;

            case 1:
                load.Axis      = LoadAxis.Global;
                load.Projected = false;
                break;

            case 2:
                load.Axis      = LoadAxis.Global;
                load.Projected = true;
                break;

            case 3:         // Gravity
                load.Axis      = LoadAxis.Global;
                load.Projected = dir == 11;
                break;

            default:
                break;
            }
        }
示例#5
0
 public AssemblyLoader(IAssemblyManager manager, ILoad dlr)
 {
     Dlr = dlr;
      AssemblyManager = manager;
      AssemblyManager.AssemblyLoaded += assemblyManager_AssemblyLoaded;
      LoadedAssemblies = new List<IAssembly>();
 }
示例#6
0
        void CreateStaticSchema()
        {
            if (BelkaObciazonaSilaSkupiona.IsChecked == true || BelkaZObciazeniemCiaglym.IsChecked == true)
            {
                image2.Source = new BitmapImage(new Uri("/WpfApplication1;component/Images/BelkaJedno.JPG"));
                beam          = new SingleBeam(beam_lenght);
            }

            if (WspornikObciazonySilaSkupiona.IsChecked == true || WspornikZObciazeniemCiaglym.IsChecked == true)
            {
                beam = new Bracket(beam_lenght);
            }

            if (BelkaObciazonaSilaSkupiona.IsChecked == true || WspornikObciazonySilaSkupiona.IsChecked == true)
            {
                load = new FocusForce(beam, load_value, center);
            }

            if (BelkaZObciazeniemCiaglym.IsChecked == true || WspornikZObciazeniemCiaglym.IsChecked == true)
            {
                load = new ContinuousLoad(beam, load_value);
            }

            beam.Reactions(load);
        }
示例#7
0
        public void Solve(TypeOfFixation type, IBoundaryCondition conditions, ILoad load)
        {
            globalMatrix = solver.GlobalMatrix;
            results      = new double[length];

            SetLoads(load);
            SetBoundaryConditions(type, conditions);

            //List<double> nonZeroRows = globalMatrix.Storage.EnumerateNonZero().ToList();

            var iterationCountStopCriterion = new IterationCountStopCriterion <double>(length >> 1);
            var residualStopCriterion       = new ResidualStopCriterion <double>(ACCURACY);

            var monitor = new Iterator <double>(iterationCountStopCriterion, residualStopCriterion);

            var solverM = new TFQMR();

            //Vector<double> vectorResults = globalMatrix.LU().Solve(Vector.Build.DenseOfArray(loads));
            Vector <double> vectorResults = globalMatrix
                                            .SolveIterative(Vector.Build.DenseOfArray(loads), solverM, monitor);

            results = vectorResults.ToArray();
            for (int i = 0; i < results.Length; i++)
            {
                if (globalMatrix[i, i] == 1.0)
                {
                    results[i] = 0.0;
                }
            }
        }
示例#8
0
        public void Activate(List <string> fileNames, ILoad loadObject)
        {
            if (loadObject == null)
            {
                throw new ArgumentException();
            }

            this.loadObject = loadObject;

            gameObject.SetActive(true);
            errorMessage.SetActive(false);

            if (fileNames != null)
            {
                foreach (string fileName in fileNames)
                {
                    GameObject fileToggle = (GameObject)GameObject.Instantiate
                                                (fileItemPrefab, fileList.transform.position, fileList.transform.rotation);
                    fileToggle.name = fileName;
                    fileToggle.GetComponentInChildren <Text>().text = fileName;
                    fileToggle.transform.SetParent(fileList.transform);
                    fileToggle.transform.localScale          = new Vector3(1, 1, 1);
                    fileToggle.GetComponent <Toggle>().group = fileList;
                    // create prefab here
                }
            }
            MapMovementDriver.MovementEnabled = false;
        }
示例#9
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static void ToRFEM(this ILoad load, int loadId, int loadcaseId)
        {
            if (load != null)
            {
                BH.Engine.Base.Compute.RecordError("Load type '" + load.GetType() + "' area not supported");
            }
        }
示例#10
0
 public BusinessPresentation(ILoad iLoad, ISave iSave, IExtBitmap extBitmap, IDisplay display)
 {
     this.display   = display;
     this.extBitmap = extBitmap;
     this.iLoad     = iLoad;
     this.iSave     = iSave;
 }
示例#11
0
        /// <summary>
        /// Получает Список элементов.
        /// </summary>
        /// <typeparam name="T"> Тип элементов. </typeparam>
        /// <param name="path"> Путь. </param>
        /// <returns> Список элементов. </returns>
        public List <T> GetListItemData <T>(string path)
        {
            var listItems = ILoad.GetData <List <T> >(path);

            listItems ??= new List <T>();

            return(listItems);
        }
示例#12
0
        public IEnumerable <string> GetResults(ILoad load)
        {
            yield return($"Maksymlany moment zginajacy belkę: {maxMoment(load)} kNm");

            yield return($"Reakcja R1: {Reaction1} kN");

            yield return($"Reakcja R2: {Reaction2} kN");
        }
示例#13
0
 private void Initialize(IExtraction extraction, ITranslation translation, ILoad load)
 {
     _extraction  = extraction;
     _translation = translation;
     _load        = load;
     _extraction.DataExtractionComplete   += _translation.TranslateData;
     _translation.DataTranslationComplete += load.LoadData;
 }
示例#14
0
        /***************************************************/

        private bool CreateObject(ILoad bhLoad)
        {
            bool success = true;

            Helper.SetLoad(m_model, bhLoad as dynamic, this.EtabsConfig.ReplaceLoads);


            return(success);
        }
示例#15
0
        /// <summary>
        /// Solves the problem of stress-strain state
        /// </summary>
        /// <param name="type">Type of fixation</param>
        /// <param name="conditions">Boundary conditions</param>
        /// <returns>Result vector</returns>
        public void Solve(TypeOfFixation type, IBoundaryCondition conditions, ILoad load)
        {
            results = new double[solver.GlobalMatrix.Length];

            SetLoads(load);
            SetBoundaryConditions(type, conditions);

            results = MathOps.MethodOfGauss(DIRECTORY_PATH, globalMatrix, loads);
            //results = MathOps.CGMethod(DIRECTORY_PATH, globalMatrix, loads, EPSILON);
        }
示例#16
0
        public static bool IsNull(this ILoad load, string msg = "", [CallerMemberName] string methodName = "Method")
        {
            if (load == null)
            {
                ErrorMessage(methodName, "Load", msg);
                return(true);
            }

            return(false);
        }
示例#17
0
 public void RqstStart(ILoad load)
 {
     Log("Request to Start", load);
     if (DebugMode)
     {
         Debug.WriteLine("{0}:\t{1}\tRqstStart\t{2}", ClockTime, this, load);
     }
     List_PendingToStart.Add(load);
     AtmptStart();
 }
示例#18
0
        private static string Initialize(ILoad frameLoad, string characters)
        {
            var result = new StringBuilder();

            result.AppendLine($"{characters}Load type: {frameLoad.Type}");
            result.AppendLine($"{characters}Load Case Name: {frameLoad.LoadCase.Name}");
            result.AppendLine($"{characters}----");

            return(result.ToString());
        }
        /// <summary>
        /// Solves the problem of stress-strain state
        /// </summary>
        /// <param name="type">Type of fixation</param>
        /// <param name="conditions">Boundary conditions</param>
        /// <returns>Result vector</returns>
        public void Solve(TypeOfFixation type, IBoundaryCondition conditions, ILoad load)
        {
            globalMatrix = solver.GlobalMatrix;
            results      = new double[globalMatrix.Count];

            SetLoads(load);
            SetBoundaryConditions(type, conditions);

            results = MathOps.MethodOfGauss(ref globalMatrix, loads);
        }
示例#20
0
 public void RqstEnqueue(ILoad load)
 {
     Log("RqstEnqueue");
     if (DebugMode)
     {
         Debug.WriteLine("{0}:\t{1}\tRqstEnqueue\t{2}", ClockTime, this, load);
     }
     List_PendingToEnqueue.Add(load);
     AtmptEnqueue();
 }
示例#21
0
        /// <summary>
        /// Solves the problem of stress-strain state
        /// </summary>
        /// <param name="type">Type of fixation</param>
        /// <param name="conditions">Boundary conditions</param>
        /// <returns>Result vector</returns>
        public void Solve(TypeOfFixation type, IBoundaryCondition conditions, ILoad load)
        {
            globalMatrix = solver.GlobalMatrix;
            results      = new double[globalMatrix.GetLength(1)];

            SetLoads(load);
            SetBoundaryConditions(type, conditions);

            results = MathOps.GausSlau(globalMatrix, loads);
        }
示例#22
0
 public double maxForce(ILoad load)
 {
     if (load.CenterOfGravity == _lenght)
     {
         return(0);
     }
     else
     {
         return(load.Value);
     }
 }
示例#23
0
 public double maxForce(ILoad load)
 {
     if (load.CenterOfGravity == 0 || load.CenterOfGravity == _lenght)
     {
         return(0);
     }
     else
     {
         return(Math.Max(_reaction1, _reaction2));
     }
 }
示例#24
0
 protected void Exit(ILoad load)
 {
     if (!_occupying.ContainsKey(load))
     {
         throw new Exception("The load does not exist.");
     }
     _rcqModel.Finish(_loadToBatch[load], null);
     _occupying[load].Depart(load);
     _occupying.Remove(load);
     _loadToBatch.Remove(load);
 }
示例#25
0
        private double[,] ApplyNodalLoad(double[,] matrix, ILoad currentLoad)
        {
            int nodeNumber = currentLoad.NodeNumber;
            int loadDoF_1  = nodeNumber * model.LQ - 2;
            int loadDoF_2  = nodeNumber * model.LQ - 1;

            matrix[loadDoF_1, 0] = currentLoad.Pz;
            matrix[loadDoF_2, 0] = currentLoad.My;

            return(matrix);
        }
示例#26
0
        private double[,] ApplyNodalLoad(double[,] matrix, ILoad currentLoad)
        {
            int nodeNumber = currentLoad.IntNode;
            int loadDoF_1  = nodeNumber * BcLoadModel.IntDOFPerNode - 2;
            int loadDoF_2  = nodeNumber * BcLoadModel.IntDOFPerNode - 1;

            matrix[loadDoF_1, 0] = currentLoad.DoubleForce;
            matrix[loadDoF_2, 0] = currentLoad.DoubleMoment;

            return(matrix);
        }
示例#27
0
 private void ReadyToDepart(ILoad load)
 {
     Log("Ready to Depart", load);
     if (DebugMode)
     {
         Debug.WriteLine("{0}:\t{1}\tReadyToDepart\t{2}", ClockTime, this, load);
     }
     HSet_Serving.Remove(load);
     HSet_PendingToDepart.Add(load);
     HC_Serving.ObserveChange(-1, ClockTime);
     HC_PendingToDepart.ObserveChange(1, ClockTime);
     OnReadyToDepart.Invoke(load);
 }
示例#28
0
        public LogWin(ILoad component) : base(component)
        {
            EventLog evt = new EventLog();

            // NOTA: PARA QUE ESTA INSTRUCCION FUNCIONES SE DEBE
            // EJECUTAR VISUAL STUDIO EN MODO ADMINISTRADOR
            if (!EventLog.SourceExists(SourceName))
            {
                EventLog.CreateEventSource(SourceName, "Application");
            }

            evt.Close();
        }
示例#29
0
        /***************************************************/

        private void GetDirectionData(ILoad load, out string axis, out int shift)
        {
            if (load.Axis == LoadAxis.Local)
            {
                axis  = "Local";
                shift = 0;
            }
            else
            {
                axis  = "Global";
                shift = load.Projected ? 6 : 3;
            }
        }
示例#30
0
 public void Dequeue(ILoad load)
 {
     if (List_Queueing.Contains(load))
     {
         Log("Dequeue", load);
         if (DebugMode)
         {
             Debug.WriteLine("{0}:\t{1}\tDequeue\t{2}", ClockTime, this, load);
         }
         List_Queueing.Remove(load);
         HC_Queueing.ObserveChange(-1, ClockTime);
         AtmptEnqueue();
     }
 }
示例#31
0
 public HomeController(ILoad load, IVGALoad LoadVGA, IRAMLoad LoadRAM, ILoadCPU LoadCPU, ILoadCase LoadCase, ILog LogService, IUser UserService
                       , ILoadCart LoadCartService, ICartRepository CartService, ISearchQuerry SearchService)
 {
     _LoadComputer    = load;
     _LoadVGA         = LoadVGA;
     _LoadRAM         = LoadRAM;
     _LoadCPU         = LoadCPU;
     _LoadCase        = LoadCase;
     _LogService      = LogService;
     _UserService     = UserService;
     _LoadCartService = LoadCartService;
     _CartService     = CartService;
     _SearchService   = SearchService;
 }
示例#32
0
        /// <summary>
        /// Start a simulation
        /// </summary>
        /// <param name="initial">The initial state</param>
        /// <param name="motor">The motor object</param>
        /// <param name="load">The load</param>
        /// <param name="path">The path</param>
        public bool Start(IRecord initial, IMotor motor, ILoad load, IPath path, SimulationEnv env)
        {
            _record = initial;
            _motor = motor;
            _load = load;
            _path = path;

            double mass = _load.Mass + _motor.CoilMass;

            int count = _record.Time.Length;

            if (_record.Time == null || (_record.Position == null && _record.Velocity == null && _record.Acceleration == null))
                return false;

            if (_record.Acceleration == null)
                _record.Acceleration = new double[count];

            if (_record.Velocity == null)
                _record.Velocity = new double[count];

            if (_record.Position == null)
                _record.Position = new double[count];

            _record.RMSforce = Math.Pow(mass * _record.Acceleration[0], 2);

            if (_record.Acceleration != null && !isZero(_record.Acceleration))
            {
                if (isZero(_record.Velocity))
                {
                    for (int i = 1; i < count; i++)
                    {
                        _record.Velocity[i] = (_record.Time[i] - _record.Time[i - 1]) * _record.Acceleration[i] + _record.Velocity[i - 1];
                        _record.Position[i] = (_record.Time[i] - _record.Time[i - 1]) * _record.Velocity[i] + _record.Position[i - 1];
                        _record.RMSforce += Math.Pow(mass * _record.Acceleration[i] + env.StaticFriction + env.DynamicFriction * _record.Velocity[i] + env.ThrustForce, 2);
                    }
                }
                else if (!isZero(_record.Velocity) && isZero(_record.Position))
                {
                    for (int i = 1; i < count; i++)
                    {
                        _record.Position[i] = (_record.Time[i] - _record.Time[i - 1]) * _record.Velocity[i] + _record.Position[i - 1];
                        _record.RMSforce += Math.Pow(mass * _record.Acceleration[i] + env.StaticFriction + env.DynamicFriction * _record.Velocity[i] + env.ThrustForce, 2);
                    }
                }
                else
                {
                    for (int i = 1; i < count; i++)
                    {
                        _record.RMSforce += Math.Pow(mass * _record.Acceleration[i] + env.StaticFriction + env.DynamicFriction * _record.Velocity[i] + env.ThrustForce, 2);
                    }
                }
            }
            else if (_record.Velocity != null && !isZero(_record.Velocity))
            {
                if (isZero(_record.Position))
                {
                    for (int i = 1; i < count; i++)
                    {
                        _record.Position[i] = (_record.Time[i] - _record.Time[i - 1]) * _record.Velocity[i] + _record.Position[i - 1];
                        _record.Acceleration[i] = (_record.Velocity[i] - _record.Velocity[i - 1]) / (_record.Time[i] - _record.Time[i - 1]);
                        _record.RMSforce += Math.Pow(mass * _record.Acceleration[i] + env.StaticFriction + env.DynamicFriction * _record.Velocity[i] + env.ThrustForce, 2);
                    }
                }
                else
                {
                    for (int i = 1; i < count; i++)
                    {
                        _record.Acceleration[i] = (_record.Velocity[i] - _record.Velocity[i - 1]) / (_record.Time[i] - _record.Time[i - 1]);
                        _record.RMSforce += Math.Pow(mass * _record.Acceleration[i] + env.StaticFriction + env.DynamicFriction * _record.Velocity[i] + env.ThrustForce, 2);
                    }
                }
            }
            else
            {
                for (int i = 1; i < count; i++)
                {
                    _record.Velocity[i] = (_record.Position[i] - _record.Position[i - 1]) / (_record.Time[i] - _record.Time[i - 1]);
                    _record.Acceleration[i] = (_record.Velocity[i] - _record.Velocity[i - 1]) / (_record.Time[i] - _record.Time[i - 1]);
                    _record.RMSforce += Math.Pow(mass * _record.Acceleration[i] + env.StaticFriction + env.DynamicFriction * _record.Velocity[i] + env.ThrustForce, 2);
                }
            }

            double efficiency = env.MechEfficiency * 0.01;

            _record.RMSforce = Math.Sqrt(_record.RMSforce / count) / efficiency;
            _record.MAXforce = (mass * _record.Acceleration.Max() + env.StaticFriction + env.DynamicFriction * _record.Velocity.Max() + env.ThrustForce) / efficiency;
            _record.RMScurrent = _record.RMSforce / _motor.ForceConstant;
            _record.MAXcurrent = _record.MAXforce / _motor.ForceConstant;
            _record.TemperatureRise = (Math.Pow(_record.RMSforce / _motor.MotorConstant, 2) * _motor.ThermalResistance);

            Write();

            return true;
        }