Outline:

Defining initial equation
Using if-else statement
Using Plotting perspective
Handling time and state events
Defining reinit() function
Rectify the errors in Messages Browser
Using Simulate button
Using Simulation Setup option
Specifying Stop Time
Using when statement