Main Content

Build a Simple Actuator System

Build the Model

The Simulink®product is a software environment for modeling, simulating, and analyzing dynamic systems. Try building a simple model that drives an actuator with a sine wave and displays the actuator's position superimposed on the sine wave.

Note

If you prefer to open the complete model shown below instead of building it, enteraeroblktutorialat the MATLAB®command line.

The following section (Create a Model) explains how to build a model on Windows®platforms. You can use this same procedure to build a model on Linux®platforms.

The section describes how to build the model. It does not describe how to set the configuration parameters for the model. SeeSet Model Configuration Parameters for a Model. That topic describes the Configuration Parameters dialog box for models. If you do not set any configuration parameters, simulating models might cause warnings like:

Warning: Using a default value of 0.2 for maximum step size. The simulation step size will be equal to or less than this value. You can disable this diagnostic by setting 'Automatic solver parameter selection' diagnostic to 'none' in the Diagnostics page of the configuration parameters dialog

Create a Model

To create a new blank model and open the Simulink library browser:

  1. On the MATLABHometab, click Simulink. In the Simulink start page, click the Blank Model template, and then click Create Model.

  2. To open the Library Browser, click the browser button.

  3. Add aSine Waveblock to the model.

    1. ClickSourcesin the Library Browser to view the blocks in the Simulink Sources library.

    2. Drag the Sine Wave block from the Sources library into the new model window.

  4. Add aLinear Second-Order Actuatorblock to the model.

    1. Click thesymbol next toAerospace Blocksetin the Library Browser to expand the hierarchical list of the aerospace blocks.

    2. In the expanded list, clickActuatorsto view the blocks in the Actuator library.

    3. Drag the Linear Second-Order Actuator block into the model window.

  5. Add aMuxblock to the model.

    1. ClickSignal Routingin the Library Browser to view the blocks in the Simulink Signals & Systems library.

    2. Drag the Mux block from the Signal Routing library into the model window.

  6. Add aScopeblock to the model.

    1. ClickSinksin the Library Browser to view the blocks in the Simulink Sinks library.

    2. 拖动块范围从水槽图书馆为the model window.

  7. Resize the Mux block in the model.

    1. Click the Mux block to select the block.

    2. Hold down the mouse button and drag a corner of the Mux block to change the size of the block.

  8. Connect the blocks.

    1. Position the pointer near the output port of the Sine Wave block. Hold down the mouse button and drag the line that appears until it touches the input port of the Linear Second-Order Actuator block. Release the mouse button.

    2. Using the same technique, connect the output of the Linear Second-Order Actuator block to the second input port of the Mux block.

    3. Using the same technique, connect the output of the Mux block to the input port of the Scope block.

    4. Position the pointer near the first input port of the Mux block. Hold down the mouse button and drag the line that appears over the line from the output port of the Sine Wave block until double crosshairs appear. Release the mouse button. The lines are connected when a knot is present at their intersection.

  9. Set the block parameters.

    1. Double-click the Sine Wave block. The dialog box that appears allows you to set the block's parameters.

      For this example, configure the block to generate a 10 rad/s sine wave by entering10for theFrequencyparameter. The sinusoid has the default amplitude of1and phase of0specified by theAmplitudeandPhase offsetparameters.

    2. ClickOK.

      Sine Wave block configured for frequency 10

    3. Double-click the Linear Second-Order Actuator block.

      In this example, the actuator has the default natural frequency of150rad/s, a damping ratio of0.7, and an initial position of0radians specified by theNatural frequency,Damping ratio, andInitial positionparameters.

    4. ClickOK.

      Linear Second-Order Actuator block natural frequency set to 150, damping ration set to 0.7

Run the Simulation

You can now run the model that you built to see how the system behaves in time:

  1. Double-click the Scope block if the Scope window is not already open on your screen. The Scope window appears.

  2. SelectRunfrom theSimulationmenu in the model window. The signal containing the 10 rad/s sinusoid and the signal containing the actuator position are plotted on the scope.

  3. Adjust the Scope block's display. While the simulation is running, right-click they-axis of the scope and selectAutoscale. The vertical range of the scope is adjusted to better fit the signal.

  4. Vary the Sine Wave block parameters.

    1. While the simulation is running, double-click the Sine Wave block to open its parameter dialog box.

    2. You can then change the frequency of the sinusoid. Try entering1or20in theFrequencyfield. Close the Sine Wave dialog box to enter your change. You can then observe the changes on the scope.

  5. Select停止from theSimulation菜单停止仿真。

Many parameterscannotbe changed while a simulation is running. This is usually the case for parameters that directly or indirectly alter a signal's dimensions or sample rate. However, there are some parameters, like the Sine WaveFrequencyparameter, that you cantunewithout stopping the simulation.

Run a Simulation from a Script

You can also modify and run a Simulink simulation from a script. By doing this, you can automate the variation of model parameters to explore a large number of simulation conditions rapidly and efficiently. For information on how to do this, seeRun Simulations Programmatically.

See Also

Related Topics