Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

1. OPC UA Setup.

start with the setup described in

Getting started: IoT LFW V2.2 example for netX 90 APP

2. Change OPC UA object

Create OPC UA Hello World Variable in the Actuator object

open the communication studio project

netXStudio_PNSV5_NetProxy_simple_V3.0.0.0\Components\cifXApplicationDemoNpx\OPCUA_CONFIG_PORT2\CommunicationStudioProject\NetProxy_simple\NetProxy_simple

and go to the object "Actuator"

Image Added

click on "add new Node" and create in the "Actuator" object a new variable with the name "HelloWorld"

Image Added

Now change the Data Type to "int16" with click on the green configuration symbol.

Image Added

after choose of "int16" click on apply

Image AddedImage Added

4. Change netProxy object

Go to netProxy Object definition of the Actuator and click on Add

Image Added

change the name to Hello World and data type int16

Image Added

and click on Apply

Image Added

5. Connect OPC UA with netProxy

Go to the mapping to connect netProxy with the OPC UA object

Image Added

navigate to the HelloWorld variable and choose it and after ok do not forget to click apply.

Image Added

If everthing is ok, it looks now like this

Image Added

Export now this configuration for the OPC UA server

Image Added

CONFIG.NXD

OPC_INIT.TLV

Download these configuration files to the netX90 like in the getting started guide described.

6. UA Expert

Give the PC an IP address like 192.168.0.40. Set with Ethernet Device Configuration Tool the IP 192.168.0.50 at the device.

Image Added

Start UAexpert project and configurate the device IP address in this project.

netXStudio_PNSV5_NetProxy_simple_V3.0.0.0\Components\cifXApplicationDemoNpx\OPCUA_CONFIG_PORT2\UAexpertProject\NetProxy_simple_UAexpert_config.uap

Image Added

UAexpert is the OPC UA client and connect it to the OPC UA Server on the netX90.

Image Added


move variable with drag and drop in the data access view window

Image Added

7. Application Source Code Changes

Change in the file NpxUserObjects.h the structure of the Actuartor and add the HelloWorld

Code Block
languagecpp
typedef struct ACTUATOR_Ttag
{
    uint8_t bMode;     /*!< Mode[uint8] */
    uint8_t bState;    /*!< State[uint8] */
    int16_t iValue;    /*!< Value[int16] */
    int16_t iHelloWorld;    /*!< Value[int16] */
} ACTUATOR_T;

Change the file AppNpx_TerminaHandler.c and add HelloWorld handling.

Code Block
languagecpp
case APP_TERMINAL_HANDLER_COMMAND_OPC_WRITE:
    {
      ACTUATOR_T tActuatorObj;
      tActuatorObj.bMode=0x55;
      tActuatorObj.bState=0xAA;
      tActuatorObj.iValue=0x1234;
      tActuatorObj.iHelloWorld=4321;
	...
	}

7. Terminal

Connect with a tool like hterm to the uart of the netX90. With "help" the possible list of commands will be returned.

Image Added

choose "opcwr" will activate the function APP_TERMINAL_HANDLER_COMMAND_OPC_WRITE. This means, that the netX90 application will write the netPROXY objects. The netPROXY objects are connected with the OPC UA objects. The UA expert read cyclic the OPC UA object. Here the change can be seen:

Image Added

8. No Uart RS232 Modul

If no RS232 modul is available:

download the OPC UA Server configuration files to the netX90

Change the taglist of the firmware:

Image Added

change the hwc

Image Added

download the new hwc and the changed firmware to the netX90. 

Now the terminal is mapped to the ftdi uart (usb of NXHX90 board), but it is no longer possible to reach the marshaller.

For a new OPC UA configuration it is neccessary to change back these settings.