Home Download Help Forum Resources Extensions FAQ NetLogo Publications Contact Us Donate Models: Library Community Modeling Commons Beginners Interactive NetLogo Dictionary (BIND) NetLogo Dictionary User Manuals: Web Printable Chinese Czech Farsi / Persian Japanese Spanish

NetLogo User Community Models(back to the NetLogo User Community Models)
## WHAT IS IT?
This model simulates the effects of the doppler effect by emulating the frequency of sound heard by an observer as a train passes by. The doppler effect is defined as the apparent change in the frequency of a wave caused by relative motion between the source of the wave and the observer. For the driver of the train, the sound would consistently be heard at the same original frequency. However, since the sound waves appear to be closer together in the direction the train is traveling and spread further apart in the opposite direction, an observer would hear variations in relative frequency as the train passes him. A higher relative frequency would be observed in front of the train, and a lower relative freqency would be observed behind the train.
## HOW IT WORKS
The frequency heard by the observer is calculated based on the doppler effect equation. If the observer is moving towards the train, the speed of the observer is added in the numerator and subtracted if it is moving away from the train. If the train is moving towards the observer, the speed of the train is subtracted in the denominator and added if it is moving away from the observer. If the observer and train do not have the same y coordinate, the observer’s velocity is multiplied by the sine of theta and the train’s velocity is multiplied by the cosine of theta where theta is the angle between the train's forward velocity and the line of sight from the train to the observer.
The model simulates the motion of sound waves by emitting a "wave" from the train after a certain, userspecified interval. The waves are represened by creating a circle of 300 agents and then moving the agents forward during each time step.
## HOW TO USE IT
The model takes in inputs of both the observing person’s and train’s x and y positions. It also takes in inputs for the train’s velocity (horizontal only) and the observing person’s velocity (vertical only). The frequency of the train’s whistle, the emission interval of the sound waves, and the visibility of the sound waves are also user inputs. The visual outputs include a monitor that displays the frequency heard by the observing person at each tick, as well as a graph of the frequency heard by the observing person over time.
Once you've set the inputs, make sure that the speed slider at the top is set to "slower". Setting it two notches below "normal" will give the ideal speed to observe relative freqency.
Next, click the setup button and then the go button to watch the model run.
## THINGS TO NOTICE
Note that the sound heard by an observer is actually the combination of both frequency and intensity. This makes the observed noise sound as though it is heard in a smooth, parabolic increase and then decrease as the train passes the observer. The intensity of the sound does indeed follow this behavior. However, the frequency of the observed sound follows different graphical patterns, those that can be observed from test cases within this model.
When the observer is stationary and consistently has the same ycoordinate as the train, the relative pitch wil be constant while the observer is in front of the train and will drop right away to a lower constant after the train passes the observer. However, if the observer is not begin at the same ycoordinate as the train or is also in motion, the observer will experience a gradual decrease in pitch as the train approaches, a faster decrease in pitch as the train nears, and then again a gradual decrease in pitch as the train passes.
## THINGS TO TRY
Try running the model when the train and observer are positioned at the same initial y coordinates and the observer has no velocity. Then try giving the observer velocity. Try out the same velocity values for the train and observer but with them starting at different initial y coordinates. Try positioning the observer behind the train while the train travels forward. Try increasing the velocity of the train so that it travels at or even faster than the speed of sound.
## EXTENDING THE MODEL
In order to further the complexity of the model, the train could have parameters to accelerate. Furthermore, the calculations for observed frequency could be performed based on the observer sensing the frequency at which the waves hit him rather than using an equation. The observer could also have parameters to travel diagonally  appropriate changes to the equation would have to be made in order to accurately represent this.
## NETLOGO FEATURES
Use of the createorderedturtles command to create the sound waves. The wrap feature is disabled; instead, agents in the wave are terminated once they reach the frame boundaries.
## CREDITS AND REFERENCES
https://www.youtube.com/watch?v=h4OnBYrbCjY&t=50s
Wilensky, U. 1999. NetLogo 6.1.1. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and ComputerBased Modeling, Northwestern University. Evanston, IL.
This model was created by Pracheeti N. Shikarkhane
Appreciation is extended to the North Carolina School of Science and Mathematics for the opportunity to pursue this work. 
(back to the NetLogo User Community Models)