Blame view

SRC/BUNDLE_DOMAIN_CREATION/plot_bundle_cross_section.F90 9.39 KB
886c558b   Steve Greedy   SACAMOS Public Re...
1
!
fe64b32b   Chris Smartt   Update file heade...
2
! This file is part of SACAMOS, State of the Art CAble MOdels for Spice. 
886c558b   Steve Greedy   SACAMOS Public Re...
3
4
5
! It was developed by the University of Nottingham and the Netherlands Aerospace 
! Centre (NLR) for ESA under contract number 4000112765/14/NL/HK.
! 
fe64b32b   Chris Smartt   Update file heade...
6
! Copyright (C) 2016-2018 University of Nottingham
886c558b   Steve Greedy   SACAMOS Public Re...
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
! 
! SACAMOS is free software: you can redistribute it and/or modify it under the 
! terms of the GNU General Public License as published by the Free Software 
! Foundation, either version 3 of the License, or (at your option) any later 
! version.
! 
! SACAMOS is distributed in the hope that it will be useful, but 
! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
! or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
! for more details.
! 
! A copy of the GNU General Public License version 3 can be found in the 
! file GNU_GPL_v3 in the root or at <http://www.gnu.org/licenses/>.
! 
! SACAMOS uses the EISPACK library (in /SRC/EISPACK). EISPACK is subject to 
! the GNU Lesser General Public License. A copy of the GNU Lesser General Public 
! License version can be found in the file GNU_LGPL in the root of EISPACK 
! (/SRC/EISPACK ) or at <http://www.gnu.org/licenses/>.
! 
! The University of Nottingham can be contacted at: ggiemr@nottingham.ac.uk
!
fe64b32b   Chris Smartt   Update file heade...
28
!
886c558b   Steve Greedy   SACAMOS Public Re...
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
! FILE CONTENTS:
!SUBROUTINE plot_bundle_cross_section
!
!
! NAME
!     SUBROUTINE plot_bundle_cross_section
!
! DESCRIPTION
!  This subroutine plots the cross section of the cables (conductors and dielectrics) which 
!  contitute a cable bundle.
!     
! COMMENTS
!     
!
! HISTORY
!    started 2/12/2015 CJS
!    9/5/2016 CJS   plot bundle cross section to jpeg file as well as the screen
!    14/6/2016 CJS  Create the arrays of x and y coordinates of each conductor which are used in the incident field excitation
!    5/9/2016 CJS   include additional shielded cable types with surface impedance loss models
!    20/4/2017 CJS  Separate the set_conductor_positions_for_Einc process from plot_bundle_cross_section and make use of generate_shapes.F90
44c11f06   Chris Smartt   Include software ...
49
!    16/3/2018 CJS plot ML_flex_cable 
886c558b   Steve Greedy   SACAMOS Public Re...
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
!

SUBROUTINE plot_bundle_cross_section(bundle)

USE type_specifications
USE general_module
USE constants
USE cable_module
USE cable_bundle_module
USE PUL_parameter_module
USE filter_module
USE maths

  IMPLICIT NONE

! variables passed to subroutine

  type(bundle_specification_type),intent(INOUT)    :: bundle
  
! local variables
  
  integer:: cable
  real(dp) :: xmin,xmax,ymin,ymax   ! the extent of the plot area
  real(dp) :: xc,yc                 ! the centre of the plot area
  real(dp) :: length                ! edge length of the plot area
  
  integer :: conductor              ! counter for conductors
  integer :: i                      ! loop counter
  
  real(dp) ::  FC_x0,FC_y0,theta    ! flex cable conductor offset and rotation angle

! START
  
! open files for the dielectric and conductor geometry data

  open(unit=dielectric_geometry_file_unit,file=dielectric_geometry_filename)  ! file for dielectric geometry

  open(unit=conductor_geometry_file_unit,file=conductor_geometry_filename)  ! file for conductor geometry

! reset the extent of the plot area
  xmin=1D30
  xmax=-1D30
  ymin=1D30
  ymax=-1D30
  
