Nuget Package Management
A. How to use existing Microsoft Nuget packages
B. How to create my own Nuget package for the TwinCAT HMI project
Will be updated SOON…..
For non development environment
For development environment
We must install the license for the server. Beckhoff allows every 7 days a free development license, so for test and development purposes, we can use it conveniently. For the actual product, we must buy the license from them. But how to activate the 7 days free license in the server? We shall describe these steps here. One easy way to create a small Beckfoff PLC project and activate the necessary license for 7 days. We can create the project on the server or our client computer and push it to the server. In the visual studio project, under license, we can select “Manage License” tab and select all the features we need. After this, we activate the 7 days trial license.
=> Install the HMI Server to the remote computer.
=>Make the HMI Server auto startable by following steps
=> Click Start→All Programs
=> Right-click the Startup folder and click Open. (C:\Users\mylogin_name\AppData\Roaming\Microsoft\Windows\StartMenu\Progras\Startup)
=> Right-click Start and choose Open Windows Explorer.
=> Locate the program (TF2000-HMI-Server) we want to start when we start Windows, then drag it into the startup folder
=> Click the Close button in the upper-right corner of both Explorer windows to close them.
=> Type ‘run’ in the search box, it will pop a dialog where you can insert what to open or run
=> Type shell:startup, this will pop up or open a startup folder
=> Now you can drag and drop the TF2000-HMI-Server short cut
Now every time when the server computer starts then the Beckhoff HMI/SCADA server starts. If the HMI server does not run in the remote server, we can’t push or upload our project there.
Another way to make the server restarting is to use the server register as a service (C:\TwinCAT\Functions\TF2000-HMI-Server\register_service), execute this command as admin in the command line.
For a development environment we can use the following server found in the following folder:
This server is started when we lunch an HMI from visual studio. Following image shows the startup folder:
Viewing and inspecting the HMI project or User interface while we are developing it.
When we are developing then we need to view the UI frequently for checking how it looks and feels. If we press on the live view as shown in the following image.
When we are happy with step 2 then we can check our HMI by publishing it to local server. Whenever we have installed the TwinCAT 3 Engineering then by default a local server is lunched when we lunch the application. We can test all most all our functionalities by using development HMI server as shown in the following image. We need to configure the debugger to Google chrome.
Application running, lunched with Visual Studio
This is final step about publishing the contents to server. If we want to publish our application to local machine (IP: 127.0.0.1) or a remote machine 192.x.x.x/10.x.x.x in either case we must have a running server there. To run the server, put a shortcut of the server to the startup folder or run the batch file from command line.
=> Now the HMI server will be up and running and we can publish the contents to the server
=> Select TWINCAT HMI Menu in Visual Studio | Publish to TwinCAT HMI Server, we see the following dialog. Press next.
This step is very important. We need to put the Server IP address and the port. We need to make sure that the used port is free. We might need to change some TCP/IP related settings for the port as shown in the following image. If we are publishing for the first time then it will ask for the password. This password will be asked when the client wants to connect to the server. The connection can be tested by pressing on validate Connection. If the connection is OK then we can finish by pressing on publish button.
If we want to publish the HMI to local machine, then we use the server address 127.0.0.1
If we want to publish to remote machine (it must have a HMI server running) then we use the IP address (x.x.x.x) of the server
Now we are ready to connect the HMI server to use our HMI. Point to the address https://xx.xx.xx.xx:1020 in Chrome. It will show a login page. We just insert the password and we are in.
Finally we have the HMI running.
We can log in to the localhost and access the config page of the HMI. To do this, we click on the server icon (bottom right corner of the server computer) and then we access the config page. We can do lots of useful configuration there. One of the configurations is how to avoid login names as shown in the following diagram.
If we are not using SSL then we remove the check from the check box.
Tips 00 : Page has been published but variables are not read by the HMI Server
The HMI has been published to the server and all looks fine. But my HMI does not read the variables or does not make any decision based on the PLC data. Here we can have 2 problems and it’s solution.
=> Add the route to the server as described in the page https://www.hemelix.com/automation/structured-text/
=> Enable ADS in the HMI Server as shown in the following image.
=> Login as administrator account
Configure the AmsNetId in the server setting and accept the settings.
As we see in the following screenshot that ADS version and Device name are missing. This will not work as I see the AMS Net Id is wrong.
Actual AMS Net Id should be used 192.168.12.56 and press accept. After that we see that ADS version and name has been updated. Learn more about AMS Net Id at https://www.hemelix.com/automation/structured-text-how-to-change-ams-net-id/
We can add an IP address directly to the Webserver settings page as shown in the following screenshot.
After this our HMI should be able to work properly
01: Make sure that the server in the target computer is running
02: If you are using 7 days license then make sure it is valid
03: Make sure you can ping the server
04: If you are publishing sometimes the visual studio may not show the progress of publishing, in that case, if you press again (assuming it has not started) then the publishing will not work. Be patient and try again.
05: When publishing HMI with extension project then all the dependency DLL will publish to the HMI server without any extra efforts.
06: Starting the HMI Server, we can start the HMI server by putting a short cut of HMIServer.exe to this folder: C:\Users\USER_NAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup, the problem with this is if we login to the server it will have the effect of restarting the server again. To avoid this, run the bat file as admin C:\TwinCAT\Functions\TF2000-HMI-Server\register_service.bat. This will create a windows service that will start when windows start.
07: HMI-Server and HMI Engineering server is different, if we use the service registration batch file then we have to careful as there are 64 bit and 32-bit versions. I noticed at least a 32-bit version worked for me.
08: Check that Windows FireWall is OFF, if you want to keep it ON then you have to open a certain port.
09: We must have all the necessary license especially if we want to publish an extension module
We may see the following error code when we have issue with license:
Error User Extension "ServerExtensionCSharp1" is not licensed.
A licence for "TF2200 | TC3 HMI Extension SDK" is required on the remote system to execute user extensions. TcHmiProject1 C:\TwinCAT\Functions\TE2000-HMI-Engineering\MSBuild\Beckhoff.TwinCAT.HMI.targets 42
We need the above license if we want to run and publish to a remote server (for example to a CX device where we want to run HMI and our PLC program etc). We need to activate the license by using VS and the PLC program. Once the PLC program is running with the required license then we can publish the contents to the server as usual way.
10: When we publish content to a remote server especially with an extension, we may see INVALID_SYMBOL or similar error, somehow the TwinCAT server becomes messy, one solution helps if we just restart the HMI server in the remote machine.
11: If there are problems to publish the contents, we can delete the profile and make a new one. That may help to publish when there are confusing cases.
12: It looks like we can’t put 2 PLC addresses in the interface, if there are extra then the unused one can be removed.
13: We can see the following note when we try to publish, we can delete the profile, add route and check if we have duplicate AMS net ID.