如何使用启用了 Hyper-V 的本地 TwinCat 3 运行时?

发布于 2025-01-11 05:30:35 字数 135 浏览 0 评论 0原文

我正在尝试在需要打开 hyper-V 的 PC 中运行 TwinCat 3 XAR 才能运行 Azure IoT Edge(使用 hyper-V)。有没有办法在打开 hyper-V 的情况下运行 XAR?有没有办法将核心与 hyper-v 或其他东西隔离?

I'm trying to run TwinCat 3 XAR in a PC where I need to have hyper-V ON to run Azure IoT Edge (which uses hyper-V). Is there a way to run XAR with hyper-V turned on? Is there any way to isolate the cores from hyper-v or something else?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

戏剧牡丹亭 2025-01-18 05:30:35

编辑于 2022 年 4 月 22 日

有关此内容的完整教程,请参阅 我的博客发布

有一种方法可以实现这一点。您可以通过在虚拟机中的运行时上运行代码来实现此目的,而不是使用本地运行时。我从这篇 Reddit 帖子中得到了这个想法。

为了使其正常工作,我执行了以下操作:

  1. 下载并安装VMware Player。非商业用途免费。您还可以使用付费专业版(工作站)。我不确定这是否也适用于 Virtual Box。

  2. 按照 Jakob 这段出色的 YouTube 视频中的说明,在虚拟机上安装 TwinCAT BSD< /a>


  3. 如果您使用 VMware Player 并且需要启用 UEFI,则需要按照 YouTube 用户 Eivind Hilde 的说明执行以下操作:

    <块引用>

    1. 按照视频中的指南进行操作,但跳过设置固件类型的步骤。
    2. 尝试启动虚拟机。它会失败。
    3. 使用记事本打开VM目录中的.vmx文件。
    4. 找到“firmware = “bios”并替换为“firmware ="efi””并保存。如果此行不存在,只需将其添加到某处即可。
    5. 它现在将启动,您可以按照视频中的指南进行其余操作。

  4. 在虚拟机上运行您的 TwinCAT 项目,无需禁用 Hyper-V

Edit 22 April 2022

For a complete tutorial on this see my blog post.

There is a way to accomplish this. You can do this by instead of having a local runtime, you can run the code on a runtime in a virtual machine. I got the idea from this reddit post.

To make it work I did the following:

  1. Download and install VMware Player. Its free for non-commercial use. You can also use the paid Pro (Workstation) version. I'm not sure if this also works with Virtual Box.

  2. Install TwinCAT BSD on the virtual machine as described in this excellent YouTube video by Jakob

  3. If you're using VMware Player and need to enable UEFI you need to do the following as noted by YouTube user Eivind Hilde:

    1. Follow the guide in the video, but skip the step where the firmware type is set.
    2. Try to boot the VM. it will fail.
    3. Open the .vmx file in the VM directory with notepad .
    4. Find "firmware = "bios" and replace with "firmware ="efi"" and save. If this line doesn't exist, just add it somewhere.
    5. It will now boot, and you can follow the guide in the video for the rest.
  4. Run your TwinCAT project on the virtual machine, without the need to disable Hyper-V. ????

Previous answer

I don't think so. InfoSys mentions:

Hyper-V environment:

  • The runtime environment cannot be started inside a Hyper-V environment. This refers in particular to virtual Hyper-V machines, which are run in a privileged Hyper-V machine. As soon as a component of the computer uses Hyper-V, only the engineering environment (XAE) can be used on this computer, not the runtime environment (XAR).

But they also mention that:

  • TwinCAT attempts to detect these Hyper-V environments; however, it is in the nature of virtualization approaches that they do not wish to be detected and TwinCAT therefore cannot carry out any 100% detection.

So maybe there is some way you can prevent TwinCAT from detecting a Hyper-V environment. However, that is something I can't answer.

大姐,你呐 2025-01-18 05:30:35

您应考虑在主机上运行 TwinCAT,并在虚拟机上运行 UI 和其他与机器相关的工具。为此,Beckhoff 使用了 TCBSD,它基本上是 FreeBSD,并安装了经过调整的调度程序和 TwinCAT 3 XAR。
请注意,TwinCAT 3 依赖于 Intel vt-d,虚拟机正在使用该资源,并且不使用 Vt-d 模拟处理器,因此主机操作系统上甚至客户操作系统上都不能存在第二个应用程序来使用硬件辅助虚拟化。

you shall consider running the TwinCAT on the host and UI with other machine related tools on Virtual Machine. for this Beckhoff has TCBSD which basically FreeBSD with tweaked scheduler and TwinCAT 3 XAR installed.
Note that TwinCAT 3 relies on Intel vt-d, and virtual machines are using that resource, and do not emulate processor with Vt-d thus no 2nd application can exist on the host OS or even more on guest OS to use hardware assisted virtualization.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文