Thread Subject: Simulink library functions and variables

Subject: Simulink library functions and variables

From: Rajesh

Date: 8 Nov, 2011 13:18:11

Message: 1 of 3

Hello All,

In the system top level model, many reference blocks are used for each and every subsystem.
When generating the code, the library blocks are creating function for each and every reference block.
In other words:
First reference block uses time trigger block which is coming in the code as first_Timetrigger function.
Same time trigger block is generating the code as second_Timetrigger function even I used the same type of inputs and same block names.
How can I model my system such that it should generate only one function for time trigger among the entire reference blocks?

2. when one signal is passing from the one reference block to another, signal is passing as function argument how can I avoid that or in other words how can I define all the global variables in single file for many reference blocks?

Subject: Simulink library functions and variables

From: Phil Goddard

Date: 10 Nov, 2011 16:53:28

Message: 2 of 3

Have a look in the RTW documentation for ideas on how to do what you want.

Specifically the section,
Real-Time Workshop -> User's Guide -> Developing Models for Code Generation -> Architecture Considerations -> Creating Reusable Components -> Reusable Code and Referenced Models

Phil.

Subject: Simulink library functions and variables

From: Dave Everett

Date: 12 Dec, 2011 08:41:08

Message: 3 of 3

"Phil Goddard" <phil@modeling-simulation-visualization.com> wrote in message <j9gvi8$7ns$1@newscl01ah.mathworks.com>...
> Have a look in the RTW documentation for ideas on how to do what you want.
>
> Specifically the section,
> Real-Time Workshop -> User's Guide -> Developing Models for Code Generation -> Architecture Considerations -> Creating Reusable Components -> Reusable Code and Referenced Models
>
> Phil.

Hello,

I have a similar problem but it relates to library blocks in referenced models. If I define a reusable subsystem in a library and use it in two different referenced models the code generated has two instances of the library code - one for each referenced model. There must surely be a way to reconcile the duplication through the code generation process. I've looked at Phil's help suggestion but this provides no insight.

- Dave

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
rtw Phil Goddard 10 Nov, 2011 11:54:28
model reference Phil Goddard 10 Nov, 2011 11:54:28
reusable function Phil Goddard 10 Nov, 2011 11:54:28
rssFeed for this Thread

Contact us at files@mathworks.com