120 likes | 328 Views
Configuring and Running the OPC .NET Generic Clients. Generic Client Software. Client Interface. Server Interface. Standard code for OPC Wrappers. Generic Client. Client Base. OPC COM Server. Server Base. OPC Wrapper. WCF. Class API. Class API Client. Alternate Server
E N D
Generic Client Software Client Interface Server Interface Standard code for OPC Wrappers Generic Client Client Base OPC COM Server Server Base OPC Wrapper WCF Class API Class API Client Alternate Server Implementation Adhoc Client Ad- hoc API Standard code for the server Developer-specific code Extended Client Interfaces Standard code for the client
Generic Client Applications • Xi Client GenericApp • Wraps only one server of each type • Wrapped OPC Classic servers can be local or remote to the Wrapper • Multiple Wrappers can exist on the same PC at the same time • Wrappers are located by their URL
Wrapper Server Projects • Expand the projects: • GenericApp AdhocApi • GenericApp ClassApi • GenericApp
Client App.Config Files Open the App.Config files (they are identical):
Set the Url of the Default Server <appSettings> <!--TODO: Use this key to set the URL of the default Xi Server.--> <addkey="XiServerUrl“ value="http://localhost:60080/XiServices/serverDiscovery"/> • This key is used to identify the default OPC .NET server for the client application: • GenericApp – this URL will be the first URL in the list of URLs • GenericApp AdhocApi and ClassApi – these client applications will automatically attempt to connect to the default server
Set the Server Info <appSettings> <!—Set the name of your company and the name of your server--> <addkey="Vendor" value="My Company Name"/> <addkey="Server" value="My Server Name"/> <!—Add site specific info (e.g. location of the server). This info is used only for display purposes--> <addkey="UserInfo" value="Deployment Specific Info"/>
Set the System Name <appSettings> … <!--If the server provides access to a single system only, add this key and the name of the system. Otherwise, comment out this entry. The system is the underlying system to which the native Xi server or the wrapped OPC COM server provides access. The system name is used by clients to differentiate Xi InstanceIds obtained from multiple Xi Servers. The system name will be embedded in the InstanceIds of this server.--> <addkey="System" value="This System Name"/>
Set the ProgIds of the wrapped OPC Classic servers <appSettings> … <!--The following keys contain the ProgIds for the wrapped servers--> <addkey="OPCDA" value="OPC DA ProgId"/> <addkey="OPCAE" value="OPC AE ProgId"/> <addkey="OPCHDA" value="OPC HDA ProgId"/>
Set the MachineName of the wrapped OPC Classic servers <appSettings> … <!--The following keys contain the Machine Names/IP Addresses for the wrapped servers. Leave them commented out if they are on the same machine as the Wrapper--> <!--<add key="OPCDAHOST" value =“MachineName"/>--> <!--<add key="OPCAEHOST" value =“MachineName"/>--> <!--<add key="OPCHDAHOST" value =" MachineName "/>-->
Set the Base Addresses <system.serviceModel> … <host> <baseAddresses> <!--Change the default “XiServices” and the Port Numbers (60080 and 60081) in the following three lines to your own values only if multiple OPC .NET 3.0 servers will be on the same machine--> <addbaseAddress="net.pipe://localhost/XiServices" /> <addbaseAddress="http://localhost:60080/XiServices" /> <addbaseAddress="net.tcp://localhost:60081/XiServices" />
Running the Console App • Build the Wrapper Server project • The App.config file will be compiled and copied to the bin directory with the executable • Run the Wrapper Server using the debugger, or run the executable from either: • Xi Projects\x86\Debug\bin • Xi Projects\x86\Release\bin