auralius / soft-rt-simulink-arduino

Soft Real-time System with Simulink and Arduino

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Soft Real-time System with Simulink and Arduino

The aim here is to build a (low-cost) soft real-time system by using Arduino as an IO server (data acquisition device). The software that we use is MATLAB Simulink 2018b. The developed real-time system will be used for controlling low dynamic systems, such as thermal and fluidic systems, while performing data acquisition process. The real-time system is expected to run at a 10 Hz of sampling rate, with the capability to log data to its hard drive at each iteration, thus, the resulting data is equally timed.

Steps to do:

Here, we assume you have successfully installed the Simulink Support Packages for Arduino. After running the MATLAB, go to system monitor (in Linux system) or task manager (in Windows system), and set the MATLAB priority to be the highest. Sort the process lists based on the priority and make sure that MATLAB has the highest priority. You must set priority of other processes to normal if they consume rather high processor power.

alt text

Figure 1: In Linux, process priority value is called "nice value": the lower the nice value is, the higher the priority is. -20 is the highest prority in a Linux system. In a Windows system, the highest priority is labelled as “realtime”.

Next, run the provided MATLAB Simulink file. A Simulink file named: Template10HzUno.slx is provided. Use this file as a template to build your project (see Figure 2). You can adapt the configuration to suit your hardware selections. However, before continuing with your project, you should perform jitter test. Run the Simulink file for at least 60 seconds and then use the m-file named: jitter_tes_result.m to plot the result. Your system should have jitter less than 1% (see Figure 3).

alt text

Figure 2: Run this model for about 60 seconds. A file named loggedtime.mat is generated.

alt text

Figure 3: Jitter result from jitter_test_result.m showing jitter of less than one percent.


alt text

Figure 4: For Windows user, use the Task Manager to increase MATLAB prioriy.


Contact:

manurung.@yandex.com

About

Soft Real-time System with Simulink and Arduino


Languages

Language:MATLAB 100.0%