Week -2
1.)
Simulink Model Setup
Open Simulink:
- Launch MATLAB and open Simulink.
Create a New Model:
- Go to File > New > Model.
Add the Components:
- Battery: Use a DC Voltage Source block.
- Switch: Use a Switch block (or a Manual Switch).
- Solenoid: Use a Simscape block for a solenoid or a custom force block that simulates the plunger's motion.
- Bell: Represent this as a simple mechanical block that receives input from the solenoid (this could be a spring or mass block).
Parameters
Assume the following parameters for the components:
- Battery Voltage: V=12V
- Switch Timing: The switch will be closed for t=2s.
- Solenoid Force: Adjust parameters to simulate the pull of the solenoid (e.g., a force of 5N).
- Plunger Mass: m=0.1kg (this can be adjusted based on desired behavior).
Model Steps
Battery Configuration:
- Add a DC Voltage Source block and set it to 12V.
Switch Configuration:
- Add a Manual Switch or Switch block. Connect it to the battery and solenoid.
- To automate the switch for 2 seconds, you can use a Pulse Generator or Signal Builder block to control the switch state.
Solenoid Configuration:
- Use a Simscape block representing the solenoid or create a custom model with a force acting on the plunger based on the battery voltage.
- Connect the output of the switch to the solenoid input.
Mechanical Setup:
- Add a Mass block to represent the plunger.
- Add a Spring and Damper block if you want to model the physical properties of the plunger mechanism.
Output:
- Use a Scope block to visualize the movement of the plunger over time.
- Connect the output of the plunger (or force) to the scope to observe its behavior.
Sample Connections
- DC Voltage Source → Manual Switch → Solenoid.
- Solenoid → Mass (Plunger).
- Mass → Scope to observe displacement/velocity.
Running the Model
Set the Simulation Parameters:
- Go to Simulation > Model Configuration Parameters.
- Set the stop time to 5s to observe the plunger movement after the switch is released.
Run the Simulation:
- Click the Run button to simulate the model.
Observe the Output:
- Open the Scope to view how the plunger moves when the switch is closed for 2 seconds.
2.)
Simulink Model Setup
Open Simulink:
- Launch MATLAB and open Simulink.
Create a New Model:
- Go to File > New > Model.
Add Components:
- Temperature Source: Use a Signal Builder or Step block to generate the temperature profile.
- Thermistor: This can be represented simply by a transfer function or a sensor block that outputs the current temperature.
- Fan Control Logic: Use a Switch block to turn the fan ON/OFF based on the temperature.
- Fan Model: Use a Scope to visualize the fan state (ON/OFF).
Step-by-Step Configuration
1. Create the Temperature Source
Signal Builder Block:
- Drag a Signal Builder block from the Simulink library.
- Set it to output the following temperatures:
- From 0 to 10 seconds: 20∘C
- From 10 to 30 seconds: 27∘C
- From 30 to 50 seconds: 23∘C
You can set the points in the Signal Builder as follows:
- (0, 20)
- (10, 20)
- (10, 27)
- (30, 27)
- (30, 23)
- (50, 23)
2. Add the Thermistor
- The thermistor can be represented as a simple output from the temperature source. Just connect the output of the Signal Builder directly to the input of the switch.
3. Add Fan Control Logic
- Switch Block:
- Drag a Switch block from the Simulink library.
- Set the threshold of the switch to 25∘C to determine whether the fan should be ON or OFF.
- Connect the output of the temperature source to the first input of the Switch block.
4. Configure the Fan Output
- Fan State:
- For the second input of the switch, connect a constant block set to 0 (OFF) and a constant block set to 1 (ON) for the fan.
- Use a Scope to visualize the output of the Switch block, which will show the fan state (1 for ON, 0 for OFF).
5. Connect the Blocks
- Connect the output of the Signal Builder to the first input of the Switch block.
- Connect the second input of the Switch to the constant blocks (0 and 1).
- Connect the output of the Switch to a Scope block to visualize the fan state.
6. Set Simulation Parameters
- Go to Simulation > Model Configuration Parameters.
- Set the stop time to 50 seconds.
7. Run the Model
- Click the Run button to simulate the model.
- Open the Scope to observe the fan's state over time based on the temperature profile.
Saving the Model in Previous Version
Save the Model:
- Go to File > Save As.
- Choose a name for your model.
Convert to Previous Version:
- Go to File > Save As.
- Select Previous Version.
- Choose R2021a or any lower version.