Blame view

GUI/SW1/SRC/SPACEWIRE.cpp 74.6 KB
886c558b   Steve Greedy   SACAMOS Public Re...
1
2
3
4
5
6
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
2a0d305e   Steve Greedy   Modifications to ...
7
// Copyright (C) 2015 - 2018 University of Nottingham
886c558b   Steve Greedy   SACAMOS Public Re...
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
114
115
116
//
// 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
//     SPACEWIRE.cpp
//
// DESCRIPTION
//     GUI for the construction of cable_spec file for cable type: Spacewire
//
// AUTHOR(S)
//     Steve Greedy
//
/////////////////////////////////////////////////////////////////////////////////

#include "SPACEWIRE.h"

//(*InternalHeaders(SPACEWIRE)
#include <wx/settings.h>
#include <wx/intl.h>
#include <wx/string.h>
//*)

//(*IdInit(SPACEWIRE)
const long SPACEWIRE::ID_STATICTEXT1 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL1 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT2 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL2 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT3 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL3 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT4 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL4 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT5 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL5 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT6 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL6 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT7 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL7 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT8 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL8 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT9 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL9 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT10 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL10 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT11 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL11 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT12 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL12 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT13 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL13 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT14 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL14 = wxNewId();
const long SPACEWIRE::ID_PANEL2 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT15 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL15 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT16 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL26 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT17 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL27 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT18 = wxNewId();
const long SPACEWIRE::ID_CHECKBOX1 = wxNewId();
const long SPACEWIRE::ID_PANEL3 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT19 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL16 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT20 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL17 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT21 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL18 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT23 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL19 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT24 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL20 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT26 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL21 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT30 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL22 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT31 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL23 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT32 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL24 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT33 = wxNewId();
const long SPACEWIRE::ID_TEXTCTRL25 = wxNewId();
const long SPACEWIRE::ID_PANEL4 = wxNewId();
const long SPACEWIRE::ID_NOTEBOOK1 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT29 = wxNewId();
const long SPACEWIRE::ID_CHECKBOX2 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT22 = wxNewId();
const long SPACEWIRE::ID_COMBOBOX1 = wxNewId();
const long SPACEWIRE::ID_STATICTEXT25 = wxNewId();
const long SPACEWIRE::ID_CHECKBOX3 = wxNewId();
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
117
const long SPACEWIRE::ID_PANEL1 = wxNewId();
886c558b   Steve Greedy   SACAMOS Public Re...
118
119
120
const long SPACEWIRE::ID_BUTTON1 = wxNewId();
const long SPACEWIRE::ID_BUTTON2 = wxNewId();
const long SPACEWIRE::ID_BUTTON3 = wxNewId();
886c558b   Steve Greedy   SACAMOS Public Re...
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
//*)

BEGIN_EVENT_TABLE(SPACEWIRE,wxDialog)
	//(*EventTable(SPACEWIRE)
	//*)
END_EVENT_TABLE()

