Problem with Building tmc-file / tmx-file from Simulink Model to load into Twincat 3

110 visualizzazioni (ultimi 30 giorni)
After i installed the TE14xx Toolbox from Beckhoff, to compile a C++ - Code to represent my Simulink Model in Twincat3, i receive the following error Message.
All components that are required are installed. VS2019, test mode within Windows for signing the certificates and the drivers and of course the certificate that has been created. It looks like I am missing a toolset for compiling. What strange is that along with VS2019 I also have the latest MSVC v142 buildtools.
I think it is a very easy solution for this, but i cannot see it.
Is their a point where i have to link the compiler to matlab?
Warning: No appropriate platform toolset was found
ERROR: Unable to find compatible C++ platform toolset version.
ERROR: Can't create log file "C"
### Starting build procedure for: AnBeckhoff
################################################################################
### Starting TwinCAT TE1400 Simulink Model Verification
### Model Name: AnBeckhoff
### MATLAB Version: R2021b (win64)
### TE1400 Version: 2.3.1.1
################################################################################
################################################################################
### Generating code and artifacts to 'Model specific' folder structure
### Generating code into build folder: C:\test\AnBeckhoff_tcgrt
### Invoking Target Language Compiler on AnBeckhoff.rtw
### Using System Target File: C:\TwinCAT\Functions\TE14xx-ToolsForMatlabAndSimulink\TE140x\Simulink\TLC\TwinCatGrt.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
### Caching model source code
### Writing header file AnBeckhoff_types.h
### Writing header file AnBeckhoff.h
### Writing header file rtwtypes.h
### Writing header file multiword_types.h
### Writing source file AnBeckhoff.cpp
### Writing header file AnBeckhoff_private.h
### Writing header file rtmodel.h
.
### Writing source file AnBeckhoff_data.cpp
### Writing header file rt_nonfinite.h
### Writing source file rt_nonfinite.cpp
### Writing header file rtGetInf.h
### Writing source file rtGetInf.cpp
### Writing header file rtGetNaN.h
.
### Writing source file rtGetNaN.cpp
### TLC code generation complete.
....### Creating HTML report file index.html
### Saving binary information cache.
.
### Processing Template Makefile: C:\TwinCAT\Functions\TE14xx-ToolsForMatlabAndSimulink\TE140x\Simulink\TLC\tcgrt_msbuild.tmf
### Makefile C:\test\AnBeckhoff_tcgrt\AnBeckhoff.mk is up to date
################################################################################
### Starting TwinCAT TE1400 Simulink Model Export
################################################################################
Warning: Unable to get handle of subsystem <S51>: Unable to locate Simulink Coder block or system name '<S51>' in model 'AnBeckhoff'
Model hierarchy export finished successfully
Warning: No appropriate platform toolset was found
ERROR: Unable to find compatible C++ platform toolset version.
ERROR: Can't create log file "C"
[Info]
[Info#ModuleGenerator]
ProductId: TE140x
ProductName: TE140x-TargetForMatlabSimulink
Version: 2.3.1.1
InstallDir: C:\TwinCAT\Functions\TE14xx-ToolsForMatlabAndSimulink\TE140x
SDK: C:\TwinCAT\Functions\TE14xx-ToolsForMatlabAndSimulink\TE140x\SDK
[Info#ModuleGeneratorHost]
Description: MATLAB 9.11.0.1837725 (R2021b) Update 2 (win64)
InstallDir: C:\Program Files\MATLAB\R2021b
[Info#TE140x]
SDK: C:\TwinCAT\Functions\TE14xx-ToolsForMatlabAndSimulink\TE140x\SDK
[Create Project]
[Export Classes]
[Export Classes#License]
[License#AnBeckhoff]
Warning: ExportAnBeckhoff
[Generate#AnBeckhoff#TcCom]
Implement interfaces
### Build procedure for AnBeckhoff aborted due to an error.
Build Summary
Top model targets built:
Model Action Rebuild Reason
======================================================================
AnBeckhoff Failed Code generation information file does not exist.
0 of 1 models built (0 models already up to date)
Build duration: 0h 0m 14.445s
The call to TwinCatGrt_make_rtw_hook, during the after_make hook generated the following error:
Project preparation failed
The build process will terminate as a result.
Caused by: Project preparation failed

Risposte (3)

Taranjit Singh
Taranjit Singh il 8 Ago 2022
Were you able to solve this problem ?
  2 Commenti
Hedayatullah Fiazi
Hedayatullah Fiazi il 8 Ago 2022
Hi,
yes. I had a call with beckhoff. there is a bug, when you have the MSVC Version 14.2 2019 and VS 2019.
I installed VS2017 and also MSVC Version14.1 2017 and it works.
Fabian Bause
Fabian Bause il 4 Nov 2022
Hi,
I am not aware of any issues of our TwinCAT Targets with Visual Studio 2019. Maybe you missed to install the C++ develeopent kits with VS2019? You need to select those manually when installing VS2019. Also it is important to first install VS with C++ kit and then install TwinCAT 3. TwinCAT 3 creats platformtoolsets on top of the toolsets provided by the C++ kit. If they do not exist, TwinCAT does not install the TwinCAT platformtoolsets.
Anyway, I am happy to hear that you have a running developement system.
If further questions arise regading our TwinCAT Target for Simulink or TwinCAT Target for MATLAB, please don't hesitate to contact your local Beckhoff Support Team.
Thanks,
Fabian
(Product management TwinCAT)

Accedi per commentare.


gregory pais
gregory pais il 31 Ott 2023
Hi,
I had this issue with same messages
Warning: No appropriate platform toolset was found
ERROR: Unable to find compatible C++ platform toolset version.
I ran vs_installer.exe from "C:\Program Files (x86)\Microsoft Visual Studio\Installer"
To check my VS installation and if Visual C++ was correcty installed.
But two products was installed:
  • Visual Studio build tools 2019
  • Visual Studio Community 2019
This issue was solved after deinstalation of VS build tools

Vojtech
Vojtech il 22 Gen 2025 alle 10:29
Hi,
I have quite simular issue. I cant export tmc-file / tmx-file from Simulink Model to load into Twincat 3.
My Software set up:
For export purposes, I'm working on a virtual machine where I installed VS2017 Community 9/15/69. I then implemented TwinCAT Standard – Engineering (XAE) version 4026.12.1 and TE1400 TwinCAT 3 Target for Simulink version 2.9.43 into VS2017 using TwinCAT Package Manager. Next, I installed Matlab 2024b and installed add-on(s) Simulink version 24.2, Matlab Coder version 24.2, Simulink Coder version 24.2 and Matlab Support for MinGW-w64 C/C++/Fortran Compilet version 24.2.0. I don't have anything else installed on the virtual machine. The installs were done on a clean Windows 10 OS in the order listed and everything should be fine.
When I try to set up a path like in "TC3 Target for Matlab/Simulink Manual ->Setup instruction", the p-file does not link the MATLAB version used to the TE1400. It appears only this:
but i find our company internal manual where it appears this: "TwinCAT TE140x path were added and saved successfully".
I am not sure but i guess this is the main reason why cant i export. I also try to import a model already exported in the past on diferend PC and in TwinCAT TcCOM Objects insertion I cant see the TE140x Module Vendor (if you let the default name of Vendor name) which may appear when the path set up is successfull, i guess.
My error message during export:
=== Build (Elapsed: 1:17 min) ===
Start model export with TE1400
### Versions
MATLAB 24.2.0.2806996 (R2024b) Update 3 (win64), C:\Program Files\MATLAB\R2024b
TE140x-TargetForMatlabSimulink 2.9.43.0, C:\Program Files (x86)\Beckhoff\TwinCAT\Functions\TE14xx-ToolsForMatlabAndSimulink\TE140x
### Starting build procedure for: ZkouskaExportu
### Verify model parameters
Warning:The value 'off' of model parameter 'GenCodeOnly' is not supported by this version of TE1400 and was changed to 'on' automatically.
### Generating code and artifacts to 'Model specific' folder structure
### Generating code into build folder: C:\Program Files (x86)\Beckhoff\TwinCAT\Functions\TE14xx-ToolsForMatlabAndSimulink\ZkouskaExportu_tcgrt
### Invoking Target Language Compiler on ZkouskaExportu.rtw
### Using System Target File: C:\Program Files (x86)\Beckhoff\TwinCAT\Functions\TE14xx-ToolsForMatlabAndSimulink\TE140x\Simulink\TLC\TwinCatGrt.tlc
### Loading TLC function libraries
.......
### Initial pass through model to cache user defined code
### Caching model source code
............................
### Writing header file ZkouskaExportu_types.h
### Writing header file ZkouskaExportu.h
### Writing header file rtwtypes.h
.
### Writing header file multiword_types.h
### Writing source file ZkouskaExportu.cpp
### Writing header file ZkouskaExportu_private.h
### Writing header file rtmodel.h
### Writing header file rt_defines.h
### TLC code generation complete (took 18.079s).
### Save TLC export
### Saving binary information cache.
### Export block diagram
Block diagram export succeeded
### Export TwinCAT C++ project
### Init TMX exporter for Simulink model ZkouskaExportu
### Init project
### Init TMX exporter for Simulink model ZkouskaExportu
Importing TlcExport file from directory C:\Program Files (x86)\Beckhoff\TwinCAT\Functions\TE14xx-ToolsForMatlabAndSimulink\ZkouskaExportu_tcgrt
### Import model information for ZkouskaExportu
### Save project "ZkouskaExportu"
The TwinCAT C++ project ZkouskaExportu.vcxproj was generated successfully
### Publish TMX
Configuration: "Release"
Platform(s): "TwinCAT RT (x86);TwinCAT RT (x64);TwinCAT OS (x64)"
TwinCAT SDK: "C:\Program Files (x86)\Beckhoff\TwinCAT\3.1\SDK\" (Version 3.1.4026.12)
Platform Toolset: V141 (Automatically selected)
Microsoft (R) Build Engine verze 15.9.21+g9802d43bc3 pro .NET Framework
Copyright (C) Microsoft Corporation. V�echna pr�va vyhrazena.
C:\Program Files (x86)\Beckhoff\TwinCAT\3.1\SDK\Build\MsBuild\VsProps\TwinCAT OS Common.props(38,10): error MSB4066: Atribut Contidition v elementu &lt;Lib&gt; nebyl rozpozn�n. [C:\Program Files (x86)\Beckhoff\TwinCAT\Functions\TE14xx-ToolsForMatlabAndSimulink\ZkouskaExportu_tcgrt\ZkouskaExportu.vcxproj]
Error: ERROR: Publish procedure failed
See log file ZkouskaExportu_PublishLog.txt for details
### Import model information for ZkouskaExportu: Block diagram
Error: ERROR: Code generation failed: Project export failed
Build procedure for ZkouskaExportu aborted due to an error.
### Finish model export
Model export duration: 57.7 s
Closing log file ZkouskaExportu_ModuleGenerationLog.txt
Top model targets:
Model Build Reason Status Build Duration
==========================================================================================================================================
ZkouskaExportu Information cache folder or artifacts were missing. Failed to build. For more information, see build log. 0d
0 of 1 models built (0 models already up to date)
Build duration: 0h 1m 13.41s
Error:The call to TwinCatGrt_make_rtw_hook, during the after_make hook generated the following error:
Project export failed
The build process will terminate as a result.
Caused by:
Project export failed
...
Does any one know how to deal with this issue?
Best regard,
Vojta
  2 Commenti
Fabian Bause
Fabian Bause il 27 Gen 2025 alle 8:29
Hi Vojta,
Did you install the Visual Studio with "Desktop development with C++" option enabled? This is an option you actively need to set to install the MS build stuff. TE1400 uses MS build and MS Visual C/C++ Compiler to build TwinCAT exectables (tmx files).
Also, did you execute the integration of TwinCAT into the Visual Studio installation?
To check if the toolchain for building TwinCAT C++ projects works, you can simply open the Visual Studio and build an empty TwinCAT C++ template. If this failes, the root cause is no TE1400 or some MATLAB specific things.
If the problem persists, I recommend to contact the Beckhoff support which is free of charge.
Fabian
Vojtech
Vojtech il 27 Gen 2025 alle 9:33
Hi Fabian,
Thank you for fast answer.
Yes I did it step by step like its described in TE1400 Manual.
For now it allready works. To solve this problem i musted uninstal TwinCAT build 4026 via Package Manager and then instal build 4024 from .exe file and mainly chose a the correct storage location. For me it was directly to the C disc. After instalation everything work as it may.
I thing in program files (where Package Manager instal files defaultly) there are some limited rights. Maybe.
Best Regard,
Vojta

Accedi per commentare.

Categorie

Scopri di più su Introduction to Installation and Licensing in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by