Thread Subject: Warning for S-function block that back-inherits sampling time

Subject: Warning for S-function block that back-inherits sampling time

From: Carl

Date: 7 Dec, 2007 06:05:04

Message: 1 of 5

I have a Level-2 S-function written in C with 1 outport and
0 inports. For the purposes of my simulation, this block
must have its sample time back-inherited from the blocks it
drives. If it is connected to a continuous block it should
be continuous. If it is connected to a discrete block it
should be discrete with the same rate, etc. If none of the
blocks specify timing it should default to continuous.

When I try to set the sample time to inherited, Matlab gives
a warning, "Source block specifies that its sample time (-1)
should be back-inherited from the block(s) it drives. You
should explicitly specify the sample times of source
blocks." There are a number of source blocks that Simulink
provides which have this same configuration (Constant block,
for example) but do not produce this warning.

What is the correct way to back-inherit the sampling time
for a block that has no inputs? Does anyone know how to
suppress this warning, or at least know why it may be
happening for my block but not others?

Thank you for your help,
Carl

Subject: Warning for S-function block that back-inherits sampling time

From: riccardo

Date: 7 Dec, 2007 08:47:26

Message: 2 of 5

"Carl " <dynamic.solutions.inc.nospam@gmail.com> wrote in
message <fjanqg$etq$1@fred.mathworks.com>...
> I have a Level-2 S-function written in C with 1 outport
and
> 0 inports. For the purposes of my simulation, this block
> must have its sample time back-inherited from the blocks
it
> drives. If it is connected to a continuous block it
should
> be continuous. If it is connected to a discrete block it
> should be discrete with the same rate, etc. If none of
the
> blocks specify timing it should default to continuous.
>
> When I try to set the sample time to inherited, Matlab
gives
> a warning, "Source block specifies that its sample time (-
1)
> should be back-inherited from the block(s) it drives. You
> should explicitly specify the sample times of source
> blocks." There are a number of source blocks that
Simulink
> provides which have this same configuration (Constant
block,
> for example) but do not produce this warning.
>
> What is the correct way to back-inherit the sampling time
> for a block that has no inputs? Does anyone know how to
> suppress this warning, or at least know why it may be
> happening for my block but not others?
>
> Thank you for your help,
> Carl

Hi Carl,
Simulink "likes" - there are reasons for that - output-
driven models.
Anyway if the output is a standard signal, your s-fcn
should be fine as it is. You can suppress the warning if
you want, otherwise just ignore it.
Should a conflict on sample rates arise, Simulink would
issue an error, not a warning.
HTH
riccardo

Subject: Warning for S-function block that back-inherits sampling time

From: Peter Raeth

Date: 14 Mar, 2008 18:54:03

Message: 3 of 5

On page 33 of "Simulink 7, Writing S-Functions", is stated:

An S-function can inherit its sample time from
- The driving block
- The destination block
- The fastest sample time in the system

All examples assume inheritance from the driving block. I
also have a block that has no inputs and needs to inherit
from the destination block. Ignoring the warning gives no
indication from where the sampling time is coming from.

Spent a lot of time in this manual and others but can find
no way to specify from where the inherited sampling time
should come.

Has anyone an answer to this issue? How do we explicitely
specify the source of inherited sampling time?

Subject: Warning for S-function block that back-inherits sampling time

From: Seth Popinchalk

Date: 15 Mar, 2008 03:17:01

Message: 4 of 5

Carl, This warning is controlled by a diagnostic setting.
Go to the Configuration Parameters -> Diagnostics -> Sample Time

You will see "Source block specifies -1 sample time". Set
this to None to suppress this warning.

Seth

"Carl " <dynamic.solutions.inc.nospam@gmail.com> wrote in
message <fjanqg$etq$1@fred.mathworks.com>...
> I have a Level-2 S-function written in C with 1 outport and
> 0 inports. For the purposes of my simulation, this block
> must have its sample time back-inherited from the blocks it
> drives. If it is connected to a continuous block it should
> be continuous. If it is connected to a discrete block it
> should be discrete with the same rate, etc. If none of the
> blocks specify timing it should default to continuous.
>
> When I try to set the sample time to inherited, Matlab gives
> a warning, "Source block specifies that its sample time (-1)
> should be back-inherited from the block(s) it drives. You
> should explicitly specify the sample times of source
> blocks." There are a number of source blocks that Simulink
> provides which have this same configuration (Constant block,
> for example) but do not produce this warning.
>
> What is the correct way to back-inherit the sampling time
> for a block that has no inputs? Does anyone know how to
> suppress this warning, or at least know why it may be
> happening for my block but not others?
>
> Thank you for your help,
> Carl

Subject: Warning for S-function block that back-inherits sampling time

From: Douglas Scott

Date: 6 Aug, 2008 21:36:02

Message: 5 of 5

"Seth Popinchalk" <Seth.Popinchalk.nospam@mathworks.com>
wrote in message <frff3d$gko$1@fred.mathworks.com>...
> Carl, This warning is controlled by a diagnostic setting.
> Go to the Configuration Parameters -> Diagnostics ->
Sample Time
>
> You will see "Source block specifies -1 sample time". Set
> this to None to suppress this warning.
>
> Seth

I have been looking for a resolution for this same issue.
If you have a large model, on which multiple people
working, there is a very good chance that some of the
blocks (constants, inputs ports ... ) will get added with a
sample time of -1, in which case you want the warning to
find possible errors.

However, if you create an s-function block to be used
within this large model then you will get a large number of
these warnings for a case that you know should not be
occuring. This defeats the purpose and intent of the
warning.

This is an issue for large scale development. In C/C++ you
could bypass the warning on a case-by-case basis and
properly document it. It seems that this cannot be done in
this case.

There are multiple references in the documentation
on 'inheriting' the sample rates. But, as has been pointed
out, there appears to be no means to create an S-Function
to 'back-inherit' the sample time.

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
diagnostics Seth Popinchalk 14 Mar, 2008 23:20:24
sample time Seth Popinchalk 14 Mar, 2008 23:20:24
simulink Seth Popinchalk 14 Mar, 2008 23:20:23
sampling Peter Raeth 14 Mar, 2008 14:55:18
sample time Peter Raeth 14 Mar, 2008 14:55:18
destination Peter Raeth 14 Mar, 2008 14:55:18
inherit Peter Raeth 14 Mar, 2008 14:55:17
sfunction Carl 7 Dec, 2007 01:10:08
simulink Carl 7 Dec, 2007 01:10:08
rssFeed for this Thread

Contact us at files@mathworks.com