Beispiel #1
0
        private void InitializeSimulatedTestBench(TestType testType)
        {
            // get the behavior for the simulators, based on test type.
            var engine     = new SimulatorEngine(new Stopwatch());
            var torqueCell = new SimulatedTorqueCell(engine);
            var servoDrive = new SimulatedServoDrive(engine);

            TestBench.Initialize(torqueCell, servoDrive);
        }
        public void ElapsedTimeCountsDownForMultipleTestConditions()
        {
            // initialize the simulated test bench
            var engine     = new SimulatorEngine(new Stopwatch());
            var torqueCell = new SimulatedTorqueCell(engine);
            var servoDrive = new SimulatedServoDrive(engine);

            TestBench.Initialize(torqueCell, servoDrive);

            // create a fatigue test and add a condition.
            var fatigueTest = new FatigueTest();

            engine.CurrentCondition = SingleFatigueTestCondition();
            fatigueTest.TestConditions.Add(engine.CurrentCondition);
            fatigueTest.TestConditions.AddRange(MultipleFatigueTestConditions());

            // load the test.
            TestBench.Singleton.LoadTest(fatigueTest);
            TestBench.Singleton.BeginCurrentTest();

            TimeSpan start = new TimeSpan(0, 0, 0);

            for (int i = 0; i < 1000; i++)
            {
                if (i == 0)
                {
                    start = fatigueTest.EstimatedCompletionTime;
                }
                torqueCell.RefreshTorque();
                servoDrive.StoreParameter(ServoDriveEnums.RegisterAddress.TorqueValue, (int)torqueCell.Torque);
                servoDrive.RefreshPosition();
                System.Threading.Thread.Sleep(10);
            }
            TimeSpan finish = fatigueTest.EstimatedCompletionTime;

            Console.WriteLine($"The estimated completion for the duty cycle is {finish.Days}:{finish.Hours}:{finish.Minutes}:{finish.Seconds}");
            var totalSeconds = start.Subtract(finish).TotalSeconds;

            Assert.GreaterOrEqual(totalSeconds, 10);
        }
Beispiel #3
0
        public void Init()
        {
            var stopwatch = new System.Diagnostics.Stopwatch();

            _engine = new SimulatorEngine(stopwatch);
            var condition = new FatigueTestCondition()
            {
                CounterclockwiseTorque = -1000,
                ClockwiseTorque        = 2500,
                CyclesPerSecond        = 3,
                CalibrationInterval    = 100,
                CyclesRequired         = 1000000,
                FatigueTestId          = 5,
                Id = 1
            };

            _engine.CurrentCondition = condition;
            _torqueCell           = new SimulatedTorqueCell(_engine);
            _servoDrive           = new SimulatedServoDrive(_engine);
            _servoDrive.Stiffness = 525;

            _engine.StartSimulate();
        }