Beispiel #1
0
        public bool ReadMachineRealTimeData()
        {
            foreach (KeyValuePair <int, SimMachine> d in _dicSimMachine)
            {
                MachineRealTimeData realTimeData = new MachineRealTimeData();
                realTimeData.MachineID  = d.Key;
                realTimeData.MotorInfos = new List <MotorInfo>();

                SimMachine simMachine = d.Value;

                int[] drivingCurrents  = simMachine.GetDrivingCurrent();
                int[] hoistingCurrents = simMachine.GetHoistingCurrent();
                int[] forkCurrents     = simMachine.GetForkCurrent();

                DateTime dt = DateTime.UtcNow;
                for (int i = 0; i < drivingCurrents.Length; i++)
                {
                    DateTime newDT = dt.AddSeconds((i + 1) - drivingCurrents.Length);
                    realTimeData.MotorInfos.Add(
                        new MotorInfo(
                            newDT.ToString("o"),
                            drivingCurrents[i],
                            hoistingCurrents[i],
                            forkCurrents[i]));
                }

                if (_dicMachineRealTimeData.ContainsKey(d.Key) == true)
                {
                    _dicMachineRealTimeData[d.Key] = realTimeData;
                }
            }

            return(true);
        }
Beispiel #2
0
        public bool ReadMachineCycleData()
        {
            foreach (KeyValuePair <int, SimMachine> d in _dicSimMachine)
            {
                int        machineID  = d.Key;
                SimMachine simMachine = d.Value;

                if (simMachine.IsCycleCompleted == true)
                {
                    MachineCycleData cycleData = new MachineCycleData();

                    // Fill cycle data and add to dictionary
                    cycleData.JobID          = simMachine.CycleJobID;
                    cycleData.JobType        = simMachine.CycleJobType;
                    cycleData.MachineID      = simMachine.CycleMachineID;
                    cycleData.TotalStartTime = simMachine.CycleTotalStartTime;
                    cycleData.TotalEndTime   = simMachine.CycleTotalEndTime;
                    cycleData.DrivingInfo    = new List <MachineCycleDrivingInfo>();
                    cycleData.DrivingInfo.Add(simMachine.CycleFirstDrivingInfo);
                    cycleData.DrivingInfo.Add(simMachine.CycleSecondDrivingInfo);
                    cycleData.UpperDrivingInfo = new List <MachineCycleUpperDrivingInfo>();
                    cycleData.UpperDrivingInfo.Add(simMachine.CycleUpperDrivingInfo);
                    cycleData.HoistingInfo = new List <MachineCycleHoistingInfo>();
                    cycleData.HoistingInfo.Add(simMachine.CycleFirstHoistingInfo);
                    cycleData.HoistingInfo.Add(simMachine.CycleSecondHoistingInfo);
                    cycleData.ForkInfo = new List <MachineCycleForkInfo>();
                    cycleData.ForkInfo.Add(simMachine.CycleForkInfo);
                    cycleData.LaserDistanceMeterTotalUsedTime = simMachine.CycleLaserDistanceMeterTotalUsedTime;
                    cycleData.OpticalRepeaterTotalUsedTime    = simMachine.CycleOpticalRepeaterTotalUsedTime;
                    cycleData.Weight         = simMachine.CycleWeight;
                    cycleData.InventoryCount = simMachine.CycleInventoryCount;

                    if (_dicMachineCycleData.ContainsKey(machineID) == true)
                    {
                        _dicMachineCycleData[machineID] = cycleData;
                    }

                    simMachine.IsCycleCompleted = false;
                }
                else
                {
                    _dicMachineCycleData[machineID] = null;
                }
            }

            return(true);
        }
Beispiel #3
0
        public MachineErrorData GetMachineErrorData()
        {
            MachineErrorData data = new MachineErrorData();

            data.ErrorInfos = new List <MachineErrorItem>();

            foreach (KeyValuePair <int, SimMachine> d in _dicSimMachine)
            {
                int        machineID  = d.Key;
                SimMachine simMachine = d.Value;
                if (simMachine.IsExistErrorData == true)
                {
                    MachineErrorItem item = simMachine.GetMachineErrorData();
                    data.ErrorInfos.Add(item);

                    simMachine.IsExistErrorData = false;
                }
            }

            return(data);
        }