! loop over the cables calling the appropriate plot routine for each cable in turn
! except for the ground plane which is done later once a scale for the goemetry has been worked out

  do cable=1,bundle%n_cables
  
    if (bundle%cable(cable)%cable_type.EQ.cable_geometry_type_cylindrical) then

      CALL cylindrical_plot( bundle%cable(cable),                 &
                      bundle%cable_x_offset(cable), &
                      bundle%cable_y_offset(cable), &
                      bundle%cable_angle(cable),xmin,xmax,ymin,ymax )
                                             
    else if (bundle%cable(cable)%cable_type.EQ.cable_geometry_type_coax) then
    
      CALL coax_plot( bundle%cable(cable),                 &
                      bundle%cable_x_offset(cable), &
                      bundle%cable_y_offset(cable), &
                      bundle%cable_angle(cable),xmin,xmax,ymin,ymax )
                                             
    else if (bundle%cable(cable)%cable_type.EQ.cable_geometry_type_twinax) then
    
      CALL twinax_plot( bundle%cable(cable),                 &
                      bundle%cable_x_offset(cable), &
                      bundle%cable_y_offset(cable), &
                      bundle%cable_angle(cable),xmin,xmax,ymin,ymax )
                                                                                          
    else if (bundle%cable(cable)%cable_type.EQ.cable_geometry_type_twisted_pair) then
    
      CALL twisted_pair_plot( bundle%cable(cable),                 &
                      bundle%cable_x_offset(cable), &
                      bundle%cable_y_offset(cable), &
                      bundle%cable_angle(cable),xmin,xmax,ymin,ymax )
                                             
    else if (bundle%cable(cable)%cable_type.EQ.cable_geometry_type_shielded_twisted_pair) then
    
      CALL shielded_twisted_pair_plot( bundle%cable(cable),                 &
                      bundle%cable_x_offset(cable), &
                      bundle%cable_y_offset(cable), &
                      bundle%cable_angle(cable),xmin,xmax,ymin,ymax )
                                                                                          
    else if (bundle%cable(cable)%cable_type.EQ.cable_geometry_type_overshield) then
    
      CALL overshield_plot( bundle%cable(cable),                 &
                      bundle%cable_x_offset(cable), &
                      bundle%cable_y_offset(cable), &
                      bundle%cable_angle(cable),xmin,xmax,ymin,ymax )
                                                                                          
    else if (bundle%cable(cable)%cable_type.EQ.cable_geometry_type_spacewire) then
    
      CALL spacewire_plot( bundle%cable(cable),                 &
                      bundle%cable_x_offset(cable), &
                      bundle%cable_y_offset(cable), &
                      bundle%cable_angle(cable),xmin,xmax,ymin,ymax )
                                                                                           
    else if (bundle%cable(cable)%cable_type.EQ.cable_geometry_type_flex_cable) then
    
      CALL flex_cable_plot( bundle%cable(cable),                 &
                      bundle%cable_x_offset(cable), &
                      bundle%cable_y_offset(cable), &
                      bundle%cable_angle(cable),xmin,xmax,ymin,ymax )
44c11f06   Chris Smartt   Include software ...
155
156
157
158
159
160
161
                                                                                           
    else if (bundle%cable(cable)%cable_type.EQ.cable_geometry_type_ML_flex_cable) then
    
      CALL ML_flex_cable_plot( bundle%cable(cable),                 &
                      bundle%cable_x_offset(cable), &
                      bundle%cable_y_offset(cable), &
                      bundle%cable_angle(cable),xmin,xmax,ymin,ymax )
886c558b   Steve Greedy   SACAMOS Public Re...
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
                                              
    else if (bundle%cable(cable)%cable_type.EQ.cable_geometry_type_dconnector) then
    
      CALL dconnector_plot( bundle%cable(cable),                 &
                      bundle%cable_x_offset(cable), &
                      bundle%cable_y_offset(cable), &
                      bundle%cable_angle(cable),xmin,xmax,ymin,ymax )
                                                
    end if
    
  end do ! read the next cable file in the bundle
  
! we now have the extent of the bundle so we can add the ground plane to the plot if it exists

  do cable=1,bundle%n_cables
      
     if (bundle%cable(cable)%cable_type.EQ.cable_geometry_type_ground_plane) then

! include the 'mid point' of the ground plane in the plot extent calculation
    
      xmin=min(xmin,bundle%cable_x_offset(cable))
      xmax=max(xmax,bundle%cable_x_offset(cable))
      ymin=min(ymin,bundle%cable_y_offset(cable))
      ymax=max(ymax,bundle%cable_y_offset(cable))
! edge length of the plot area including a bit of addional space to include some ground plane     
      length=2d0*max(xmax-xmin,ymax-ymin)                ! length of the ground plane to plot

      CALL ground_plane_plot( bundle%cable(cable),         &
                              bundle%cable_x_offset(cable), &
                              bundle%cable_y_offset(cable), &
                              bundle%cable_angle(cable),length,xmin,xmax,ymin,ymax )
    
    end if
    
  end do ! read the next cable file in the bundle

! close the conductor and dielectric data files
  close(unit=dielectric_geometry_file_unit)
  close(unit=conductor_geometry_file_unit)

! open file for plotting the frame surrounding the bundle. The frame improves the
! look of the plot.

  open(unit=frame_geometry_file_unit,file=frame_geometry_filename) 

! work out the plotting area
! get the centre of the plot area

  xc=(xmax+xmin)/2d0
  yc=(ymax+ymin)/2d0
  
! edge length of the plot area including a bit of addional space to include some ground plane  
   
  length=1.5d0*max(xmax-xmin,ymax-ymin)                ! edge length of the plot area
    
  xmin=xc-length/2d0
  xmax=xc+length/2d0
  ymin=yc-length/2d0
  ymax=yc+length/2d0

! write the frame coordinates to file  
  write(frame_geometry_file_unit,*)xmin,ymin
  write(frame_geometry_file_unit,*)xmin,ymax
  write(frame_geometry_file_unit,*)xmax,ymax
  write(frame_geometry_file_unit,*)xmax,ymin
  write(frame_geometry_file_unit,*)xmin,ymin
  
  close(unit=frame_geometry_file_unit) 

END SUBROUTINE plot_bundle_cross_section