public override void endBlock(GCodeParser parser, MachineStatus machineStatus, IDictionary <String, ParsedWord> currentBlock) { String currentLine = parser.getCurrentLine(); const String MachiningPlane = "G18"; String motionMode = base.machine.getMotionMode(); String coordinateSystem = base.machine.getCoordinateSystems(); Vector3D toolAx = motion.GetToolAxis(MachiningPlane, machineStatus); if (parser.findWordInBlock(new StringBuilder(currentLine)) != null) { if (!String.IsNullOrEmpty(coordinateSystem)) { int beforeAddCount = listOffset.Count; listOffset.Add(coordinateSystem); if (listOffset.Count > beforeAddCount) { ToolChange(); } } base.StartNXPathSettings(currentBlock); base.LinearMotion(motionMode, MachiningPlane, currentBlock, machineStatus, toolAx, false); CircularMotion(machineStatus, currentBlock, motionMode, MachiningPlane, false); base.EndNXPathSettings(currentBlock); } }
public GcMachine() { userStack = new Varible[stackSize]; systemStack = new int[stackSize]; userStackTop = 0; systemStackTop = 0; userStackBase = 0; code = new Instruction[codeSize]; globalMap = new Dictionary <string, Varible>(); stringMap = new List <string>(); locals = new Dictionary <string, List <string> >(); wantPause = false; flags = MachineFlags.MACHINE_FLAGS_NONE; breakpointList = new Dictionary <int, bool>(); functionTable = new SortedDictionary <int, string>(); inSystemFunction = null; lineCode = new int[maxLines]; executeEvent = new System.Threading.EventWaitHandle(false, System.Threading.EventResetMode.ManualReset); for (int i = 0; i < maxLines; ++i) { lineCode[i] = -1; } status = MachineStatus.MACHINE_STATUS_PAUSED; compileComplete = false; }
public static void PushStatusUpdate(MachineStatus statusUpdate) { GlobalHost.ConnectionManager.GetHubContext <StatusHub>() .Clients .Group(StatusHubService.MonitoringGroupName) .StatusUpdate(statusUpdate); }
private void CheckAnswer(bool autoTimer, string userAnswer) { timerHide.Stop(); timerCheckAnswer.Stop(); DateTime testEndDate = DateTime.Now; double time = (testEndDate - testStartDate).TotalSeconds; int?userAnswerInt = null; int tempInt = 0; if (int.TryParse(userAnswer, out tempInt)) { userAnswerInt = tempInt; } bool isAnswerRight = false; string answerText = string.Empty; string userAnswerText = string.Empty; this.generator.CheckAnswer(userAnswer, out isAnswerRight, out answerText, out userAnswerText); //currentSerie.Attempts.Add(new ExerciseAttempt(TrainType.Calculate, this.testStartDate, time, autoTimer, this.generator.QuestionText, this.generator.AnswerValue.ToString(), isAnswerRight, userAnswerText)); status = MachineStatus.Pause; OnTrainQuestionResult(new QuestionResultEventArgs(answerText, isAnswerRight, autoTimer)); }
private void btnBroadCastData_Click(object sender, EventArgs e) { try { if (this.cboLine.SelectedIndex < 0) { throw new Exception("No line name selected from list"); } if (this.cboMachine.SelectedIndex < 0) { throw new Exception("No machine selected from list"); } if (this.cboStatus.SelectedIndex < 0) { throw new Exception("No machine status selected from list"); } string lineName = this.cboLine.SelectedItem.ToString(); string machineName = this.cboMachine.SelectedItem.ToString(); MachineStatus status = (MachineStatus)this.cboStatus.SelectedItem; MachineStatusData data = new MachineStatusData(lineName, machineName, status); ALDSDataServer.GetInstance().DistributeData(data); this.lblSendStatus.Text = "Last Data sent OK"; } catch (Exception ex) { MessageBox.Show(ex.Message); this.lblSendStatus.Text = "No data sent"; } }
private void GenerateNewQuestion() { this.generator.CreateNewQuestion(); testCount++; timerHideAndNextQuestion.Stop(); timerCheckAnswer.Stop(); if (this.status == MachineStatus.NotStarted) { if (this.isAutoShowing) { testStartDate = DateTime.Now; } OnTrainStarted(new EventArgs()); } OnTrainQuestionNew(new EventArgs()); if (this.isAutoShowing) { status = MachineStatus.AutoShowing; } else { status = MachineStatus.ShowingQuestion; } timerHideAndNextQuestion.Start(); }
public NetworkController(MachineStatus initialStatus) { status = initialStatus; connection = new TcpClient("169.254.211.1", 23); ns = connection.GetStream(); updateMachineStatus(); }
public virtual void Stop() { testCount = 0; timerPause.Stop(); timerHideAndNextQuestion.Stop(); timerCheckAnswer.Stop(); if (status != MachineStatus.NotStarted) { if (status == MachineStatus.AutoShowing) { DateTime dateEnd = DateTime.Now; double time = (dateEnd - this.testStartDate).TotalSeconds; ExerciseAttempt newAttept = new ExerciseAttempt(TrainType.NumberGenerator, this.testStartDate, time, false, string.Empty, string.Empty, true, string.Empty); newAttept.DateEnd = dateEnd; newAttept.TestCount = testCount; currentSerie.Attempts.Add(newAttept); } status = MachineStatus.NotStarted; OnTrainStoped(new EventArgs()); } }
public void HandleMachineStatus(string machineName, MachineStatus machineStatus) { lock (_locker) { if (machineStatus == MachineStatus.manual) { //starts a handler if not exists if (!this._handlersList.ContainsKey(machineName)) { MachineStopHandler handler = new MachineStopHandler(machineName); handler.StartWatching(); handler.MachineStopped += new MachineStopped(handler_MachineStopped); this._handlersList.Add(machineName, handler); } } else if (machineStatus == MachineStatus.automatic) { //removes a hander if exists because machine resume operation if (this._handlersList.ContainsKey(machineName)) { MachineStopHandler handler = this._handlersList[machineName]; handler.StopWatching(); handler.MachineStopped -= handler_MachineStopped; handler.Dispose(); this._handlersList.Remove(machineName); if (MachineHasResumedOperation != null) { MachineHasResumedOperation(machineName); } } } } }
private void CheckAnswer(bool autoTimer, string userAnswer) { timerHide.Stop(); timerCheckAnswer.Stop(); DateTime testEndDate = DateTime.Now; double time = (testEndDate - testStartDate).TotalSeconds; bool isAnswerRight = false; string answerText = string.Empty; string userAnswerText = string.Empty; this.generator.CheckAnswer(userAnswer, out isAnswerRight, out answerText, out userAnswerText); currentSerie.Attempts.Add(new ExerciseAttempt(TrainType.Stepanov, this.testStartDate, time, autoTimer, this.generator.AnswerText, string.Empty, isAnswerRight, userAnswer)); if (isAnswerRight) { status = MachineStatus.Pause; timerPause.Start(); } else { status = MachineStatus.ShowingError; } OnTrainQuestionResult(new QuestionResultEventArgs(answerText, isAnswerRight, autoTimer)); }
private void GenerateNewQuestion() { if (this.WithMultiplication) { CheckMultiplicationConditions(); } this.generator.CreateNewQuestion(); timerHide.Stop(); timerCheckAnswer.Stop(); if (this.status == MachineStatus.NotStarted) { OnTrainStarted(new EventArgs()); } OnTrainQuestionNew(new EventArgs()); if (this.isHideQuestion) { status = MachineStatus.ShowingQuestion; timerHide.Start(); } else { testStartDate = DateTime.Now; StartWaitingAnswer(); } }
private async Task ProcessAssetEvents(MachineStatus machine, Guid projectUid, Guid customerUid, IHeaderDictionary headers) { AssetAggregateStatus statusEvent = null; if (machine.AssetUid.HasValue) { // CCSSCOON-85 it's not possible to match radio types in WM cws/ProfileX // var matchingAsset = await _deviceProxy.GetMatching3D2DAssets(new MatchingAssetsDisplayModel() {AssetUID3D = assetList.First().Key.ToString()}, headers); //Change that for the actual matched asset. Since we supplied 3d asset get data for the matching 2d asset. //if there is no 2d asset we should try using SNM asset var(details, summary) = await GetAssetData(machine.AssetUid.ToString(), headers); statusEvent = GenerateEvent(customerUid, projectUid, machine.AssetUid, machine, details, summary); } else { // Cant find some information, build a cut down event statusEvent = GenerateEvent(customerUid, projectUid, null, machine, null, null); } if (statusEvent != null) { await _assetStatusServerHubClient.UpdateAssetLocationsForClient(statusEvent); } }
private void PerformNextQuestion() { timerNextQuestion.Stop(); if (status == MachineStatus.NotStarted) { testCount = 0; testStartTime = DateTime.Now; OnTrainStarted(new EventArgs()); } this.generator.CreateNewQuestion(); testCount++; if (this.isAutoShowing) { status = MachineStatus.AutoShowing; timerNextQuestion.Start(); } else { status = MachineStatus.ShowingQuestion; } OnTrainQuestionNew(new EventArgs()); }
public static void PushStatusUpdate(IHubContext <StatusHub> hubContext, MachineStatus status) { hubContext .Clients .Group(StatusHubService.MonitoringGroupName) .SendAsync("StatusUpdate", status); }
private void executeThread() { int currentLine = CurrentLine; wantPause = false; try { status = MachineStatus.MACHINE_STATUS_RUNNING; executeEvent.Set(); executeInner(); status = MachineStatus.MACHINE_STATUS_FINISHED; } catch (BreakpointException) { status = MachineStatus.MACHINE_STATUS_PAUSED; int line = symbol_getLineByCode(pc); if (breakpointList.ContainsKey(line) && breakpointList[line] == false) { RemoveBreakpoint(line); } } catch (RuntimeException e) { status = MachineStatus.MACHINE_STATUS_DEAD; errorMessage = e.Description; } catch (Exception e) { status = MachineStatus.MACHINE_STATUS_DEAD; errorMessage = e.Message; } }
private void ExecuteThread() { while (!needPause) { int oldpc = pc; ExecuteLine(); if (pc == oldpc || pc == instructions.Count) { if (pc == instructions.Count) { pc = instructions.Count - 1; } status = MachineStatus.MACHINE_STATUS_FINISHED; needPause = false; break; } if (breakpoints.ContainsKey(pc)) { if (!breakpoints[pc]) { breakpoints.Remove(pc); } break; } } status = MachineStatus.MACHINE_STATUS_PAUSED; needPause = false; }
private void CheckAnswer(string userAnswer) { timerHide.Stop(); bool nextWord = this.showingRightAnswer; if (!nextWord) { if (this.generator.CurrentElement.TestType == NetTestType.Pattern) { this.generator.CheckAnswer(userAnswer, out nextWord); } else { nextWord = true; } } if (nextWord) { bool answerIsRight = !this.showingRightAnswer; DateTime testEndDate = DateTime.Now; double time = (testEndDate - testStartDate).TotalSeconds; string logQuestion = string.Empty; string logAnswer = string.Empty; if (this.generator.CurrentElement.TestType == NetTestType.Pattern) { logQuestion = this.generator.CurrentElement.Answer; logAnswer = this.generator.CurrentElement.Question; } else if (this.generator.CurrentElement.TestType == NetTestType.Number) { logQuestion = this.generator.CurrentElement.Question; logAnswer = this.generator.CurrentElement.Answer; } currentSerie.Attempts.Add(new ExerciseAttemptNetTrain(this.generator.CurrentElement.TestType, this.testStartDate, time, false, logQuestion, logAnswer, this.generator.CurrentElement.BaseUnit.NetName, answerIsRight, string.Empty)); status = MachineStatus.Pause; if (this.generator.CurrentElement.TestType == NetTestType.Pattern) { OnTrainShowRightAnswer(new EventArgs()); timerPause.Start(); } else { GenerateNewQuestion(); } } else { OnTrainShowErrorMessage(new EventArgs()); } }
public void TurnOff() { if (Status != MachineStatus.TurnedOff) { Status = MachineStatus.TurnedOff; Console.WriteLine("Recognizer machine turned off"); } }
public void TurnOn() { Status = MachineStatus.OnAndNotWorking; SoundFingerprintingWrapper.Initialize(); mScanner.Initialize(); Console.WriteLine("Recognizer machine turned on"); }
public void Execute() { status = MachineStatus.MACHINE_STATUS_RUNNING; System.Threading.Thread t = new System.Threading.Thread(ExecuteThread); //executeEvent.Reset(); t.Start(); //executeEvent.WaitOne(System.Threading.Timeout.Infinite); }
public Machine(int M_No, int M_type) { //构造函数,初始时设置机器为空闲 status = MachineStatus.Vergin; Machine_No = M_No; Machine_Type = M_type; Machine_Scale = 1; onholdParts = new ArrayList(); }
public void Stop() { if (this.status != MachineStatus.NotStarted) { this.status = MachineStatus.NotStarted; OnStopTest(new EventArgs()); } }
protected override async Task <MachineStatus> AcquireStatus(CancellationToken cancellationToken) { dynamic machineState = await _connector.Request(Machine, "api/printer", cancellation : cancellationToken); var status = new MachineStatus { MachineId = MachineId }; foreach (dynamic pair in machineState.temperature) { var heaterIndex = GetHeaterIndex(pair.Name); status.Temperatures.Add(heaterIndex, new TemperatureStatus { HeaterIndex = heaterIndex, Actual = pair.Value.actual, Target = pair.Value.target }); } var flags = machineState.state.flags; if ((bool)flags.operational) { if ((bool)flags.paused || (bool)flags.pausing) { status.State = MachineState.Paused; } else if ((bool)flags.printing || (bool)flags.resuming) { status.State = MachineState.Operational; } else { status.State = MachineState.Idle; } var jobStatus = await _connector.Request(Machine, "api/job", cancellation : cancellationToken); status.ElapsedJobTime = (int?)jobStatus["progress"]["printTime"] ?? 0; status.EstimatedTimeRemaining = (int?)jobStatus["progress"]["printTimeLeft"] ?? 0; status.Progress = (float)Math.Round(((float?)jobStatus["progress"]["completion"] ?? 0f), 1); // these values can't be retrieved through the octoprint api, or from marlin by gcode, so it's not going // to be supported by the Octoprint provider, however the values are being defaulted here to replicate the // Octoprint UI behavior upon refresh. status.FanSpeed = 100; status.FeedRate = 100; status.FlowRates = Machine.Tools .Where(tool => tool.ToolType == MachineToolType.Extruder) .ToDictionary(tool => tool.Index, tool => 100f); } else { status.State = MachineState.Idle; } return(status); }
public MainWindow() { //this.Hide(); InitializeComponent(); status = new MachineStatus(); // netController = new NetworkController(status); // show(); }
private void StartWaitingAnswer() { status = MachineStatus.WaitingAnswer; if (this.isAutoAnswer) { timerCheckAnswer.Start(); } }
public Machine(ProductBox prodcutBox, CoinBox rBox, CoinBox sBox, IMessenger messenger) { this._pBox = prodcutBox; this._rBox = rBox; this._sBox = sBox; this._msg = messenger; this._status = MachineStatus.Init; }
public void ShowRightAnswer() { if (CanWriteAnswer) { this.showingRightAnswer = true; this.status = MachineStatus.AutoShowing; OnTrainShowRightAnswer(new EventArgs()); } }
private void StartWaitingAnswer() { testStartDate = DateTime.Now; status = MachineStatus.WaitingAnswer; if (this.isAutoAnswer) { timerCheckAnswer.Start(); } }
public override void end(GCodeParser parser, MachineStatus machineStatus) { CoordinatOffsetManager.Instance().AddValue(listOffset); mcsData = NXToolsViewModel.Instance.McsData; SCM_CW.Remove(startIndex, endIndex - startIndex); SCM_CW.Insert(startIndex, "MSYS/" + mcsData.OffsetX.ToString("F6") + ";" + mcsData.OffsetY.ToString("F6") + ";" + mcsData.OffsetZ.ToString("F6") + ";" + mcsData.M11.ToString("F9") + ";" + mcsData.M12.ToString("F9") + ";" + mcsData.M13.ToString("F9") + ";" + mcsData.M21.ToString("F9") + ";" + mcsData.M22.ToString("F9") + ";" + mcsData.M23.ToString("F9")).Replace(',', '.'); }
private void PerformAutoCheckAnswer() { this.status = MachineStatus.AutoCheckingAnswer; AutoCheckEventArgs args = new AutoCheckEventArgs(); OnTrainAnswerAutoCheck(args); CheckAnswer(true, args.UserAnswer); }
public MachineStatusData(string lineName, string machineName, MachineStatus status) : base(MESSAGE_ID) { base.AttachDataAttribute(MachineStatusData.LINE_NAME, lineName); base.AttachDataAttribute(MachineStatusData.MACHINE_NAME, machineName); base.AttachDataAttribute(MachineStatusData.MACHINE_STATUS, status.ToString().ToUpper()); // this._lineName = lineName; this._machineName = machineName; this._status = status; }
public MachineStatus GetMachineStatus() { MachineStatus status = new MachineStatus(); Performance performance = new Performance(); status.CpuRating = performance.GetCurrentCpuUsage(); status.FreeMem = performance.GetAvailableRamSize(); status.TotalMem = performance.GetTotalMem(); status.MachineName = performance.GetMachineName(); return(status); }
public void DemolitionRepair (string characterType, bool isRepaired, bool isDestroyed) { if (characterType == "MadScientist" && isRepaired) { if (MachineCurrentStatus == MachineStatus.Destroyed){ MachineCurrentStatus = MachineStatus.Repaired; GetComponent<Renderer> ().material = repairedMachine; // after all MachineStatus MachineCurrentStatus = MachineStatus.Repaired; //Debug.Log ("character type: mad scientist / repair"); } } else if (characterType == "Nephew" && isDestroyed) { if (MachineCurrentStatus == MachineStatus.Repaired || MachineCurrentStatus == MachineStatus.Intact){ MachineCurrentStatus = MachineStatus.Destroyed; GetComponent<Renderer> ().material = destroyedMachine; // after all MachineStatus MachineCurrentStatus = MachineStatus.Destroyed; //Debug.Log ("character type: nephew / demolition"); } } }
public bool DoPurchase(Product product) { if (_pBox == null) throw new InvalidOperationException("_pBox"); bool purchased = false; MachineStatus oldStatus = _status; _status = MachineStatus.InTransaction; CoinBox changes = _rBox; try { if (product.Equals(_none)) throw new Exception(); int count = _pBox[product]; if (count < 0) throw new Exception("No such product is avaiable."); if (count == 0) throw new Exception("The product is out of sale."); int changesValue = _rBox.TotalValue - product.Price; if (changesValue < 0) throw new Exception("Not enough money."); changes = OnMakeChanges(changesValue); if (changes == null) { changes = _rBox; throw new Exception("Cannot return changes."); } DeliverProduct(product); purchased = true; } catch (Exception ex) { if (_msg != null) _msg.Show(ex.Message); } finally { ReturnChanges(changes); _status = oldStatus; } return purchased; }
private void OnMsg(string msg) { _host.WriteLogMessage("CncMachine", msg); try { var obj = JObject.Parse(msg); if (obj["sr"] != null) { var status = (MachineStatus)obj["sr"]["stat"].Value<int>(); _lkpos = _coordSystem.FromInner(new Coord( obj["sr"]["posx"].Value<double>(), obj["sr"]["posy"].Value<double>(), obj["sr"]["posz"].Value<double>(), obj["sr"]["posa"].Value<double>() )); if (status != _lastStatus) { _host.WriteLogMessage("CncMachine", $"Transitioned from {_lastStatus} to {status}."); if (IsIdleState(_lastStatus) && IsMovementState(status)) { _transitionToMovement.Set(); } else if (IsMovementState(_lastStatus) && IsIdleState(status)) { _transitionToIdle.Set(); } _lastStatus = status; } } else if (obj["er"] != null) { _host.WriteLogMessage(ComponentName, $"An unrecoverable error has occurred."); _error = true; } } catch { _host.WriteLogMessage("CncMachine", "Unable to parse log message."); } }
public string ConvertEnum(MachineStatus value) { return Enum.GetName(typeof (MachineStatus), value); }
private void MachineStatusList_ElementChanged(int index, MachineStatus machineStatus) { #region Async Call Management try { if (!IsHandleCreated || IsDisposed || Disposing) return; if (InvokeRequired) { this.BeginInvoke(dlgMslMachineStatusChanged, index, machineStatus); return; } } catch { return; } #endregion if (rmsList.ContainsKey(machineStatus.IPAddress)) { MachineStatusControl msc = rmsList[machineStatus.IPAddress]; msc.MachineStatus = machineStatus; } }
private void MachineStatusList_MachineStatusAdded(MachineStatus machineStatus) { #region Async Call Management try { if (!IsHandleCreated || IsDisposed || Disposing) return; if (InvokeRequired) { this.BeginInvoke(dlgMslMachineStatusAdded, machineStatus); return; } } catch { return; } #endregion if (!rmsList.ContainsKey(machineStatus.IPAddress)) { MachineStatusControl msc = new MachineStatusControl(machineStatus); rmsList.Add(machineStatus.IPAddress, msc); if (!flpRemoteMachineStatus.Contains(msc)) flpRemoteMachineStatus.Controls.Add(msc); } }
public void RestartMachine(){ MachineCurrentStatus = MachineStatus.Intact; }
private static bool IsIdleState(MachineStatus status) { return status == MachineStatus.Stop || status == MachineStatus.Ready; }
private static bool IsMovementState(MachineStatus status) { return status == MachineStatus.Homing || status == MachineStatus.Run || status == MachineStatus.Probe || // When jogging and pausing the jog the machine sits here while // decelerating. status == MachineStatus.Hold; }
public virtual void Start(/*Service*/) { display.Show("Автомат начал работу."); status = MachineStatus.Waiting; }
public virtual void Shutdown(/*Service*/) { display.Show("Автомат отключается..."); Cancel(); status = MachineStatus.Shutdown; }
void Start () { MachineCurrentStatus = MachineStatus.Intact; GetComponent<Renderer> ().material = intactMachine; }
public void Start() { if (_pBox == null || _pBox.IsEmpty) { this._status = MachineStatus.OutOfOrder; if (_msg != null) _msg.Show("Mahince is out of order."); return; } if (_sBox == null || _sBox.IsEmpty) { this._status = MachineStatus.OutOfOrder; if (_msg != null) _msg.Show("Mahince is out of order."); return; } if (_rBox == null) _rBox = new CoinBox(ReceiveCoinBox); _rBox.Clear(); if (_msg != null) _msg.Show("Mahince has started."); this._status = MachineStatus.Running; if (_msg != null) _msg.Show("Mahince is running."); }
public void Shutdown() { if (_status != MachineStatus.Running) { _msg.Show("Cannot shutdown."); return; } _status = MachineStatus.Shutdown; _msg.Show("Shutdown completed."); }