get start
Discription
System requirements
Speedgoat
Development Computer setting
Requirement:
64-bit、Net Framework 4.5、USB
Communication Setup :
Ethernet port—use IPv4. only
IP address boxes as folows:
IP address—10.10.10.10. Subnet mask—255.255.255.0Software installation:
uninstalled prior itsallations of Simulink real-time product
NET Framework 4.5 or later C conpiler installed
Files:matlabroot\toolbox\slrt
matlabroot\toolbox\rtw\targets\C Compiler Configuration:
install a support c compiler
type: slrtsetCC setup
Target Compter setting
PCI Bus Ethernet Setup:
Hardware:
1.type: tg=slrt; getPCIInfo(tg,‘ehernet’)
2.assign a static IP address to the target computer Ethernet card
3.connect by using an UTP cable
Settings:
1.type slrtexplr
2.Target Properties :add target button
3.Host -to-Target communication:
set Target computer IP address (10.10.10.15)
set Subnet mask (255.255.255.0)
port (22222)
gateway (255.255.255.255)
4.Select Bus type PCI
5.Target driver (auto)
set up and configure simulink real time
single PCI bus targrt computer
network targrt computer boot method
C compiler
configure link between development and target
1.type slrtexplr
2.Host -to-Target communication:
IP address (10.10.10.15)
Subnet mask (255.255.255.0)
port (22222)
gateway (10.10.10.10)
3.Ethernet Device Settings:
Target driver:auto
Bus type:PCI
configure target setting
1.type slrtexplr
2.target properties
USB Support、Multicore CPU、Graphics mode
configure boot configuration
1.type slrtexplr
2.target properties
boot mode network
creat boot disk
run the confidence test
- 1.create network boot,restart targrt computer
- 2.select a folder outside the matlab root folder
- 3.type slrttest
Create and run Real-time application from simulink Model
create a non-real-time model
transform simulink model to real-time application
add simulink real-time scope block
set targrt scope block parameters
set configuration parameters:
model configuration parameters:
- type: fixed-setup
- solver:ode4
code generation :
- system target file:slrt.tlc
start target computer
build and download real-time application
execute real-time application with simulink external mode
simulation>mode>external
connect to target
run
target to host transmission using UDP
real-time simulation and testing
1.create a model
2.simulate the model as a non-real-time application
3.configure the development and target computers
4.prepare the model for real-time execution
5.configure the build environment
6.connect to physical hardware
7.restart the target computer
8.build and download the real-time application
9.execute the real-time application
10.visualize signals
11.tune parameters
12.prepare regression and stress tests
Model preparation for real-time execution
Control and Instrumentation
signal monitoring and tracing
Standalone Operation
standalone target computer setup
standalone boot method
Dos environment restrictions
if you want to use real-time scope blocks to display or record output ,select start scope when application starts in the block parameters dialog box
Standalone settings
(you copy files created from the build process to the target computer hard drive)
slrtexplr
boot mode > stand alone
real-time application build
code>c/c++code>build mode
create a folder ,containing the following files:
autoexec.bat 包含调用xpcboot.com启动Simulink实时内核的可执行文件
xpcboot.com 加载并执行*.rtb文件
slrtkrnl,rtb 包含Simulink实时独立内核,目标计算机的IP地址
name.mldatx 包含实时应用程序和特定于应用程序的数据
real-time application transfer and boot configuration
( the target computer support network boot mode)
1.restart the target computer in DOS mode and open the DOS prompt
2.save the copy of the target computer c:\autoexec.bat file to a backup file
3.start the target computer by using network boot mode
4.in the command window,change to the folder that contains the kernel and real-time application files
5.copy these files to the root folder of the target computer c:\drive
6.reatart the target computer
application transfer and boot configuration with flash drive
(the target computer dose not support network boot mode )
1.restart the target computer in DOS mode and open the DOS prompt
2.save the copy of the target computer c:\autoexec.bat file to a backup file
3.connect the flash to the development computer
4.copy four files to the root folder of the flash frive
5.connect the flash drive to the target computer
6.restart the target computer
Export and run explorer configuration as standalone executable(将资源管理器配置导出并作为独立可执行文件运行)
explorer configuration exported to run outside matlab
execution environment
run the standalone computer
64-bit computer
Microsoft® .NET Framework 4.5
target computer
boot mode :standalone
test :build and download a real-time application to target computer
signal groups
parameter groups
instrument panels
window layout
limitations as standalone executable
prepare explorer environment for export
run the standalone computer
64-bit computer
Microsoft® .NET Framework 4.5
target computer
properties
boot mode :stand alone
prepare instrument panel configuration for export
1.load instrument panels into srt explorer
2.Create a parameter group for the key block
3.create parameter groups for the low-level blocks
4.Create a signal group for the key blocks
5.Create signal groups for the low-level blocks
export explorer configuration
1.file>export
2.type name
Unpack and run standalone configuration
1.copy name.zip to a computer
2.Connect the target computer to the computer
3.Restart the target computer
4.Double-click runxpctank_instr_export.exe
deploy matlab application as standalone executable(将matlab应用程序部署为独立的可执行文件)
matlab runtime setup
1.type mcrinstaller
2.Copy the full path to the MCRInstaller
program into the Windows Run text box
3.Place the MATLAB Runtime in the default location, for example:
C:\Program Files\MATLAB\MATLAB Runtime
From the installation dialog box, copy and paste the location where the installer places the MATLAB Runtime binary files:
C:\Program Files\MATLAB\MATLAB Runtime\v93
4.Close MATLAB and open a Windows command prompt window
5.set PATH=C:\Program Files\MATLAB\MATLAB Runtime\v93\bin\win64;%PATH%
deploy matlab application to control real-time application
prerequisites
1.completed the steps in matlab runtime setup
2.Opened MATLAB from the Windows® command prompt window within which you performed MATLAB run-time setup
3.configure TCP/IPcommunication ,save the script in working folder
4.build the real-time application
package the matlab application
1.app>application compiler
2.add the name and summary information as required
3.save name.prj
4.add main file ,then navigate to the file name.m
5.packaging options>runtime included in package
6.package
7.save
run the matlab application
control and instrumentation with .net
configuration and execution
simulink real-time.NET API application creation
1.visual studio coding environment
use a third-party development environment (such as microsoft visual studio )
To run the application on a 64-bit computer, copy
xpcapi.dll
file from*matlabroot*\toolbox\rtw\targets\xpc\api\x64
to the folder where you build the executable application.Add a reference for
xPCFramework.dll
to your project by including the following in your code.using MathWorks.xPCTarget.FrameWork;
2.visual studio design environment
- Add
xPCFramework.dll
to the Visual Studio® Toolbox.- Add an
xPCTargetPC
object to the application form by dragging anxPCTargetPC
control from the Toolbox window to the design surface.- To explore and customize the
xPCTargetPC
properties, click thexPCTargetPC
control in the design surface.
simulink real-time .NET API application distribution
- When you build your application, the Visual Studio® software builds the files for your executable, including a
*.exe
file. When you distribute your application, include these files in the same folder.- Keep in mind that the client application depends on
xPCFramework.dll
, which depends onxpcapi.dll
.