简体   繁体   English

机器实时处理

[英]Real-time processing with machines

I will be writing an interface in C++ that controls a large CNC machine and it will run on Windows. 我将用C ++编写一个控制大型CNC机器的界面,该界面将在Windows上运行。 For safety reasons, I would like this process to run on it's own core so that it can run the process in real-time. 出于安全原因,我希望此过程在其自身的核心上运行,以便它可以实时运行该过程。 If it shares a core with Windows, all of the Windows processes will be dealt with before my process is. 如果它与Windows共享一个核心,则所有Windows进程都将在我的进程之前处理。 Basically, how do I make sure either my process is always in the front of the processing queue, or how do I designate a core to run my process and leave the other core to handle Windows? 基本上,我如何确保我的进程始终处于处理队列的最前面,或者如何指定一个内核来运行我的进程,而让另一个内核来处理Windows? Also, is there any way of seeing that my programming is run in real-time. 另外,有没有办法看到我的程序是实时运行的。 AKA, this core is processing this program, but that core is not doing anything because we told out program not to run on it. AKA,此核心正在处理该程序,但该核心未执行任何操作,因为我们告诉程序不要在其上运行。 Any input would be helpful. 任何输入都会有所帮助。

There is no guarantee your process will be dealt with in real time. 不能保证您的过程将得到实时处理。 Windows does not do that. Windows不会这样做。 Since you mention safety, I will mention that if a lawsuit occurred you would be in deep trouble. 既然您提到安全,我要提到的是,如果发生诉讼,您将陷入严重麻烦。 Expert witnesses would testify that the design is inherently unsafe. 专家证人将证明该设计本质上是不安全的。

User control and display can be done in Windows but real time operations belong in dedicated hardware such as a PLC. 用户控制和显示可以在Windows中完成,但实时操作属于专用硬件,例如PLC。

You can use SetThreadAffinityMask to restrict a thread to running on some subset of available processors/cores. 您可以使用SetThreadAffinityMask来限制线程在可用处理器/内核的某些子集上运行。

If you use SetThreadPriority and SetProcessPriorityClass to set a thread to real time priority, only other threads running at real time priority can interrupt it, effectively forcing other threads to run on other cores (unless you raise two or more threads to real time priority. 如果使用SetThreadPrioritySetProcessPriorityClass将线程设置为实时优先级,则只有以实时优先级运行的其他线程才能中断该线程,从而有效地迫使其他线程在其他内核上运行(除非您将两个或多个线程提升为实时优先级。

As an alternative, Windows Embedded Compact is a realtime priority-based OS that can make soft realtime guarantees (far better than Windows Vista/7). 作为替代方案, Windows Embedded Compact是基于实时优先级的操作系统,可以提供软实时保证(远胜于Windows Vista / 7)。 It's costly, but on par with other commercial RTOSes. 它的成本很高,但与其他商用RTOS相当。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM