proj3c - Simulation Project 3: Electrical Circuit Simulator...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Simulation Project 3: Electrical Circuit Simulator Note: This is one of a few options for the CMPSC 201 Simulation Project. This option is designed with electrical engineering students in mind, but it is written to be accessible to anyone in the course who is interested. This project was designed in conjunction with Greg Link (PSU '06) of the Electrical and Computer Engineering Department at York College of Pennsylvania and Josh Petko of the PSU Electrical Engineering Department. Be sure to read the background information on simulations and random numbers on the general Simulation Project page . Theory In this project you will be simulating an electrical circuit called a low pass filter . The circuit has an input voltage, V in , and has a resistor (resistance R S ) and capacitor (capacitance C ). There's a load on the circuit, and its resistance is denoted by R L . At the end of a pass through this circuit, the voltage will change, resulting in output voltage V out . You'll also need to consider the current in different parts of the circuit. Consider the following illustration of our circuit: The equations that govern this circuit are: Equation 1: Equation 2: Equation 3: Equation 4: The voltage is governed by a function. In this project, we'll look at what happens with two different flavors of voltage functions: Step Function: Start the voltage at 0, change it to 1 on the first step, and keep it at 1. Alternatively,
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
invert this situation: start at 1, go to 0, stay at 0. Sine Function: Use a sine wave with time as an input to determine the voltage at a given time. The frequency of the sine function will produce varying effects. To simulate this circuit, we'll also need a time step , i.e. how much time to wait between passes through the circuit. Each pass through the circuit will correspond to an iteration of a loop in your simulation. Before you begin coding, you have some algebra to do. Use the equations above to find an expression for the derivative of v out with respect to time, i.e. dv out / dt . What you'll have is a first-order differential equation that you'll use to reset the voltage during each time step of the simulation. Handling the Derivative and Differential Equation You'll notice that Equation 4 contains a derivative and you were told you needed a first-order differential equation. We also know the initial value of v out , namely that it will match v in (and in most, but not all, cases
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 02/10/2011.

Page1 / 5

proj3c - Simulation Project 3: Electrical Circuit Simulator...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online