SPACEWIRE::SPACEWIRE(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
	//(*Initialize(SPACEWIRE)
	wxBoxSizer* BoxSizer4;
	wxStaticBoxSizer* StaticBoxSizer2;
	wxFlexGridSizer* FlexGridSizer4;
	wxFlexGridSizer* FlexGridSizer3;
	wxFlexGridSizer* FlexGridSizer5;
	wxFlexGridSizer* FlexGridSizer2;
	wxBoxSizer* BoxSizer2;
	wxFlexGridSizer* FlexGridSizer7;
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
139
	wxFlexGridSizer* FlexGridSizer8;
886c558b   Steve Greedy   SACAMOS Public Re...
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
	wxBoxSizer* BoxSizer1;
	wxFlexGridSizer* FlexGridSizer6;
	wxStaticBoxSizer* StaticBoxSizer1;
	wxFlexGridSizer* FlexGridSizer1;

	Create(parent, wxID_ANY, _("SACAMOS: SPACEWIRE CABLE MODEL"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY"));
	FlexGridSizer1 = new wxFlexGridSizer(0, 2, 0, 0);
	StaticBoxSizer1 = new wxStaticBoxSizer(wxVERTICAL, this, _("SPACEWIRE Cable Parameters"));
	FlexGridSizer2 = new wxFlexGridSizer(0, 1, 0, 0);
	BoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
	StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Cable Name"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1"));
	BoxSizer1->Add(StaticText1, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl1 = new wxTextCtrl(this, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL1"));
	BoxSizer1->Add(TextCtrl1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer2->Add(BoxSizer1, 1, wxALL|wxEXPAND, 5);
	BoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
	Notebook1 = new wxNotebook(this, ID_NOTEBOOK1, wxDefaultPosition, wxDefaultSize, 0, _T("ID_NOTEBOOK1"));
	Panel2 = new wxPanel(Notebook1, ID_PANEL2, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL2"));
	FlexGridSizer3 = new wxFlexGridSizer(0, 2, 0, 0);
	StaticText2 = new wxStaticText(Panel2, ID_STATICTEXT2, _("Inner Conductor Radius (m)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2"));
	FlexGridSizer3->Add(StaticText2, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl2 = new wxTextCtrl(Panel2, ID_TEXTCTRL2, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL2"));
	FlexGridSizer3->Add(TextCtrl2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText3 = new wxStaticText(Panel2, ID_STATICTEXT3, _("Inner Dielectric Radius (m)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT3"));
	FlexGridSizer3->Add(StaticText3, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl3 = new wxTextCtrl(Panel2, ID_TEXTCTRL3, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL3"));
	FlexGridSizer3->Add(TextCtrl3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText4 = new wxStaticText(Panel2, ID_STATICTEXT4, _("Inner Conductor Separation (m)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT4"));
	FlexGridSizer3->Add(StaticText4, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl4 = new wxTextCtrl(Panel2, ID_TEXTCTRL4, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL4"));
	FlexGridSizer3->Add(TextCtrl4, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText5 = new wxStaticText(Panel2, ID_STATICTEXT5, _("Inner Shield Radius (m)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT5"));
	FlexGridSizer3->Add(StaticText5, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl5 = new wxTextCtrl(Panel2, ID_TEXTCTRL5, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL5"));
	FlexGridSizer3->Add(TextCtrl5, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText6 = new wxStaticText(Panel2, ID_STATICTEXT6, _("Inner Shield Thickness (m)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT6"));
	FlexGridSizer3->Add(StaticText6, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl6 = new wxTextCtrl(Panel2, ID_TEXTCTRL6, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL6"));
	FlexGridSizer3->Add(TextCtrl6, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText7 = new wxStaticText(Panel2, ID_STATICTEXT7, _("Inner Shield Jacket Radius (m)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT7"));
	FlexGridSizer3->Add(StaticText7, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl7 = new wxTextCtrl(Panel2, ID_TEXTCTRL7, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL7"));
	FlexGridSizer3->Add(TextCtrl7, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText8 = new wxStaticText(Panel2, ID_STATICTEXT8, _("STP Radius (m)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT8"));
	FlexGridSizer3->Add(StaticText8, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl8 = new wxTextCtrl(Panel2, ID_TEXTCTRL8, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL8"));
	FlexGridSizer3->Add(TextCtrl8, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText9 = new wxStaticText(Panel2, ID_STATICTEXT9, _("Outer Shield Radius (m)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT9"));
	FlexGridSizer3->Add(StaticText9, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl9 = new wxTextCtrl(Panel2, ID_TEXTCTRL9, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL9"));
	FlexGridSizer3->Add(TextCtrl9, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText10 = new wxStaticText(Panel2, ID_STATICTEXT10, _("Outer Shield Thickness (m)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT10"));
	FlexGridSizer3->Add(StaticText10, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl10 = new wxTextCtrl(Panel2, ID_TEXTCTRL10, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL10"));
	FlexGridSizer3->Add(TextCtrl10, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText11 = new wxStaticText(Panel2, ID_STATICTEXT11, _("Outer Dielectric Radius (m)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT11"));
	FlexGridSizer3->Add(StaticText11, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl11 = new wxTextCtrl(Panel2, ID_TEXTCTRL11, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL11"));
	FlexGridSizer3->Add(TextCtrl11, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText12 = new wxStaticText(Panel2, ID_STATICTEXT12, _("Inner Conductor Conductivity (S/m)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT12"));
	FlexGridSizer3->Add(StaticText12, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl12 = new wxTextCtrl(Panel2, ID_TEXTCTRL12, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL12"));
	FlexGridSizer3->Add(TextCtrl12, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText13 = new wxStaticText(Panel2, ID_STATICTEXT13, _("Inner Shield Conductivity (S/m)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT13"));
	FlexGridSizer3->Add(StaticText13, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl13 = new wxTextCtrl(Panel2, ID_TEXTCTRL13, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL13"));
	FlexGridSizer3->Add(TextCtrl13, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText14 = new wxStaticText(Panel2, ID_STATICTEXT14, _("Outer Shield Conductivity (S/m)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT14"));
	FlexGridSizer3->Add(StaticText14, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl14 = new wxTextCtrl(Panel2, ID_TEXTCTRL14, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL14"));
	FlexGridSizer3->Add(TextCtrl14, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	Panel2->SetSizer(FlexGridSizer3);
	FlexGridSizer3->Fit(Panel2);
	FlexGridSizer3->SetSizeHints(Panel2);
	Panel3 = new wxPanel(Notebook1, ID_PANEL3, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL3"));
	FlexGridSizer4 = new wxFlexGridSizer(0, 2, 0, 0);
	StaticText15 = new wxStaticText(Panel3, ID_STATICTEXT15, _("Inner Dielectric Permittivity"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT15"));
	FlexGridSizer4->Add(StaticText15, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl15 = new wxTextCtrl(Panel3, ID_TEXTCTRL15, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL15"));
	FlexGridSizer4->Add(TextCtrl15, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText16 = new wxStaticText(Panel3, ID_STATICTEXT16, _("Inner Shield Jacket Permittivity"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT16"));
	FlexGridSizer4->Add(StaticText16, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl26 = new wxTextCtrl(Panel3, ID_TEXTCTRL26, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL26"));
	FlexGridSizer4->Add(TextCtrl26, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText17 = new wxStaticText(Panel3, ID_STATICTEXT17, _("Outer Dielectric Permittivity"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT17"));
	FlexGridSizer4->Add(StaticText17, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl27 = new wxTextCtrl(Panel3, ID_TEXTCTRL27, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL27"));
	FlexGridSizer4->Add(TextCtrl27, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText18 = new wxStaticText(Panel3, ID_STATICTEXT18, _("or Frequency Dependent Model"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT18"));
	FlexGridSizer4->Add(StaticText18, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	CheckBox1 = new wxCheckBox(Panel3, ID_CHECKBOX1, _("Yes"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX1"));
	CheckBox1->SetValue(false);
	FlexGridSizer4->Add(CheckBox1, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
	Panel3->SetSizer(FlexGridSizer4);
	FlexGridSizer4->Fit(Panel3);
	FlexGridSizer4->SetSizeHints(Panel3);
	Panel4 = new wxPanel(Notebook1, ID_PANEL4, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL4"));
	FlexGridSizer5 = new wxFlexGridSizer(0, 2, 0, 0);
	StaticText19 = new wxStaticText(Panel4, ID_STATICTEXT19, _("Inner Normalisation Constant"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT19"));
	FlexGridSizer5->Add(StaticText19, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl16 = new wxTextCtrl(Panel4, ID_TEXTCTRL16, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL16"));
	FlexGridSizer5->Add(TextCtrl16, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText20 = new wxStaticText(Panel4, ID_STATICTEXT20, _("numerator order"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT20"));
	FlexGridSizer5->Add(StaticText20, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl17 = new wxTextCtrl(Panel4, ID_TEXTCTRL17, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL17"));
	FlexGridSizer5->Add(TextCtrl17, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText21 = new wxStaticText(Panel4, ID_STATICTEXT21, _("coefficients"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT21"));
	FlexGridSizer5->Add(StaticText21, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl18 = new wxTextCtrl(Panel4, ID_TEXTCTRL18, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL18"));
	FlexGridSizer5->Add(TextCtrl18, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText23 = new wxStaticText(Panel4, ID_STATICTEXT23, _("Denominator Order"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT23"));
	FlexGridSizer5->Add(StaticText23, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl19 = new wxTextCtrl(Panel4, ID_TEXTCTRL19, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL19"));
	FlexGridSizer5->Add(TextCtrl19, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText24 = new wxStaticText(Panel4, ID_STATICTEXT24, _("coefficients"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT24"));
	FlexGridSizer5->Add(StaticText24, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl20 = new wxTextCtrl(Panel4, ID_TEXTCTRL20, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL20"));
	FlexGridSizer5->Add(TextCtrl20, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText26 = new wxStaticText(Panel4, ID_STATICTEXT26, _("Outer Normalisation Constant"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT26"));
	FlexGridSizer5->Add(StaticText26, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl21 = new wxTextCtrl(Panel4, ID_TEXTCTRL21, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL21"));
	FlexGridSizer5->Add(TextCtrl21, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText30 = new wxStaticText(Panel4, ID_STATICTEXT30, _("Numerator Order"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT30"));
	FlexGridSizer5->Add(StaticText30, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl22 = new wxTextCtrl(Panel4, ID_TEXTCTRL22, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL22"));
	FlexGridSizer5->Add(TextCtrl22, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText31 = new wxStaticText(Panel4, ID_STATICTEXT31, _("coefficients"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT31"));
	FlexGridSizer5->Add(StaticText31, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl23 = new wxTextCtrl(Panel4, ID_TEXTCTRL23, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL23"));
	FlexGridSizer5->Add(TextCtrl23, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText32 = new wxStaticText(Panel4, ID_STATICTEXT32, _("Denominator Order"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT32"));
	FlexGridSizer5->Add(StaticText32, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl24 = new wxTextCtrl(Panel4, ID_TEXTCTRL24, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL24"));
	FlexGridSizer5->Add(TextCtrl24, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText33 = new wxStaticText(Panel4, ID_STATICTEXT33, _("coefficients"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT33"));
	FlexGridSizer5->Add(StaticText33, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl25 = new wxTextCtrl(Panel4, ID_TEXTCTRL25, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL25"));
	FlexGridSizer5->Add(TextCtrl25, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	Panel4->SetSizer(FlexGridSizer5);
	FlexGridSizer5->Fit(Panel4);
	FlexGridSizer5->SetSizeHints(Panel4);
	Notebook1->AddPage(Panel2, _("General"), false);
	Notebook1->AddPage(Panel3, _("Material"), false);
	Notebook1->AddPage(Panel4, _("Transfer Impedance"), false);
	BoxSizer4->Add(Notebook1, 1, wxALL|wxEXPAND, 5);
	FlexGridSizer2->Add(BoxSizer4, 5, wxALL|wxEXPAND, 5);
	FlexGridSizer7 = new wxFlexGridSizer(0, 2, 0, 0);
	StaticText29 = new wxStaticText(this, ID_STATICTEXT29, _("Use Laplace"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT29"));
	FlexGridSizer7->Add(StaticText29, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	CheckBox2 = new wxCheckBox(this, ID_CHECKBOX2, _("Yes"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX2"));
	CheckBox2->SetValue(false);
	FlexGridSizer7->Add(CheckBox2, 3, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	StaticText22 = new wxStaticText(this, ID_STATICTEXT22, _("View Mesh"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT22"));
	FlexGridSizer7->Add(StaticText22, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	ComboBox1 = new wxComboBox(this, ID_COMBOBOX1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("ID_COMBOBOX1"));
	FlexGridSizer7->Add(ComboBox1, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	StaticText25 = new wxStaticText(this, ID_STATICTEXT25, _("Refine Laplace Mesh"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT25"));
	FlexGridSizer7->Add(StaticText25, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	CheckBox3 = new wxCheckBox(this, ID_CHECKBOX3, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX3"));
	CheckBox3->SetValue(false);
	CheckBox3->Disable();
	FlexGridSizer7->Add(CheckBox3, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer2->Add(FlexGridSizer7, 1, wxALL|wxEXPAND, 5);
	StaticBoxSizer1->Add(FlexGridSizer2, 8, wxALL|wxEXPAND, 5);
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
304
305
306
307
308
309
310
311
	FlexGridSizer1->Add(StaticBoxSizer1, 1, wxALL|wxEXPAND, 5);
	FlexGridSizer8 = new wxFlexGridSizer(0, 1, 0, 0);
	StaticBoxSizer2 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Cross Section"));
	Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxSize(500,500), wxTAB_TRAVERSAL, _T("ID_PANEL1"));
	Panel1->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
	Panel1->SetToolTip(_("Double Click to Reset Schematic"));
	StaticBoxSizer2->Add(Panel1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer8->Add(StaticBoxSizer2, 1, wxALL|wxALIGN_TOP|wxALIGN_CENTER_HORIZONTAL, 5);
886c558b   Steve Greedy   SACAMOS Public Re...
312
313
314
315
316
317
318
319
	FlexGridSizer6 = new wxFlexGridSizer(0, 1, 0, 0);
	BoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
	Button1 = new wxButton(this, ID_BUTTON1, _("SAVE"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
	BoxSizer2->Add(Button1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	Button2 = new wxButton(this, ID_BUTTON2, _("BUILD"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2"));
	BoxSizer2->Add(Button2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	Button3 = new wxButton(this, ID_BUTTON3, _("CLOSE"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON3"));
	BoxSizer2->Add(Button3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
320
321
322
	FlexGridSizer6->Add(BoxSizer2, 1, wxALL|wxALIGN_RIGHT, 5);
	FlexGridSizer8->Add(FlexGridSizer6, 1, wxALL|wxEXPAND, 5);
	FlexGridSizer1->Add(FlexGridSizer8, 1, wxALL|wxEXPAND, 5);
886c558b   Steve Greedy   SACAMOS Public Re...
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
	SetSizer(FlexGridSizer1);
	FlexGridSizer1->Fit(this);
	FlexGridSizer1->SetSizeHints(this);

	Connect(ID_TEXTCTRL2,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl2Text);
	Connect(ID_TEXTCTRL3,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl3Text);
	Connect(ID_TEXTCTRL4,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl4Text);
	Connect(ID_TEXTCTRL5,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl5Text);
	Connect(ID_TEXTCTRL6,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl6Text);
	Connect(ID_TEXTCTRL7,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl7Text);
	Connect(ID_TEXTCTRL8,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl8Text);
	Connect(ID_TEXTCTRL9,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl9Text);
	Connect(ID_TEXTCTRL10,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl10Text);
	Connect(ID_TEXTCTRL11,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl11Text);
	Connect(ID_TEXTCTRL12,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl12Text);
	Connect(ID_TEXTCTRL13,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl13Text);
	Connect(ID_TEXTCTRL14,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl14Text);
	Connect(ID_TEXTCTRL15,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl15Text);
	Connect(ID_TEXTCTRL26,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl26Text);
	Connect(ID_TEXTCTRL27,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl27Text);
	Connect(ID_CHECKBOX1,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&SPACEWIRE::OnCheckBox1Click);
	Connect(ID_TEXTCTRL16,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl16Text);
	Connect(ID_TEXTCTRL17,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl17Text);
	Connect(ID_TEXTCTRL18,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl18Text);
	Connect(ID_TEXTCTRL19,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl19Text);
	Connect(ID_TEXTCTRL20,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl20Text);
	Connect(ID_TEXTCTRL21,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl21Text);
	Connect(ID_TEXTCTRL22,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl22Text);
	Connect(ID_TEXTCTRL23,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl23Text);
	Connect(ID_TEXTCTRL24,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl24Text);
	Connect(ID_TEXTCTRL25,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&SPACEWIRE::OnTextCtrl25Text);
	Connect(ID_COMBOBOX1,wxEVT_COMMAND_COMBOBOX_SELECTED,(wxObjectEventFunction)&SPACEWIRE::OnComboBox1Selected);
	Connect(ID_CHECKBOX3,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&SPACEWIRE::OnCheckBox3Click);
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
356
357
	Panel1->Connect(wxEVT_PAINT,(wxObjectEventFunction)&SPACEWIRE::OnPanel1Paint,0,this);
	Panel1->Connect(wxEVT_LEFT_DCLICK,(wxObjectEventFunction)&SPACEWIRE::OnPanel1LeftDClick,0,this);
886c558b   Steve Greedy   SACAMOS Public Re...
358
359
360
	Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SPACEWIRE::OnButton1Click);
	Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SPACEWIRE::OnButton2Click);
	Connect(ID_BUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SPACEWIRE::OnButton3Click);
2a0d305e   Steve Greedy   Modifications to ...
361
	Connect(wxID_ANY,wxEVT_INIT_DIALOG,(wxObjectEventFunction)&SPACEWIRE::OnInit);
dd86ff43   Steve Greedy   Updates to SW1
362
	Connect(wxEVT_PAINT,(wxObjectEventFunction)&SPACEWIRE::OnPaint);
886c558b   Steve Greedy   SACAMOS Public Re...
363
	//*)
2a0d305e   Steve Greedy   Modifications to ...
364
}
886c558b   Steve Greedy   SACAMOS Public Re...
365

2a0d305e   Steve Greedy   Modifications to ...
366
367
368
369
370
371
372
373
374
SPACEWIRE::~SPACEWIRE()
{
	//(*Destroy(SPACEWIRE)
	//*)
}


void SPACEWIRE::OnInit(wxInitDialogEvent& event)
{
886c558b   Steve Greedy   SACAMOS Public Re...
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
    TextCtrl2->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&SPACEWIRE::OnHighlightSchematic, this);
    TextCtrl3->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&SPACEWIRE::OnHighlightSchematic, this);
    TextCtrl4->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&SPACEWIRE::OnHighlightSchematic, this);
    TextCtrl5->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&SPACEWIRE::OnHighlightSchematic, this);
    TextCtrl6->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&SPACEWIRE::OnHighlightSchematic, this);
    TextCtrl7->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&SPACEWIRE::OnHighlightSchematic, this);
    TextCtrl8->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&SPACEWIRE::OnHighlightSchematic, this);
    TextCtrl9->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&SPACEWIRE::OnHighlightSchematic, this);
    TextCtrl10->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&SPACEWIRE::OnHighlightSchematic, this);
    TextCtrl11->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&SPACEWIRE::OnHighlightSchematic, this);
    TextCtrl12->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&SPACEWIRE::OnHighlightSchematic, this);
    TextCtrl13->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&SPACEWIRE::OnHighlightSchematic, this);
    TextCtrl14->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&SPACEWIRE::OnHighlightSchematic, this);
    TextCtrl15->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&SPACEWIRE::OnHighlightSchematic, this);
    TextCtrl26->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&SPACEWIRE::OnHighlightSchematic, this);
    TextCtrl27->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&SPACEWIRE::OnHighlightSchematic, this);
    CheckBox1->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&SPACEWIRE::OnHighlightSchematic, this);
}

dd86ff43   Steve Greedy   Updates to SW1
394
395
396
397
398
void SPACEWIRE::OnPaint(wxPaintEvent& event)
{
    if (EDIT_EXISTING==true) EditExistingCable();
}

886c558b   Steve Greedy   SACAMOS Public Re...
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
487
488
489
490
491
void SPACEWIRE::SetPathToMOD(wxString Path, wxString Name)
{
    pathToMOD << Path;
    MODname << Name;
}

void SPACEWIRE::OnButton1Click(wxCommandEvent& event)
{
    int IsError = 0;

    wxString fileName = TextCtrl1->GetValue();

    TextCtrl1->SetBackgroundColour(wxColor(255,255,255));

    if (fileName == "")
    {
        wxMessageBox("Please Specify a Cable Name" , _("Missing Cable Name"));
        return;
    }

    check_is_empty(TextCtrl2, &IsError);
    check_is_empty(TextCtrl3, &IsError);
    check_is_empty(TextCtrl4, &IsError);
    check_is_empty(TextCtrl5, &IsError);
    check_is_empty(TextCtrl6, &IsError);
    check_is_empty(TextCtrl7, &IsError);
    check_is_empty(TextCtrl8, &IsError);
    check_is_empty(TextCtrl9, &IsError);
    check_is_empty(TextCtrl10, &IsError);
    check_is_empty(TextCtrl11, &IsError);
    check_is_empty(TextCtrl12, &IsError);
    check_is_empty(TextCtrl13, &IsError);
    check_is_empty(TextCtrl14, &IsError);
    check_is_empty(TextCtrl16, &IsError);
    check_is_empty(TextCtrl17, &IsError);
    check_is_empty(TextCtrl18, &IsError);
    check_is_empty(TextCtrl19, &IsError);
    check_is_empty(TextCtrl20, &IsError);
    check_is_empty(TextCtrl21, &IsError);
    check_is_empty(TextCtrl22, &IsError);
    check_is_empty(TextCtrl23, &IsError);
    check_is_empty(TextCtrl24, &IsError);
    check_is_empty(TextCtrl25, &IsError);

    if (CheckBox1->GetValue())
    {

    }
    else
    {
        check_is_empty(TextCtrl15, &IsError);
        check_is_empty(TextCtrl26, &IsError);
        check_is_empty(TextCtrl27, &IsError);
    }

    if ( IsError == 1)
    {
        wxMessageBox("Please fix highlighted errors" , _("Non numeric entry"));
        return;
    }

    WriteCableFile (fileName);

    Button1->Disable();
}

void SPACEWIRE::OnCheckBox1Click(wxCommandEvent& event)
{
    TextCtrl15->Disable();
    TextCtrl26->Disable();
    TextCtrl27->Disable();

    FD_ESR_SW *winFD_ESR = new FD_ESR_SW(this);

    if ( winFD_ESR->ShowModal() == wxID_OK )
    {
        FD_ESR1 = winFD_ESR->TextCtrl1->GetValue();
        FD_ESR2 = winFD_ESR->TextCtrl2->GetValue();
        FD_ESR3 = winFD_ESR->TextCtrl3->GetValue();
        FD_ESR4 = winFD_ESR->TextCtrl4->GetValue();
        FD_ESR5 = winFD_ESR->TextCtrl5->GetValue();

        FD_ESR6 = winFD_ESR->TextCtrl6->GetValue();
        FD_ESR7 = winFD_ESR->TextCtrl7->GetValue();
        FD_ESR8 = winFD_ESR->TextCtrl8->GetValue();
        FD_ESR9 = winFD_ESR->TextCtrl9->GetValue();
        FD_ESR10= winFD_ESR->TextCtrl10->GetValue();

        FD_ESR11= winFD_ESR->TextCtrl11->GetValue();
        FD_ESR12 = winFD_ESR->TextCtrl12->GetValue();
        FD_ESR13 = winFD_ESR->TextCtrl13->GetValue();
        FD_ESR14 = winFD_ESR->TextCtrl14->GetValue();
        FD_ESR15 = winFD_ESR->TextCtrl15->GetValue();
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
492

dd86ff43   Steve Greedy   Updates to SW1
493
494
        FD_Default = winFD_ESR->CheckBox1->GetValue();

d475f4d6   Steve Greedy   SW1 Update to v1.0.1
495
496
497
498
499
        FD_ORDER = winFD_ESR->TextCtrl16->GetValue();
        FD_lin   = winFD_ESR->RadioButton1->GetValue();
        FD_Fmin  = winFD_ESR->TextCtrl17->GetValue();
        FD_Fmax  = winFD_ESR->TextCtrl18->GetValue();
        FD_Num   = winFD_ESR->TextCtrl19->GetValue();
886c558b   Steve Greedy   SACAMOS Public Re...
500
501
502
503
504
505
506
507
508
509
510
    }
    winFD_ESR->Destroy();
}

void SPACEWIRE::OnButton2Click(wxCommandEvent& event)
{
    //clean up directory
    clean_temp_files();

    //CABLE BUIDER
    wxString fileName = TextCtrl1->GetValue();
2a0d305e   Steve Greedy   Modifications to ...
511
    wxString command_line;
886c558b   Steve Greedy   SACAMOS Public Re...
512

1bcf33cb   Steve Greedy   Modifications to ...
513
514
    wxString separator(wxFileName::GetPathSeparator());

886c558b   Steve Greedy   SACAMOS Public Re...
515
    std::stringstream stream;
1bcf33cb   Steve Greedy   Modifications to ...
516
517
518

    stream  <<"." + separator
            << "cable_model_builder"
886c558b   Steve Greedy   SACAMOS Public Re...
519
            << " "
1bcf33cb   Steve Greedy   Modifications to ...
520
            << ".." + separator + MODname + separator + "CABLE" + separator
886c558b   Steve Greedy   SACAMOS Public Re...
521
522
            << fileName ;

3d24aeb1   Steve Greedy   Modification to s...
523
    wxExecute (command_line, wxEXEC_SYNC);
886c558b   Steve Greedy   SACAMOS Public Re...
524
525
526
527
528
529
530

    // Display Run Status
    RUN_STATUS *run_status = new RUN_STATUS(this);
    run_status->ShowModal();

    Button1->Enable();

dd86ff43   Steve Greedy   Updates to SW1
531
532
533
534
535
    if (CheckBox2->GetValue())
    {

        wxString pattern (("*.msh.vtk")) ;

886c558b   Steve Greedy   SACAMOS Public Re...
536
        wxString file;
dd86ff43   Steve Greedy   Updates to SW1
537

886c558b   Steve Greedy   SACAMOS Public Re...
538
539
540
        ComboBox1->Clear();

        file = wxFindFirstFile(pattern);
dd86ff43   Steve Greedy   Updates to SW1
541

886c558b   Steve Greedy   SACAMOS Public Re...
542
543
544
        while ( !file.empty())
        {
                wxString meshfile = file;
dd86ff43   Steve Greedy   Updates to SW1
545
                size_t extindex = meshfile.find_last_of (".");
886c558b   Steve Greedy   SACAMOS Public Re...
546
547
548

                meshfile  = meshfile.substr(0, extindex);

dd86ff43   Steve Greedy   Updates to SW1
549
550
551
552
553
554
                extindex = meshfile.find_last_of (".");

                meshfile  = meshfile.substr(0, extindex);

                meshfile = meshfile.substr(2,meshfile.length());

886c558b   Steve Greedy   SACAMOS Public Re...
555
                ComboBox1->Append(meshfile);
886c558b   Steve Greedy   SACAMOS Public Re...
556

dd86ff43   Steve Greedy   Updates to SW1
557
558
                file = wxFindNextFile();
        }
886c558b   Steve Greedy   SACAMOS Public Re...
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
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
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
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
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

        CheckBox3->Enable();
    }
}

void SPACEWIRE::OnButton3Click(wxCommandEvent& event)
{
    //clean up directory
    clean_temp_files();
    Close();
}

void SPACEWIRE::OnTextCtrl2Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl2, &IsError);
    check_is_positive (TextCtrl2, &IsError);
}

void SPACEWIRE::OnTextCtrl3Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric_list(TextCtrl3, &IsError);
    check_is_positive (TextCtrl3, &IsError);
    check_is_less_than(TextCtrl3, TextCtrl2, &IsError);
}

void SPACEWIRE::OnTextCtrl4Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric_list(TextCtrl4, &IsError);
    check_is_positive (TextCtrl4, &IsError);

    double value_tb3, value_tb4;
    wxString contents_tb3, contents_tb4;

    contents_tb3 = TextCtrl3->GetValue();
    contents_tb4 = TextCtrl4->GetValue();

    contents_tb3.ToDouble(&value_tb3);
    contents_tb4.ToDouble(&value_tb4);

    if (value_tb4 <= (value_tb3 + value_tb3))
    {
        TextCtrl4->SetBackgroundColour(wxColor(255,153,153));
        TextCtrl4->SetFocus();
        IsError = 1;
    }
}

void SPACEWIRE::OnTextCtrl5Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl5, &IsError);
    check_is_positive (TextCtrl5, &IsError);

    double value_tb3, value_tb5;
    wxString contents_tb3, contents_tb5;

    contents_tb3 = TextCtrl3->GetValue();
    contents_tb5 = TextCtrl5->GetValue();

    contents_tb3.ToDouble(&value_tb3);
    contents_tb5.ToDouble(&value_tb5);

    if (value_tb5 <= (4.0 * value_tb3))
    {
        TextCtrl5->SetBackgroundColour(wxColor(255,153,153));
        TextCtrl5->SetFocus();
        IsError = 1;
    }
}

void SPACEWIRE::OnTextCtrl6Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl6, &IsError);
    check_is_positive (TextCtrl5, &IsError);
}

void SPACEWIRE::OnTextCtrl7Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl7, &IsError);
    check_is_positive (TextCtrl7, &IsError);

    double value_tb5, value_tb6, value_tb7;
    wxString contents_tb5, contents_tb6, contents_tb7;

    contents_tb5 = TextCtrl5->GetValue();
    contents_tb6 = TextCtrl6->GetValue();
    contents_tb7 = TextCtrl7->GetValue();

    contents_tb5.ToDouble(&value_tb5);
    contents_tb6.ToDouble(&value_tb6);
    contents_tb7.ToDouble(&value_tb7);

    if (value_tb7 < (value_tb5 + value_tb6))
    {
        TextCtrl7->SetBackgroundColour(wxColor(255,153,153));
        TextCtrl7->SetFocus();
        IsError = 1;
    }
}

void SPACEWIRE::OnTextCtrl8Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl8, &IsError);
    check_is_positive (TextCtrl8, &IsError);

    double value_tb7, value_tb8;
    wxString contents_tb7, contents_tb8;

    contents_tb7 = TextCtrl7->GetValue();
    contents_tb8 = TextCtrl8->GetValue();

    contents_tb7.ToDouble(&value_tb7);
    contents_tb8.ToDouble(&value_tb8);

    float hyp = sqrt(pow(value_tb8,2) + pow(value_tb8,2));

    if (hyp <= (value_tb7 + value_tb7))
    {
        TextCtrl8->SetBackgroundColour(wxColor(255,153,153));
        TextCtrl8->SetFocus();
        IsError = 1;
    }
}

void SPACEWIRE::OnTextCtrl9Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl9, &IsError);
    check_is_positive (TextCtrl9, &IsError);

    double value_tb7, value_tb8, value_tb9;
    wxString contents_tb7, contents_tb8, contents_tb9;

    contents_tb7 = TextCtrl7->GetValue();
    contents_tb8 = TextCtrl8->GetValue();
    contents_tb9 = TextCtrl9->GetValue();

    contents_tb7.ToDouble(&value_tb7);
    contents_tb8.ToDouble(&value_tb8);
    contents_tb9.ToDouble(&value_tb9);

    if (value_tb9 <= (value_tb7 + value_tb8))
    {
        TextCtrl9->SetBackgroundColour(wxColor(255,153,153));
        TextCtrl9->SetFocus();
        IsError = 1;
    }
}

void SPACEWIRE::OnTextCtrl10Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl10, &IsError);
    check_is_positive(TextCtrl10, &IsError);
}

void SPACEWIRE::OnTextCtrl11Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl11, &IsError);
    check_is_positive(TextCtrl11, &IsError);

    double value_tb9, value_tb10, value_tb11;
    wxString contents_tb9, contents_tb10, contents_tb11;


    contents_tb9 = TextCtrl9->GetValue();
    contents_tb10 = TextCtrl10->GetValue();
    contents_tb11 = TextCtrl11->GetValue();


    contents_tb9.ToDouble(&value_tb9);
    contents_tb10.ToDouble(&value_tb10);
    contents_tb11.ToDouble(&value_tb11);

    if (value_tb11 < (value_tb9 + value_tb10))
    {
        TextCtrl11->SetBackgroundColour(wxColor(255,153,153));
        TextCtrl11->SetFocus();
        IsError = 1;
    }
}

void SPACEWIRE::OnTextCtrl12Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl12, &IsError);
    check_is_positive(TextCtrl12, &IsError);
}

void SPACEWIRE::OnTextCtrl13Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl13, &IsError);
    check_is_positive(TextCtrl13, &IsError);
}

void SPACEWIRE::OnTextCtrl14Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl14, &IsError);
    check_is_positive(TextCtrl14, &IsError);
}

void SPACEWIRE::OnTextCtrl15Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl15, &IsError);
    check_is_positive(TextCtrl15, &IsError);
}

void SPACEWIRE::OnTextCtrl26Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl26, &IsError);
    check_is_positive(TextCtrl26, &IsError);
}

void SPACEWIRE::OnTextCtrl27Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl27, &IsError);
    check_is_positive(TextCtrl27, &IsError);
}

void SPACEWIRE::OnTextCtrl16Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl16, &IsError);
    check_is_positive(TextCtrl16, &IsError);
}

void SPACEWIRE::OnTextCtrl17Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl17, &IsError);
    check_is_positive(TextCtrl17, &IsError);
}

void SPACEWIRE::OnTextCtrl18Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric_list(TextCtrl18, &IsError);
}

void SPACEWIRE::OnTextCtrl19Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl19, &IsError);
    check_is_positive(TextCtrl19, &IsError);
}

void SPACEWIRE::OnTextCtrl20Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric_list(TextCtrl20, &IsError);
}

void SPACEWIRE::OnTextCtrl21Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl21, &IsError);
    check_is_positive(TextCtrl21, &IsError);
}


void SPACEWIRE::OnTextCtrl22Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl22, &IsError);
    check_is_positive(TextCtrl22, &IsError);
}


void SPACEWIRE::OnTextCtrl23Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric_list(TextCtrl23, &IsError);
}

void SPACEWIRE::OnTextCtrl24Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric(TextCtrl24, &IsError);
    check_is_positive(TextCtrl24, &IsError);
}

void SPACEWIRE::OnTextCtrl25Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric_list(TextCtrl25, &IsError);
    check_is_positive(TextCtrl25, &IsError);
}

void SPACEWIRE::WriteCableFile (wxString fileName)
{

    ofstream cableFile;

1bcf33cb   Steve Greedy   Modifications to ...
864
865
866
    wxString separator(wxFileName::GetPathSeparator());

    wxString fullFileName = pathToMOD + separator + "CABLE" + separator + fileName + ".cable_spec";
886c558b   Steve Greedy   SACAMOS Public Re...
867
868
869
870
871
872
873
874

    cableFile.open (fullFileName);

    if (cableFile.is_open())
    {

        // minimum requirements for type Coax
        cableFile <<"# MOD_cable_lib_dir \n";
1bcf33cb   Steve Greedy   Modifications to ...
875
        cableFile <<".." << separator << MODname << separator << "CABLE" << separator <<"\n";
886c558b   Steve Greedy   SACAMOS Public Re...
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
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
        cableFile <<"Spacewire\n";
        cableFile <<"13 \t#number of conductors \n";
        cableFile <<"13 \t#number of parameters \n";
        cableFile << TextCtrl2->GetValue() <<" \t# parameter 1: inner conductor radius (m)\n";
        cableFile << TextCtrl3->GetValue() <<" \t# parameter 2: inner dielectric radius (m)\n";
        cableFile << TextCtrl4->GetValue() <<" \t# parameter 3: inner conductor separation (m)\n";
        cableFile << TextCtrl5->GetValue() <<" \t# parameter 4: inner shield radius (m)\n";
        cableFile << TextCtrl6->GetValue() <<" \t# parameter 5: inner shield thickness (m)\n";

        cableFile << TextCtrl7->GetValue() <<" \t# parameter 6: inner shield jacket radius (m)\n";
        cableFile << TextCtrl8->GetValue() <<" \t# parameter 7: shielded twisted pair radius (m)\n";

        cableFile << TextCtrl9->GetValue() <<" \t# parameter 8: outer shield radius (m)\n";
        cableFile << TextCtrl10->GetValue() <<" \t# parameter 9: outer shield thickness (m)\n";
        cableFile << TextCtrl11->GetValue() <<" \t# parameter 10: outer dielectric radius (m)\n";

        cableFile << TextCtrl12->GetValue() <<" \t# parameter 11: inner conductor electric conductivity (m)\n";
        cableFile << TextCtrl13->GetValue() <<" \t# parameter 12: inner shield electric conductivity (m)\n";
        cableFile << TextCtrl14->GetValue() <<" \t# parameter 13: inner shield electric conductivity (m)\n";
        cableFile <<"3 \t# number of frequency dependent parameters\n";;

        if (CheckBox1->GetValue()){
            cableFile << "# Inner dielectric relative permittivity\n";
            cableFile << FD_ESR1 <<"\t # w normalisation constant\n";
            cableFile << FD_ESR2 <<"\t # a order, a coefficients follow below\n";
            cableFile << FD_ESR3 <<"\n";
            cableFile << FD_ESR4 <<"\t # b order, b coefficients follow below\n";
            cableFile << FD_ESR5 <<"\n";

            cableFile << "# Inner shield dielectric relative permittivity\n";
            cableFile << FD_ESR6 <<"\t # w normalisation constant\n";
            cableFile << FD_ESR7 <<"\t # a order, a coefficients follow below\n";
            cableFile << FD_ESR8 <<"\n";
            cableFile << FD_ESR9 <<"\t # b order, b coefficients follow below\n";
            cableFile << FD_ESR10 <<"\n";

            cableFile << "#  Outer dielectric relative permittivity\n";
            cableFile << FD_ESR11 <<"\t # w normalisation constant\n";
            cableFile << FD_ESR12 <<"\t # a order, a coefficients follow below\n";
            cableFile << FD_ESR13 <<"\n";
            cableFile << FD_ESR14 <<"\t # b order, b coefficients follow below\n";
            cableFile << FD_ESR15 <<"\n";

        }

        else{
            cableFile << "# Inner dielectric relative permittivity\n";
            cableFile << "1.0 # w normalisation constant\n";
            cableFile << "0 # a order, a coefficients follow below\n";
            cableFile << TextCtrl15->GetValue()<<"\n";
            cableFile << "0 # b order, b coefficients follow below\n";
            cableFile << "1.0\n";

            cableFile << "# Inner shield dielectric relative permittivity\n";
            cableFile << "1.0 # w normalisation constant\n";
            cableFile << "0 # a order, a coefficients follow below\n";
            cableFile << TextCtrl26->GetValue()<<"\n";
            cableFile << "0 # b order, b coefficients follow below\n";
            cableFile << "1.0\n";

            cableFile << "#  Outer dielectric relative permittivity\n";
            cableFile << "1.0 \t# w normalisation constant\n";
            cableFile << "0 \t# a order, a coefficients follow below\n";
            cableFile << TextCtrl27->GetValue()<<"\n";
            cableFile << "0 \t# b order, b coefficients follow below\n";
            cableFile << "1.0\n";
        }

        cableFile << "2 \t# number of frequency dependent transfer impedance models\n";
        cableFile << "#  Inner shield Transfer impedance mode \n";
        cableFile << TextCtrl16->GetValue() <<" \t# angular frequency normalisation\n";
        cableFile << TextCtrl17->GetValue() <<" \t# order of numerator model\n";
        cableFile << TextCtrl18->GetValue() <<" \t# list of numerator coefficients a0 a1 a2... \n";
        cableFile << TextCtrl19->GetValue() <<" \t# order of denominator model\n";
        cableFile << TextCtrl20->GetValue() <<" \t# list of denominator coefficients b0 b1 b2... \n";

        cableFile << "#  Outer shield Transfer impedance mode \n";
        cableFile << TextCtrl21->GetValue() <<" \t# angular frequency normalisation\n";
        cableFile << TextCtrl22->GetValue() <<" \t# order of numerator model\n";
        cableFile << TextCtrl23->GetValue() <<" \t# list of numerator coefficients a0 a1 a2... \n";
        cableFile << TextCtrl24->GetValue() <<" \t# order of denominator model\n";
        cableFile << TextCtrl25->GetValue() <<" \t# list of denominator coefficients b0 b1 b2... \n";
    }

dd86ff43   Steve Greedy   Updates to SW1
960
    if (!FD_Default){
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
961
962
963
964

        cableFile << FD_ORDER <<"\t # order for filter fitting\n";
        if (FD_lin)
        {
dd86ff43   Steve Greedy   Updates to SW1
965
            cableFile << "lin   # frequency range type for filter fitting type (lin or dB)\n";
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
966
967
968
        }
        else
        {
dd86ff43   Steve Greedy   Updates to SW1
969
            cableFile << "log   # frequency range type for filter fitting type (lin or dB)\n";
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
970
        }
dd86ff43   Steve Greedy   Updates to SW1
971
        cableFile << FD_Fmin <<" "<< FD_Fmax <<" "<< FD_Num <<"\t # fmin fmax number_of_frequencies for filter fitting\n";
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
972
973
    }

886c558b   Steve Greedy   SACAMOS Public Re...
974
975
976
977
978
979
980
981
982
    if (CheckBox2->GetValue()){
        cableFile << "use_laplace\n";
    }
    else{
        cableFile << "no_laplace\n";
    }

    if (CheckBox3->GetValue())
    {
dd86ff43   Steve Greedy   Updates to SW1
983
984
        //cableFile << "Laplace_boundary_constant\n";
        //cableFile << MESH_PARAM1 <<"\n";
886c558b   Steve Greedy   SACAMOS Public Re...
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
        cableFile << "Laplace_surface_mesh_constant\n";
        cableFile << MESH_PARAM2 <<"\n";

        CheckBox3 ->SetValue(false);
    }
    cableFile.close();
}
void SPACEWIRE::OnPanel1Paint(wxPaintEvent& event)
{
    spacewireSchematic();
}

void SPACEWIRE::spacewireSchematic()
{
    int size_h, size_v;
    Panel1->GetSize(&size_h, &size_v );

    wxClientDC dc(Panel1);
    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(*wxBLUE);
    dc.DrawText("General Spacewire Cable", 10, 15);

    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;


    outer_dielectric_radius = 0.4 * size_h;
    outer_shield_radius = 0.35 * size_h;
    outer_shield_thickness = 0.01 * size_h;

    shielded_twisted_pair_radius = 0.2 * size_h;

    inner_shield_jacket_radius = 0.12* size_h;
    inner_shield_radius = 0.09 * size_h;
    inner_shield_thickness = 0.01 * size_h;

    inner_dielectric_radius = 0.04 * size_h;
    inner_conductor_radius = 0.03 * size_h;
    inner_conductor_separation = 0.09 * size_h;

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxBDIAGONAL_HATCH));
    dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_dielectric_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
    dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_shield_radius + outer_shield_thickness );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
    dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_shield_radius );

    //TP Top
    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxFDIAGONAL_HATCH));
    dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius)), inner_shield_jacket_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224)));
    dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius)), inner_shield_thickness + inner_shield_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
    dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius)), inner_shield_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxBDIAGONAL_HATCH));
    dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius-inner_conductor_separation/2)), inner_dielectric_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxBDIAGONAL_HATCH));
    dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius+inner_conductor_separation/2)), inner_dielectric_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
    dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius-inner_conductor_separation/2)), inner_conductor_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
    dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius+inner_conductor_separation/2)), inner_conductor_radius );


    //TP Left
    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxFDIAGONAL_HATCH));
    dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_radius),size_v/2), inner_shield_jacket_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224)));
    dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_radius),size_v/2), inner_shield_thickness + inner_shield_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
    dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_radius),size_v/2), inner_shield_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxBDIAGONAL_HATCH));
    dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_radius-inner_conductor_separation/2),size_v/2), inner_dielectric_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxBDIAGONAL_HATCH));
    dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_radius+inner_conductor_separation/2),size_v/2), inner_dielectric_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
    dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_radius-inner_conductor_separation/2),size_v/2), inner_conductor_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
    dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_radius+inner_conductor_separation/2),size_v/2), inner_conductor_radius );

    //TP Bottom
    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxFDIAGONAL_HATCH));
    dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_radius)), inner_shield_jacket_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224)));
    dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_radius)), inner_shield_thickness + inner_shield_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
    dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_radius)), inner_shield_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxBDIAGONAL_HATCH));
    dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_radius+inner_conductor_separation/2)), inner_dielectric_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxBDIAGONAL_HATCH));
    dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_radius-inner_conductor_separation/2)), inner_dielectric_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
    dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_radius+inner_conductor_separation/2)), inner_conductor_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
    dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_radius-inner_conductor_separation/2)), inner_conductor_radius );

    //TP Right
    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxFDIAGONAL_HATCH));
    dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_radius),size_v/2), inner_shield_jacket_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224)));
    dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_radius),size_v/2), inner_shield_thickness + inner_shield_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
    dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_radius),size_v/2), inner_shield_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxBDIAGONAL_HATCH));
    dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_radius-inner_conductor_separation/2),size_v/2), inner_dielectric_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxBDIAGONAL_HATCH));
    dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_radius+inner_conductor_separation/2),size_v/2), inner_dielectric_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
    dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_radius-inner_conductor_separation/2),size_v/2), inner_conductor_radius );

    dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
    dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
    dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_radius+inner_conductor_separation/2),size_v/2), inner_conductor_radius );

}

