Documente Academic
Documente Profesional
Documente Cultură
!*******************************************************
SUBROUTINE XDot(SVV,DSVV)
!
.
!
X = [A]X+[B]U
!*******************************************************
!
!
!
!
Appendix H
H.1
(Kind
(Kind
(Kind
(Kind
(Kind
(Kind
(Kind
(Kind
=
=
=
=
=
=
=
=
!
!
Initalize Variables
------------------Finish_Time = 1.0D-3
R = 1.0D0
L = 50.00D-6
V_source = 100.0
Tau = L/R
DeltaT = 50.0D-6
!
!
!
!
!
!
Seconds
Ohms
Henries
Volts
Seconds
Seconds
!
!
!
!
Ohms
Ohms
Ohms
Initially switch is open
m = 1
i(m) = 0.0
Time_Sec = 0.0
v(m) =100.0
v_load(m) = 0.0
K_i = (1-DeltaT*R/(2*L))/(1+DeltaT*R/(2*L))
K_v = (DeltaT/(2*L))/(1+DeltaT*R/(2*L))
G_eff = K_v
G_switch = 1.0/R_switch
OPEN (unit=10,status=unknown,file=SwitchRL1.out)
No_Steps= Finish_Time/DeltaT
IF(Max_Steps<No_Steps) THEN
STOP *** Too Many Steps ***
END IF
MainLoop: DO k=1,No_Steps,1
m=m+1
Time_Sec = k*DeltaT
!
!
!
!
!
!
!
!
H.2
The same case as in section H.1 is modelled here, however, the program is now
structured in a general manner, where each component is subjected to numerical
integrator substitution (NIS) and the conductance matrix is built up. Moreover, rather
than modelling the switch as a variable resistor, matrix partitioning is applied (see
section 4.4.1), which enables the use of ideal switches.
!===============================
!
PROGRAM EMT_Switch_RL
!
! Checked and correct 4 May 2001
!===============================
IMPLICIT NONE
! INTEGER SELECT_REAL_KIND
!INTEGER ,PARAMETER:: Real_18_4931 =SELECT_REAL_KIND(P=18,R=4931)
REAL*8
REAL*8
REAL*8
REAL*8
REAL*8
REAL*8
REAL*8
REAL*8
REAL*8
REAL*8
::
::
::
::
::
::
::
::
::
::
R,L,Tc
DeltaT
i_L,i_R,i_Source,i_Source2
R_switch,G_switch
G(3,3),v(3),I_Vector(2)
G_L,G_R
V_source
I_L_history
Multiplier
R_ON,R_OFF
INTEGER k,n,NoTimeSteps
INTEGER NoColumns
open(unit=11,status=unknown,file=vi.out)
NoTimeSteps = 6
NoColumns = 3
R_ON = 1.0D-10
R_OFF = 1.0D+10
! Ohms
! Ohms
Initialize Variables
-------------------I_Vector(1) =0.0D0
I_Vector(2) =0.0D0
i_L =0.0D0
DO k=1,3
v(k) = 0.000D0
END DO
!
!
!
!
Forward Reduction
----------------CALL Forward_Reduction_G(NoColumns,G,Multiplier)
!
!
!
!
!
!
!
!
!
!
!
!
Back-substitution
----------------v(3) = I_Vector(2)/G(2,2)
v(2) = (I_Vector(1)-G(1,2)*v(3))/G(1,1)
END DO
close(11)
1160 FORMAT(1X,F8.6,1X,6(G16.10,1X))
STOP
END
!====================================================
SUBROUTINE Form_G(G_R,G_L,G_switch,G)
!====================================================
IMPLICIT NONE
REAL*8 :: G(3,3)
REAL*8 :: G_L,G_R,G_switch
G(1,1) = G_switch + G_R
G(2,1) = - G_R
G(1,2) = - G_R
G(2,2) = G_L + G_R
G(1,3) = -G_switch
G(2,3) = 0.0D0
G(3,1) =
G(3,2) =
G(3,3) =
-G_switch
0.0D0
G_switch
CALL Show_G(G)
RETURN
END
!====================================================
SUBROUTINE Forward_Reduction_G(NoColumns,G,Multiplier)
!====================================================
IMPLICIT NONE
REAL*8 :: G(3,3)
REAL*8 :: Multiplier
INTEGER :: k,NoColumns
Multiplier = G(2,1)/G(1,1)
PRINT *, Multiplier= ,Multiplier
DO k=1,NoColumns
G(2,k) = G(2,k) - Multiplier*G(1,k)
END DO
RETURN
END
H.3
This program is used to demonstrate the numerical oscillation that occurs at turn-off,
by modelling an RL load fed from an a.c. source through a diode. The RL load
is modelled by one difference equation rather than each component separately. The
results are given in section 9.4.
!====================================================================
PROGRAM EMT_DIODE_RL1
!====================================================================
IMPLICIT NONE
INTEGER, PARAMETER:: RealKind_DP = SELECTED_REAL_KIND(15,307)
INTEGER, PARAMETER:: Max_Steps = 5000
REAL (Kind = RealKind_DP), PARAMETER :: pi = 3.141592653589793233D0
REAL
REAL
REAL
REAL
REAL
REAL
REAL
REAL
REAL
(Kind
(Kind
(Kind
(Kind
(Kind
(Kind
(Kind
(Kind
(Kind
=
=
=
=
=
=
=
=
=
RealKind_DP)
RealKind_DP)
RealKind_DP)
RealKind_DP)
RealKind_DP)
RealKind_DP)
RealKind_DP)
RealKind_DP)
RealKind_DP)
INTEGER :: k,m,ON,No_Steps
::
::
::
::
::
::
::
::
::
!
!
Initalize Variables
------------------f=50.0
Finish_Time = 60.0D-3
R = 100.0
L = 500D-3
Tau = L/R
DeltaT = 50.0D-6
V_mag = 230.0*sqrt(2.)
V_ang = 0.0
R,L,Tau,f
DeltaT,Time_Sec
K_i,K_v
R_switch,G_switch
V_mag,V_ang
I_inst,I_history
i(Max_Steps),v(Max_Steps),v_load(Max_Steps)
R_ON,R_OFF
G_eff,Finish_Time
R_ON = 1.0D-10
R_OFF = 1.0D10
R_Switch = R_ON
m=1
i(m) = 0.0
Time_Sec = 0.0
v(m) = V_mag*sin(V_ang*pi/180)
v_load(m)=v(m)
ON=1
K_i = (1-DeltaT*R/(2*L))/(1+DeltaT*R/(2*L))
K_v = (DeltaT/(2*L))/(1+DeltaT*R/(2*L))
G_eff = K_v
G_switch = 1.0/R_switch
OPEN (unit=10,status=unknown,file=DiodeRL1.out)
No_Steps= Finish_Time/DeltaT
IF(Max_Steps<No_Steps) THEN
STOP *** Too Many Steps ***
END IF
MainLoop: DO k=1,No_Steps,1
m=m+1
Time_Sec = k*DeltaT
!
!
!
!
!
!
!
!
H.4
This program evaluates the step response of a simple lossless transmission line, as
shown in section 6.6.
!==========================================================
PROGRAM Lossless_TL
!
! A simple lossless travelling wave transmission line
!==========================================================
IMPLICIT NONE
INTEGER, PARAMETER:: RealKind_DP = SELECTED_REAL_KIND(15,307)
INTEGER, PARAMETER:: TL_BufferSize = 100
!
!
Vsend(TL_BufferSize)
Vrecv(TL_BufferSize)
Isend_Hist(TL_BufferSize)
Irecv_Hist(TL_BufferSize)
REAL
REAL
REAL
REAL
REAL
REAL
REAL
REAL
REAL
REAL
L_dash,C_dash,Length
DeltaT
Time
R_Source,R_Load
V_Source,I_Source
Gsend,Grecv,Rsend,Rrecv
Zc, Gamma
Finish_Time,Step_Time
i_send ! Sending to Receiving end current
i_recv ! Receiving to Sending end current
(Kind=RealKind_DP)
(Kind=RealKind_DP)
(Kind=RealKind_DP)
(Kind=RealKind_DP)
(Kind=RealKind_DP)
(Kind=RealKind_DP)
(Kind=RealKind_DP)
(Kind=RealKind_DP)
(Kind=RealKind_DP)
(Kind=RealKind_DP)
INTEGER
INTEGER
INTEGER
INTEGER
::
::
::
::
::
::
::
::
::
::
Position
PreviousHistoryPSN
k,NumberSteps,Step_No
No_Steps_Delay
OPEN(UNIT=10,file=TL.out,status="UNKNOWN")
!
!
=
=
=
=
Initialize Buffers
DO k=1,TL_BufferSize
Vsend(k) = 0.0D0
Vrecv(k) = 0.0D0
Isend_Hist(k) = 0.0D0
Irecv_Hist(k) = 0.0D0
END DO
Position = 0
NumberSteps = NINT(Finish_Time/DeltaT)
!
!
!
!
!
!
Update Sources
-------------IF(Time< 5*DeltaT) THEN
V_Source = 0.0
ELSE
V_Source = 100.0
END IF
I_Source = V_Source/R_Source
!
!
!
!
!
!
WRITE(10,1000) Time,Vsend(Position),Vrecv(Position),i_send,i_recv,
Isend_Hist(Position),Irecv_Hist(Position)
END DO
1000 FORMAT(1X,7(G16.6,1X))
CLOSE(10)
PRINT *, Successful Completion
END
H.5
In this example the step response of a simple transmission line with lumped losses
(Bergeron model) is evaluated (see section 6.6).
!==========================================================
PROGRAM TL_Bergeron
! Bergeron Line Model (Lumped representation of Losses)
!==========================================================
IMPLICIT NONE
INTEGER, PARAMETER:: RealKind_DP = SELECTED_REAL_KIND(15,307)
INTEGER, PARAMETER:: TL_BufferSize = 100
!
!
Vsend(TL_BufferSize)
Vrecv(TL_BufferSize)
Isend_Hist(TL_BufferSize)
Irecv_Hist(TL_BufferSize)
REAL
REAL
REAL
REAL
REAL
REAL
REAL
REAL
REAL
R_dash,L_dash,C_dash,Length
DeltaT,Time
R,R_Source,R_Load
V_Source,I_Source
Gsend,Grecv,Rsend,Rrecv
Zc, Zc_Plus_R4,Gamma
Finish_Time,Step_Time
i_send ! Sending to Receiving end current
i_recv ! Receiving to Sending end current
(Kind=RealKind_DP)
(Kind=RealKind_DP)
(Kind=RealKind_DP)
(Kind=RealKind_DP)
(Kind=RealKind_DP)
(Kind=RealKind_DP)
(Kind=RealKind_DP)
(Kind=RealKind_DP)
(Kind=RealKind_DP)
INTEGER
INTEGER
INTEGER
INTEGER
::
::
::
::
::
::
::
::
::
Position
PreviousHistoryPSN
k,NumberSteps,Step_No
No_Steps_Delay
OPEN(UNIT=10,file=TL.out,status="UNKNOWN")
R_dash = 100D-6
L_dash = 400D-9
C_dash = 40D-12
Length = 2.0D5
DeltaT = 50D-6
R_Source = 0.1
R_Load = 100.0
Finish_Time = 1.0D-4
Step_Time=5*DeltaT
CALL ReadTLData(R_dash,L_dash,C_Dash,Length,DeltaT,R_Source,
R_Load,Step_Time,Finish_Time)
R=R_Dash*Length
Zc = sqrt(L_dash/C_dash)
Gamma = sqrt(L_dash*C_dash)
No_Steps_Delay = Length*Gamma/DeltaT
Zc_Plus_R4 = Zc+R/4.0
!
!
Gsend
Rsend
Grecv
Rrecv
=
=
=
=
DO k=1,TL_BufferSize
Vsend(k) = 0.0D0
Vrecv(k) = 0.0D0
Isend_Hist(k) = 0.0D0
Irecv_Hist(k) = 0.0D0
END DO
Position = 0
Position = 0
NumberSteps = NINT(Finish_Time/DeltaT)
DO Step_No = 1,NumberSteps,1
Time = DeltaT*Step_No
Position = Position+1
!
!
!
!
Update Sources
-------------IF(Time< 5*DeltaT) THEN
V_Source = 0.0
ELSE
V_Source = 100.0
END IF
I_Source = V_Source/R_Source
!
!
!
!
WRITE(10,1000) Time,Vsend(Position),Vrecv(Position),
i_send,i_recv,Isend_Hist(Position),Irecv_Hist(Position)
END DO
1000 FORMAT(1X,7(G16.6,1X))
CLOSE(10)
PRINT *, Successful Completion
END
H.6
This program demonstrates the implementation of a full frequency-dependent transmission line and allows the step response to be determined. This is an s-domain
implementation using recursive convolution. For simplicity interpolation of buffer
values is not included. Results are illustrated in section 6.6.
!==========================================================
PROGRAM TL_FDP_s
!
! Simple Program to demonstrate the implementation of a
! Frequency-Dependent Transmission Line using s-domain representation.
!
!
Isend(w)
Irecv(w)
!
------>---------<----!
|
|
!
--------------!
|
|
|
|
!
_|__
/
/
_|__
!
| | /
/
| |
! Vs(w)
|Yc|
| /
| / |Yc|
Vr(w)
!
|__|
/
/
|__|
!
|
| Ih_s
| Ih_r |
!
--------------!
|
|
!
---------------------!
!==========================================================