Blame view

GUI/SW1/SRC/BUNDLE_SCHEMATIC.cpp 41.5 KB
886c558b   Steve Greedy   SACAMOS Public Re...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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
/////////////////////////////////////////////////////////////////////////////////
//
// This file is part of SACAMOS, cable models for EMI simulations in SPICE.
// It was developed by the University of Nottingham and the Netherlands Aerospace
// Centre (NLR) for ESA under contract number 4000112765/14/NL/HK.
//
// Copyright (C) 2015 - 2017 University of Nottingham
//
// 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/>.
//
// wxWidgets is currently licenced under the "wxWindows Library Licence".
// A copy of the wxWindows Library Licence, Version 3.1 can be found in the file
// wxWindows_Library_Licence_v3-1 in the root or at:
// <https://www.wxwidgets.org/about/licence/>
//
// The University of Nottingham can be contacted at: ggiemr@nottingham.ac.uk
//
// File Contents:
//
// NAME
//     BUNDLE_SCHEMATIC.cpp
//
// DESCRIPTION
//     Functions to render cables - arguements: full path to .bundle_spec file
//
// AUTHOR(S)
//     Steve Greedy
//
/////////////////////////////////////////////////////////////////////////////////


#include "BUNDLE_SCHEMATIC.h"

void draw_bundle(wxPanel *Panel, wxString Path, wxString bundle_to_draw)
{
    int size_h, size_v;
    Panel->GetSize(&size_h, &size_v );

    wxClientDC dc(Panel);
    dc.Clear();

    // Draw centre lines
    dc.SetPen( wxPen( wxColor(224,224,224),1, wxDOT_DASH) );
    dc.DrawLine( 0, size_v/2, size_h,size_v/2 );
    dc.DrawLine( size_h/2, 0, size_h/2, size_v);

    dc.SetTextForeground(*wxBLACK);
    dc.DrawText("y=0", 5, (size_v/2)-20);
    dc.DrawText("x=0", (size_h/2)+5, size_v-20);

    float maxDimension;
    maxDimension = findMaxDim(bundle_to_draw);

    if (maxDimension == 0.0)
    {
        maxDimension = 0.02;
    }
    else
    {
        maxDimension = maxDimension * 2.0;
    }

    std::ifstream bundleFile;
    bundleFile.open (bundle_to_draw);
    if (bundleFile.fail()){
                wxMessageBox(bundle_to_draw , _("Failed to Open Bundle Specification"));
    }

    std::string bundle_str, cable_str;

    std::getline(bundleFile, bundle_str);
    std::getline(bundleFile, bundle_str);
    std::getline(bundleFile, bundle_str);
    std::getline(bundleFile, bundle_str);

    int cableCount;
    bundleFile >> cableCount;
    std::getline(bundleFile, bundle_str); //Read to end of line

    float scaleFactor = (size_h/2 * 1.0);
    float xCoord, yCoord;// rot;

    wxString scale;
    scale << maxDimension/2.0;

    dc.SetTextForeground(*wxBLUE);
    dc.SetPen( wxPen( wxColor(255,0,0),1 ) );
    dc.DrawLine( size_h/2, size_v-50, size_h-size_h/4, size_v-50 );
    dc.DrawLine( size_h/2, size_v-50, size_h/2, size_v-40 );
    dc.DrawLine( size_h-size_h/4, size_v-50, size_h-size_h/4, size_v-40 );

    dc.DrawText("scale (m)", (size_h/2+50), size_v-70);
    dc.DrawText(scale, (size_h/2+55), size_v-40);


    wxString component_cable, cableFileName;

    for (int cable_no = 0; cable_no < cableCount; cable_no++)
    {
        std::getline(bundleFile, bundle_str);
        wxString cable_spec(bundle_str);

3d24aeb1   Steve Greedy   Modification to s...
114
115
        wxString separator(wxFileName::GetPathSeparator());

886c558b   Steve Greedy   SACAMOS Public Re...
116
        wxString cableFileName;
3d24aeb1   Steve Greedy   Modification to s...
117
118

        cableFileName << Path << separator << "CABLE" << separator <<cable_spec<<".cable_spec";
886c558b   Steve Greedy   SACAMOS Public Re...
119
120
121

        bundleFile >> xCoord;
        bundleFile >> yCoord;
2a0d305e   Steve Greedy   Modifications to ...
122

886c558b   Steve Greedy   SACAMOS Public Re...
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
155
156
157
158
159
160
161
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
        std::getline(bundleFile, bundle_str); //Read to end of line

        std::ifstream cableFile;
        cableFile.open (cableFileName);

        if (cableFile.fail()){
                wxMessageBox(cable_spec , _("Failed to Open Cable Specification"));
        }

        std::getline(cableFile, cable_str);
        std::getline(cableFile, cable_str);
        std::getline(cableFile, cable_str);

        if (cable_str.compare("Cylindrical") == 0 )
        {
            std::getline(cableFile, cable_str);
            std::getline(cableFile, cable_str);

            float conductor_radius, dielectric_radius;

            cableFile >> conductor_radius;
            std::getline(cableFile, cable_str); //Read to end of line

            cableFile >> dielectric_radius;

            float dielectric_Scaledradius,conductor_Scaledradius, scaledxCoord, scaledyCoord;

            dielectric_Scaledradius = (dielectric_radius/maxDimension)*scaleFactor;
            conductor_Scaledradius  = (conductor_radius/maxDimension)*scaleFactor;
            scaledxCoord = (xCoord/maxDimension)*scaleFactor;
            scaledyCoord = -1.0*(yCoord/maxDimension)*scaleFactor;

            dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
            dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
            dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2-scaledyCoord), dielectric_Scaledradius );
            dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
            dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
            dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2-scaledyCoord), conductor_Scaledradius);

            cableFile.close();
        }

        if (cable_str.compare("Coax") == 0 )
        {
            std::getline(cableFile, cable_str);
            std::getline(cableFile, cable_str);

            float inner_conductor_radius, shield_radius, outer_insulation, shield_thickness;

            cableFile >> inner_conductor_radius;
            std::getline(cableFile, cable_str); //Read to end of line
            cableFile >> shield_radius;
            std::getline(cableFile, cable_str); //Read to end of line
            cableFile >> outer_insulation;
            std::getline(cableFile, cable_str); //Read to end of line
            std::getline(cableFile, cable_str); //Read to end of line
            cableFile >> shield_thickness;

            float  inner_conductor_Scaledradius, shield_Scaledradius, outer_Scaledinsulation, shield_Scaledthickness, scaledxCoord, scaledyCoord;

            outer_Scaledinsulation  = (outer_insulation/maxDimension)*scaleFactor;
            shield_Scaledthickness  = (shield_thickness/maxDimension)*scaleFactor;
            shield_Scaledradius     = (shield_radius/maxDimension)*scaleFactor;
            inner_conductor_Scaledradius = (inner_conductor_radius/maxDimension)*scaleFactor;
            scaledxCoord = (xCoord/maxDimension)*scaleFactor;
            scaledyCoord = -1.0*(yCoord/maxDimension)*scaleFactor;

            dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
            dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
            dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), outer_Scaledinsulation );

            dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
            dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
            dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), shield_Scaledthickness+shield_Scaledradius );

            dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
            dc.SetBrush(wxBrush(*wxLIGHT_GREY, wxSOLID));
            dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), shield_Scaledradius );

            dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
            dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
            dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), inner_conductor_Scaledradius );

            cableFile.close();
        }

        if (cable_str.compare("Twinax") == 0 )
        {
                std::getline(cableFile, cable_str);
                std::getline(cableFile, cable_str);

                float inner_conductor_radius, inner_dielectric_radius, conductor_separation, shield_radius, shield_thickness, outer_dielectric_radius;

                cableFile >> inner_conductor_radius;
                std::getline(cableFile, cable_str); //Read to end of line
                cableFile >> inner_dielectric_radius;
                std::getline(cableFile, cable_str); //Read to end of line
                cableFile >> conductor_separation;
                std::getline(cableFile, cable_str); //Read to end of line
                cableFile >> shield_radius;
                std::getline(cableFile, cable_str); //Read to end of line
                cableFile >> shield_thickness;
                std::getline(cableFile, cable_str); //Read to end of line
                cableFile >> outer_dielectric_radius;

                float   outer_dielectric_Scaledradius,
                                    shield_Scaledthickness,
                                    shield_Scaledradius,
                                    inner_dielectric_Scaledradius,
                                    inner_conductor_Scaledradius,
                                    conductor_Scaledseparation,
                                    scaledxCoord,
                                    scaledyCoord;

                outer_dielectric_Scaledradius = (outer_dielectric_radius/maxDimension)*scaleFactor;
                shield_Scaledthickness = (shield_thickness/maxDimension)*scaleFactor;
                shield_Scaledradius = (shield_radius/maxDimension)*scaleFactor;
                inner_dielectric_Scaledradius = (inner_dielectric_radius/maxDimension)*scaleFactor;
                inner_conductor_Scaledradius = (inner_conductor_radius/maxDimension)*scaleFactor;
                conductor_Scaledseparation = (conductor_separation/maxDimension)*scaleFactor;
                scaledxCoord = 2.0*(xCoord/maxDimension)*scaleFactor;
                scaledyCoord = -2.0*(yCoord/maxDimension)*scaleFactor;

                float size_ho = size_h + scaledxCoord;
                float size_vo = size_v + scaledyCoord;

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
                dc.DrawCircle( wxPoint(size_ho/2,size_vo/2), outer_dielectric_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
                dc.DrawCircle( wxPoint(size_ho/2,size_vo/2), shield_Scaledthickness+shield_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxLIGHT_GREY, wxSOLID));
                dc.DrawCircle( wxPoint(size_ho/2,size_vo/2), shield_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
                dc.DrawCircle( wxPoint((size_ho/2)+(conductor_Scaledseparation/2),size_vo/2), inner_dielectric_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
                dc.DrawCircle( wxPoint((size_ho/2)-(conductor_Scaledseparation/2),size_vo/2), inner_dielectric_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
                dc.DrawCircle( wxPoint((size_ho/2)+(conductor_Scaledseparation/2),size_vo/2), inner_conductor_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
                dc.DrawCircle( wxPoint((size_ho/2)-(conductor_Scaledseparation/2),size_vo/2), inner_conductor_Scaledradius );

                cableFile.close();
        }

        if (cable_str.compare("Twisted_pair") == 0 )
        {
            std::getline(cableFile, cable_str);
            std::getline(cableFile, cable_str);

            float conductor_radius, conductor_separation, dielectric_radius;

            cableFile >> conductor_radius;
            std::getline(cableFile, cable_str); //Read to end of line
            cableFile >> conductor_separation;
            std::getline(cableFile, cable_str); //Read to end of line
            cableFile >> dielectric_radius;

            float  conductor_Scaledradius, conductor_Scaledseparation, dielectric_Scaledradius, scaledxCoord, scaledyCoord;

            conductor_Scaledradius = (conductor_radius/maxDimension)*scaleFactor;
            conductor_Scaledseparation = (conductor_separation/maxDimension)*scaleFactor;
            dielectric_Scaledradius = (dielectric_radius/maxDimension)*scaleFactor;
            scaledxCoord = 2.0*(xCoord/maxDimension)*scaleFactor;
            scaledyCoord = -2.0*(yCoord/maxDimension)*scaleFactor;

            float size_ho = size_h + scaledxCoord;
            float size_vo = size_v + scaledyCoord;

            float wire_pos = (conductor_Scaledseparation/2)*0.707;

            dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
            dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
            dc.DrawCircle( wxPoint(size_ho/2-wire_pos,size_vo/2-wire_pos), conductor_Scaledradius );


            dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
            dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
            dc.DrawCircle( wxPoint(size_ho/2-wire_pos,size_vo/2-wire_pos), dielectric_Scaledradius );

            dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
            dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
            dc.DrawCircle( wxPoint(size_ho/2+wire_pos,size_vo/2+wire_pos), conductor_Scaledradius );

            dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
            dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
            dc.DrawCircle( wxPoint(size_ho/2+wire_pos,size_vo/2+wire_pos), dielectric_Scaledradius );

            cableFile.close();
        }

        if (cable_str.compare("Shielded_twisted_pair") == 0 )
        {
                std::getline(cableFile, cable_str);
                std::getline(cableFile, cable_str);

                float inner_conductor_radius, inner_conductor_separation, inner_dielectric_radius, shield_radius, shield_thickness, outer_dielectric_radius;

                cableFile >> inner_conductor_radius;
                std::getline(cableFile, cable_str); //Read to end of line
                cableFile >> inner_dielectric_radius;
                std::getline(cableFile, cable_str); //Read to end of line
                cableFile >> inner_conductor_separation;
                std::getline(cableFile, cable_str); //Read to end of line
                cableFile >> shield_radius;
                std::getline(cableFile, cable_str); //Read to end of line
                cableFile >> shield_thickness;
                std::getline(cableFile, cable_str); //Read to end of line
                cableFile >> outer_dielectric_radius;

                float   inner_conductor_Scaledradius,
                        inner_conductor_Scaledseparation,
                        inner_dielectric_Scaledradius,
                        shield_Scaledradius,
                        shield_Scaledthickness,
                        outer_dielectric_Scaledradius,
                        scaledxCoord,
                        scaledyCoord;

                inner_conductor_Scaledradius = (inner_conductor_radius/maxDimension)*scaleFactor;
                inner_conductor_Scaledseparation = (inner_conductor_separation/maxDimension)*scaleFactor;
                inner_dielectric_Scaledradius = (inner_dielectric_radius/maxDimension)*scaleFactor;
                shield_Scaledradius = (shield_radius/maxDimension)*scaleFactor;
                shield_Scaledthickness =  (shield_thickness/maxDimension)*scaleFactor;
                outer_dielectric_Scaledradius = (outer_dielectric_radius/maxDimension)*scaleFactor;
                scaledxCoord = (xCoord/maxDimension)*scaleFactor;
                scaledyCoord = -1.0 *(yCoord/maxDimension)*scaleFactor;

                float size_ho = size_h + scaledxCoord;
                float size_vo = size_v + scaledyCoord;

                float wire_pos = (inner_conductor_Scaledseparation/2)*0.707;

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
                dc.DrawCircle( wxPoint(size_ho/2,size_vo/2), outer_dielectric_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
                dc.DrawCircle( wxPoint(size_ho/2,size_vo/2), shield_Scaledthickness+shield_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
                dc.DrawCircle( wxPoint(size_ho/2,size_vo/2), shield_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
                dc.DrawCircle( wxPoint(size_ho/2-wire_pos,size_vo/2-wire_pos), inner_dielectric_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
                dc.DrawCircle( wxPoint(size_ho/2-wire_pos,size_vo/2-wire_pos), inner_conductor_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
                dc.DrawCircle( wxPoint(size_ho/2+wire_pos,size_vo/2+wire_pos), inner_dielectric_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
                dc.DrawCircle( wxPoint(size_ho/2+wire_pos,size_vo/2+wire_pos), inner_conductor_Scaledradius );

                cableFile.close();
        }

        if (cable_str.compare("Spacewire") == 0 )
        {
                std::getline(cableFile, cable_str);
                std::getline(cableFile, cable_str);

                float   inner_conductor_radius, inner_conductor_separation, inner_dielectric_radius, inner_shield_radius, inner_shield_thickness,
                        inner_shield_jacket_radius, shielded_twisted_pair_radius, outer_shield_radius, outer_shield_thickness, outer_dielectric_radius;

                cableFile >> inner_conductor_radius;
                std::getline(cableFile, cable_str); //Read to end of line
                cableFile >> inner_dielectric_radius;
                std::getline(cableFile, cable_str); //Read to end of line
                cableFile >> inner_conductor_separation;
                std::getline(cableFile, cable_str); //Read to end of line
                cableFile >> inner_shield_radius;
                std::getline(cableFile, cable_str); //Read to end of line
                cableFile >> inner_shield_thickness;
                std::getline(cableFile, cable_str); //Read to end of line
                cableFile >> inner_shield_jacket_radius;
                std::getline(cableFile, cable_str); //Read to end of line
                cableFile >> shielded_twisted_pair_radius;
                std::getline(cableFile, cable_str); //Read to end of line
                cableFile >> outer_shield_radius;
                std::getline(cableFile, cable_str); //Read to end of line
                cableFile >> outer_shield_thickness;
                std::getline(cableFile, cable_str); //Read to end of line
                cableFile >> outer_dielectric_radius;

                        float   inner_conductor_Scaledradius,
                        inner_dielectric_Scaledradius,
                        inner_conductor_Scaledseparation,
                        inner_shield_Scaledradius,
                        inner_shield_Scaledthickness,
                        inner_shield_jacket_Scaledradius,
                        shielded_twisted_pair_Scaledradius,
                        outer_shield_Scaledradius,
                        outer_shield_Scaledthickness,
                        outer_dielectric_Scaledradius,
                        scaledxCoord,
                        scaledyCoord;

                inner_conductor_Scaledradius = (inner_conductor_radius/maxDimension)*scaleFactor;
                inner_dielectric_Scaledradius = (inner_dielectric_radius/maxDimension)*scaleFactor;
                inner_conductor_Scaledseparation = (inner_conductor_separation/maxDimension)*scaleFactor;
                inner_shield_Scaledradius = (inner_shield_radius/maxDimension)*scaleFactor;
                inner_shield_Scaledthickness = (inner_shield_thickness/maxDimension)*scaleFactor;
                inner_shield_jacket_Scaledradius = (inner_shield_jacket_radius/maxDimension)*scaleFactor;
                shielded_twisted_pair_Scaledradius = (shielded_twisted_pair_radius/maxDimension)*scaleFactor;
                outer_shield_Scaledradius = (outer_shield_radius/maxDimension)*scaleFactor;
                outer_shield_Scaledthickness = (outer_shield_thickness/maxDimension)*scaleFactor;
                outer_dielectric_Scaledradius = (outer_dielectric_radius/maxDimension)*scaleFactor;
                scaledxCoord = (xCoord/maxDimension)*scaleFactor;
                scaledyCoord = -1.0*(yCoord/maxDimension)*scaleFactor;

                float size_ho = size_h + scaledxCoord;
                float size_vo = size_v + scaledyCoord;

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
                dc.DrawCircle( wxPoint(size_ho/2,size_vo/2), outer_dielectric_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
                dc.DrawCircle( wxPoint(size_ho/2,size_vo/2), outer_shield_Scaledthickness+outer_shield_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
                dc.DrawCircle( wxPoint(size_ho/2,size_vo/2), outer_shield_Scaledradius );

                //TP Top
                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
                dc.DrawCircle( wxPoint(size_ho/2,(size_vo/2-shielded_twisted_pair_Scaledradius)), inner_shield_jacket_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
                dc.DrawCircle( wxPoint(size_ho/2,(size_vo/2-shielded_twisted_pair_Scaledradius)), inner_shield_Scaledthickness + inner_shield_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
                dc.DrawCircle( wxPoint(size_ho/2,(size_vo/2-shielded_twisted_pair_Scaledradius)), inner_shield_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
                dc.DrawCircle( wxPoint(size_ho/2,(size_vo/2-shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2)), inner_dielectric_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
55800c8b   Steve Greedy   Update to SW1
487
                dc.DrawCircle( wxPoint(size_ho/2,(size_vo/2-shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2)), inner_dielectric_Scaledradius );
886c558b   Steve Greedy   SACAMOS Public Re...
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
                dc.DrawCircle( wxPoint(size_ho/2,(size_vo/2-shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2)), inner_conductor_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
                dc.DrawCircle( wxPoint(size_ho/2,(size_vo/2-shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2)), inner_conductor_Scaledradius );


                //TP Left
                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
                dc.DrawCircle( wxPoint((size_ho/2-shielded_twisted_pair_Scaledradius),size_vo/2), inner_shield_jacket_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
                dc.DrawCircle( wxPoint((size_ho/2-shielded_twisted_pair_Scaledradius),size_vo/2), inner_shield_Scaledthickness + inner_shield_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
                dc.DrawCircle( wxPoint((size_ho/2-shielded_twisted_pair_Scaledradius),size_vo/2), inner_shield_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
                dc.DrawCircle( wxPoint((size_ho/2-shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2),size_vo/2), inner_dielectric_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
55800c8b   Steve Greedy   Update to SW1
517
                dc.DrawCircle( wxPoint((size_ho/2-shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2),size_vo/2), inner_dielectric_Scaledradius );
886c558b   Steve Greedy   SACAMOS Public Re...
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
                dc.DrawCircle( wxPoint((size_ho/2-shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2),size_vo/2), inner_conductor_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
                dc.DrawCircle( wxPoint((size_ho/2-shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2),size_vo/2), inner_conductor_Scaledradius );

                //TP Bottom
                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
                dc.DrawCircle( wxPoint(size_ho/2,(size_vo/2+shielded_twisted_pair_Scaledradius)), inner_shield_jacket_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
                dc.DrawCircle( wxPoint(size_ho/2,(size_vo/2+shielded_twisted_pair_Scaledradius)), inner_shield_Scaledthickness + inner_shield_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
                dc.DrawCircle( wxPoint(size_ho/2,(size_vo/2+shielded_twisted_pair_Scaledradius)), inner_shield_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
                dc.DrawCircle( wxPoint(size_ho/2,(size_vo/2+shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2)), inner_dielectric_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
                dc.DrawCircle( wxPoint(size_ho/2,(size_vo/2+shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2)), inner_dielectric_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
                dc.DrawCircle( wxPoint(size_ho/2,(size_vo/2+shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2)), inner_conductor_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
                dc.DrawCircle( wxPoint(size_ho/2,(size_vo/2+shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2)), inner_conductor_Scaledradius );

                //TP Right
                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
                dc.DrawCircle( wxPoint((size_ho/2+shielded_twisted_pair_Scaledradius),size_vo/2), inner_shield_jacket_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
                dc.DrawCircle( wxPoint((size_ho/2+shielded_twisted_pair_Scaledradius),size_vo/2), inner_shield_Scaledthickness + inner_shield_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
                dc.DrawCircle( wxPoint((size_ho/2+shielded_twisted_pair_Scaledradius),size_vo/2), inner_shield_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
55800c8b   Steve Greedy   Update to SW1
571
                dc.DrawCircle( wxPoint((size_ho/2+shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2),size_vo/2), inner_dielectric_Scaledradius );
886c558b   Steve Greedy   SACAMOS Public Re...
572
573
574
575
576
577
578

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
                dc.DrawCircle( wxPoint((size_ho/2+shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2),size_vo/2), inner_dielectric_Scaledradius );

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
55800c8b   Steve Greedy   Update to SW1
579
                dc.DrawCircle( wxPoint((size_ho/2+shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2),size_vo/2), inner_conductor_Scaledradius );
886c558b   Steve Greedy   SACAMOS Public Re...
580
581
582

                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
55800c8b   Steve Greedy   Update to SW1
583
                dc.DrawCircle( wxPoint((size_ho/2+shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2),size_vo/2), inner_conductor_Scaledradius );
886c558b   Steve Greedy   SACAMOS Public Re...
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620

                cableFile.close();
        }

        if (cable_str.compare("Overshield") == 0 )
        {
            std::getline(cableFile, cable_str);
            std::getline(cableFile, cable_str);

            float overshield_radius, overshield_thickness;

            cableFile >> overshield_radius;
            std::getline(cableFile, cable_str); //Read to end of line
            cableFile >> overshield_thickness;


            float overshield_Scaledradius, overshield_Scaledthickness, scaledxCoord, scaledyCoord;

            overshield_Scaledradius     = (overshield_radius/maxDimension)*scaleFactor;
            overshield_Scaledthickness  = (overshield_thickness/maxDimension)*scaleFactor;
            scaledxCoord = (xCoord/maxDimension)*scaleFactor;
            scaledyCoord = -1.0*(yCoord/maxDimension)*scaleFactor;

            float size_ho = size_h + scaledxCoord;
            float size_vo = size_v + scaledyCoord;

            dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
            dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
            dc.DrawCircle( wxPoint(size_ho/2,size_vo/2), overshield_Scaledthickness+overshield_Scaledradius );

            dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
            dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
            dc.DrawCircle( wxPoint(size_ho/2,size_vo/2), overshield_Scaledradius );

            cableFile.close();
        }

dd86ff43   Steve Greedy   Updates to SW1
621
        if (cable_str.compare("flex_cable") == 0 )
886c558b   Steve Greedy   SACAMOS Public Re...
622
        {
dd86ff43   Steve Greedy   Updates to SW1
623
            float dielectric_width, dielectric_height, conductor_rows;
886c558b   Steve Greedy   SACAMOS Public Re...
624

886c558b   Steve Greedy   SACAMOS Public Re...
625
            std::getline(cableFile, cable_str); //Read to end of line
886c558b   Steve Greedy   SACAMOS Public Re...
626
            std::getline(cableFile, cable_str); //Read to end of line
dd86ff43   Steve Greedy   Updates to SW1
627
            cableFile >> dielectric_width;
886c558b   Steve Greedy   SACAMOS Public Re...
628
            std::getline(cableFile, cable_str); //Read to end of line
dd86ff43   Steve Greedy   Updates to SW1
629
            cableFile >> dielectric_height;
886c558b   Steve Greedy   SACAMOS Public Re...
630
            std::getline(cableFile, cable_str); //Read to end of line
dd86ff43   Steve Greedy   Updates to SW1
631
            cableFile >> conductor_rows;
886c558b   Steve Greedy   SACAMOS Public Re...
632
            std::getline(cableFile, cable_str); //Read to end of line
886c558b   Steve Greedy   SACAMOS Public Re...
633

dd86ff43   Steve Greedy   Updates to SW1
634
635
636
637
            wxString mystring2;
            mystring2 << dielectric_width;
            dc.DrawText ("Dielectric Width (m)", 10, 40);
            dc.DrawText(mystring2, 10, 55);
886c558b   Steve Greedy   SACAMOS Public Re...
638

dd86ff43   Steve Greedy   Updates to SW1
639
640
641
642
            wxString mystring3;
            mystring3 << dielectric_height;
            dc.DrawText ("Dielectric Height (m):", 10, 75);
            dc.DrawText(mystring3, 10, 90);
886c558b   Steve Greedy   SACAMOS Public Re...
643

dd86ff43   Steve Greedy   Updates to SW1
644
645
646
647
            wxString mystring4;
            mystring4 << conductor_rows;
            dc.DrawText ("Number of Conductor Rows:", 10, 110);
            dc.DrawText(mystring4, 10, 125);
886c558b   Steve Greedy   SACAMOS Public Re...
648

dd86ff43   Steve Greedy   Updates to SW1
649
            float scaleFactor = (size_h/dielectric_width) * 0.8;
886c558b   Steve Greedy   SACAMOS Public Re...
650

dd86ff43   Steve Greedy   Updates to SW1
651
652
653
654
655
656
            float scaled_dielectric_width, scaled_dielectric_height, scaled_offset_x, scaled_offset_y;

            scaled_dielectric_width = dielectric_width * scaleFactor;
            scaled_dielectric_height = dielectric_height * scaleFactor;

            //Draw dielectric
886c558b   Steve Greedy   SACAMOS Public Re...
657
658
659

            dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
            dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
dd86ff43   Steve Greedy   Updates to SW1
660
            dc.DrawRectangle(wxPoint(size_h/2-scaled_dielectric_width/2, size_v/2-scaled_dielectric_height/2), wxSize(scaled_dielectric_width, scaled_dielectric_height));
886c558b   Steve Greedy   SACAMOS Public Re...
661

dd86ff43   Steve Greedy   Updates to SW1
662
            float offset_x, offset_y, width, height,separation, conductors;
886c558b   Steve Greedy   SACAMOS Public Re...
663

dd86ff43   Steve Greedy   Updates to SW1
664
665
666
            for (int i = 0; i < conductor_rows;i++){
                cableFile >> offset_x;
                std::getline(cableFile, cable_str); //Read to end of line
886c558b   Steve Greedy   SACAMOS Public Re...
667

dd86ff43   Steve Greedy   Updates to SW1
668
669
670
671
672
                cableFile >> offset_y;
                std::getline(cableFile, cable_str); //Read to end of line

                cableFile >> width;
                std::getline(cableFile, cable_str); //Read to end of line
886c558b   Steve Greedy   SACAMOS Public Re...
673

dd86ff43   Steve Greedy   Updates to SW1
674
675
                cableFile >> height;
                std::getline(cableFile, cable_str); //Read to end of line
886c558b   Steve Greedy   SACAMOS Public Re...
676

dd86ff43   Steve Greedy   Updates to SW1
677
678
                cableFile >> separation;
                std::getline(cableFile, cable_str); //Read to end of line
886c558b   Steve Greedy   SACAMOS Public Re...
679

dd86ff43   Steve Greedy   Updates to SW1
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
                cableFile >> conductors;
                std::getline(cableFile, cable_str); //Read to end of line


                float scaled_offset_x = offset_x * scaleFactor;
                float scaled_offset_y = offset_y * scaleFactor;
                float scaled_conductor_width = width * scaleFactor;
                float scaled_conductor_height = height * scaleFactor;
                float scaled_conductor_separation = separation * scaleFactor;


                float x_origin = size_h/2 - (scaled_conductor_width * conductors/2) - scaled_conductor_separation*(conductors - 1)/2 - scaled_offset_x;
                float y_origin = size_v/2 - (scaled_conductor_height/2) - scaled_offset_y;



                dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
                dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));

                for (int j = 0; j<conductors; j++){

                        dc.DrawRectangle(wxPoint(x_origin+(j*(scaled_conductor_width + scaled_conductor_separation + scaled_offset_x) ), y_origin), wxSize(scaled_conductor_width,scaled_conductor_height));
                }
                cableFile.close();
        }




//            float conductors, conductor_width, conductor_height, conductor_separation, dielectric_offset_x, dielectric_offset_y;
//
//            cableFile >> conductors;
//            std::getline(cableFile, cable_str); //Read to end of line
//            std::getline(cableFile, cable_str); //Read to end of line
//            cableFile >> conductor_width;
//            std::getline(cableFile, cable_str); //Read to end of line
//            cableFile >> conductor_height;
//            std::getline(cableFile, cable_str); //Read to end of line
//            cableFile >> conductor_separation;
//            std::getline(cableFile, cable_str); //Read to end of line
//            cableFile >> dielectric_offset_x;
//            std::getline(cableFile, cable_str); //Read to end of line
//            cableFile >> dielectric_offset_y;
//
//
//            float   conductor_Scaledwidth,
//                    conductor_Scaledheight,
//                    conductor_Scaledseparation,
//                    dielectric_Scaledoffset_x,
//                    dielectric_Scaledoffset_y,
//                    totalScaledWidth,
//                    totalScaledHeight,
//                    scaledxCoord,
//                    scaledyCoord;
//
//            float totalWidth = (conductors*conductor_width)+((conductors-1) * conductor_separation)+(dielectric_offset_x * 2);
//            float totalHeight = (2 * dielectric_offset_y) + conductor_height;
//
//            conductor_Scaledwidth = (conductor_width/maxDimension)*scaleFactor;
//            conductor_Scaledheight = (conductor_height/maxDimension)*scaleFactor;
//            conductor_Scaledseparation = (conductor_separation/maxDimension)*scaleFactor;
//            dielectric_Scaledoffset_x = (dielectric_offset_x/maxDimension)*scaleFactor;
//            dielectric_Scaledoffset_y = (dielectric_offset_y/maxDimension)*scaleFactor;
//            totalScaledHeight = (totalHeight/maxDimension)*scaleFactor;
//            totalScaledWidth = (totalWidth/maxDimension)*scaleFactor;
//            scaledxCoord = (xCoord/maxDimension)*scaleFactor;
//            scaledyCoord = -1.0*(yCoord/maxDimension)*scaleFactor;
//
//            float size_ho = size_h + scaledxCoord;
//            float size_vo = size_v + scaledyCoord;
//
//            dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
//            dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
//            dc.DrawRectangle(wxPoint(size_ho/2-totalScaledWidth/2, size_vo/2-totalScaledHeight/2), wxSize(totalScaledWidth,totalScaledHeight));
//
//            float x_origin, y_origin;
//            x_origin = (size_ho/2 - totalScaledWidth/2) + dielectric_Scaledoffset_x;
//            y_origin = (size_vo/2 - conductor_Scaledheight/2) + dielectric_Scaledoffset_y;
//
//            dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
//            dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
//
//            for(int i=0;i<conductors;i++){
//
//                dc.DrawRectangle(wxPoint(x_origin, y_origin), wxSize(conductor_Scaledwidth,conductor_Scaledheight));
//
//                x_origin = x_origin + (conductor_Scaledwidth+conductor_Scaledseparation);
//            }
//
//            cableFile.close();
886c558b   Steve Greedy   SACAMOS Public Re...
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
        }

        if (cable_str.compare("Dconnector") == 0 )
        {
            float conductors, conductor_radius, conductor_pitch, conductor_separation, shell_offset;

            cableFile >> conductors;
            std::getline(cableFile, cable_str); //Read to end of line
            std::getline(cableFile, cable_str); //Read to end of line
            cableFile >> conductor_radius;
            std::getline(cableFile, cable_str); //Read to end of line
            cableFile >> conductor_pitch;
            std::getline(cableFile, cable_str); //Read to end of line
            cableFile >> conductor_separation;
            std::getline(cableFile, cable_str); //Read to end of line
            cableFile >> shell_offset;

            //float totalWidth = (conductors/2 * conductor_separation) + (2 * shell_offset) + (2 * conductor_radius);

            float   conductor_Scaledradius,
                    conductor_Scaledpitch,
                    conductor_Scaledseparation,
                    //shell_Scaledoffset,
                    //total_Scaledwidth,
                    scaledxCoord,
                    scaledyCoord;

            float x_origin, y_origin;

            scaleFactor = (size_h * 0.25);

            conductor_Scaledradius = (conductor_radius/maxDimension)*scaleFactor;
            conductor_Scaledpitch = (conductor_pitch/maxDimension)*scaleFactor;
            conductor_Scaledseparation = (conductor_separation/maxDimension)*scaleFactor;
            //shell_Scaledoffset = (shell_offset/maxDimension)*scaleFactor;
            //total_Scaledwidth = (totalWidth/maxDimension)*scaleFactor;
            scaledxCoord = (xCoord/maxDimension)*scaleFactor;
            scaledyCoord = -1.0*(yCoord/maxDimension)*scaleFactor;

            float size_ho = size_h + scaledxCoord;
            float size_vo = size_v + scaledyCoord;

            dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
            dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));

            // Upper conductors & Shell
            int upper_conductors = conductors / 2;
            x_origin = (size_ho/2) - (upper_conductors/2 * conductor_Scaledseparation);
            y_origin = (size_vo/2) - (conductor_Scaledpitch);

            dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
            dc.SetBrush(wxBrush(*wxBLACK));

            for(int i=0;i<upper_conductors;i++){

                dc.DrawCircle( wxPoint(x_origin,y_origin), conductor_Scaledradius );
                x_origin = x_origin + (conductor_Scaledpitch);
            }
            // Lower conductors
            int lower_conductors = (conductors / 2) - 1;
            x_origin = (size_ho/2) - (lower_conductors/2 * conductor_Scaledseparation) + conductor_Scaledseparation/2;
            y_origin = (size_vo/2) + (conductor_Scaledpitch); // This isn't correct!!

            for(int i=0;i<lower_conductors;i++){

                dc.DrawCircle( wxPoint(x_origin,y_origin), conductor_Scaledradius );
                x_origin = x_origin + (conductor_Scaledpitch);
            }

            cableFile.close();
        }
    }


    std::getline(bundleFile, bundle_str);
    wxString groundPlane(bundle_str);

    if (groundPlane == "ground_plane")
    {
        dc.SetPen( wxPen( (*wxBLACK) ,4 , wxSOLID) );
        dc.DrawLine( 0, (size_v/2)+2, size_h,(size_v/2)+2 );
    }

    bundleFile.close();
}


float findMaxDim(wxString bundle_to_draw)
{
    float xCoord, yCoord;// rot;
    float maxxCoord, maxyCoord;

    maxxCoord = 0.0;
    maxyCoord = 0.0;

    std::ifstream bundleFile;
    bundleFile.open (bundle_to_draw);
    if (bundleFile.fail()){
                wxMessageBox(bundle_to_draw , _("Failed to Open Bundle Specification"));
    }

    std::string bundle_str, cable_str;

    std::getline(bundleFile, bundle_str);
    std::getline(bundleFile, bundle_str);
    std::getline(bundleFile, bundle_str);
    std::getline(bundleFile, bundle_str);

    int cableCount;
    bundleFile >> cableCount;
    std::getline(bundleFile, bundle_str); //Read to end of line

    for (int cable_no = 0; cable_no < cableCount; cable_no++)
    {
        std::getline(bundleFile, bundle_str); //Read to end of line
        bundleFile >> xCoord;
        bundleFile >> yCoord;
        std::getline(bundleFile, bundle_str); //Read to end of line

        if (abs(yCoord) > maxyCoord )
            maxyCoord = abs(yCoord);

        if (abs(xCoord) > maxxCoord )
            maxxCoord = abs(xCoord);

    }

    float maxDim;

    if (maxxCoord > maxyCoord)
    {
        maxDim = maxxCoord;
    }
    else
    {
        maxDim = maxyCoord;
    }
    bundleFile.close();

    return maxDim;

}