SysPhS Debugging Tips
As with any code generation from a model, there can be many factors that can cause an error in the generated script used in the external application. Hence the need for options to find the cause of the issue. This topic provides some tips on isolating the source of an issue in the model.
Before checking the generated code, an external script must be generated using the or.
Finding an issue
For finding any issues with the generated script, the key options to use include:
- For the generation process, a listing of the steps run through and any errors generated are logged in the System Output view ( )
- For any error listed in the System Output window, if it is related to a specific element, double-clicking on that error will locate the associated object in the left pane of the Configure Simulation window
- Where access to the generated script is needed, use the 'Open Simulation Directory' option under the icon on the Toolbar; see the Viewing the Generated Model Help topic
In this example we have a Part in the IBD that is incorrectly linked to another Part. That is, a direct link, not a link through a Port. This causes an error when generated to both Modelica and Simulink.
What is generated in the System Output is an error. Double-clicking on that error highlights the related object in the Simulation list.
This can be further verified by opening the generated script in the external application and viewing the generated diagram, by:
- Clicking on the icon from the Toolbar
- Selecting the Open Simulation Directory option
- Using the context menu to open the file in the external application
For example, in this case in Modelica:
When opening the generated model in Modelica, using the icon on the Toolbar, this is the view showing that the connector is not linked to the triangle that is the import to the Signal object:
Similarly for Simulink, this is the resulting model showing the lack of a connector from the SineOutput: