void ReleaseDelayTimer_Elapsed(Core.Timer sender) { ReleaseDelayTimerRunning = false; ReleaseDelayTimer.Reset(); OnTransferStatusChangedController(this, new EventArgs()); //Release(); }
public Commbox(T stream) : base(stream) { commboxInfo = new CommboxInfo(); cmdBuffInfo = new CmdBuffInfo(); cmdTemp = new byte[256]; lastError = 0; isDB20 = false; isDoNow = true; password = new byte[10]; password[0] = 0x0C; password[1] = 0x22; password[2] = 0x17; password[3] = 0x41; password[4] = 0x57; password[5] = 0x2D; password[6] = 0x43; password[7] = 0x17; password[8] = 0x2D; password[9] = 0x4D; position = 0; reqByteToByte = new Core.Timer(); reqWaitTime = new Core.Timer(); resByteToByte = new Core.Timer(); resWaitTime = new Core.Timer(); }
public bool SetCommTime(byte type, Core.Timer time) { byte[] timeBuff = new byte[2]; GetLinkTime(type, time); ulong microTime = (ulong)time.Microseconds; if (type == Constant.SETVPWSTART || type == Constant.SETVPWRECS) { if (type == Constant.SETVPWRECS) { microTime = (microTime * 2) / 3; } type = (byte)(type + (Constant.SETBYTETIME & 0xF0)); microTime = (ulong)((microTime * 1000000.0) / box.BoxTimeUnit); } else { microTime = (ulong)((microTime * 1000000.0) / (box.TimeBaseDB * box.BoxTimeUnit)); } timeBuff[0] = (byte)(microTime / 256); timeBuff[1] = (byte)(microTime % 256); if (timeBuff[0] == 0) { return(DoSet(type, timeBuff, 1, 1)); } return(DoSet(type, timeBuff, 0, 2)); }
public StraightAccumulationConveyor(StraightAccumulationConveyorInfo info) : base(info) { straightAccumulationinfo = info; if (straightAccumulationinfo.blockedTimeout != 0) { BlockedTimer = new Core.Timer(straightAccumulationinfo.blockedTimeout); BlockedTimer.AutoReset = false; BlockedTimer.OnElapsed += BlockedTimer_OnElapsed; } if (straightAccumulationinfo.clearTimeout != 0) { ClearTimer = new Core.Timer(straightAccumulationinfo.clearTimeout); ClearTimer.AutoReset = false; ClearTimer.OnElapsed += ClearTimer_OnElapsed; } RollAngle = info.rollAngle; AccPitch = info.Pitch; OutfeedSection = info.OutfeedSection; UpdateConveyor(); //The scene is not loading therefore it is loaded from the catalog if (!Core.Environment.Scene.Loading) { } }
/// <summary> /// Called when the script is first initialized /// </summary> public override void Start() { base.Start(); // Get the navigation component on the same entity as this script Navigation = Entity.Get <NavigationComponent>(); // Will search for an CharacterComponent within the same entity as this script Character = Entity.Get <CharacterComponent>(); if (Character == null) { throw new ArgumentException("Please add a CharacterComponent to the entity containing PlayerController!"); } //if (PunchCollision == null) throw // new ArgumentException("Please add a RigidbodyComponent as a PunchCollision to the entity containing PlayerController!"); ModelChildEntity = Entity.GetChild(0); MoveToDestination = Entity.Transform.WorldMatrix.TranslationVector; //PunchCollision.Enabled = false; Entity atimerE = new Entity { new Core.Timer() }; SceneSystem.SceneInstance.RootScene.Entities.Add(atimerE); AttackTimer = atimerE.Get <Core.Timer>(); }
private void EMUDAIConnectionConstructor() { //Data Check Ticker dataCheckTicker = new Core.Timer(1); dataCheckTicker.OnElapsed += new Core.Timer.ElapsedEvent(dataCheckTicker_Elapsed); dataCheckTicker.AutoReset = true; dataCheckTicker.Start(); }
public bool CommboxDelay(Core.Timer time) { byte[] timeBuff = new byte[2]; byte delayWord = Constant.DELAYSHORT; long microTime = time.Microseconds + 1; microTime = Convert.ToInt64(microTime / (commboxInfo.CommboxTimeUnit / 1000000.0)); if (microTime == 0) { lastError = Constant.SETTIME_ERROR; return(false); } if (microTime > 65535) { microTime = microTime / commboxInfo.TimeBaseDB; if (microTime > 65535) { microTime = (microTime * commboxInfo.TimeBaseDB) / commboxInfo.TimeExternDB; if (microTime > 65535) { lastError = Constant.COMMTIME_OUT; return(false); } delayWord = Constant.DELAYLONG; } else { delayWord = Constant.DELAYTIME; } } timeBuff[0] = Utils.HighByte(microTime); // (byte)(microTime / 256); timeBuff[1] = Utils.LowByte(microTime); // (byte)(microTime % 256); if (timeBuff[0] == 0) { if (isDoNow) { return(CommboxDo(delayWord, timeBuff, 1, 1)); } else { return(AddToBuff(delayWord, timeBuff, 1, 1)); } } else { if (isDoNow) { return(CommboxDo(delayWord, timeBuff, 0, 2)); } else { return(AddToBuff(delayWord, timeBuff, 0, 2)); } } }
private void RefreshCycle_OnElapsed(Core.Timer sender) { Log.Write(DateTime.Now.ToString()); //TODO:Request palleter load back foreach (var item in palletRequestList) { InFeedMethod(item); } }
public Elevator(ElevatorInfo info) : base(info) { multishuttleElevatorInfo = info; Embedded = true; ParentMultiShuttle = info.Multishuttle; Side = info.Side; AisleNumber = ParentMultiShuttle.AisleNumber; GroupName = info.groupName; ElevatorConveyor = new ElevatorConveyor(new ElevatorConveyorInfo { length = info.multishuttleinfo.ElevatorConveyorLength, width = info.multishuttleinfo.ElevatorConveyorWidth, thickness = 0.05f, color = Core.Environment.Scene.DefaultColor, Elevator = this } ); Add(ElevatorConveyor); ElevatorConveyor.Visible = false; ElevatorConveyor.Route.Motor.Speed = info.multishuttleinfo.ConveyorSpeed; ElevatorConveyor.LocalYaw = -(float)Math.PI; Lift = new TrackRail(new TrackRailInfo() { parentMultiShuttle = ParentMultiShuttle, level = 0, shuttlecarSpeed = ParentMultiShuttle.ShuttleCarSpeed, controlAssembly = this }); Vehicle = new TrackVehicle(new TrackVehicleInfo() { trackRail = Lift, moveToDistance = 0, controlAssembly = this }); Vehicle.Length = info.multishuttleinfo.ElevatorConveyorLength; Vehicle.Width = info.multishuttleinfo.ElevatorConveyorWidth; Vehicle.Color = Color.Silver; Vehicle.OnVehicleArrived += ElevatorOnArrived; Vehicle.OnPositionChanged += Car_PositionChanged; Add((Core.Parts.RigidPart)Lift, new Vector3(-0.025f, 0, 0)); Lift.LocalRoll = -(float)Math.PI / 2; Lift.Route.Motor.Speed = multishuttleElevatorInfo.multishuttleinfo.elevatorSpeed; Lift.Route.Motor.Stop(); Vehicle.Roll = (float)Math.PI / 2; Vehicle.Movable = false; ElevatorTasks.Clear(); ElevatorTasks.CollectionChanged += ElevatorTasks_CollectionChanged; taskMonitor = new Timer(5); taskMonitor.AutoReset = true; taskMonitor.OnElapsed += TaskMonitor_OnElapsed; taskMonitor.Start(); Core.Environment.Scene.OnResetCompleted += Scene_OnResetCompleted; }
public Commbox(T stream) : base(stream) { lastError = 0; boxVer = 0; box = new Box(); startpos = 0; reqByteToByte = new Core.Timer(); reqWaitTime = new Core.Timer(); reqByteToByte = new Core.Timer(); resWaitTime = new Core.Timer(); }
public TwoToOneMerge(TwoToOneMergeInfo info) : base(info) { info.height = info.height * 2; // assembley is placed at height/2 so that it comes out at height ?!!?? twoToOneInfo = info; rhsConveyor = new StraightConveyor(NewStraightInfo()); Add(rhsConveyor); rhsEnd = rhsConveyor.TransportSection.Route.InsertActionPoint(3); lhsConveyor = new StraightConveyor(NewStraightInfo()); Add(lhsConveyor); lhsEnd = lhsConveyor.TransportSection.Route.InsertActionPoint(3); lhsConveyor.EndFixPoint.Enabled = false; //Disable one of the fixpoints so that there is only one that can be fixed to lhsConveyor.EndFixPoint.Visible = false; #region Make it look nice BasicInfo boxInfo = new BasicInfo { length = info.length, width = info.width, height = 0.05f, color = Core.Environment.Scene.DefaultColor }; box = new Cube(boxInfo); Add(box); #endregion lhsEnd.OnEnter += lhsEnd_OnEnter; TwoToOneWidth = info.width; TwoToOneLength = info.length; InternalConvWidth = info.internalConvWidth; UpdateMergeAngles(); lhsConveyor.RouteAvailable = RouteStatuses.Request; //We are setting this to request because the DHDM controls the release of loads from the previous conveyor onto it. rhsConveyor.RouteAvailable = RouteStatuses.Request; //same here ReleaseDelayTimer = new Core.Timer(ReleaseDelayTime); //loads will be only be released when the timer elapses the timer will start when a load transfers ReleaseDelayTimer.OnElapsed += ReleaseDelayTimer_OnElapsed; lhsConveyor.StartFixPoint.OnSnapped += LHSStartFixPoint_OnSnapped; lhsConveyor.StartFixPoint.OnUnSnapped += LHSStartFixPoint_OnUnSnapped; rhsConveyor.StartFixPoint.OnSnapped += RHSStartFixPoint_OnSnapped; rhsConveyor.StartFixPoint.OnUnSnapped += RHSStartFixPoint_OnUnSnapped; rhsConveyor.OnNextRouteStatusAvailableChanged += rhsConveyor_OnNextRouteStatusAvailableChanged; }
public bool CheckResult(Core.Timer time) { Stream.ReadTimeout = time; byte[] rb = new byte[1]; rb[0] = 0; if (Stream.Read(rb, 0, 1) != 1) { return(false); } if (rb[0] == Constant.READY || rb[0] == Constant.ERROR) { Stream.Clear(); return(true); } return(false); }
public ThreeWaySwitch(ThreeWaySwitchInfo info) : base(info) { try { threeWaySwitchInfo = info; ControllerProperties = StandardCase.SetMHEControl(info, this); info.height = info.height * 2; // assembley is placed at height/2 so that it comes out at height ?!!?? LeftConv = new StraightThrough(NewStraightInfo(info), this) { convPosition = ThreeWayRoutes.Left }; RightConv = new StraightThrough(NewStraightInfo(info), this) { convPosition = ThreeWayRoutes.Right }; CenterConv = new StraightThrough(NewStraightInfo(info), this) { convPosition = ThreeWayRoutes.Center }; Add(LeftConv, new Vector3(0, 0, -info.width / 2)); Add(RightConv, new Vector3(0, 0, info.width / 2)); Add(CenterConv, new Vector3(0, 0, info.centerOffset)); ReleaseDelayTimer = new Core.Timer(ReleaseDelayTimeStraight); //loads will be only be released when the timer elapses the timer will start when a load transfers ReleaseDelayTimer.OnElapsed += ReleaseDelayTimer_OnElapsed; ReleaseDelayTimer.AutoReset = false; TimerReleaseConvs.CollectionChanged += TimerReleaseConvs_CollectionChanged; ThreeWayLength = info.threeWayLength; internalWidth = info.threeWayWidth - ((float)info.internalConvWidth / 1000); CenterOffset = info.centerOffset; LeftDefaultDirection = info.leftDefaultDirection; RightDefaultDirection = info.rightDefaultDirection; CenterDefaultDirection = info.centerDefaultDirection; InternalConvWidth = info.internalConvWidth; Speed = info.speed; ReleaseDelayTimeStraight = info.releaseDelayTimeStraight; Core.Environment.Scene.OnLoaded += Scene_OnLoaded; } catch (Exception e) { Log.Write(e.Message); } }
public bool SetCommTime(byte type, Core.Timer time) { byte[] timeBuff = new byte[2]; GetLinkTime(type, time); ulong microTime = (ulong)time.Microseconds; if (type == Constant.SETVPWSTART || type == Constant.SETVPWRECS) { if (Constant.SETVPWRECS == type) { microTime = (microTime * 2) / 3; } type = (byte)(type + (Constant.SETBYTETIME & 0xF0)); microTime = (ulong)((microTime * 1000000.0) / commboxInfo.CommboxTimeUnit); } else { microTime = (ulong)((microTime * 1000000.0) / (commboxInfo.TimeBaseDB * commboxInfo.CommboxTimeUnit)); // microTime = (microTime / commboxInfo.TimeBaseDB) / (commboxInfo.CommboxTimeUnit / 1000000.0); } if (microTime > 65535) { lastError = Constant.COMMTIME_OUT; return(false); } if (type == Constant.SETBYTETIME || type == Constant.SETWAITTIME || type == Constant.SETRECBBOUT || type == Constant.SETRECFROUT || type == Constant.SETLINKTIME) { timeBuff[0] = (byte)(microTime / 256); timeBuff[1] = (byte)(microTime % 256); if (timeBuff[0] == 0) { return(SendCmdToBox(type, timeBuff, 1, 1)); } else { return(SendCmdToBox(type, timeBuff, 0, 2)); } } lastError = Constant.UNDEFINE_CMD; return(false); }
public bool SendOk(Core.Timer time) { Stream.ReadTimeout = time; byte[] receiveBuffer = new byte[1]; receiveBuffer[0] = 0; if (Stream.Read(receiveBuffer, 0, 1) == 1) { if (receiveBuffer[0] == Constant.SEND_OK) { return(true); } else if (receiveBuffer[0] >= Constant.UP_TIMEOUT && receiveBuffer[0] <= Constant.ERROR_REC) { lastError = Constant.SENDDATA_ERROR; return(false); } } lastError = Constant.TIMEOUT_ERROR; return(false); }
public bool CheckResult(Core.Timer time) { Stream.ReadTimeout = time; byte[] receiveBuffer = new byte[1]; receiveBuffer[0] = 0; if (Stream.Read(receiveBuffer, 0, 1) != 1) { lastError = Constant.TIMEOUT_ERROR; return(false); } if (receiveBuffer[0] == Constant.SUCCESS) { return(true); } while (Stream.Read(receiveBuffer, 0, 1) == 1) { ; } lastError = receiveBuffer[0]; return(false); }
private void GetLinkTime(byte type, Core.Timer time) { switch (type) { case Constant.SETBYTETIME: reqByteToByte = time; break; case Constant.SETWAITTIME: reqWaitTime = time; break; case Constant.SETRECBBOUT: resByteToByte = time; break; case Constant.SETRECFROUT: resWaitTime = time; break; } }
public int ReadData(byte[] buffer, int offset, int length, Core.Timer time) { Stream.ReadTimeout = time; int len = Stream.Read(buffer, offset, length); if (len < length) { int avail = Stream.BytesToRead; if (avail > 0) { if (avail <= (length - len)) { len += Stream.Read(buffer, offset + len, avail); } else { len += Stream.Read(buffer, offset + len, length - len); } } } return(len); }
public override void Start() { base.Start(); // Get the navigation component on the same entity as this script Navigation = Entity.Get <NavigationComponent>(); // Will search for an CharacterComponent within the same entity as this script Character = Entity.Get <CharacterComponent>(); Entity charEntity = Entity.Scene.Entities.FirstOrDefault(x => string.Equals(x.Name, "PlayerCharacter")); PlayerRef = charEntity.Get <Player.PlayerController>(); Entity atimerE = new Entity { new Core.Timer() }; SceneSystem.SceneInstance.RootScene.Entities.Add(atimerE); AttackTimer = atimerE.Get <Core.Timer>(); // Get the navigation component on the same entity as this script Navigation = Entity.Get <NavigationComponent>(); MoveDestination = Entity.Transform.WorldMatrix.TranslationVector; }
public bool CommboxDelay(Core.Timer time) { byte[] timeBuff = new byte[2]; byte delayWord = Constant.DELAYSHORT; ulong microTime = (ulong)(time.Microseconds / (box.BoxTimeUnit / 1000000.0)); if (microTime == 0) { return(false); } if (microTime > 65535) { microTime = microTime / box.TimeBaseDB; if (microTime > 65535) { microTime = (microTime * box.TimeBaseDB) / box.TimeExternB; if (microTime > 65535) { return(false); } delayWord = Constant.DELAYDWORD; } else { delayWord = Constant.DELAYTIME; } } timeBuff[0] = (byte)(microTime / 256); timeBuff[1] = (byte)(microTime % 256); if (timeBuff[0] == 0) { return(DoSet(delayWord, timeBuff, 1, 1)); } return(DoSet(delayWord, timeBuff, 0, 2)); }
//BG: I've added this because sometimes the data message is not being processed for "D002" or "D003" messages. If it does I have //added to a list and on a ticker (every 5 seconds) check if the data can be updated. void dataCheckTicker_Elapsed(Core.Timer sender) { //ExperiorOutputMessage("Ticker", MessageSeverity.Test); if (dataMissionID.Count != 0) { List <string[]> foundDataMissions = new List <string[]>(); foreach (string[] telegramFields in dataMissionID) { //WMS sends data after data request. //Find caseload and update the data (SSCC barcode) string missionID = telegramFields[1]; string ssccbarcode = telegramFields[2]; Case_Load caseload = Case_Load.GetCaseFromULID(missionID); if (caseload != null) { caseload.SSCCBarcode = ssccbarcode; ExperiorOutputMessage(string.Format("Error Recovery: Updated mission ID {0} after initial failure", missionID), MessageSeverity.Information); if (telegramFields.Length >= 5) { //Inner tray barcodes (Tesco specific) caseload.Case_Data.UserData = telegramFields[3] + "," + telegramFields[4]; } foundDataMissions.Add(telegramFields); } } foreach (string[] telegramFields in foundDataMissions) { dataMissionID.Remove(telegramFields); } } }
public override async Task Execute() { Trigger.ProcessCollisions = true; Entity atimerE = new Entity { new Core.Timer() }; SceneSystem.SceneInstance.RootScene.Entities.Add(atimerE); AttackTimer = atimerE.Get <Core.Timer>(); while (Game.IsRunning) { Collision firstCollision = await Trigger.NewCollision(); PhysicsComponent otherCollider = Trigger == firstCollision.ColliderA ? firstCollision.ColliderB : firstCollision.ColliderA; Player.PlayerController isPlayer = otherCollider.Entity.Get <Player.PlayerController>(); if (isPlayer != null) { CollisionStarted(isPlayer); } } }
void ClearTimer_OnElapsed(Core.Timer sender) { ClearTimer.Stop(); ClearTimer.Reset(); RouteAvailable = RouteStatuses.Available; }
void ticker_OnElapsed(Core.Timer sender) { }
void ClearTimer_OnElapsed(Core.Timer sender) { PhotocellStatus = PhotocellState.Clear; ClearTimer.OnElapsed -= ClearTimer_OnElapsed; ClearTimer.Reset(); }
public Transfer(TransferInfo info) : base(info) { transferInfo = info; info.height = info.height * 2; // assembley is placed at height/2 so that it comes out at height ?!!?? rightLeftCrossover = new StraightTransportSection(info.color, 1, convThickness, 0.25f); leftRightCrossover = new StraightTransportSection(info.color, 1, convThickness, 0.25f); rightLeftCrossover.Route.Arrow.Visible = false; leftRightCrossover.Route.Arrow.Visible = false; if (transferInfo.type == TransferType.TwoWay) { rightLeftCrossover.Route.Motor.Speed = DivertSpeed; leftRightCrossover.Route.Motor.Speed = DivertSpeed; } else if (transferInfo.type == TransferType.DHDM) { rightLeftCrossover.Route.Motor.Speed = DHDMSpeed; leftRightCrossover.Route.Motor.Speed = DHDMSpeed; } Add(rightLeftCrossover); Add(leftRightCrossover); rhsConveyor = new StraightConveyor(NewStraightInfo(info)); lhsConveyor = new StraightConveyor(NewStraightInfo(info)); rhsConveyor.Name = "rhs"; lhsConveyor.Name = "lhs"; if (transferInfo.type == TransferType.TwoWay) { crossoverOffset = info.length / 2; } Add(rhsConveyor); Add(lhsConveyor); lhsConveyor.StartFixPoint.OnSnapped += lhsStartFixPoint_OnSnapped; lhsConveyor.StartFixPoint.OnUnSnapped += lhsStartFixPoint_OnUnSnapped; lhsConveyor.OnNextRouteStatusAvailableChanged += lhsConveyor_OnNextRouteStatusAvailableChanged; lhsConveyor.EndFixPoint.OnSnapped += lhsEndFixPoint_OnSnapped; rhsConveyor.StartFixPoint.OnSnapped += rhsStartFixPoint_OnSnapped; rhsConveyor.StartFixPoint.OnUnSnapped += rhsStartFixPoint_OnUnSnapped; rhsConveyor.OnNextRouteStatusAvailableChanged += rhsConveyor_OnNextRouteStatusAvailableChanged; rhsConveyor.EndFixPoint.OnSnapped += rhsEndFixPoint_OnSnapped; lhsConveyor.RouteAvailable = RouteStatuses.Request; //We are setting this to request because the DHDM controls the release of loads from the previous conveyor onto it. rhsConveyor.RouteAvailable = RouteStatuses.Request; //same here rhsStartAP = rhsConveyor.TransportSection.Route.InsertActionPoint(crossoverOffset); lhsStartAP = lhsConveyor.TransportSection.Route.InsertActionPoint(crossoverOffset); rhsEndAP = rhsConveyor.TransportSection.Route.InsertActionPoint(DHDMLength - crossoverOffset); lhsEndAP = lhsConveyor.TransportSection.Route.InsertActionPoint(DHDMLength - crossoverOffset); rightToLeftStartAP = rightLeftCrossover.Route.InsertActionPoint(0); leftToRightStartAP = leftRightCrossover.Route.InsertActionPoint(0); rightToLeftEndAP = rightLeftCrossover.Route.InsertActionPoint(0); //Should be placed at the end this is done in UpdateCrossoverSectionAngles when we know the correct length of the crossover sections leftToRightEndAP = leftRightCrossover.Route.InsertActionPoint(0); //Should be placed at the end this is done in UpdateCrossoverSectionAngles when we know the correct length of the crossover sections rhsStartAP.OnEnter += rhsStartAP_OnEnter; lhsStartAP.OnEnter += lhsStartAP_OnEnter; rhsEndAP.OnEnter += rhsEndAP_OnEnter; lhsEndAP.OnEnter += lhsEndAP_OnEnter; rightToLeftEndAP.OnEnter += rightToLeftEndAP_OnEnter; leftToRightEndAP.OnEnter += leftToRightEndAP_OnEnter; DHDMWidth = info.width; //This will adjust the crossover conveyors so that the corossover angles are correct DHDMLength = info.length; InternalConvWidth = info.internalConvWidth; ReleaseDelayTimer = new Core.Timer(ReleaseDelayTimeStraight); //loads will be only be released when the timer elapses the timer will start when a load transfers ReleaseDelayTimer.OnElapsed += ReleaseDelayTimer_Elapsed; ReleaseDelayTimer.AutoReset = false; Core.Environment.Scene.OnLoaded += Scene_OnLoaded; ControllerProperties = StandardCase.SetMHEControl(info, this); }
public int ReadData(byte[] receiveBuffer, int offset, int length, Core.Timer totalTime) { Stream.ReadTimeout = totalTime; return(Stream.Read(receiveBuffer, offset, length)); }
public SerialPortStream(SerialPort serialPort) { this.serialPort = serialPort; this.readTimeout = new Core.Timer(-1); }
void ReleaseDelayTimer_OnElapsed(Core.Timer sender) { Release(); }
void BlockedTimer_OnElapsed(Core.Timer sender) { PhotocellStatus = PhotocellState.Blocked; BlockedTimer.OnElapsed -= BlockedTimer_OnElapsed; BlockedTimer.Reset(); }