void SPACEWIRE::OnHighlightSchematic(wxCommandEvent& event)
{
    spacewireSchematic();

    int ID = event.GetId();
    event.Skip(true);

    int size_h, size_v;
    Panel1->GetSize(&size_h, &size_v );

    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;


    outer_dielectric_radius = 0.4 * size_h;
    outer_shield_radius = 0.35 * size_h;
    outer_shield_thickness = 0.01 * size_h;

    shielded_twisted_pair_radius = 0.2 * size_h;

    inner_shield_jacket_radius = 0.12* size_h;
    inner_shield_radius = 0.09 * size_h;
    inner_shield_thickness = 0.01 * size_h;

    inner_dielectric_radius = 0.04 * size_h;
    inner_conductor_radius = 0.03 * size_h;
    inner_conductor_separation = 0.09 * size_h;

    float x, y, x1, y1;

    wxClientDC dc(Panel1);

    wxPoint arrowHead[3];

    if ( ID == ID_TEXTCTRL2)
    {
        x = size_h/2;
        y = size_v/2-shielded_twisted_pair_radius-inner_conductor_separation/2;

        x1 = x + inner_conductor_radius;
        y1 = y;

        dc.SetPen(wxPen(wxColor(51,51,255), 3));
        dc.SetBrush(wxBrush(wxColor(51,51,255), wxSOLID));
        dc.DrawCircle( wxPoint(x,y), 2 );
        dc.DrawLine( x,y,x1,y1);

        arrowHead[0] = wxPoint(x1,y1);
        arrowHead[1] = wxPoint(x1-3,y1-3);
        arrowHead[2] = wxPoint(x1-3,y1+3);
        dc.DrawPolygon(WXSIZEOF(arrowHead), arrowHead);
    }

    if ( ID == ID_TEXTCTRL3)
    {
        x = size_h/2;
        y = size_v/2-shielded_twisted_pair_radius-inner_conductor_separation/2;

        x1 = x + inner_dielectric_radius;
        y1 = y;

        dc.SetPen(wxPen(wxColor(51,51,255), 3));
        dc.SetBrush(wxBrush(wxColor(51,51,255), wxSOLID));
        dc.DrawCircle( wxPoint(x,y), 2 );
        dc.DrawLine( x,y,x1,y1);

        arrowHead[0] = wxPoint(x1,y1);
        arrowHead[1] = wxPoint(x1-3,y1-3);
        arrowHead[2] = wxPoint(x1-3,y1+3);
        dc.DrawPolygon(WXSIZEOF(arrowHead), arrowHead);
    }

    if ( ID == ID_TEXTCTRL4)
    {
        x = size_h/2;
        y = size_v/2-shielded_twisted_pair_radius-inner_conductor_separation/2;

        x1 = size_h/2;
        y1 = size_v/2-shielded_twisted_pair_radius+inner_conductor_separation/2;

        dc.SetPen(wxPen(wxColor(51,51,255), 3));
        dc.SetBrush(wxBrush(wxColor(51,51,255), wxSOLID));
        dc.DrawLine( x,y,x1,y1);

        arrowHead[0] = wxPoint(x,y);
        arrowHead[1] = wxPoint(x-3,y+3);
        arrowHead[2] = wxPoint(x+3,y+3);
        dc.DrawPolygon(WXSIZEOF(arrowHead), arrowHead);

        arrowHead[0] = wxPoint(x1,y1);
        arrowHead[1] = wxPoint(x1-3,y1-3);
        arrowHead[2] = wxPoint(x1+3,y1-3);
        dc.DrawPolygon(WXSIZEOF(arrowHead), arrowHead);
    }

    if ( ID == ID_TEXTCTRL5)
    {
        x = size_h/2;
        y = size_v/2-shielded_twisted_pair_radius;

        x1 = x + inner_shield_radius;
        y1 = y;

        dc.SetPen(wxPen(wxColor(51,51,255), 3));
        dc.SetBrush(wxBrush(wxColor(51,51,255), wxSOLID));
        dc.DrawCircle( wxPoint(x,y), 2 );
        dc.DrawLine( x,y,x1,y1);

        arrowHead[0] = wxPoint(x1,y1);
        arrowHead[1] = wxPoint(x1-3,y1-3);
        arrowHead[2] = wxPoint(x1-3,y1+3);
        dc.DrawPolygon(WXSIZEOF(arrowHead), arrowHead);
    }

    if ( ID == ID_TEXTCTRL6)
    {
        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxFDIAGONAL_HATCH));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius)), inner_shield_jacket_radius );

        dc.SetPen( wxPen( wxColor(wxColor(51,51,255)),1 ) );
        dc.SetBrush(wxBrush(wxColor(wxColor(51,51,255))));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius)), inner_shield_thickness + inner_shield_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius)), inner_shield_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxBDIAGONAL_HATCH));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius-inner_conductor_separation/2)), inner_dielectric_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxBDIAGONAL_HATCH));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius+inner_conductor_separation/2)), inner_dielectric_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius-inner_conductor_separation/2)), inner_conductor_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius+inner_conductor_separation/2)), inner_conductor_radius );
    }

    if ( ID == ID_TEXTCTRL7)
    {
        x = size_h/2;
        y = size_v/2-shielded_twisted_pair_radius;

        x1 = x + inner_shield_jacket_radius;
        y1 = y;

        dc.SetPen(wxPen(wxColor(51,51,255), 3));
        dc.SetBrush(wxBrush(wxColor(51,51,255), wxSOLID));
        dc.DrawCircle( wxPoint(x,y), 2 );
        dc.DrawLine( x,y,x1,y1);

        arrowHead[0] = wxPoint(x1,y1);
        arrowHead[1] = wxPoint(x1-3,y1-3);
        arrowHead[2] = wxPoint(x1-3,y1+3);
        dc.DrawPolygon(WXSIZEOF(arrowHead), arrowHead);
    }

    if ( ID == ID_TEXTCTRL8)
    {
        x = size_h/2;
        y = size_v/2;

        x1 = x + shielded_twisted_pair_radius;
        y1 = y;

        dc.SetPen(wxPen(wxColor(51,51,255), 1, wxDOT_DASH));
        dc.SetBrush(wxBrush(wxColor(51,51,255), wxTRANSPARENT));
        dc.DrawCircle( wxPoint(x,y), shielded_twisted_pair_radius );

        dc.SetPen(wxPen(wxColor(51,51,255), 3));
        dc.SetBrush(wxBrush(wxColor(51,51,255), wxSOLID));
        dc.DrawCircle( wxPoint(x,y), 2 );
        dc.DrawLine( x,y,x1,y1);

        arrowHead[0] = wxPoint(x1,y1);
        arrowHead[1] = wxPoint(x1-3,y1-3);
        arrowHead[2] = wxPoint(x1-3,y1+3);
        dc.DrawPolygon(WXSIZEOF(arrowHead), arrowHead);
    }

    if ( ID == ID_TEXTCTRL9)
    {
        x = size_h/2;
        y = size_v/2;

        x1 = x + outer_shield_radius;
        y1 = y;

        dc.SetPen(wxPen(wxColor(51,51,255), 3));
        dc.SetBrush(wxBrush(wxColor(51,51,255), wxSOLID));
        dc.DrawCircle( wxPoint(x,y), 2 );
        dc.DrawLine( x,y,x1,y1);

        arrowHead[0] = wxPoint(x1,y1);
        arrowHead[1] = wxPoint(x1-3,y1-3);
        arrowHead[2] = wxPoint(x1-3,y1+3);
        dc.DrawPolygon(WXSIZEOF(arrowHead), arrowHead);
    }

    if ( ID == ID_TEXTCTRL10 || ID == ID_TEXTCTRL14)
    {
        x = size_h/2;
        y = size_v/2;

        dc.SetPen(wxPen(wxColor(51,51,255), outer_shield_thickness));
        dc.SetBrush(wxBrush(wxColor(51,51,255), wxTRANSPARENT));
        dc.DrawCircle( wxPoint(x,y), outer_shield_radius + outer_shield_thickness/2 );
    }

    if ( ID == ID_TEXTCTRL11)
    {
        x = size_h/2;
        y = size_v/2;

        x1 = x + outer_dielectric_radius;
        y1 = y;

        dc.SetPen(wxPen(wxColor(51,51,255), 3));
        dc.SetBrush(wxBrush(wxColor(51,51,255), wxSOLID));
        dc.DrawCircle( wxPoint(x,y), 2 );
        dc.DrawLine( x,y,x1,y1);

        arrowHead[0] = wxPoint(x1,y1);
        arrowHead[1] = wxPoint(x1-3,y1-3);
        arrowHead[2] = wxPoint(x1-3,y1+3);
        dc.DrawPolygon(WXSIZEOF(arrowHead), arrowHead);
    }

    if ( ID == ID_TEXTCTRL12)
    {
        x = size_h/2;
        y = size_v/2-shielded_twisted_pair_radius-inner_conductor_separation/2;

        dc.SetPen(wxPen(wxColor(51,51,255), 3));
        dc.SetBrush(wxBrush(wxColor(51,51,255), wxSOLID));
        dc.DrawCircle( wxPoint(x,y), inner_conductor_radius );
    }

    if ( ID == ID_TEXTCTRL13)
    {
        x = size_h/2;
        y = size_v/2-shielded_twisted_pair_radius;

        dc.SetPen(wxPen(wxColor(51,51,255), inner_shield_thickness));
        dc.SetBrush(wxBrush(wxColor(51,51,255), wxTRANSPARENT));
        dc.DrawCircle( wxPoint(x,y), inner_shield_radius + inner_shield_thickness/2 );
    }

    if ( ID == ID_TEXTCTRL15)
    {
        dc.SetPen( wxPen( wxColor(51,51,255),1 ) );
        dc.SetBrush(wxBrush(wxColor(51,51,255), wxBDIAGONAL_HATCH));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius-inner_conductor_separation/2)), inner_dielectric_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius-inner_conductor_separation/2)), inner_conductor_radius );
    }

    if ( ID == ID_TEXTCTRL26)
    {
        dc.SetPen( wxPen( wxColor(51,51,255),1 ) );
        dc.SetBrush(wxBrush(wxColor(51,51,255), wxFDIAGONAL_HATCH));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius)), inner_shield_jacket_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224)));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius)), inner_shield_thickness + inner_shield_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius)), inner_shield_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxBDIAGONAL_HATCH));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius-inner_conductor_separation/2)), inner_dielectric_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxBDIAGONAL_HATCH));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius+inner_conductor_separation/2)), inner_dielectric_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius-inner_conductor_separation/2)), inner_conductor_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius+inner_conductor_separation/2)), inner_conductor_radius );
    }

    if ( ID == ID_TEXTCTRL27 || ID == ID_CHECKBOX1)
    {
        dc.SetPen( wxPen( wxColor(51,51,255),1 ) );
        dc.SetBrush(wxBrush(wxColor(51,51,255), wxBDIAGONAL_HATCH));
        dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_dielectric_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
        dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_shield_radius + outer_shield_thickness );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
        dc.DrawCircle( wxPoint(size_h/2,size_v/2), outer_shield_radius );

        //TP Top

        if (ID == ID_CHECKBOX1)
        {
            dc.SetPen( wxPen( wxColor(51,51,255),1 ) );
            dc.SetBrush(wxBrush(wxColor(51,51,255), wxFDIAGONAL_HATCH));
            dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius)), inner_shield_jacket_radius );

        }
        else
        {
            dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
            dc.SetBrush(wxBrush(wxColor(224,224,224), wxFDIAGONAL_HATCH));
            dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius)), inner_shield_jacket_radius );
        }


        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224)));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius)), inner_shield_thickness + inner_shield_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius)), inner_shield_radius );

        if (ID == ID_CHECKBOX1)
        {
            dc.SetPen( wxPen( wxColor(51,51,255),1 ) );
            dc.SetBrush(wxBrush(wxColor(51,51,255), wxBDIAGONAL_HATCH));
            dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius-inner_conductor_separation/2)), inner_dielectric_radius );
        }

        else
        {
            dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
            dc.SetBrush(wxBrush(wxColor(224,224,224), wxBDIAGONAL_HATCH));
            dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius-inner_conductor_separation/2)), inner_dielectric_radius );
        }

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxBDIAGONAL_HATCH));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius+inner_conductor_separation/2)), inner_dielectric_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius-inner_conductor_separation/2)), inner_conductor_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2-shielded_twisted_pair_radius+inner_conductor_separation/2)), inner_conductor_radius );


        //TP Left
        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxFDIAGONAL_HATCH));
        dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_radius),size_v/2), inner_shield_jacket_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224)));
        dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_radius),size_v/2), inner_shield_thickness + inner_shield_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
        dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_radius),size_v/2), inner_shield_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxBDIAGONAL_HATCH));
        dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_radius-inner_conductor_separation/2),size_v/2), inner_dielectric_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxBDIAGONAL_HATCH));
        dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_radius+inner_conductor_separation/2),size_v/2), inner_dielectric_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
        dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_radius-inner_conductor_separation/2),size_v/2), inner_conductor_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
        dc.DrawCircle( wxPoint((size_h/2-shielded_twisted_pair_radius+inner_conductor_separation/2),size_v/2), inner_conductor_radius );

        //TP Bottom
        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxFDIAGONAL_HATCH));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_radius)), inner_shield_jacket_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224)));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_radius)), inner_shield_thickness + inner_shield_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_radius)), inner_shield_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxBDIAGONAL_HATCH));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_radius+inner_conductor_separation/2)), inner_dielectric_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxBDIAGONAL_HATCH));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_radius-inner_conductor_separation/2)), inner_dielectric_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_radius+inner_conductor_separation/2)), inner_conductor_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
        dc.DrawCircle( wxPoint(size_h/2,(size_v/2+shielded_twisted_pair_radius-inner_conductor_separation/2)), inner_conductor_radius );

        //TP Right
        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxFDIAGONAL_HATCH));
        dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_radius),size_v/2), inner_shield_jacket_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224)));
        dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_radius),size_v/2), inner_shield_thickness + inner_shield_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(*wxWHITE, wxSOLID));
        dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_radius),size_v/2), inner_shield_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxBDIAGONAL_HATCH));
        dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_radius-inner_conductor_separation/2),size_v/2), inner_dielectric_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxBDIAGONAL_HATCH));
        dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_radius+inner_conductor_separation/2),size_v/2), inner_dielectric_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
        dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_radius-inner_conductor_separation/2),size_v/2), inner_conductor_radius );

        dc.SetPen( wxPen( wxColor(192,192,192),1 ) );
        dc.SetBrush(wxBrush(wxColor(224,224,224), wxSOLID));
        dc.DrawCircle( wxPoint((size_h/2+shielded_twisted_pair_radius+inner_conductor_separation/2),size_v/2), inner_conductor_radius );
    }
}


