Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

fhis program will be written in the c + + language, and recap pointers, structures, and dyramic memory allacation. Create a program that will selve

fhis program will be written in the c++ language, and recap pointers, structures, and dyramic memory allacation.
Create a program that will selve for voltage and current across a capacitor as a function of time.
Constant current source power supply
For charging a capacitor with a constant current power supply, the resulting circuit looks ike
The current through a capacitor as a function of time can be written as
I(t)=CdV(t)dt
Using a finite-difference method, the voltage across the capacitor can be found as
V(t+1)=V(t)+I(t)t1C
At time t=0, the voltage across the capacitor is 0.
Constant voltage seurce power supply
In this case, a resistor is used to protect the power supply. The resulting circuit loaks as
Vi(t)=Vr(t)+Vlon(t)
Insegrating equation (1) and plugging inte equation (3) with Chin's lae gipres
h(t)-f(t)n+1cf(r)dr
Taking die detivative of this equation and multiplying by C yive:
n(t+1:)=n(t)-r(l)Nct
At time t=0,I(t-0) is equal so 53.
Data Format
Use a structure that looks like
:
typodef struct _capacitor Gabstah
Solve for the voltage across the capacitor in the constant current case using
V(t+1)=V(t)+I(t)t1C
In words, this means that the voltage at the next time step (t+1) is equal to the voltage and the previous time step (t)
plus the current at the previous timestep (t) multiplied by t and inverse capacitance.
and the current through the capacitor using
I(t+1)=I(t)-I(t)RCt
Again, in words, this means that the current at the next timestep (t+1) is equal to the current at the previous timestep
(t-1) minus the current at the previous timestep (t) multiplied by resistance, capacitance and t.
Again in words, this means that the cursent at the neat tirestap t+1 is equal so the current at the previous timestep
(t-1) minus the curnent at the previous timestep (t) multipied by resistance. capocitance and t.
Uie the valuet of
t=1c*10s
hinal time - se 6s
Number of timatereps - ie h/fie 10- scovos
k=1kn
ct= tanis 12+
r(x)=10,2 A (for conetant current suaply)
V1-100 V (for conctant woltage sapply)
You will need to dyanmicaly allocute the tinse, woltsge, and cartert arrays in the structure, Output the fosulting
current and voltage for the capacitor for the diffenent changing circuits exry 200 timestops to the screen.
A loop over the number of timesteps will be feeded to iterate the voltage ard current is time, Start at timestep 1.
with timestep o being filled with the initial conditions given in the equation detalls.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Science Project Ideas In Health Care Volume 1

Authors: Zemelak Goraga

1st Edition

B0CPX2RWPF, 979-8223791072

More Books

Students also viewed these Databases questions

Question

Apply your own composing style to personalize your messages.

Answered: 1 week ago

Question

Format memos and e-mail properly.

Answered: 1 week ago