Troubleshooting
Problem
Here are some ways you can troubleshoot the integration between the IBM Rhapsody® PCE add-on and Mathworks® MATLAB.
Environment
When you right click a Constraint View and select "Open Contraint View...", Rhapsody® launches a plugin helper that opens a UI.
The plugin also opens an instance of MATLAB® and connects to the instance via a HTTP socket. The plugin will attempt to find the socket defined by MATLAB. If not it defaults to 6434.
![]() |
![]() |
When the user presses the "Evaluate" button in the UI, the Rhapsody® plugin executes the MATLAB® scripts located in the PCE profile directory (shown below)
![image 9873](/support/pages/system/files/inline-images/image_9873.png)
These MATLAB® scripts then call more Rhapsody API code in order to evaluate your model's parametric constraints in MATLAB®.
You can modify these MATLAB® scripts to obtain further debug information.
Resolving The Problem
1. Check you have a valid path for the MATLAB® executable path in the the Rhapsody® tools menu > PCE Enviroment Settings.
![image 9872](/support/pages/system/files/inline-images/image_9872.png)
2. Check MATLAB® has exported the MATLAB_PORT_NO environment variable. This is used by the Rhapsody® plugin to connect to launch an instance of MATLAB®. Test it by running this from the MATLAB® console:
disp(getenv('MATLAB_PORT_NO'));
MATLAB® should print the port number on the console.
3. Check the Rhapsody plugin has connected successfully to the MATLAB® instance by modifying the xpceMATLAB.m script:
xpceServer = com.ibm.rhapsody.pce.net.Server();
// add this line
disp(xpceServer.COPY_RIGHT);
This will output the copyright banner into the MATLAB® console if successfully connected.
4. Increase the level of detail from error messages in the MATLAB® console. Open the xpceMATLABexecute.m script.
In each catch section add further disp() functions to output exception details. A modified example is shown below:
%
% MATLAB script for Rhapsody Parametric Constraints Evaluator
% xpceMATLABexecute.m
%
% (C) Copyright IBM Corp. 2010. All rights reserved.
%
while true
xpceRequest = xpceServer.receiveRequest();
if (length(xpceRequest) <= 0)
break
elseif xpceRequest == 'xpceQuit'
xpceServer.finalizeServer();
quit
elseif xpceRequest.endsWith(';')
try
eval(xpceRequest);
catch ME
disp(' => eval error!')
// output additional exception info
disp(ME.identifier);
disp(ME.message);
disp(ME.stack);
disp(ME.cause);
//
end
elseif xpceRequest.endsWith(':')
try
evalin(symengine,char(xpceRequest));
catch ME
disp(' => evalin error!')
// output additional exception info
disp(ME.identifier);
disp(ME.message);
disp(ME.stack);
disp(ME.cause);
//
end
else
try
xpceAnswer = eval(xpceRequest);
if (isnumeric(xpceAnswer) | islogical(xpceAnswer))
xpceServer.sendResult(num2str(xpceAnswer));
else
xpceServer.sendResult(char(xpceAnswer));
end
catch ME
xpceServer.sendResult('');
disp(' => eval error!')
// output additional exception info
disp(ME.identifier);
disp(ME.message);
disp(ME.stack);
disp(ME.cause);
//
end
end
end
Now when you press the "Evaluate" button again, you should receive more logging information in the MATLAB® console:
If you receive errors such as:
MATLAB:UndefinedFunction
Unrecognized function or variable 'symengine'.
MATLAB:UndefinedFunction
Undefined function 'syms' for input arguments of type 'char'.
MATLAB:UndefinedFunction
Unrecognized function or variable 'x0'.
Type 'symengine' in the MATLAB console.
![image 9871](/support/pages/system/files/inline-images/image_9871.png)
If it is missing, click the red link to purchase and/or download the missing package.
Further errors displayed on the console should be forwarded to IBM Support.
Document Location
Worldwide
[{"Type":"SW","Line of Business":{"code":"LOB59","label":"Sustainability Software"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"ARM Category":[{"code":"a8m50000000CjWPAA0","label":"Rhapsody->Collaborations->Simulink"}],"ARM Case Number":"TS005569913","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Version(s)"}]
Was this topic helpful?
Document Information
Modified date:
27 May 2022
UID
ibm16452223