TwinActivateで作成したモデルをスタンドアロンで動くArduinoコードを出力したいです。
使っているバージョンは以下です。
TwinActivate2025.1
Arduino1.8.19
ArduinoMEGA
私は添付のモデル(20251222_CodeGenerationTest_rev4-1.scm)を作成して、モデル内にあるスーパーブロックを選択した状態で以下のコマンドをomlウィンドウで実行しました。
embededsolver=struct;
embededsolver.solver = 'rk4';
embededsolver.h = 0.01;
pparams = struct;
pparams.embededsolver = embededsolver;
vssGenerateInoFile(bdeGetSelectedBlock(bdeGetCurrentDiagram), pparams);
実行した結果から出力されたinofileと*.hファイルは全てinofileというフォルダ直下に移動させました。
またフォルダ移動に伴いinofileの#include "src/types.h"という記載を#include "types.h"に改めました。
上記の記載の変更は全てのヘッダファイルに適用しました。
Arduinoスケッチで対象のinofileを開いて実行すると「exit status 1 'double_t' does not name a type; did you mean 'double'?」というエラーが出ます。
なぜこのエラーが発生するか、どうやればエラーが発生しなくなるかを教えて欲しいです。
おそらく何かヘッダファイルが不足しているのではないかと思っていますので、私の環境でinofileと同時に生成されたヘッダファイルも添付します。
ーーーーーーーーーーーーー
Error "double_t does not name a type" when compiling Arduino code generated from Twin Activate 2025.1
Description:
I am trying to export standalone Arduino code from a model created in Twin Activate.
Environment:
- Twin Activate 2025.1
- Arduino IDE 1.8.19
- Board: Arduino MEGA
Steps taken:I created the attached model (20251222_CodeGenerationTest_rev4-1.scm) and executed the following commands in the OML window with the SuperBlock selected:
embededsolver=struct;embededsolver.solver = 'rk4';embededsolver.h = 0.01;pparams = struct;pparams.embededsolver = embededsolver;vssGenerateInoFile(bdeGetSelectedBlock(bdeGetCurrentDiagram), pparams);
After generation, I moved the resulting .ino and .h files directly into a folder named inofile.Since I changed the file structure, I updated the include paths in all header files (e.g., changed #include "src/types.h" to #include "types.h").
Issue:When I open the .ino file in the Arduino IDE and attempt to compile/verify, I encounter the following error:exit status 1 'double_t' does not name a type; did you mean 'double'?
Question:Could you please explain why this error occurs and how to resolve it?I suspect that some header files might be missing or there is a type definition conflict. I have attached the header files that were generated along with the .ino file for your reference.