milkypros
Technical User
- Oct 25, 2009
- 11
An RL circuit is described by the first order differential equation: L.(dI(t)/dt)+R.I(t)=V(t) where V(t)=Vo.e^(-t/?). The total current I according to Taylor rule is described by the equation
I(i+1)=((1/(1+(h/d)))*I(i))+((h/d)/(1+(h/d))*(V(i+1)/R)). I wrote the program below but it seems that there is a problem i can't find since i am new to fortran. Can anyone help?
dimension t(0:30),I(0:30)
L=32.690*10**(-6) !(Henri)
R=10.998*10**(-3) !(Ohm)
V=0.212 !(volt)
?=6.6 !(time constant ?: msec)
d=L/R
t1=0 !(msec)
t2=8 !(msec)
t(0)=t1
I(0)=0 !I=current
n=80
h=(t2-t1)/n !h=?t
do i=0, n-1
t(i+1)=t(i)+h
I(i+1)=((1/(1+(h/d)))*I(i))+(((h/d)/(1+(h/d)))* (V(i+1)/R))
V=V*(exp(-t/?))
dI(t)=(V(t)-R*I(t))/L !current derivative
PL(t)=L*I(t)*dI(t) !inductive power
PR(t)=R*(I**2(t)) !ohmic power
Pv(t)=V(t).I(t) !power transmited from battery
end do
do i=0 , n
print*, t(i),I(i),dI(t),PL(t),PR(t),Pv(t)
end do
end
I(i+1)=((1/(1+(h/d)))*I(i))+((h/d)/(1+(h/d))*(V(i+1)/R)). I wrote the program below but it seems that there is a problem i can't find since i am new to fortran. Can anyone help?
dimension t(0:30),I(0:30)
L=32.690*10**(-6) !(Henri)
R=10.998*10**(-3) !(Ohm)
V=0.212 !(volt)
?=6.6 !(time constant ?: msec)
d=L/R
t1=0 !(msec)
t2=8 !(msec)
t(0)=t1
I(0)=0 !I=current
n=80
h=(t2-t1)/n !h=?t
do i=0, n-1
t(i+1)=t(i)+h
I(i+1)=((1/(1+(h/d)))*I(i))+(((h/d)/(1+(h/d)))* (V(i+1)/R))
V=V*(exp(-t/?))
dI(t)=(V(t)-R*I(t))/L !current derivative
PL(t)=L*I(t)*dI(t) !inductive power
PR(t)=R*(I**2(t)) !ohmic power
Pv(t)=V(t).I(t) !power transmited from battery
end do
do i=0 , n
print*, t(i),I(i),dI(t),PL(t),PR(t),Pv(t)
end do
end