void SPACEWIRE::OnPanel1LeftDClick(wxMouseEvent& event)
{
    spacewireSchematic();
}


void SPACEWIRE::OnComboBox1Selected(wxCommandEvent& event)
{
    wxString meshToView;
    meshToView<<ComboBox1->GetValue();
    draw_mesh(Panel1,meshToView);
}

void SPACEWIRE::OnCheckBox3Click(wxCommandEvent& event)
{
    if (CheckBox3->GetValue())
    {
        MESH_PARAM *winMESH_PARAM = new MESH_PARAM(this);

        winMESH_PARAM->TextCtrl1->Disable();
dd86ff43   Steve Greedy   Updates to SW1
1635
1636
        winMESH_PARAM->TextCtrl3->Disable();
        winMESH_PARAM->TextCtrl4->Disable();
886c558b   Steve Greedy   SACAMOS Public Re...
1637
1638
1639

        if ( winMESH_PARAM->ShowModal() == wxID_OK )
        {
dd86ff43   Steve Greedy   Updates to SW1
1640
            //MESH_PARAM1 = winMESH_PARAM->TextCtrl1->GetValue();
886c558b   Steve Greedy   SACAMOS Public Re...
1641
1642
1643
1644
1645
1646
            MESH_PARAM2 = winMESH_PARAM->TextCtrl2->GetValue();
        }
        winMESH_PARAM->Destroy();
    }
    WriteCableFile (TextCtrl1->GetValue());
}
d475f4d6   Steve Greedy   SW1 Update to v1.0.1
1647
1648
1649
1650

void SPACEWIRE::OnTextCtrl28Text(wxCommandEvent& event)
{
}
dd86ff43   Steve Greedy   Updates to SW1
1651
1652
1653
1654
1655

void SPACEWIRE::EditExistingCable()
{
    Close();
}
2a0d305e   Steve Greedy   Modifications to ...