Is there a setting somewhere in the Data Store Memory block I can set to force the data store to use my previouly declared definition of a bus type when generating code?

조회 수: 1 (최근 30일)
I’m working on a tire model that uses a data store to hold a bunch of tire parameters with a bus structure defined by the attached “tireParamBus.h” header. I generate the bus structure using the “Simulink.importExternalCTypes” function which give me a bus definition in the base workspace defined as “tireParamBus” with an imported data scope and the “tireParamBus.h” header file.
I then have a tire model which is implemented as an S-Function which gets a pointer to this data store in the mdlStart function and stores the pointer in a DWork vector for use by the derivatives and outputs. The S-Function has a wrapper tlc file for code generation which works when building the model as a standalone model.
The problem I’m having is when I integrate this model with my airplane simulation, the struct tireParamBus is redefined in the “…_types.h” header.
If I delete the TIRE_PARAMS data store, this issue goes away (so do my parameters).
My question is: is there a setting somewhere in the Data Store Memory block I can set to force the data store to use my previous definition of tireParamBus? I have tried a few different Storage Class options, but none seem to work.

답변 (1개)

TAB
TAB 2018년 6월 1일
Check definition of your tireParamBus.
Assuming that its is "Simulink.Bus" object, you should assign the data scope propertie as below
tireParamBus.DataScope = 'Imported';
tireParamBus.HeaderFile = 'tireParamBus.h' % This file will be included in generated code using #include
  댓글 수: 1
Taylor Hubbard
Taylor Hubbard 2018년 6월 1일
Unfortunately, that doesn't help. As I stated earlier, the DataScope is set to Imported and the header file is set to tireParmBus.h. In other places this seems to work fine.
tireParamBus =
Bus with properties:
Description: ''
DataScope: 'Imported'
HeaderFile: 'tireParamBus.h'
Alignment: -1
Elements: [7×1 Simulink.BusElement]

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by