TwinCAT in user space

If you want to write TwinCAT 3 software and run it, it’s not obvious how to get TwinCAT 3 to run on your desktop machine, be it directly on the machine or inside a virtual machine. The primary reason for this is because TwinCAT 3 is running in something called kernel space. While I was bored recently on a late afternoon, I discovered that Beckhoff had quietly added some files in the TwinCAT 3 folder in one of the newer releases of TwinCAT 3, that might change all of this.

How you may wonder? Let’s find out!

  • Share on:

12 Comments, RSS

  1. Kowalevskaja

    I hope you are bored again any time soon 😉 Many thanks, Jacob, you shared this information with us! This is great news going on.
    I guess Beckhoff needs this feature for themselves too for their Cloud-Engineering plattform*, which (I hope for them) is based on instances of virtual machines.

    *https://www.beckhoff.com/en-us/products/automation/cloud-engineering/

  2. David

    Thanks so much for finding and sharing this.
    Beckhoff announced this feature last summer for 4026 and we have been waiting for it since then.
    Trying it myself the runtime crashed when I ran my program. I could trace the issue back to FB_S_UPS_CX51x0. Calling an instance of that function block, seems to do something the user mode runtime can’t handle. After skipping the call, everything works smothly so far.

    Another funny thing is, that the Runtime seems to pretend to be running on a BSD system, when reading the system details.

    Keep up the good work!

  3. Bruno

    Thank you for discovering this nice feature.

    I tried this out and for a small example it’s working fine. But when trying to run a more realistic project, the XAE stated that ther is not enough memory on device.

    Did you or anyone else already find out how the available memory could be increased?
    The physical amount of memory should not be the problem on my Notebook.

    • Hi! You need to adjust the amount of router memory available for TwinCAT. I don’t have my computer with TwinCAT/BSD available now, but I think it’s possible to configure the amount of router memory via an XML file in the folder for the UM-TwinCAT.

      • sem

        I asked Beckhoff support about this problem and found a solution:

        You need to add a “registry” value in the file “C:\TwinCAT\3.1\Runtimes\\3.1\TcRegistry.xml”.

        In “HKLM/Software/Beckhoff/TwinCAT3/System/” you need to add
        1400

        The value is in Hexadecimal format, with this setting 1400 you reserve more than 1GB.

        Increasing the Router Memory is counter productive, since it takes away memory from the heap.

        • sem

          @Jakob: In my previous Post are the xml tags missing. Looks like sharp brackets and the text within are not supported in comments.

          Can you restore them?

          • Julian

            Hey Sem,
            could you repost the XML tags, maybe using a placeholder for the sharp brackets? Thanks in advance.

        • bp

          Could you please repost at least the name of the registry variable under the System key, which configures the amount of memory?

      • JulSchsl

        I have the same issue, and according to Beckhoff’s support, this error message is not related to the router memory, but to the data segment (.data) of the binary. It will be fixed with the release of build 4026.

  4. James Davis

    Interesting. I wonder if this will allow cyclic communication between user space and real time. I miss the R3IO api in Tc2 that allowed for cyclically updating task image data to synchronize with soft-real-time user program.

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.