Code Generation File Does not exist.

17 views (last 30 days)
Friso
Friso on 16 Jul 2022
Answered: Kshittiz on 20 Sep 2023
For a project I am trying to convert a Simulink model, XXX, which consits out of XXX_1 and XXX_2 into an XYZ file. However, I keep on getting this error in the build sumarry: "Code generation file does not exist.". You can find the full output here.
XYZ.export('XXX')
Warning: Removed 'C:\Users\Friso Meeusen\ Uni\XXX\out\ExportCode' from the
MATLAB path for this MATLAB session.
See 'doc path' for more information.
> In verifyAndExport
In XYZ.export (line 38)
### Verify and Export script executed for model XXX.
### Executing Model Advisor checks.
Running Model Advisor
Running Model Advisor on XXX_1
Warning: ['XXX_1'] : Simscape Multibody visualization using the Mechanics Explorer is not supported for
models using model reference. Please turn off visualization in the Simscape Multibody:Explorer configuration pane
of the referenced model 'XXX_1'. Resolve this issue in order to remove the warning.
> In modeladvisorutil2
In modeladvisorutil2
In modeladvisorprivate
In Simulink.ModelAdvisor/handleModelCompileForCheck
In Simulink.ModelAdvisor/run
In Simulink.ModelAdvisor/runCheck
In ModelAdvisor.run>runMACheckIDListMultMdls
In ModelAdvisor/run
In verifyModel
In verifyAndExport
In XYZ.export (line 38)
============================================================
Model Advisor run: 16-Jul-2022 11:48:33
Configuration: None
System: XXX
System version: 10.4
Created by: Friso Meeusen
============================================================
(1) Pass: Check sample time of outports [check ID: XYZ.OutportSampleTimeCheck]
------------------------------------------------------------
(2) Pass: Check step size [check ID: XYZ.FixedStepCheck]
------------------------------------------------------------
(3) Pass: Model information check [check ID: XYZ.InformationCheck]
------------------------------------------------------------
(4) Pass: Check top model pattern [check ID: XYZ.TopModelCheck]
------------------------------------------------------------
(5) Pass: Check data types for in and outports [check ID: XYZ.DataTypeCheck]
------------------------------------------------------------
(6) Pass: Check dimension for in and outports [check ID: XYZ.DimensionCheck]
------------------------------------------------------------
(7) Pass: Check names of ports and models [check ID: XYZ.PortNameCheck]
------------------------------------------------------------
(8) Pass: Check test point paths [check ID: XYZ.TestPointCheck]
------------------------------------------------------------
(9) Pass: Check reference model names [check ID: XYZ.DuplicateRefModelNameCheck]
------------------------------------------------------------
(10) Pass: Check storage class used [check ID: XYZ.StorageClassCheck]
------------------------------------------------------------
Summary: Pass Warning Fail Not Run
10 0 0 0
============================================================
Systems passed: 1 of 1
Systems with warnings: 0 of 1
Systems failed: 0 of 1
Summary Report
### All checks passed!
### Generating code.
### A toolchain is selected that is not supported for simulator code. Using MinGW to build simulator code.
### Starting serial model reference code generation build
### Checking the status of model reference code generation target for model 'XXX_2' used 'XXX'
### Model reference code generation target (XXX_2.c) for model XXX_2 may be out of date. The model or library 'XXX_2'has changed.
### Starting build procedure for: XXX_2
### Generating code and artifacts to 'Target environment subfolder' folder structure
### Code for the model reference code generation target for model XXX_2 is up to date because no functional changes were found in the referenced model.
### Saving binary information cache.
### Model reference code generation target for XXX_2 is up to date.
### Checking the status of model reference code generation target for model 'XXX_1' used in 'XXX'
### Model reference code generation target (XXX_1.c) for model XXX_1 may be out of date. The model or library 'XXX_1' has changed.
### Starting build procedure for: XXX_1
### Generating code and artifacts to 'Target environment subfolder' folder structure
Warning: ['XXX_1'] : Simscape Multibody visualization using the Mechanics Explorer is not supported for
models using model reference. Please turn off visualization in the Simscape Multibody:Explorer configuration pane
of the referenced model 'XXX_1'. Resolve this issue in order to remove the warning.
Warning: The referenced model 'XXX_1' has set Single output/update function, but Simulink is unable to
honor this request. Some possible reasons for this are
* The model has a continuous sample time.
* The model is saving states.
### Code for the model reference code generation target for model XXX_1 is up to date because no functional changes were found in the referenced model.
### Saving binary information cache.
### Model reference code generation target for XXX_1 is up to date.
### Simulink cache artifacts for 'XXX_2' were created in 'C:\Users\Friso Meeusen\OneDrive - Uni\XXX\cache\XXX_2.slxc'.
### Simulink cache artifacts for 'XXX_1' were created in 'C:\Users\Friso Meeusen\OneDrive - Uni\XXX\cache\XXX_1.slxc'.
### Starting build procedure for: XXX
### Generating code and artifacts to 'Target environment subfolder' folder structure
### Generating code into build folder: C:\Users\Friso Meeusen\OneDrive - Uni\XXX\out\IntelWin32_XYZ\XXX
Warning: File 'codedescriptor.dmr' not found.
Warning: File 'codedescriptor.dmr' not found.
Warning: File 'codedescriptor.dmr' not found.
Warning: File 'codedescriptor.dmr' not found.
### Invoking Target Language Compiler on XXX.rtw
### Using System Target File: C:\Users\Friso Meeusen\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\XYZ Toolbox for Simulink\SystemTargetFile\XYZ.tlc
### Loading TLC function libraries
.......
### Initial pass through model to cache user defined code
.
### Caching model source code
.....................................................
Error: Simulink Coder Error: Simulink Coder Fatal: Failed to compute step size for TID=[0...1] in 'ModelReference' Block: '<Root>/Robot'
Main program:
==> [00] C:\Program Files\MATLAB\R2021b\rtw\c\tlc\public_api\block_api.tlc:LibBlockSampleTime(346)
[01] C:\Users\Friso Meeusen\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\XYZ Toolbox for Simulink\MainFileGenerator\utilityFunctions.tlc:myLibWriteSubsystemStruct(215)
[02] C:\Users\Friso Meeusen\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\XYZ Toolbox for Simulink\MainFileGenerator\generateMain.tlc:FcnGenerateMain(91)
[03] C:\Users\Friso Meeusen\OneDrive - Uni\XXX\out\IntelWin32_XYZ\XXX\tlc\XYZ_file_process.tlc:<NONE>(15)
[04] C:\Program Files\MATLAB\R2021b\rtw\c\tlc\mw\formatwide.tlc:<NONE>(566)
.
### Writing header file XXX_types.h
### Writing header file XXX.h
.
### Writing source file XXX.c
### Writing header file XXX_private.h
### Writing header file rtmodel.h
### Writing source file simulationWrapper.c
### TLC code generation complete.
### Build procedure for XXX aborted due to an error.
Build Summary
Top model targets built:
Model Action Rebuild Reason
==========================================================================
XXX Failed Code generation information file does not exist.
0 of 3 models built (2 models already up to date)
Build duration: 0h 0m 22.007s
Error using tlc_new
Error: Errors occurred - aborting
Error in callTLCService
Error in tlc_c
Error in tlc_c
Error in coder.internal.ModelBuilder>i_buildProcedure (line 706)
buildResult = tlc_c(hCodegenMgr,...
Error in coder.internal.ModelBuilder.make_rtw (line 119)
[buildResult, mainObjFolder] = i_buildProcedure...
Error in build_target
Error in build_target
Error in build_standalone_rtw_target
Error in slbuild_private
Error in slbuild_private
Error in sl_feval
Error in slbuild
Error in slbuild
Error in rtwbuild
Error in verifyAndExport
Error in verifyAndExport
Error in XYZ.export (line 38)
verifyAndExport(model, varargin{:});
Please let me know if you have an idea to fix this.
Thank you in advance!

Answers (1)

Kshittiz
Kshittiz on 20 Sep 2023
Hi,
I understand that you are encountering an error message stating : “Code Generation file does not exist” error.
The error message suggests that the code generation process for your Simulink model has failed as it could not find a required file.
Upon further investigation of the error log, I conclude that the issue is occurring due to the model named ‘XXX’. The specific error message related to this model is:
Error: Simulink Coder Error: Simulink Coder Fatal: Failed to compute step size for TID=[0...1] in 'ModelReference' Block: '<Root>/Robot'
This error message suggests that there might be an issue related to the step size configuration in your Simulink model, particularly within a 'ModelReference' block.
You can try the following workarounds to address this issue:
  1. Verify that the step sizes are correctly configured in your Simulink model, especially in the 'ModelReference' block named 'Robot'.
  2. Examine the 'ModelReference' block named 'Robot' to see if there are any configurations or settings that might be causing the step size computation to fail.
  3. Since you are using a ‘ModelReference’ block, it means your model has multiple referenced models. Make sure that the simulation settings are consistent across all referenced models.
I hope the insight on the error message and the workaround mentioned helps in resolving the issues you are facing.
Thanks,
Kshittiz

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!