Screamer Project  V3.3.1
Screamer Structure
 All Files Functions Variables
settrlin.f
Go to the documentation of this file.
1  subroutine setup_trline (ib, ibk, icounter, na, iflgs, switch,
2  & ic_type, ic_counter)
3 c
4 c Define passed variables
5 c
6  integer ib, ibk, icounter, na, iflgs, switch,
7  & ic_type, ic_counter
8 c
9 c ---------------------------------------------------------------------------
10 c Modifications:
11 c 02/08/94, KWS, Modified to eliminate last capacitor element and
12 c set Z for first/last segments to be Zin/Zout exactly.
13 c 08/12/97, MLK, Corrected formula for exponential line segments
14 c 2014-05-02 RBS: Changed integer*4 to integer
15 c ---------------------------------------------------------------------------
16 c
17 c Set up for a transmission line or MITL.
18 c
19  include 'zdemparm.h'
20  include 'zdemmax.h'
21  include 'zdemcomm.h'
22  include 'zdemwork.h'
23  parameter(factor = 4.38e3)
24 c
25 c Set up for lossless line or MITL
26 c
27  if (switch .eq. transline) then
28  tau = pin(1,ibk,ib)
29  zin = pin(2,ibk,ib)
30  zout = pin(3,ibk,ib)
31  tres = pin(4,ibk,ib)
32  itype = itrl_type(icounter)
33  else if (switch .eq. mitline) then
34  tau = pin(3,ibk,ib)
35  zin = pin(4,ibk,ib)
36  zout = zin
37  tres = pin(5,ibk,ib)
38  itype = linearz
39  else if (switch .eq. pmitline) then
40  tau = pin(2,ibk,ib)
41  zin = pin(3,ibk,ib)
42  zout = zin
43  tres = pin(4,ibk,ib)
44  itype = linearz
45  end if
46 c
47 c Determine the number of segments given the resolution time.
48 c
49  na = int((tau / tres) + 0.5)
50  if (na .lt. 2) then
51  na = 2
52  else if (na .ge. max_trline_nodes) then
53  na = max_trline_nodes
54  end if
55  nseg = na
56  n1 = nr(ib) + 1
57  n2 = nr(ib) + nseg
58 c
59 c Set the blocks up for linear or exponential variation in z
60 c
61  delt = tau / nseg
62 c
63 c Do a linear variation.
64 c
65  if (itype .eq. linearz) then
66  alpha = (zout-zin) / float(nseg-1)
67  do ie = n1, n2
68  zele = zin + alpha * float(ie-n1)
69  shuntc = delt / zele
70  seriesl = delt * zele
71  c(ie,ib) = shuntc
72  zlr(ie,ib) = seriesl
73  g(ie,ib) = 0.0
74  rr(ie,ib) = 0.0
75  iflg(ie,ib) = iflgs
76  cechk(ie,ib) = shuntc
77  zlrechk(ie,ib) = seriesl
78  end do
79 c
80 c Exponential variation.
81 c
82  else if (itype .eq. exponentialz) then
83 c
84  alpha = (log(zout/zin))/(n2-n1)
85  do ie = n1, n2
86  zele = zin*exp((ie-n1)*alpha)
87  shuntc = delt / zele
88  seriesl = delt * zele
89  c(ie,ib) = shuntc
90  zlr(ie,ib) = seriesl
91  g(ie,ib) = 0.0
92  rr(ie,ib) = 0.0
93  iflg(ie,ib) = iflgs
94  cechk(ie,ib) = shuntc
95  zlrechk(ie,ib) = seriesl
96  end do
97  end if
98 c
99 c Set up some MITL indicies for resetting the conductances later.
100 c
101  if (switch .eq. mitline) then
102  indexmitl(1,icounter) = ib
103  indexmitl(2,icounter) = ibk
104  indexmitl(3,icounter) = n1
105  indexmitl(4,icounter) = n2
106  indexmitl(5,icounter) = switch
107  pin(3,ibk,ib) = delt
108  else if (switch .eq. pmitline) then
109  indexmitl(1,icounter) = ib
110  indexmitl(2,icounter) = ibk
111  indexmitl(3,icounter) = n1
112  indexmitl(4,icounter) = n2
113  indexmitl(5,icounter) = switch
114  delperv=pin(1,ibk,ib) / nseg
115  pin(1,ibk,ib) = delperv
116  pin(2,ibk,ib) = delt
117  gap = factor*delt/(delperv*(exp(zin/60.)-1.0))
118  pin(5,ibk,ib) = gap
119  end if
120 c
121 c Setup for any initial voltage or current on the line.
122 c Set the voltage at all the nodes and
123 c add the energy resulting from the initial voltage to the initial
124 c energy total for capacitors.
125 c OR set the current at all but the last node and add the energy from
126 c the initial current to the energy total for all inductors.
127 c
128  if (ic_type .eq. vtrline) then
129  vinitial = value_init(ic_counter)
130  vinitial2 = 0.5 * vinitial * vinitial
131  ctot = 0.0
132  do ie = n1, n2
133  v(ie,ib) = vinitial
134  vn(ie,ib) = vinitial
135  ctot = ctot + c(ie,ib)
136  end do
137  ecapsource = ecapsource + ctot*vinitial2
138  else if (ic_type .eq. ctrline) then
139  cinitial = value_init(ic_counter)
140  cinitial2 = 0.5 * cinitial * cinitial
141  zlrtot = 0.0
142  do ie = n1, n2
143  zir(ie,ib) = cinitial
144  zirn(ie,ib) = cinitial
145  zlrtot = zlrtot + zlr(ie,ib)
146  end do
147  eindsource = eindsource + zlrtot*cinitial2
148  end if
149 c
150  return
151  end
c *****************************************************************************c Various format statements for read_screamer_data output c To get these into made format to be characters c for each line corrected spelling errors in format added statement for Zflow Plasma Loss Model added format for CSV output type fixed more lines longer than characters added format for Measure Zflow Block and forward c reverse current directions in Zflow plasma loss c and Zflow POS models added format for SFC output type c removed from all code calls c c c c c a80 c i10 c No grids on plots c Do not write files containing the plotted points c Execute only one cycle c Do not echo the setup parameters and indicies c c &exitting c a13 c c c c c c c c102 c &described as a function of time c c c &described as a function of time c c c &function of time c c shell c &min A K gap
Definition: zdemfmt.h:84
c *****************************************************************************c Various format statements for read_screamer_data output c To get these into made format to be characters c for each line c
Definition: zdemfmt.h:7
subroutine setup_trline(ib, ibk, icounter, na, iflgs, switch, ic_type, ic_counter)
Definition: settrlin.f:1
c *****************************************************************************c Various format statements for read_screamer_data output c To get these into made format to be characters c for each line corrected spelling errors in format added statement for Zflow Plasma Loss Model added format for CSV output type fixed more lines longer than characters added format for Measure Zflow Block and forward c reverse current directions in Zflow plasma loss c and Zflow POS models added format for SFC output type c removed from all code calls c c c c c a80 c i10 c No grids on plots c Do not write files containing the plotted points c Execute only one cycle c Do not echo the setup parameters and indicies c c &exitting c a13 c c c c c c c c102 c &described as a function of time c c c &described as a function of time c c c &function of time c c shell c &min A K c &trapped field c153 c c c Sin c c c remaining calls in rdscrelem c Tabular a10 Cond c c c &used with this model c Exponential model of a resistive switch
Definition: zdemfmt.h:118