Hi all
I have a controller model that I develop and reference in three different harnesses:
  1. simulation
  2. rapid prototyping
  3. production code generation.
I have certain blocks and signals that are used in the first two harnesses, but may not appear in the final production code generation. For example: I have made a library block of a PI controller which has an additional 'log' output port containing a bus with all kinds of signals from inside the PI controller block. In simulation I use this bus for Scope blocks, in the rapid prototyping environment I use this bus for other displaying methods. For production code generation however, this signal bus is not needed and I want to avoid code generation for this. This bus is passed through an outport.
I have found the block 'Environment Controller' which could be used to reduce blocks only used in simulation, but I still need them in rapid prototyping. I have also found this MATLAB Question but it is only a solution for MATLAB code, not Simulink.
Are there ways to reduce blocks for production code generation, which are not reduced by the automatic block reduction?
Can I differentiate based on the TLC I chose?

 채택된 답변

Jonas
Jonas 2020년 2월 27일
편집: Jonas 2020년 2월 28일
Found the solution.
I have made a variant subsystem, wherein the production code variant I have used 'Ground' blocks as sources such that the code generator reduces those blocks for logging. I did have to use the Bus Creator and named signals for the code generator to not complain about a missing bus.
The Variant subsystem is controlled by a Simulink.Variant parameter inside my data dictionary with the expression:
strcmp('ert.tlc',get_param('controller','SystemTargetFile'))
This way, the PI controller with logging function is used for simulation and prototyping, and is not used for production code generation.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Deployment, Integration, and Supported Hardware에 대해 자세히 알아보기

제품

릴리스

R2019a

질문:

2020년 2월 27일

편집:

2020년 2월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by