Thread Subject: Simulink RTW, real time problems

Subject: Simulink RTW, real time problems

From: Sean

Date: 24 Nov, 2009 01:09:20

Message: 1 of 4

Hello,

I'm probably a relative rookie when it comes to simulink and real time workshop. I've been trying to get a simple program to run on real time and I think I must be missing something.

Here's what I'm trying to do, I'm trying to simply send a signal through a usb port at real time. I've set up RTW with a discrete time step of .01, a total time of 20 units and generated the model. But both the simulation and the resulting program seem to run at a speed of higher than 20 sec. Its actually running at about 23 seconds. Am I missing something. I should probably venture into the optimization of the simulation but I was curious if you guys would have any insights or helpful remarks.

Thank you in advance,
Sean

Subject: Simulink RTW, real time problems

From: Arnaud Miege

Date: 24 Nov, 2009 08:47:22

Message: 2 of 4


"Sean " <sap86@email.arizona.edu> wrote in message
news:hefbo0$a3u$1@fred.mathworks.com...
> Hello,
>
> I'm probably a relative rookie when it comes to simulink and real time
> workshop. I've been trying to get a simple program to run on real time
> and I think I must be missing something.
>
> Here's what I'm trying to do, I'm trying to simply send a signal through a
> usb port at real time. I've set up RTW with a discrete time step of .01,
> a total time of 20 units and generated the model. But both the simulation
> and the resulting program seem to run at a speed of higher than 20 sec.
> Its actually running at about 23 seconds. Am I missing something. I should
> probably venture into the optimization of the simulation but I was curious
> if you guys would have any insights or helpful remarks.
>
> Thank you in advance,
> Sean
>

Hi Sean,

USB is generally incompatible with real-time applications. Which block are
you using for USB communications? Which RTW target are you using? On which
platform are you running the generated code? Is it a real-time environment
(i.e. not Windows)?

Arnaud

Subject: Simulink RTW, real time problems

From: Sean

Date: 24 Nov, 2009 19:40:23

Message: 3 of 4

I'm trying to interface with a PCTx connector to control an aerial remote controller in real time. I've created a block for simulink using legacy code. the System builds, its just not in real time. I'm doing this all from a windows computer.

And i'm not quite sure what you mean by: Which RTW target are you using?

Thank you for your patiance,
Sean

"Arnaud Miege" <arnaud.miege@nospam.mathworks.co.uk> wrote in message <heg6iq$f7m$1@fred.mathworks.com>...
>
> "Sean " <sap86@email.arizona.edu> wrote in message
> news:hefbo0$a3u$1@fred.mathworks.com...
> > Hello,
> >
> > I'm probably a relative rookie when it comes to simulink and real time
> > workshop. I've been trying to get a simple program to run on real time
> > and I think I must be missing something.
> >
> > Here's what I'm trying to do, I'm trying to simply send a signal through a
> > usb port at real time. I've set up RTW with a discrete time step of .01,
> > a total time of 20 units and generated the model. But both the simulation
> > and the resulting program seem to run at a speed of higher than 20 sec.
> > Its actually running at about 23 seconds. Am I missing something. I should
> > probably venture into the optimization of the simulation but I was curious
> > if you guys would have any insights or helpful remarks.
> >
> > Thank you in advance,
> > Sean
> >
>
> Hi Sean,
>
> USB is generally incompatible with real-time applications. Which block are
> you using for USB communications? Which RTW target are you using? On which
> platform are you running the generated code? Is it a real-time environment
> (i.e. not Windows)?
>
> Arnaud
>

Subject: Simulink RTW, real time problems

From: Arnaud Miege

Date: 25 Nov, 2009 12:45:47

Message: 4 of 4


"Sean " <sap86@email.arizona.edu> wrote in message
news:hehcr7$i87$1@fred.mathworks.com...
> I'm trying to interface with a PCTx connector to control an aerial remote
> controller in real time. I've created a block for simulink using legacy
> code. the System builds, its just not in real time. I'm doing this all
> from a windows computer.
>
> And i'm not quite sure what you mean by: Which RTW target are you using?
>
> Thank you for your patiance,
> Sean
>
You mean you are running a Simulink model interpretatively on a Windows
platform, not C code generated from Simulink? Anything running on Windows
will not be in real-time because Windows is not a real-time operating
system. For real-time performance, you need to generate C code with
Real-Time Workshop from your Simulink model and run the generated C code on
a real-time platform, hence my comment and question:
- Generally speaking, USB is not supported on real-time platforms
- You can generate C code from Simulink with Real-Time Workshop for
different (real-time) targets. The fact that you didn't understand my
question suggest that you are not doing that, otherwise, you'd know which
target you are generating C code for. You might want to have a look at the
Real-Time Workshop documentation.

Arnaud

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
simulation time Sean 23 Nov, 2009 20:09:24
real time Sean 23 Nov, 2009 20:09:23
rssFeed for this Thread

Contact us at files@mathworks.com