How to get up and running with Inxton in six simple steps?

Step 1: Check the prerequisites

Make sure you have installed the tools and programs below. If you do not have any of these installed yet; please follow the order of installation as listed.

  1. Visual Studio 2017 (at least the Community Edition) v15.9.12+
  2. TwinCAT 3.1 eXtended Automation Engineering (XAE) TwinCAT 3.1 4024.4+
  3. .NET Framework 4.8 Developer Pack
  4. Inxton Vortex Builder Extension

Step 2: Clone the repository

Clone the template.core repository from GitHub.

git clone https://github.com/Inxton/template.core

Alternatively, you can also download the .zip file.

Step 3: Prepare NuGet packages

Open the template.sln located in the repository you have just cloned onto your computer.

Once opened, you will see an XAE project that contains a Plc project. and a .NET Twin project called PlcConnector. These two projects constitute the starting point for all subsequent examples.

Restore packages

Open NuGet — manage the solution and restore any missing packages.

text

Update packages

In case you have any problems with NuGet: Open the Package Manager Console and type: Update-Package -Reinstall.

Step 4: Activate the configuration

To activate your configuration, download the PLC to your target system, and run it as any other TwinCAT 3 project. You will need to set the target system to the target you have available (e.g. local).

Follow the instructions from Beckhoff - Activating a TwinCAT 3 project.

Step 5: Copy the license file

To run your Inxton application you need to have a valid license. The preview license file is provided completely free of charge.

The installation is simple, just follow these steps:

  1. Download the license from inxton.com.
  2. Do not forget to save the license as a .xml file.
  3. Copy/Move the license to the C:\Inxton\License.xml folder.

Note: the preview license is valid until 1st September, 2020 — but please do not worry, you will be absolutely fine, as the full release is coming out in July 2020.

Step 6: Connect the app to your PLC

Let's start a simple PLC project — a counter.

PROGRAM prgSimple
VAR
    _counter : ULINT;
    _counterActive : BOOL;
END_VAR

Run the program in the PLC main loop.

PROGRAM MAIN
---
prgSimple();

You will need to set up an AMS ID and port (if changed for some reason). Open the file ../HansPlcConnector/Entry.cs.

#define LOCAL // Comment if your target is remote.

using Vortex.Adapters.Connector.Tc3.Adapter;

namespace HansPlc
{
    public static class Entry
    {
#if LOCAL
        const string AmsId = null; // your ams id or set to 'null' if local
        const int Port = 851;
#else
        const string AmsId = "172.20.10.102.1.1"; // set your target ams id
        const int Port = 851;
#endif
        public static HansPlcTwinController HansPlc { get; } = new HansPlcTwinController(Tc3ConnectorAdapter.Create(AmsId, Port));
    }
}

Let's establish a connection between the PLC and your .NET app.

var hans = HansPlc.Entry.HansPlc;
hans.Connector.BuildAndStart();

Access to the PLC variables from C# is very simple thanks to TwinObject and IntelliSense.

Write to the PLC variable from C#.

var simple = hans.prgSimple; // this is how you access the program
simple._counterActive.Synchron = true;
simple._counter.Cyclic = 132;

Read the PLC variable using C#.

var currentCount = simple._counter.Synchron;
if(currentCount > 133)
{
    Console.WriteLine($"Current count is way too high! it's {currentCount}");
}

Note: Each property provides access to a variable via Synchron and Cyclic.

We hope our little guide helped you to get everything up and running. We are here to help you if you have any comments, questions, or problems.

Tags: Inxton Explained

Ladislav Šroba
Marketing Assistant

Ladislav Šroba