Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: variable time step in simulink

Subject: variable time step in simulink

From: Omni Domni

Date: 13 Apr, 2008 16:51:02

Message: 1 of 4

Hello,

I have a simple subsystem that adds two numbers, A and B.

While A and B change in a continuous way, I need the
output (that is A+B) to be updated in a discrete rate,
that varies as the simulation progresses.

If I wanted a constant rate (say 5secs) using a 'sum'
block with 'sample time = 5' would be enough. Is there any
way to change the sample time dynamically?

Subject: Re: variable time step in simulink

From: Phil Goddard

Date: 14 Apr, 2008 03:23:02

Message: 2 of 4


Can you explain how the model determines when the next
sample rate will be?
Is it based on a random number? On the comparison of two
(or more) signals? Something else?
Knowing this should help in giving you some ideas on how to
proceed.

Phil.

Subject: Re: variable time step in simulink

From: Omni Domni

Date: 15 Apr, 2008 20:12:02

Message: 3 of 4

"Phil Goddard" <philgoddardNOSPAM@telus.net> wrote in
message <ftuimm$1bo$1@fred.mathworks.com>...
>
> Can you explain how the model determines when the next
> sample rate will be?
> Is it based on a random number? On the comparison of two
> (or more) signals? Something else?
> Knowing this should help in giving you some ideas on how
to
> proceed.
>
> Phil.

Thanks for answering Phil.
To be more specific, my problem has to do with a control
system. When a change is detected in the controlled
variable the control system responds to it after an
initial time delay say 10 seconds.
If the controlled variable hasn't been restored to the
desired value after the first action, the following
control system responces should be in time intervals of,
say 2 seconds. The rest of the system runs in continuous
time.
My first solution was definitely not good, so I'm
searching for a better way to implement such a kind of
systems in simulink. I hope I haven't missed any reset-
enabled triggered time-counting blocks.

Subject: Re: variable time step in simulink

From: Phil Goddard

Date: 15 Apr, 2008 23:50:19

Message: 4 of 4


Your problem doesn't sound too difficult, although giving
you a specific answer without seeing the exact model is
difficult.

You're going to have to use some combination of Triggered
and Enabled subsystems from the "Ports & Subsystems"
library, possibly in conjunction with one of the
counter/timers within the "Sources" library.
Some of the flow control blocks like "If" and "If Action"
subsystems may also come into play.

It sounds as if you may have already done that, although in
a manner that you consider messy.
The next step may be an S-function (although I don't think
you're going to need to do this).

Phil.

Tags for this Thread

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.

rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics