Module 4: Building and Simulating Your First Dynamic Model
4.1. Constructing a Multi-Signal Sine Wave Model
This exercise serves as your first practical application of the concepts learned thus far. Building a simple sine wave model is a classic introductory task in simulation environments—akin to a “hello, world” program. This process teaches the core skills of signal generation, visualization, and parameterization, which are fundamental to all subsequent modeling efforts.
We will construct a model that generates four distinct sine waves and displays them simultaneously.
- Setup: Begin by opening a new blank model and launching the Simulink Library Browser.
- Adding Sources: The blocks that generate signals are located in the Sources library.
- Navigate to the Sources library.
- Find the ‘Sine Wave’ block.
- Click and drag four separate instances of the ‘Sine Wave’ block onto your model workspace.
- Adding a Sink: To visualize the output signals, we need a block from the Sinks library.
- Navigate to the Sinks library.
- Find the ‘Scope’ block, which functions as a virtual oscilloscope.
- Drag one ‘Scope’ block into the model workspace.
At this stage, all the necessary blocks are on the canvas. However, they are not yet configured or connected, which is the crucial next step before the model can become functional.
4.2. Configuring Block Parameters and Running the Simulation
Block parameters are the configurable properties that define a block’s specific behavior. For our model to work as intended, we must adjust the parameters of both the ‘Scope’ and the ‘Sine Wave’ blocks.
First, we will configure the ‘Scope’ block to accept our four different input signals.
- Open Scope Parameters: Right-click on the ‘Scope’ block and select “Block Parameters” from the context menu.
- Access Settings: Inside the parameters window, click on the settings icon (often a gear or cogwheel).
- Change Number of Ports: Locate the option for “Number of input ports” and change the value from the default of 1 to 4.
- Apply Changes: Click “Apply” to confirm the change. The ‘Scope’ block on your canvas will now display four input ports.
Next, connect the output of each of the four ‘Sine Wave’ blocks to one of the newly created input ports on the ‘Scope’ block by drawing lines between them.
Now, we will parameterize each ‘Sine Wave’ block to give it a unique frequency.
- Open Sine Wave Parameters: Open the block parameters for the first ‘Sine Wave’ block (you can do this by right-clicking or simply double-clicking the block).
- Set Amplitude: Ensure the ‘Amplitude’ is set to 1. We will use this value for all four blocks.
- Set Frequencies: Set the ‘Frequency’ for each of the four blocks to a unique value. Use the following sequence:
- First Sine Wave: Frequency = 1
- Second Sine Wave: Frequency = 3
- Third Sine Wave: Frequency = 6
- Fourth Sine Wave: Frequency = 10
With all blocks configured and connected, the final step is to execute the simulation.
- Run the Simulation: Click the green ‘Run’ button in the model window’s toolbar.
- View the Output: Double-click the ‘Scope’ block. A new window will open, displaying a plot of the four distinct sine waves, each oscillating at its configured frequency.
This exercise demonstrates the complete modeling workflow: adding blocks, configuring their parameters to define their behavior, connecting them to establish a data flow, and running a simulation to observe and analyze the results. This same fundamental process can be applied to generate and manipulate a much wider variety of signals.