Learn how to connect ThingWorx Kepware Server to Foundation.
This guide will teach you how to create a backend Data Model in ThingWorx Foundation that works with ThingWorx Kepware Server to collect data from an Allen-Bradley PLC and send it to ThingWorx Foundation.
![system_diagram-kepserver--640-480.png system_diagram-kepserver--640-480.png](https://community.ptc.com/t5/image/serverpage/image-id/70442iE85FE9F53F6EC3C2/image-size/large?v=v2&px=999)
You'll learn how to
- Create a Data Model in ThingWorx Foundation that accepts information from ThingWorx Kepware Server
NOTE: The estimated time to complete this guide is 30 minutes
Step 1: Learning Path Overview
Assuming you are using this guide as part of the Rockwell Automation Learning Path, then you have now completed each of the following installations:
- Connected Components Workbench
- ThingWorx Kepware Server
- ThingWorx Foundation (for Windows)
You’ve also connected an Allen-Bradley PLC to Connected Components Workbench and then to ThingWorx Kepware Server.
In this guide, we’ll propagate that information further from ThingWorx Kepware Server into ThingWorx Foundation.
Step 2: Create Gateway
To make a connection between ThingWorx Kepware Server and Foundation Server, you must first create a Thing.
WARNING: To avoid a timeout error, create a Thing in ThingWorx Foundation BEFORE attempting to make the connection in ThingWorx Kepware Server.
- In ThingWorx Composer, click Browse.
- On the left, click MODELING -> Things.
- Click + NEW.
- In the Name field, enter IndConn_Server, including matching capitalization.
- In the Description field, enter an appropriate description, such as Industrial Gateway Thing to connect to ThingWorx Kepware Server.
- If Project is not already set, click the + in the Project text box and select the PTCDefaultProject.
- In the Base Thing Template field, enter indus, then select the IndustrialGateway Thing template from the sorted list.
- Click Save.
Step 3: Connect to Foundation
Now that you’ve created an Industrial Gateway Thing and an Application Key, you can configure ThingWorx Kepware Server to connect to ThingWorx Foundation.
- Return to the ThingWorx Kepware Server Windows application.
- Right-click Project.
- Select Properties.
- In the Property Editor pop-up, click ThingWorx.
- In the Enable field, select Yes from the drop-down.
- In the Host field, enter the IP address of your ThingWorx Foundation server.
- Enter the Port number. If you are using the “hosted” Developer Portal trial, enter 443.
- In the Application Key field, copy and paste the Application Key you just created.
- In the Trust self-signed certificates field, select Yes from the drop-down.
- In the Trust all certificates field, select Yes from the drop-down.
- In the Disable encryption field, select No from the drop-down if you are using a secure port. Select Yes if you are using an http port.
- Type IndConn_Server in the Thing Name field, including matching capitalization.
- If you are connecting with a remote instance of ThingWorx Foundation and you expect any breaks or latency in your connection, enable Store and Forward.
- Click Apply in the pop-up.
- Click Ok.
In the ThingWorx Kepware Server Event window at the bottom, you should see a message indicating Connected to ThingWorx.
NOTE: If you do not see the “Connected” message, repeat the steps above, ensuring that all information is correct. In particular, check the Host, Port, and Thing name fields for errors.
Step 4: Bind Industrial Tag
Now that you’ve established a connection, you can use ThingWorx Foundation to inspect all available information in ThingWorx Kepware Server.
This step will create a new Thing in ThingWorx Foundation representing two output coils of the PLC.
Create Thing for PLC coils
- In ThingWorx Foundation Composer, on the left, click MODELING -> Industrial Connections, then click IndConn_Server.
- At the top, click Discover.
- Expand Channel2, then click myPLC.
- Select check-boxes next to Coil2 and Coil3, then click Bind to New Entity.
- Scroll to select RemoteThing, then click OK.
- Enter the name PLCcoils,
- If Project is not already set, click the + in the Project text box and select the PTCDefaultProject.
- then click Save.
Test ThingWorx Foundation to PLC Communication
- Click the Properties and Alerts tab.
- Confirm that the isConnected Property has a check in the Value field, indicating a good connection between ThingWorx Kepware Server and the PLC.
- Click the pencil icon in the Coil3 line to open the edit panel, click the True radio button, then click the save checkmark button.
- You should here a soft click from the PLC and the Output 3 indicator will illuminate.
- ThingWorx Foundation is now controlling the PLC through its connection to ThingWorx Kepware Server.
Step 5: Troubleshooting
If the connection to the PLC stops working and there is a Thumbs Down icon next to your properties, the ThingWorx Kepware Server trial edition drivers are not connected to your PLC.
- The trial edition stops running after 2 hours and must be stopped and restarted.
- Right-click on ThingWorx Kepware Server icon in system tray.
- Click Stop Runtime service.
- Wait a minute for the process to stop, then click Start Runtime service.
- If Connected Components Workbench does not connect to PLC, check the IP address of the PLC using RS Linx Classic software that was installed as part of Connected Components Workbench.
- RS Linx Classic is located Start > All Programs > Rockwell Software > RSLinx > RSLinx Classic
- Click AB_ETHIP-1, Ethernet and IP addresses of connected PLCs will be discovered
NOTE: A changed PLC IP Address (typically seen through Connected Components Workbench) will require an IP Address change in ThingWorx Kepware Server settings.
Step 6: Next Steps
Congratulations! You've successfully completed the Model an Allen-Bradley PLC guide.
You've learned how to:
- Create a data model that can accept information from ThingWorx Kepware Server
- Connect ThingWorx Kepware Server to Foundation