MATLAB Answers

OPC connection fails in Matlab standalone/deployed application

2 views (last 30 days)
Balakumara Vignesh M
Balakumara Vignesh M on 19 Feb 2020
My matlab application communicates with dymola software (for dynamic modeling/simulation/calculation) by giving inputs and fetching outputs. Everything working fine in Matlab command window. The standalone application developed in the matlab (using Application compiler) works fine in the same system as the one it was developed in.
Once I install the application (with matlab runtime) into an host system without the full matlab installation, The OPC code fails.
Code developed/compiled in : Windows 10 Pro,
deployed to/Host system : Windows 10 Pro,
Matlab version 2017b
OPC toolbox version 4.0.4
Matlab runtime 9.3
The OPC code snippet is as follows:
%% File: SetupOPCDA_MatlabDymolaConnection()
try
%opcregister('install')
hostInfo = opcserverinfo('localhost');
disp(hostInfo.ServerID);
da = opcda('localhost','Dymosim.OPCServer.1');
% Connect to Dymola OPC server
connect(da);
grp = addgroup(da);
ns = getnamespace(da);
catch Err % line 33
The below given outputs are from running the generated exe file from command line in the host system.
Its failing with error:
OPC Foundation Core Components not installed. Run OPCREGISTER to install the OPC Foundation Core Components.
On uncommenting the line
opcregister('install')
I'm getting the following error (Please note I'm running the exe from commandline):
Setting OPC connection...Warning: OPC Core Components are already installed. Reinstalling may require a repair of the Core Components.
Continuing this operation will modify any OPC Foundation files already installed.
MATLAB may shut down, and a system reboot may occur.
Type 'Yes' (exactly as shown) to install the OPC Foundation files
Confirmation string: Yes
'Yes' is not recognized as an internal or external command,
operable program or batch file.
Operation cancelled by user.
On giving the line as:
opcregister('install','-silent')
Error:
Warning: OPC Core Components are already installed. Reinstalling may require a repair of the Core Components.
TWarning: Installation was not successful. Exit code was 1619.
OPC Foundation Core Components not installed. Run OPCREGISTER to install the OPC Foundation Core Components.
To compare, This is the output I get in my system, the one in which the code was developed and compiled:
It works fine in the developer system, but it fails in host system.

  0 Comments

Sign in to comment.

Answers (0)

Sign in to answer this question.