Main Content

Model a System Algorithm

When incomplete system requirements and a developing system design prevent you from defining file management and model architecture upfront, you can still model fundamental system algorithms. By organizing the model into inputs, outputs, and systems, you create a general framework for model components as the model grows.

To show the first stage of a modeling workflow that begins with limited information, this example uses a simple mechanical system composed of a mass, spring, and damper.

This second-order differential equation characterizes the system.

$$m\ddot{x} + c\dot{x} + kx = F$$

In this equation:

  • $m$ is mass.

  • $c$ is the damping coefficient.

  • $k$ is the spring constant.

  • $\ddot{x}$ is acceleration.

  • $\dot{x}$ is velocity.

  • $x$ is displacement.

  • $F$ is external force.

Solving for $\ddot{x}$ provides a form of this equation that maps more clearly to a Simulink® model.

$$\ddot{x} = \frac{1}{m}(F-c\dot{x}-kx)$$

The model named ex_modeling_simple_system represents this equation.

A Sum block computes the net force applied to the mass. The Gain block labeled 1/m computes the acceleration of the mass by multiplying the net force by $1/m$. The Integrator, Second-Order block solves for the velocity and position of the mass.

The model organizes the blocks into three areas:

  • The area named Sources contains system inputs.

  • The area named System contains blocks that represent the system, or plant.

  • The area named Sinks contains system outputs.

By organizing the model upfront, you create a general framework for model components as the model grows.

Because this example shows a model in the preliminary stages of development, the actual input force is unknown and can be represented by a variety of standard source blocks. The model uses a Step block connected as input to the system. Some alternative source blocks are shown but commented out. For example, you can use the From Spreadsheet block to load empirical data if the data is available.

Similarly, a variety of sink blocks can accept the output displacement. To check whether simulation results meet expectations, the model uses a Scope block to visualize the signals.

Related Topics