www.gusucode.com > ecoder 案例源码程序 matlab代码 > ecoder/MultirateModelingInMultitaskingModeVxWorksOSExample.m
%% Multirate Modeling in Multitasking Mode (VxWorks(R) OS) % This example generates code for a multirate discrete-time model % configured for a multitasking operating system target (VxWorks(R)). The % model contains two sample times. Inport block 1 and Inport block 2 specify % 1-second and 2-second sample times, respectively, which are enforced by % the *Periodic sample time constraint* solver configuration parameter setting. % The solver is set for multitasking operation, which means a Rate Transition % block is required to ensure that data integrity is enforced when the 1-second % task preempts the 2-second task. Simulink(R) and the code generator % enforce proper rate transitions. This model specifies an explicit % Rate Transition block. Alternatively, you can instruct Simulink(R) to % insert this block for you by setting the *Automatically handle data transfers % between tasks* solver configuration parameter. % % The model is configured to display sample-time colors upon diagram update. % Red represents the fastest discrete sample time in the model, green represents % the second fastest, and yellow represents mixed sample times. Click the % *Display Sample Time Colors* button to update the diagram and show % sample-time colors. % % Copyright 2015 The MathWorks, Inc. %% Example Model % model = 'rtwdemo_mrmtos'; open_system(model);