Guy on Simulink

Simulink & Model-Based Design

Model-Based Design Dilemma

I am currently working on a model and I have a dilemma. There are two ways I could model my system. I need you to tell me which approach is best and why.

I need your help!

The Goal

I am building a model to drive a small robot made of Lego blocks. The system is similar to the NXTWay-GS submission on the MATLAB Central.

NXTWay-GS

Following a Model-Based Design approach, I want to setup my files so that I can easily develop my controller in simulation and generate code to test my algorithm on the real hardware. This means that in simulation I need to send my actuator commands to an LTI system approximating the system dynamics; and for code generation I need to send and receive signals from hardware drivers.

Hardware drivers and simulation model

My question now is: What is the best way to include these 2 sets of blocks in my model architecture?

Option 1: Two Top Models

My first option is to create 2 top models that will both refer to the same controller using model referencing.

I would have one top model for simulation:

Model for simulation

and one top model for code generation:

model for code generation

Option 2: Subsystem Variants

My second option is to create one top model. In this top model, use Subsystem Variants to switch between the simulation and the hardware drivers:

One top model with 2 variant

Now it's your turn

What architecture do you prefer? For which reasons? Do you see other options? I am very interested to hear your comments and ideas. Please leave a comment here.

|
  • print

댓글

댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.