/////////////////////////////////////////////////////////////////////////////////
//
// 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 .
//
// 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:
//
//
// The University of Nottingham can be contacted at: ggiemr@nottingham.ac.uk
//
// File Contents:
//
// NAME
// CABLE_SCHEMATIC.cpp
//
// DESCRIPTION
// Functions to render cables - arguements: cable type and cable centre coordinates
//
// AUTHOR(S)
// Steve Greedy
//
/////////////////////////////////////////////////////////////////////////////////
#include "CABLE_SCHEMATIC.h"
void draw_cable(wxPanel *Panel, wxString cable_to_draw, float x_coord, float y_coord)
{
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)-15);
dc.DrawText("x=0", (size_h/2)+5, size_v-20);
// Draw ordinates
dc.SetPen( wxPen( wxColor(255,0,0),1 ) );
dc.DrawCircle( wxPoint(5,size_v-10), 5 );
dc.DrawLine( 5, size_v-10, 30, size_v-10 );
dc.DrawLine( 5, size_v-10, 5, size_v-35);
dc.DrawText("y", 10, size_v-45);
dc.DrawText("x", 30, size_v-25);
std::ifstream cableFile;
cableFile.open (cable_to_draw);
if (cableFile.fail()){
wxMessageBox(cable_to_draw , _("Failed to Open Cable Specification"));
}
std::string str;
std::getline(cableFile, str);
std::getline(cableFile, str);
std::getline(cableFile, str);
if (str.compare("Cylindrical") == 0 ){
dc.SetTextForeground(*wxBLUE);
wxString mystring1(str);
dc.DrawText(mystring1, 10, 15);
std::getline(cableFile, str);
std::getline(cableFile, str);
float conductor_radius, dielectric_radius;
cableFile >> conductor_radius;
std::getline(cableFile, str); //Read to end of line
cableFile >> dielectric_radius;
wxString mystring2;
mystring2 << dielectric_radius;
dc.DrawText ("Dielectric Radius (m):", 10, 40);
dc.DrawText(mystring2, 10, 55);
wxString mystring3;
mystring3 << conductor_radius;
dc.DrawText ("Conductor Radius (m):", 10, 75);
dc.DrawText(mystring3, 10, 90);
float scaleFactor, dielectric_Scaledradius,conductor_Scaledradius;
scaleFactor = (size_h * 0.25);
dielectric_Scaledradius = (dielectric_radius/dielectric_radius)*scaleFactor;
conductor_Scaledradius = (conductor_radius/dielectric_radius)*scaleFactor;
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
dc.DrawCircle( wxPoint(size_h/2,size_v/2), dielectric_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
dc.DrawCircle( wxPoint(size_h/2,size_v/2), conductor_Scaledradius );
}
if (str.compare("Coax") == 0 ){
dc.SetTextForeground(*wxBLUE);
wxString mystring1(str);
dc.DrawText(mystring1, 10, 15);
std::getline(cableFile, str);
std::getline(cableFile, str);
float inner_conductor_radius, shield_radius, outer_insulation, shield_thickness;
cableFile >> inner_conductor_radius;
std::getline(cableFile, str); //Read to end of line
cableFile >> shield_radius;
std::getline(cableFile, str); //Read to end of line
cableFile >> outer_insulation;
std::getline(cableFile, str); //Read to end of line
std::getline(cableFile, str); //Read to end of line
cableFile >> shield_thickness;
wxString mystring2;
mystring2 << outer_insulation;
dc.DrawText ("Outer Dielectric Radius (m):", 10, 40);
dc.DrawText(mystring2, 10, 55);
wxString mystring3;
mystring3 << shield_thickness;
dc.DrawText ("Shield Thickness (m):", 10, 75);
dc.DrawText(mystring3, 10, 90);
wxString mystring4;
mystring4 << shield_radius;
dc.DrawText ("Shield Radius (m):", 10, 110);
dc.DrawText(mystring4, 10, 125);
wxString mystring5;
mystring5 << inner_conductor_radius;
dc.DrawText ("Inner Conductor Radius (m):", 10, 145);
dc.DrawText(mystring5, 10, 160);
float scaleFactor, inner_conductor_Scaledradius, shield_Scaledradius, outer_Scaledinsulation, shield_Scaledthickness;
scaleFactor = (size_h * 0.25);
outer_Scaledinsulation = (outer_insulation/outer_insulation)*scaleFactor;
shield_Scaledthickness = (shield_thickness/outer_insulation)*scaleFactor;
shield_Scaledradius = (shield_radius/outer_insulation)*scaleFactor;
inner_conductor_Scaledradius = (inner_conductor_radius/outer_insulation)*scaleFactor;
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_Scaledinsulation );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
dc.DrawCircle( wxPoint(size_h/2,size_v/2), shield_Scaledthickness+shield_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxLIGHT_GREY, wxSOLID));
dc.DrawCircle( wxPoint(size_h/2,size_v/2), shield_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
dc.DrawCircle( wxPoint(size_h/2,size_v/2), inner_conductor_Scaledradius );
}
if (str.compare("Twinax") == 0 ){
dc.SetTextForeground(*wxBLUE);
wxString mystring1(str);
dc.DrawText(mystring1, 10, 15);
std::getline(cableFile, str);
std::getline(cableFile, str);
float inner_conductor_radius, inner_dielectric_radius, conductor_separation, shield_radius, shield_thickness, outer_dielectric_radius;
cableFile >> inner_conductor_radius;
std::getline(cableFile, str); //Read to end of line
cableFile >> inner_dielectric_radius;
std::getline(cableFile, str); //Read to end of line
cableFile >> conductor_separation;
std::getline(cableFile, str); //Read to end of line
cableFile >> shield_radius;
std::getline(cableFile, str); //Read to end of line
cableFile >> shield_thickness;
std::getline(cableFile, str); //Read to end of line
cableFile >> outer_dielectric_radius;
wxString mystring2;
mystring2 << outer_dielectric_radius;
dc.DrawText ("Outer Dielectric Radius (m):", 10, 40);
dc.DrawText(mystring2, 10, 55);
wxString mystring3;
mystring3 << shield_thickness;
dc.DrawText ("Shield Thickness (m):", 10, 75);
dc.DrawText(mystring3, 10, 90);
wxString mystring4;
mystring4 << shield_radius;
dc.DrawText ("Shield Radius (m):", 10, 110);
dc.DrawText(mystring4, 10, 125);
wxString mystring5;
mystring5 << inner_dielectric_radius;
dc.DrawText ("Inner Dielectric Radius (m):", 10, 145);
dc.DrawText(mystring5, 10, 160);
wxString mystring6;
mystring6 << inner_conductor_radius;
dc.DrawText ("Inner Conductor Radius (m):", 10, 180);
dc.DrawText(mystring6, 10, 195);
wxString mystring7;
mystring7 << conductor_separation;
dc.DrawText ("Conductor Separation (m):", 10, 215);
dc.DrawText(mystring7, 10, 230);
float scaleFactor, outer_dielectric_Scaledradius,
shield_Scaledthickness,
shield_Scaledradius,
inner_dielectric_Scaledradius,
inner_conductor_Scaledradius,
conductor_Scaledseparation;
scaleFactor = (size_h * 0.25);
outer_dielectric_Scaledradius = (outer_dielectric_radius/outer_dielectric_radius)*scaleFactor;
shield_Scaledthickness = (shield_thickness/outer_dielectric_radius)*scaleFactor;
shield_Scaledradius = (shield_radius/outer_dielectric_radius)*scaleFactor;
inner_dielectric_Scaledradius = (inner_dielectric_radius/outer_dielectric_radius)*scaleFactor;
inner_conductor_Scaledradius = (inner_conductor_radius/outer_dielectric_radius)*scaleFactor;
conductor_Scaledseparation = (conductor_separation/outer_dielectric_radius)*scaleFactor;
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_dielectric_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
dc.DrawCircle( wxPoint(size_h/2,size_v/2), shield_Scaledthickness+shield_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxLIGHT_GREY, wxSOLID));
dc.DrawCircle( wxPoint(size_h/2,size_v/2), shield_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
dc.DrawCircle( wxPoint((size_h/2)+(conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
dc.DrawCircle( wxPoint((size_h/2)-(conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
dc.DrawCircle( wxPoint((size_h/2)+(conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
dc.DrawCircle( wxPoint((size_h/2)-(conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius );
}
if (str.compare("Twisted_pair") == 0 ){
dc.SetTextForeground(*wxBLUE);
wxString mystring1(str);
dc.DrawText(mystring1, 10, 15);
std::getline(cableFile, str);
std::getline(cableFile, str);
float conductor_radius, conductor_separation, dielectric_radius;
cableFile >> conductor_radius;
std::getline(cableFile, str); //Read to end of line
cableFile >> conductor_separation;
std::getline(cableFile, str); //Read to end of line
cableFile >> dielectric_radius;
wxString mystring2;
mystring2 << conductor_radius;
dc.DrawText ("Conductor Radius (m):", 10, 40);
dc.DrawText(mystring2, 10, 55);
wxString mystring3;
mystring3 << conductor_separation;
dc.DrawText ("Conductor Separation (m):", 10, 75);
dc.DrawText(mystring3, 10, 90);
wxString mystring4;
mystring4 << dielectric_radius;
dc.DrawText ("Dielectric Radius (m):", 10, 110);
dc.DrawText(mystring4, 10, 125);
float scaleFactor, conductor_Scaledradius, conductor_Scaledseparation, dielectric_Scaledradius;
scaleFactor = (size_h * 0.25);
conductor_Scaledradius = (conductor_radius/(dielectric_radius+conductor_separation))*scaleFactor;
conductor_Scaledseparation = (conductor_separation/(dielectric_radius+conductor_separation))*scaleFactor;
dielectric_Scaledradius = (dielectric_radius/(dielectric_radius+conductor_separation))*scaleFactor;
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_h/2-wire_pos,size_v/2-wire_pos), conductor_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
dc.DrawCircle( wxPoint(size_h/2-wire_pos,size_v/2-wire_pos), dielectric_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
dc.DrawCircle( wxPoint(size_h/2+wire_pos,size_v/2+wire_pos), conductor_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
dc.DrawCircle( wxPoint(size_h/2+wire_pos,size_v/2+wire_pos), dielectric_Scaledradius );
}
if (str.compare("Shielded_twisted_pair") == 0 ){
dc.SetTextForeground(*wxBLUE);
wxString mystring1(str);
dc.DrawText(mystring1, 10, 15);
std::getline(cableFile, str);
std::getline(cableFile, 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, str); //Read to end of line
cableFile >> inner_dielectric_radius;
std::getline(cableFile, str); //Read to end of line
cableFile >> inner_conductor_separation;
std::getline(cableFile, str); //Read to end of line
cableFile >> shield_radius;
std::getline(cableFile, str); //Read to end of line
cableFile >> shield_thickness;
std::getline(cableFile, str); //Read to end of line
cableFile >> outer_dielectric_radius;
wxString mystring2;
mystring2 << inner_conductor_radius;
dc.DrawText ("Conductor Radius (m):", 10, 40);
dc.DrawText(mystring2, 10, 55);
wxString mystring3;
mystring3 << inner_dielectric_radius;
dc.DrawText ("Dielectric Radius (m):", 10, 75);
dc.DrawText(mystring3, 10, 90);
wxString mystring4;
mystring4 << inner_conductor_separation;
dc.DrawText ("Conductor Separation (m):", 10, 110);
dc.DrawText(mystring4, 10, 125);
wxString mystring5;
mystring5 << shield_radius;
dc.DrawText ("Shield Radius (m):", 10, 145);
dc.DrawText(mystring5, 10, 160);
wxString mystring6;
mystring6 << shield_thickness;
dc.DrawText ("Shield Thickness (m):", 10, 180);
dc.DrawText(mystring6, 10, 195);
wxString mystring7;
mystring7 << outer_dielectric_radius;
dc.DrawText ("Outer Dielectric Radius (m):", 10, 215);
dc.DrawText(mystring7, 10, 230);
float scaleFactor, inner_conductor_Scaledradius, inner_conductor_Scaledseparation, inner_dielectric_Scaledradius, shield_Scaledradius, shield_Scaledthickness, outer_dielectric_Scaledradius;
scaleFactor = (size_h * 0.25);
inner_conductor_Scaledradius = (inner_conductor_radius/outer_dielectric_radius)*scaleFactor;
inner_conductor_Scaledseparation = (inner_conductor_separation/outer_dielectric_radius)*scaleFactor;
inner_dielectric_Scaledradius = (inner_dielectric_radius/outer_dielectric_radius)*scaleFactor;
shield_Scaledradius = (shield_radius/outer_dielectric_radius)*scaleFactor;
shield_Scaledthickness = (shield_thickness/outer_dielectric_radius)*scaleFactor;
outer_dielectric_Scaledradius = (outer_dielectric_radius/outer_dielectric_radius)*scaleFactor;
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_h/2,size_v/2), outer_dielectric_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
dc.DrawCircle( wxPoint(size_h/2,size_v/2), shield_Scaledthickness+shield_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
dc.DrawCircle( wxPoint(size_h/2,size_v/2), shield_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
dc.DrawCircle( wxPoint(size_h/2-wire_pos,size_v/2-wire_pos), inner_dielectric_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
dc.DrawCircle( wxPoint(size_h/2-wire_pos,size_v/2-wire_pos), inner_conductor_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
dc.DrawCircle( wxPoint(size_h/2+wire_pos,size_v/2+wire_pos), inner_dielectric_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
dc.DrawCircle( wxPoint(size_h/2+wire_pos,size_v/2+wire_pos), inner_conductor_Scaledradius );
}
if (str.compare("Spacewire") == 0 ){
dc.SetTextForeground(*wxBLUE);
wxString mystring1(str);
dc.DrawText(mystring1, 10, 15);
std::getline(cableFile, str);
std::getline(cableFile, 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, str); //Read to end of line
cableFile >> inner_dielectric_radius;
std::getline(cableFile, str); //Read to end of line
cableFile >> inner_conductor_separation;
std::getline(cableFile, str); //Read to end of line
cableFile >> inner_shield_radius;
std::getline(cableFile, str); //Read to end of line
cableFile >> inner_shield_thickness;
std::getline(cableFile, str); //Read to end of line
cableFile >> inner_shield_jacket_radius;
std::getline(cableFile, str); //Read to end of line
cableFile >> shielded_twisted_pair_radius;
std::getline(cableFile, str); //Read to end of line
cableFile >> outer_shield_radius;
std::getline(cableFile, str); //Read to end of line
cableFile >> outer_shield_thickness;
std::getline(cableFile, str); //Read to end of line
cableFile >> outer_dielectric_radius;
wxString mystring2;
mystring2 << inner_conductor_radius;
dc.DrawText ("TP Conductor Radius (m):", 10, 40);
dc.DrawText(mystring2, 10, 55);
wxString mystring3;
mystring3 << inner_dielectric_radius;
dc.DrawText ("TP Dielectric Radius (m):", 10, 75);
dc.DrawText(mystring3, 10, 90);
wxString mystring4;
mystring4 << inner_conductor_separation;
dc.DrawText ("TP Conductor Separation (m):", 10, 110);
dc.DrawText(mystring4, 10, 125);
wxString mystring5;
mystring5 << inner_shield_radius;
dc.DrawText ("TP Shield Radius (m):", 10, 145);
dc.DrawText(mystring5, 10, 160);
wxString mystring6;
mystring6 << inner_shield_thickness;
dc.DrawText ("TP Shield Thickness (m):", 10, 180);
dc.DrawText(mystring6, 10, 195);
wxString mystring7;
mystring7 << inner_shield_jacket_radius;
dc.DrawText ("TP Shield Jacket Radius (m):", 10, 215);
dc.DrawText(mystring7, 10, 230);
wxString mystring8;
mystring8 << shielded_twisted_pair_radius;
dc.DrawText ("TP Radius (m):", 10, 250);
dc.DrawText(mystring8, 10, 265);
wxString mystring9;
mystring9 << outer_shield_radius;
dc.DrawText ("Outer Shield Radius (m):", 10, 320);
dc.DrawText(mystring9, 10, 335);
wxString mystring10;
mystring10 << outer_shield_thickness;
dc.DrawText ("Outer Shield Thickness (m):", 10, 355);
dc.DrawText(mystring10, 10, 370);
wxString mystring11;
mystring11 << outer_dielectric_radius;
dc.DrawText ("Outer Dielectric Radius (m):", 10, 390);
dc.DrawText(mystring11, 10, 405);
float scaleFactor,
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;
scaleFactor = (size_h * 0.25);
inner_conductor_Scaledradius = (inner_conductor_radius/outer_dielectric_radius)*scaleFactor;
inner_dielectric_Scaledradius = (inner_dielectric_radius/outer_dielectric_radius)*scaleFactor;
inner_conductor_Scaledseparation = (inner_conductor_separation/outer_dielectric_radius)*scaleFactor;
inner_shield_Scaledradius = (inner_shield_radius/outer_dielectric_radius)*scaleFactor;
inner_shield_Scaledthickness = (inner_shield_thickness/outer_dielectric_radius)*scaleFactor;
inner_shield_jacket_Scaledradius = (inner_shield_jacket_radius/outer_dielectric_radius)*scaleFactor;
shielded_twisted_pair_Scaledradius = (shielded_twisted_pair_radius/outer_dielectric_radius)*scaleFactor;
outer_shield_Scaledradius = (outer_shield_radius/outer_dielectric_radius)*scaleFactor;
outer_shield_Scaledthickness = (outer_shield_thickness/outer_dielectric_radius)*scaleFactor;
outer_dielectric_Scaledradius = (outer_dielectric_radius/outer_dielectric_radius)*scaleFactor;
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_dielectric_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_shield_Scaledthickness+outer_shield_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_shield_Scaledradius );
//TP Top
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
dc.DrawCircle( wxPoint(size_h/2,(size_v/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_h/2,(size_v/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_h/2,(size_v/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_h/2,(size_v/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_h/2,(size_v/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_h/2,(size_v/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_h/2,(size_v/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_h/2-shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_jacket_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_Scaledthickness + inner_shield_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius );
//TP Bottom
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
dc.DrawCircle( wxPoint(size_h/2,(size_v/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_h/2,(size_v/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_h/2,(size_v/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_h/2,(size_v/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_h/2,(size_v/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_h/2,(size_v/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_h/2,(size_v/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_h/2+shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_jacket_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_Scaledthickness + inner_shield_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius),size_v/2), inner_shield_Scaledradius );
dc.SetTextForeground(*wxBLACK);
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2),size_v/2), inner_dielectric_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius-inner_conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_Scaledradius+inner_conductor_Scaledseparation/2),size_v/2), inner_conductor_Scaledradius );
}
if (str.compare("Overshield") == 0 ){
dc.SetTextForeground(*wxBLUE);
wxString mystring1(str);
dc.DrawText(mystring1, 10, 15);
std::getline(cableFile, str);
std::getline(cableFile, str);
float overshield_radius, overshield_thickness;
cableFile >> overshield_radius;
std::getline(cableFile, str); //Read to end of line
cableFile >> overshield_thickness;
wxString mystring2;
mystring2 << overshield_radius;
dc.DrawText ("Overshield Radius (m):", 10, 40);
dc.DrawText(mystring2, 10, 55);
wxString mystring3;
mystring3 << overshield_thickness;
dc.DrawText ("Overshield Thickness (m):", 10, 75);
dc.DrawText(mystring3, 10, 90);
float scaleFactor, overshield_Scaledradius, overshield_Scaledthickness;
scaleFactor = (size_h * 0.25);
overshield_Scaledradius = (overshield_radius/overshield_radius)*scaleFactor;
overshield_Scaledthickness = (overshield_thickness/overshield_radius)*scaleFactor;
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
dc.DrawCircle( wxPoint(size_h/2,size_v/2), overshield_Scaledthickness+overshield_Scaledradius );
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
dc.DrawCircle( wxPoint(size_h/2,size_v/2), overshield_Scaledradius );
}
if (str.compare("Flex_cable") == 0 ){
dc.SetTextForeground(*wxBLUE);
wxString mystring1(str);
dc.DrawText(mystring1, 10, 15);
float conductors, conductor_width, conductor_height, conductor_separation, dielectric_offset_x, dielectric_offset_y;
cableFile >> conductors;
std::getline(cableFile, str); //Read to end of line
std::getline(cableFile, str); //Read to end of line
cableFile >> conductor_width;
std::getline(cableFile, str); //Read to end of line
cableFile >> conductor_height;
std::getline(cableFile, str); //Read to end of line
cableFile >> conductor_separation;
std::getline(cableFile, str); //Read to end of line
cableFile >> dielectric_offset_x;
std::getline(cableFile, str); //Read to end of line
cableFile >> dielectric_offset_y;
wxString mystring2;
mystring2 << conductors;
dc.DrawText ("Number of Conductors:", 10, 40);
dc.DrawText(mystring2, 10, 55);
wxString mystring3;
mystring3 << conductor_width;
dc.DrawText ("Conductor Width (m):", 10, 75);
dc.DrawText(mystring3, 10, 90);
wxString mystring4;
mystring4 << conductor_height;
dc.DrawText ("Conductor Height (m):", 10, 110);
dc.DrawText(mystring4, 10, 125);
wxString mystring5;
mystring5 << conductor_separation;
dc.DrawText ("Conductor Separation (m):", 10, 145);
dc.DrawText(mystring5, 10, 160);
wxString mystring6;
mystring6 << dielectric_offset_x;
dc.DrawText ("Dielectric Offset in x (m):", 10, 180);
dc.DrawText(mystring6, 10, 195);
wxString mystring7;
mystring7 << dielectric_offset_y;
dc.DrawText ("Dielectric Offset in y (m):", 10, 215);
dc.DrawText(mystring7, 10, 230);
float scaleFactor, conductor_Scaledwidth, conductor_Scaledheight, conductor_Scaledseparation, dielectric_Scaledoffset_x, dielectric_Scaledoffset_y, totalScaledWidth, totalScaledHeight;
scaleFactor = (size_h * 0.25);
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/totalWidth)*scaleFactor;
conductor_Scaledheight = (conductor_height/totalWidth)*scaleFactor;
conductor_Scaledseparation = (conductor_separation/totalWidth)*scaleFactor;
dielectric_Scaledoffset_x = (dielectric_offset_x/totalWidth)*scaleFactor;
dielectric_Scaledoffset_y = (dielectric_offset_y/totalWidth)*scaleFactor;
totalScaledHeight = (totalHeight/totalWidth)*scaleFactor;
totalScaledWidth = (totalWidth/totalWidth)*scaleFactor;
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK, wxBDIAGONAL_HATCH));
dc.DrawRectangle(wxPoint(size_h/2-totalScaledWidth/2, size_v/2-totalScaledHeight/2), wxSize(totalScaledWidth,totalScaledHeight));
float x_origin, y_origin;
x_origin = (size_h/2 - totalScaledWidth/2) + dielectric_Scaledoffset_x;
y_origin = (size_v/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;
std::getline(cableFile, str); //Read to end of line
std::getline(cableFile, str); //Read to end of line
cableFile >> conductor_radius;
std::getline(cableFile, str); //Read to end of line
cableFile >> conductor_pitch;
std::getline(cableFile, str); //Read to end of line
cableFile >> conductor_separation;
std::getline(cableFile, str); //Read to end of line
cableFile >> shell_offset;
wxString mystring2;
mystring2 << conductors;
dc.DrawText ("Number of Conductors:", 10, 40);
dc.DrawText(mystring2, 10, 55);
wxString mystring3;
mystring3 << conductor_radius;
dc.DrawText ("Conductor Radius (m):", 10, 75);
dc.DrawText(mystring3, 10, 90);
wxString mystring4;
mystring4 << conductor_pitch;
dc.DrawText ("Conductor Pitch (m):", 10, 110);
dc.DrawText(mystring4, 10, 125);
wxString mystring5;
mystring5 << conductor_separation;
dc.DrawText ("Conductor Separation (m):", 10, 145);
dc.DrawText(mystring5, 10, 160);
wxString mystring6;
mystring6 << shell_offset;
dc.DrawText ("Shell Offset from Conductors (m):", 10, 180);
dc.DrawText(mystring6, 10, 195);
float totalWidth = (conductors/2 * conductor_separation) + (2 * shell_offset) + (2 * conductor_radius);
float scaleFactor, conductor_Scaledradius, conductor_Scaledpitch, conductor_Scaledseparation;// shell_Scaledoffset, total_Scaledwidth;
float x_origin, y_origin;
scaleFactor = (size_h * 0.25);
conductor_Scaledradius = (conductor_radius/totalWidth)*scaleFactor;
conductor_Scaledpitch = (conductor_pitch/totalWidth)*scaleFactor;
conductor_Scaledseparation = (conductor_separation/totalWidth)*scaleFactor;
//shell_Scaledoffset = (shell_offset/totalWidth)*scaleFactor;
//total_Scaledwidth = (totalWidth/totalWidth)*scaleFactor;
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
// Upper conductors & Shell
int upper_conductors = conductors / 2;
x_origin = (size_h/2) - (upper_conductors/2 * conductor_Scaledseparation);
y_origin = (size_v/2) - (conductor_Scaledpitch);
dc.SetPen( wxPen( wxColor(0,0,0),1 ) );
dc.SetBrush(wxBrush(*wxBLACK));
for(int i=0;i