Code covered by the BSD License  

Highlights from
Real-Time Pacer for Simulink

5.0

5.0 | 1 rating Rate this file 32 Downloads (last 30 days) File Size: 18.73 KB File ID: #29107
image thumbnail

Real-Time Pacer for Simulink

by Gautam Vallabha

 

21 Oct 2010

Simulink block for forcing a simulation to run in real (wall clock) time

| Watch this File

File Information
Description

The RealTime Pacer block slows down ("paces") simulation time so that it synchronizes with real elapsed time. The degree of slowdown is controllable via a Speedup parameter.

1) The block is implemented using an M S-function, so it works on any supported Simulink platform. It does not support code generation.

2) The block uses the MATLAB PAUSE function to slow down the simulation. The PAUSE command gives up the processor during the pause, so system performance does not degrade.

3) The M-S function illustrates how to use nested functions to simplify the code.

The matching between simulation time and elapsed real time is approximate, with expected differences on the order of 10 to 30 milliseconds. This limitation is due to difficulties of precise timing with a multitasking operating system.

--------
RELATED FX ENTRIES

The following FX entries also implement "real time" functionality for Simulink. They are based on C S-functions and therefore support code generation.

* Simulink Real Time Execution (Real-Time Slower) (Filex# 21908)
* Real-Time Blockset 7.1 for Simulink (Filex# 3175)
* RTsync Blockset (Filex# 24975)

Required Products Simulink
MATLAB release MATLAB 7.7 (R2008b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
20 Jul 2011 Gustavo

Very nice work!

23 Mar 2012 Walter

This pacer for Labview works very well for slowing a SIMULINK developed control system to match the timing of a real time device. We are using it to provide control logic to a LabView DAQ system which then controls a hydraulic pump and motor system. To overcome the problem of Microsoft Operating System interrupts, we have added memory to the control system to account for the time losses.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
real time simulation Gautam Vallabha 28 Oct 2010 13:46:11
realtime Gautam Vallabha 28 Oct 2010 13:46:11
real time Gautam Vallabha 28 Oct 2010 13:46:12
real time execution Gautam Vallabha 28 Oct 2010 13:46:13
pace Gautam Vallabha 28 Oct 2010 13:46:15
real time sychronization Gautam Vallabha 28 Oct 2010 13:46:16
synchronization Gautam Vallabha 28 Oct 2010 13:46:16

Contact us at files@mathworks.com