From 68b0ecb2fd39466b62fe85593f3627498b31711f Mon Sep 17 00:00:00 2001
From: chris.smartt <chris.smartt@nottingham.ac.uk>
Date: Wed, 20 Jun 2018 18:00:20 +0100
Subject: [PATCH] Complete mesh generation parameters for flex cables

---
 DOCUMENTATION/THEORY_MANUAL/Tex/cable_types.tex                |  16 ++++++++--------
 DOCUMENTATION/THEORY_MANUAL/Tex/preamble.tex                   |   2 +-
 DOCUMENTATION/USER_GUIDE/Imgs/ML_flex_cable.eps                | 927 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 DOCUMENTATION/USER_GUIDE/Imgs/ML_flex_cable.obj                | 343 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 DOCUMENTATION/USER_GUIDE/Tex/creating_a_cable_bundle_model.tex |  16 +++++++++++++++-
 DOCUMENTATION/USER_GUIDE/Tex/creating_a_cable_model.tex        |  73 ++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------
 DOCUMENTATION/USER_GUIDE/Tex/introduction.tex                  |   2 +-
 DOCUMENTATION/USER_GUIDE/Tex/preamble.tex                      |   2 +-
 SRC/GENERAL_MODULES/constants.F90                              |   2 ++
 SRC/PUL_PARAMETER_CALCULATION/CG_solve.F90                     |  26 ++++++++++++++++++--------
 SRC/PUL_PARAMETER_CALCULATION/Laplace.F90                      |  61 +++++++++++--------------------------------------------------
 SRC/cable_bundle_model_builder.F90                             |  19 ++++++++++++++-----
 SRC/cable_model_builder.F90                                    |  18 ++++++++++++++----
 13 files changed, 1405 insertions(+), 102 deletions(-)
 create mode 100644 DOCUMENTATION/USER_GUIDE/Imgs/ML_flex_cable.eps
 create mode 100644 DOCUMENTATION/USER_GUIDE/Imgs/ML_flex_cable.obj

diff --git a/DOCUMENTATION/THEORY_MANUAL/Tex/cable_types.tex b/DOCUMENTATION/THEORY_MANUAL/Tex/cable_types.tex
index e61129a..f7f328f 100644
--- a/DOCUMENTATION/THEORY_MANUAL/Tex/cable_types.tex
+++ b/DOCUMENTATION/THEORY_MANUAL/Tex/cable_types.tex
@@ -480,7 +480,7 @@ I_0 \\
 
 \begin{figure}[h]
 \centering
-\includegraphics[scale=0.5]{../USER_GUIDE/Imgs/flex_cable.eps}
+\includegraphics[scale=0.5]{../USER_GUIDE/Imgs/ML_flex_cable.eps}
 \caption{flex cable}
 \label{fig:flex_cable}
 \end{figure}
@@ -566,12 +566,12 @@ V_{d2\_c1} \\
 V_{ref}\\
 \end{array} \right)
 =\left[ \begin{array}{cccccc}
-  1     &     0   & \cdots &     0   &&  -1       0    \\
-  0     &     1   & \cdots &     0   &&  -1       0    \\
- \vdots & \vdots  & \ddots & \vdots  && \vdots\vdots   \\
-  0     &     0   & \cdots &     1   &&  -1       0    \\
-  0     &     0   & \cdots &     0   &&   1      -1    \\
-  0     &     0   & \cdots &     0   &&   0       1    \\
+  1     &     0   & \cdots &     0   &  -1    &    0    \\
+  0     &     1   & \cdots &     0   &  -1    &    0    \\
+ \vdots & \vdots  & \ddots & \vdots  & \vdots & \vdots   \\
+  0     &     0   & \cdots &     1   &  -1    &    0    \\
+  0     &     0   & \cdots &     0   &   1    &   -1    \\
+  0     &     0   & \cdots &     0   &   0    &    1    \\
 \end{array} \right]
 \left( \begin{array}{c}
 V_1    \\
@@ -597,7 +597,7 @@ I_{ref}\\
 =\left[ \begin{array}{cccccc}
   1     &     0   & \cdots &     0   &   0    &   0    \\
   0     &     1   & \cdots &     0   &   0    &   0    \\
- \vdots & \vdots  & \ddots & \vdots  & \vdots\vdots   \\
+ \vdots & \vdots  & \ddots & \vdots  & \vdots & \vdots   \\
   0     &     0   & \cdots &     1   &   0    &   0    \\
   0     &     0   & \cdots &     0   &   1    &   0    \\
   1     &     1   & \cdots &     1   &   1    &   1    \\
diff --git a/DOCUMENTATION/THEORY_MANUAL/Tex/preamble.tex b/DOCUMENTATION/THEORY_MANUAL/Tex/preamble.tex
index a0c2fed..e9a4b5a 100644
--- a/DOCUMENTATION/THEORY_MANUAL/Tex/preamble.tex
+++ b/DOCUMENTATION/THEORY_MANUAL/Tex/preamble.tex
@@ -4,7 +4,7 @@
 \newcommand{\DocumentTitle}{Theory Manual}
 \newcommand{\DocumentSubTitle}{SACAMOS: State of the Art CAble MOdels for Spice}
 \newcommand{\DocumentSubSubTitle}{Open Souce Cable Models for EMI Simulations}
-\newcommand{\DocumentVersion}{1.1}
+\newcommand{\DocumentVersion}{1.2}
 \newcommand{\DocumentAuthors}{Christopher Smartt\footnote{\UONname, contact: Chris.Smartt@nottingham.ac.uk}, David Thomas$^1$, Steve Greedy$^1$, \\ Jaco Verpoorte\footnote{\NLRname, contact: Jaco.Verpoorte@nlr.nl}, Jesper Lansink Rotgerink$^2$ and Harmen Schippers$^2$}
 \newcommand{\License}{This document is subject to the GNU Free Documentation License (version 2.0).}
 \newcommand{\Reference}{ESA 40000112765/14/NL/HK}
diff --git a/DOCUMENTATION/USER_GUIDE/Imgs/ML_flex_cable.eps b/DOCUMENTATION/USER_GUIDE/Imgs/ML_flex_cable.eps
new file mode 100644
index 0000000..de8b31f
--- /dev/null
+++ b/DOCUMENTATION/USER_GUIDE/Imgs/ML_flex_cable.eps
@@ -0,0 +1,927 @@
+%!PS-Adobe-3.0 EPSF-3.0
+%%BoundingBox: -1 335 586 740
+%%Title: ML_flex_cable
+%%CreationDate: Wed Jun 20 11:47:45 2018
+%%Creator: Tgif-4.2.5-QPL written by William Chia-Wei Cheng (bill.cheng@acm.org)
+%%ProducedBy: (unknown)
+%%Pages: 1
+%%DocumentFonts: (atend)
+%%EndComments
+%%BeginProlog
+
+/tgifdict 54 dict def
+tgifdict begin
+
+/tgifarrowtipdict 8 dict def
+tgifarrowtipdict /mtrx matrix put
+
+/TGAT % tgifarrowtip
+ { tgifarrowtipdict begin
+      /dy exch def
+      /dx exch def
+      /h exch def
+      /w exch def
+      /y exch def
+      /x exch def
+      /savematrix mtrx currentmatrix def
+      x y translate
+      dy dx atan rotate
+      0 0 moveto
+      w neg h lineto
+      w neg h neg lineto
+      savematrix setmatrix
+   end
+ } def
+
+/TGMAX
+ { exch dup 3 1 roll exch dup 3 1 roll gt { pop } { exch pop } ifelse
+ } def
+/TGMIN
+ { exch dup 3 1 roll exch dup 3 1 roll lt { pop } { exch pop } ifelse
+ } def
+/TGSW { stringwidth pop } def
+/tgifstrw 0 def
+
+/bd { bind def } bind def
+
+/GS { gsave } bd
+/GR { grestore } bd
+/NP { newpath } bd
+/CP { closepath } bd
+/CHP { charpath } bd
+/CT { curveto } bd
+/L { lineto } bd
+/RL { rlineto } bd
+/M { moveto } bd
+/RM { rmoveto } bd
+/S { stroke } bd
+/F { fill } bd
+/TR { translate } bd
+/RO { rotate } bd
+/SC { scale } bd
+/MU { mul } bd
+/DI { div } bd
+/DU { dup } bd
+/NE { neg } bd
+/AD { add } bd
+/SU { sub } bd
+/PO { pop } bd
+/EX { exch } bd
+/CO { concat } bd
+/CL { clip } bd
+/EC { eoclip } bd
+/EF { eofill } bd
+/IM { image } bd
+/IMM { imagemask } bd
+/ARY { array } bd
+/SG { setgray } bd
+/RG { setrgbcolor } bd
+/SD { setdash } bd
+/W { setlinewidth } bd
+/SM { setmiterlimit } bd
+/SLC { setlinecap } bd
+/SLJ { setlinejoin } bd
+/SH { show } bd
+/FF { findfont } bd
+/MS { makefont setfont } bd
+/AR { arcto 4 {pop} repeat } bd
+/CURP { currentpoint } bd
+/FLAT { flattenpath strokepath clip newpath } bd
+/TGSM { tgiforigctm setmatrix } def
+/TGRM { savematrix setmatrix } def
+
+end
+
+%%EndProlog
+%%Page: 1 1
+
+%%PageBoundingBox: -1 335 586 740
+tgifdict begin
+/tgifsavedpage save def
+
+1 SM
+1 W
+
+0 SG
+
+72 0 MU 72 11.602 MU TR
+72 128 DI 100.000 MU 100 DI DU NE SC
+
+GS
+
+/tgiforigctm matrix currentmatrix def
+
+% TEXT
+NP
+0 SG
+   GS
+      1 W
+      260 880 M
+      GS
+            0 SG
+            /Courier FF [24 0 0 -24 0 0] MS
+            (Multi-layer conductor Flex cable) SH
+      GR
+   GR
+
+% TEXT
+NP
+0 SG
+   GS
+      1 W
+      120 325 M
+      GS
+            0 SG
+            /Courier FF [24 0 0 -24 0 0] MS
+            (width) SH
+      GR
+   GR
+
+% TEXT
+NP
+0 SG
+   GS
+      1 W
+      70 475 M
+      GS
+            1.000 0.000 1.000 RG
+            /Courier FF [24 0 0 -24 0 0] MS
+            (Conductor No 1) SH
+      GR
+   GR
+
+% TEXT
+NP
+0 SG
+   GS
+      1 W
+      235 410 M
+      GS
+            0 SG
+            /Courier FF [24 0 0 -24 0 0] MS
+            (height) SH
+      GR
+   GR
+
+% BOX
+0 SG
+GS
+   10 SM
+   GS
+      NP 70 390 M 220 390 L 220 420 L 70 420 L CP
+      3 W
+      S
+   GR
+GR
+
+% POLY/OPEN-SPLINE
+0 SG
+GS
+   NP
+      70 340 M
+      0 150 atan DU cos 8.000 MU exch sin 8.000 MU RM
+      0 150 atan DU cos 8.000 MU 220 exch SU
+      exch sin 8.000 MU 340 exch SU L
+   TGSM
+   1 W
+   S
+GR
+GS
+   TGSM
+   NP
+      70 340 8.000 3.000 -150 0 TGAT
+   1 SG CP F
+   0 SG
+   NP
+      70 340 8.000 3.000 -150 0 TGAT
+   CP F
+GR
+GS
+   TGSM
+   NP
+      220 340 8.000 3.000 150 0 TGAT
+   1 SG CP F
+   0 SG
+   NP
+      220 340 8.000 3.000 150 0 TGAT
+   CP F
+GR
+
+% POLY/OPEN-SPLINE
+0 SG
+GS
+   NP
+      230 390 M
+      30 0 atan DU cos 8.000 MU exch sin 8.000 MU RM
+      30 0 atan DU cos 8.000 MU 230 exch SU
+      exch sin 8.000 MU 420 exch SU L
+   TGSM
+   1 W
+   S
+GR
+GS
+   TGSM
+   NP
+      230 390 8.000 3.000 0 -30 TGAT
+   1 SG CP F
+   0 SG
+   NP
+      230 390 8.000 3.000 0 -30 TGAT
+   CP F
+GR
+GS
+   TGSM
+   NP
+      230 420 8.000 3.000 0 30 TGAT
+   1 SG CP F
+   0 SG
+   NP
+      230 420 8.000 3.000 0 30 TGAT
+   CP F
+GR
+
+% POLY/OPEN-SPLINE
+0 SG
+GS
+   NP
+      220 340 M
+      0 105 atan DU cos 8.000 MU exch sin 8.000 MU RM
+      0 105 atan DU cos 8.000 MU 325 exch SU
+      exch sin 8.000 MU 340 exch SU L
+   TGSM
+   1 W
+   S
+GR
+GS
+   TGSM
+   NP
+      220 340 8.000 3.000 -105 0 TGAT
+   1 SG CP F
+   0 SG
+   NP
+      220 340 8.000 3.000 -105 0 TGAT
+   CP F
+GR
+GS
+   TGSM
+   NP
+      325 340 8.000 3.000 105 0 TGAT
+   1 SG CP F
+   0 SG
+   NP
+      325 340 8.000 3.000 105 0 TGAT
+   CP F
+GR
+
+% TEXT
+NP
+0 SG
+   GS
+      1 W
+      220 325 M
+      GS
+            0 SG
+            /Courier FF [24 0 0 -24 0 0] MS
+            (separation) SH
+      GR
+   GR
+
+% BOX
+1.000 0.000 0.000 RG
+GS
+   10 SM
+   GS
+      NP 55 360 M 920 360 L 920 790 L 55 790 L CP
+      2 W
+      S
+   GR
+GR
+
+% BOX
+0 SG
+GS
+   10 SM
+   GS
+      NP 330 390 M 480 390 L 480 420 L 330 420 L CP
+      3 W
+      S
+   GR
+GR
+
+% BOX
+0 SG
+GS
+   10 SM
+   GS
+      NP 695 390 M 845 390 L 845 420 L 695 420 L CP
+      3 W
+      S
+   GR
+GR
+
+% POLY/OPEN-SPLINE
+0 SG
+GS
+   [16 16] 0 SD
+   NP
+      495 410 M
+      655 410 L
+   TGSM
+   4 W
+   S
+   [] 0 SD
+   1 W
+GR
+
+% TEXT
+NP
+0 SG
+   GS
+      1 W
+      315 475 M
+      GS
+            1.000 0.000 1.000 RG
+            /Courier FF [24 0 0 -24 0 0] MS
+            (Conductor No 2) SH
+      GR
+   GR
+
+% TEXT
+NP
+0 SG
+   GS
+      1 W
+      730 835 M
+      GS
+            1.000 0.000 1.000 RG
+            /Courier FF [24 0 0 -24 0 0] MS
+            (Conductor No nc) SH
+      GR
+   GR
+
+% BOX
+0 SG
+GS
+   10 SM
+   GS
+      NP 100 740 M 875 740 L 875 755 L 100 755 L CP
+      3 W
+      S
+   GR
+GR
+
+% BOX
+0 SG
+GS
+   10 SM
+   GS
+      NP 130 595 M 280 595 L 280 625 L 130 625 L CP
+      3 W
+      S
+   GR
+GR
+
+% BOX
+0 SG
+GS
+   10 SM
+   GS
+      NP 400 595 M 553 595 L 553 625 L 400 625 L CP
+      3 W
+      S
+   GR
+GR
+
+% POLY/OPEN-SPLINE
+0 SG
+GS
+   [16 16] 0 SD
+   NP
+      296 610 M
+      384 610 L
+   TGSM
+   4 W
+   S
+   [] 0 SD
+   1 W
+GR
+
+% POLY/OPEN-SPLINE
+0 SG
+GS
+   [4 12] 0 SD
+   NP
+      230 665 M
+      230 730 L
+   TGSM
+   4 W
+   S
+   [] 0 SD
+   1 W
+GR
+
+% POLY/OPEN-SPLINE
+0 SG
+GS
+   [4 12] 0 SD
+   NP
+      750 660 M
+      750 725 L
+   TGSM
+   4 W
+   S
+   [] 0 SD
+   1 W
+GR
+
+% POLY/OPEN-SPLINE
+1.000 0.000 1.000 RG
+GS
+   NP
+      850 805 M
+      -60 -80 atan DU cos 8.000 MU 770 exch SU
+      exch sin 8.000 MU 745 exch SU L
+   TGSM
+   1 W
+   S
+GR
+GS
+   TGSM
+   NP
+      770 745 8.000 3.000 -80 -60 TGAT
+   1 SG CP F
+   1.000 0.000 1.000 RG
+   NP
+      770 745 8.000 3.000 -80 -60 TGAT
+   CP F
+GR
+
+% POLY/OPEN-SPLINE
+1.000 0.000 1.000 RG
+GS
+   NP
+      175 450 M
+      -45 -5 atan DU cos 8.000 MU 170 exch SU
+      exch sin 8.000 MU 405 exch SU L
+   TGSM
+   1 W
+   S
+GR
+GS
+   TGSM
+   NP
+      170 405 8.000 3.000 -5 -45 TGAT
+   1 SG CP F
+   1.000 0.000 1.000 RG
+   NP
+      170 405 8.000 3.000 -5 -45 TGAT
+   CP F
+GR
+
+% POLY/OPEN-SPLINE
+1.000 0.000 1.000 RG
+GS
+   NP
+      425 460 M
+      -55 -10 atan DU cos 8.000 MU 415 exch SU
+      exch sin 8.000 MU 405 exch SU L
+   TGSM
+   1 W
+   S
+GR
+GS
+   TGSM
+   NP
+      415 405 8.000 3.000 -10 -55 TGAT
+   1 SG CP F
+   1.000 0.000 1.000 RG
+   NP
+      415 405 8.000 3.000 -10 -55 TGAT
+   CP F
+GR
+
+% TEXT
+NP
+0 SG
+   GS
+      1 W
+      950 275 M
+      GS
+            0 SG
+            /Courier FF [24 0 0 -24 0 0] MS
+            (Row ) SH
+      GR
+      0 24 RM
+      GS
+            0 SG
+            /Courier FF [24 0 0 -24 0 0] MS
+            (Number) SH
+      GR
+   GR
+
+% POLY/OPEN-SPLINE
+0 SG
+GS
+   NP
+      985 310 M
+      55 0 atan DU cos 8.000 MU 985 exch SU
+      exch sin 8.000 MU 365 exch SU L
+   TGSM
+   1 W
+   S
+GR
+GS
+   TGSM
+   NP
+      985 365 8.000 3.000 0 55 TGAT
+   1 SG CP F
+   0 SG
+   NP
+      985 365 8.000 3.000 0 55 TGAT
+   CP F
+GR
+
+% TEXT
+NP
+0 SG
+   GS
+      1 W
+      970 405 M
+      GS
+            0 SG
+            /Courier FF [24 0 0 -24 0 0] MS
+            (1) SH
+      GR
+   GR
+
+% TEXT
+NP
+0 SG
+   GS
+      1 W
+      975 620 M
+      GS
+            0 SG
+            /Courier FF [24 0 0 -24 0 0] MS
+            (2) SH
+      GR
+   GR
+
+% TEXT
+NP
+0 SG
+   GS
+      1 W
+      940 760 M
+      GS
+            0 SG
+            /Courier FF [24 0 0 -24 0 0] MS
+            (n_rows) SH
+      GR
+   GR
+
+% POLY/OPEN-SPLINE
+0 SG
+GS
+   [4 12] 0 SD
+   NP
+      980 650 M
+      980 715 L
+   TGSM
+   4 W
+   S
+   [] 0 SD
+   1 W
+GR
+
+% POLY/OPEN-SPLINE
+0 SG
+GS
+   NP
+      475 555 M
+      -370 0 atan DU cos 8.000 MU 475 exch SU
+      exch sin 8.000 MU 185 exch SU L
+   TGSM
+   1 W
+   S
+GR
+GS
+   TGSM
+   NP
+      475 185 8.000 3.000 0 -370 TGAT
+   1 SG CP F
+   0 SG
+   NP
+      475 185 8.000 3.000 0 -370 TGAT
+   CP F
+GR
+
+% POLY/OPEN-SPLINE
+0 SG
+GS
+   NP
+      475 555 M
+      0 485 atan DU cos 8.000 MU 960 exch SU
+      exch sin 8.000 MU 555 exch SU L
+   TGSM
+   1 W
+   S
+GR
+GS
+   TGSM
+   NP
+      960 555 8.000 3.000 485 0 TGAT
+   1 SG CP F
+   0 SG
+   NP
+      960 555 8.000 3.000 485 0 TGAT
+   CP F
+GR
+
+% TEXT
+NP
+0 SG
+   GS
+      1 W
+      490 190 M
+      GS
+            0 SG
+            /Courier FF [24 0 0 -24 0 0] MS
+            (y) SH
+      GR
+   GR
+
+% TEXT
+NP
+0 SG
+   GS
+      1 W
+      940 540 M
+      GS
+            0 SG
+            /Courier FF [24 0 0 -24 0 0] MS
+            (x) SH
+      GR
+   GR
+
+% POLY/OPEN-SPLINE
+0 SG
+GS
+   NP
+      55 280 M
+      0 860 atan DU cos 8.000 MU exch sin 8.000 MU RM
+      0 860 atan DU cos 8.000 MU 915 exch SU
+      exch sin 8.000 MU 280 exch SU L
+   TGSM
+   1 W
+   S
+GR
+GS
+   TGSM
+   NP
+      55 280 8.000 3.000 -860 0 TGAT
+   1 SG CP F
+   0 SG
+   NP
+      55 280 8.000 3.000 -860 0 TGAT
+   CP F
+GR
+GS
+   TGSM
+   NP
+      915 280 8.000 3.000 860 0 TGAT
+   1 SG CP F
+   0 SG
+   NP
+      915 280 8.000 3.000 860 0 TGAT
+   CP F
+GR
+
+% TEXT
+NP
+0 SG
+   GS
+      1 W
+      320 265 M
+      GS
+            0 SG
+            /Courier FF [24 0 0 -24 0 0] MS
+            (dielectric width) SH
+      GR
+   GR
+
+% POLY/OPEN-SPLINE
+0 SG
+GS
+   NP
+      30 360 M
+      425 0 atan DU cos 8.000 MU exch sin 8.000 MU RM
+      425 0 atan DU cos 8.000 MU 30 exch SU
+      exch sin 8.000 MU 785 exch SU L
+   TGSM
+   1 W
+   S
+GR
+GS
+   TGSM
+   NP
+      30 360 8.000 3.000 0 -425 TGAT
+   1 SG CP F
+   0 SG
+   NP
+      30 360 8.000 3.000 0 -425 TGAT
+   CP F
+GR
+GS
+   TGSM
+   NP
+      30 785 8.000 3.000 0 425 TGAT
+   1 SG CP F
+   0 SG
+   NP
+      30 785 8.000 3.000 0 425 TGAT
+   CP F
+GR
+
+% TEXT
+NP
+0 SG
+GS
+   -192 584 TR
+   [0.000 -1.000 1.000 0.000 193 107] CO
+   -192 NE 584 NE TR
+GR
+   GS
+      1 W
+      -192 584 TR
+      [0.000 -1.000 1.000 0.000 193 107] CO
+      0 19 M
+      GS
+            0 SG
+            /Courier FF [24 0 0 -24 0 0] MS
+            (dielectric height) SH
+      GR
+   GR
+
+% POLY/OPEN-SPLINE
+0.000 0.000 1.000 RG
+GS
+   NP
+      475 555 M
+      -150 -45 atan DU cos 8.000 MU 430 exch SU
+      exch sin 8.000 MU 405 exch SU L
+   TGSM
+   1 W
+   S
+GR
+GS
+   TGSM
+   NP
+      430 405 8.000 3.000 -45 -150 TGAT
+   1 SG CP F
+   0.000 0.000 1.000 RG
+   NP
+      430 405 8.000 3.000 -45 -150 TGAT
+   CP F
+GR
+
+% TEXT
+NP
+   /tgifstrw 0 def
+   /tgifstrw tgifstrw
+      /Courier FF [24 0 0 -24 0 0] MS
+      (row 1 offset) TGSW 
+   add def
+0 SG
+NP 280 500 M tgifstrw 0 RL 0 25 RL tgifstrw neg 0 RL CP 1 SG F
+0 SG
+   GS
+      1 W
+      280 520 M
+      GS
+            0.000 0.000 1.000 RG
+            /Courier FF [24 0 0 -24 0 0] MS
+            (row 1 offset) SH
+      GR
+   GR
+
+% POLY/OPEN-SPLINE
+0.000 0.000 1.000 RG
+GS
+   NP
+      475 555 M
+      55 -135 atan DU cos 8.000 MU 340 exch SU
+      exch sin 8.000 MU 610 exch SU L
+   TGSM
+   1 W
+   S
+GR
+GS
+   TGSM
+   NP
+      340 610 8.000 3.000 -135 55 TGAT
+   1 SG CP F
+   0.000 0.000 1.000 RG
+   NP
+      340 610 8.000 3.000 -135 55 TGAT
+   CP F
+GR
+
+% TEXT
+NP
+0 SG
+   GS
+      1 W
+      205 580 M
+      GS
+            0.000 0.000 1.000 RG
+            /Courier FF [24 0 0 -24 0 0] MS
+            (row 2 offset) SH
+      GR
+   GR
+
+% POLY/OPEN-SPLINE
+0.000 0.000 1.000 RG
+GS
+   NP
+      475 555 M
+      190 0 atan DU cos 8.000 MU 475 exch SU
+      exch sin 8.000 MU 745 exch SU L
+   TGSM
+   1 W
+   S
+GR
+GS
+   TGSM
+   NP
+      475 745 8.000 3.000 0 190 TGAT
+   1 SG CP F
+   0.000 0.000 1.000 RG
+   NP
+      475 745 8.000 3.000 0 190 TGAT
+   CP F
+GR
+
+% TEXT
+NP
+0 SG
+   GS
+      1 W
+      490 695 M
+      GS
+            0.000 0.000 1.000 RG
+            /Courier FF [24 0 0 -24 0 0] MS
+            (row n offset) SH
+      GR
+   GR
+
+% TEXT
+NP
+0 SG
+   GS
+      1 W
+      665 455 M
+      GS
+            1.000 0.000 1.000 RG
+            /Courier FF [24 0 0 -24 0 0] MS
+            (Conductor No n,) SH
+      GR
+      0 24 RM
+      GS
+            1.000 0.000 1.000 RG
+            /Courier FF [24 0 0 -24 0 0] MS
+            (row 1) SH
+      GR
+   GR
+
+% POLY/OPEN-SPLINE
+1.000 0.000 1.000 RG
+GS
+   NP
+      765 435 M
+      -30 5 atan DU cos 8.000 MU 770 exch SU
+      exch sin 8.000 MU 405 exch SU L
+   TGSM
+   1 W
+   S
+GR
+GS
+   TGSM
+   NP
+      770 405 8.000 3.000 5 -30 TGAT
+   1 SG CP F
+   1.000 0.000 1.000 RG
+   NP
+      770 405 8.000 3.000 5 -30 TGAT
+   CP F
+GR
+
+GR
+tgifsavedpage restore
+end
+showpage
+
+%%Trailer
+%MatchingCreationDate: Wed Jun 20 11:47:45 2018
+%%DocumentFonts: Courier
+%%EOF
diff --git a/DOCUMENTATION/USER_GUIDE/Imgs/ML_flex_cable.obj b/DOCUMENTATION/USER_GUIDE/Imgs/ML_flex_cable.obj
new file mode 100644
index 0000000..4281e96
--- /dev/null
+++ b/DOCUMENTATION/USER_GUIDE/Imgs/ML_flex_cable.obj
@@ -0,0 +1,343 @@
+%TGIF 4.2.5-QPL
+state(0,37,100.000,0,176,0,16,1,14,1,1,0,0,1,2,1,0,'Courier',0,138240,0,0,1,5,0,0,1,1,0,16,0,0,1,1,1,1,1050,1485,1,0,2880,0).
+%
+% @(#)$Header$
+% %W%
+%
+unit("1 pixel/pixel").
+color_info(50,65535,0,[
+	"Black", 0, 0, 0, 0, 0, 0, 1,
+	"White", 65535, 65535, 65535, 65535, 65535, 65535, 1,
+	"#000080", 0, 0, 32896, 0, 0, 32768, 1,
+	"#008000", 0, 32896, 0, 0, 32768, 0, 1,
+	"#008080", 0, 32896, 32896, 0, 32768, 32768, 1,
+	"#800000", 32896, 0, 0, 32768, 0, 0, 1,
+	"#800080", 32896, 0, 32896, 32768, 0, 32768, 1,
+	"#ff8000", 65535, 32896, 0, 65280, 32768, 0, 1,
+	"#808080", 32896, 32896, 32896, 32768, 32768, 32768, 1,
+	"#c0c0c0", 49344, 49344, 49344, 49152, 49152, 49152, 1,
+	"#0000ff", 0, 0, 65535, 0, 0, 65280, 1,
+	"#00ff00", 0, 65535, 0, 0, 65280, 0, 1,
+	"#00ffff", 0, 65535, 65535, 0, 65280, 65280, 1,
+	"#ff0000", 65535, 0, 0, 65280, 0, 0, 1,
+	"#ff00ff", 65535, 0, 65535, 65280, 0, 65280, 1,
+	"#ffff00", 65535, 65535, 0, 65280, 65280, 0, 1,
+	"#4c4c4c", 19532, 19532, 19532, 19456, 19456, 19456, 1,
+	"#b3b3b3", 46003, 46003, 46003, 45824, 45824, 45824, 1,
+	"#e6e6e6", 59110, 59110, 59110, 58880, 58880, 58880, 1,
+	"#dc2300", 56540, 8995, 0, 56320, 8960, 0, 1,
+	"#ff3333", 65535, 13107, 13107, 65280, 13056, 13056, 1,
+	"#b84747", 47288, 18247, 18247, 47104, 18176, 18176, 1,
+	"#99284c", 39321, 10280, 19532, 39168, 10240, 19456, 1,
+	"#94476b", 38036, 18247, 27499, 37888, 18176, 27392, 1,
+	"#9966cc", 39321, 26214, 52428, 39168, 26112, 52224, 1,
+	"#6b2394", 27499, 8995, 38036, 27392, 8960, 37888, 1,
+	"#5e11a6", 24158, 4369, 42662, 24064, 4352, 42496, 1,
+	"#4700b8", 18247, 0, 47288, 18176, 0, 47104, 1,
+	"#2323dc", 8995, 8995, 56540, 8960, 8960, 56320, 1,
+	"#0099ff", 0, 39321, 65535, 0, 39168, 65280, 1,
+	"#99ccff", 39321, 52428, 65535, 39168, 52224, 65280, 1,
+	"#00dcff", 0, 56540, 65535, 0, 56320, 65280, 1,
+	"#23b8dc", 8995, 47288, 56540, 8960, 47104, 56320, 1,
+	"#33a3a3", 13107, 41891, 41891, 13056, 41728, 41728, 1,
+	"#355e00", 13621, 24158, 0, 13568, 24064, 0, 1,
+	"#7da647", 32125, 42662, 18247, 32000, 42496, 18176, 1,
+	"#00ae00", 0, 44718, 0, 0, 44544, 0, 1,
+	"#3deb3d", 15677, 60395, 15677, 15616, 60160, 15616, 1,
+	"#ffff99", 65535, 65535, 39321, 65280, 65280, 39168, 1,
+	"#e6e64c", 59110, 59110, 19532, 58880, 58880, 19456, 1,
+	"#b3b300", 46003, 46003, 0, 45824, 45824, 0, 1,
+	"#666600", 26214, 26214, 0, 26112, 26112, 0, 1,
+	"#4c1900", 19532, 6425, 0, 19456, 6400, 0, 1,
+	"#663300", 26214, 13107, 0, 26112, 13056, 0, 1,
+	"#804c19", 32896, 19532, 6425, 32768, 19456, 6400, 1,
+	"#996633", 39321, 26214, 13107, 39168, 26112, 13056, 1,
+	"#cc6633", 52428, 26214, 13107, 52224, 26112, 13056, 1,
+	"#ff6633", 65535, 26214, 13107, 65280, 26112, 13056, 1,
+	"#ff9966", 65535, 39321, 26214, 65280, 39168, 26112, 1,
+	"#ffcc99", 65535, 52428, 39321, 65280, 52224, 39168, 1
+]).
+script_frac("0.6").
+fg_bg_colors('#ff00ff','white').
+dont_reencode("FFDingbests:ZapfDingbats").
+objshadow_info('#c0c0c0',2,2).
+rotate_pivot(0,0,0,0).
+spline_tightness(1).
+page(1,"",1,'').
+text('Black',260,861,1,0,1,480,24,27,19,5,0,0,0,0,-65534,480,24,0,0,"",0,0,0,0,880,'',[
+minilines(480,24,0,0,0,0,0,[
+mini_line(480,19,5,0,0,0,[
+str_block(0,480,19,5,0,-2,0,0,0,[
+str_seg('Black','Courier',0,138240,480,19,5,0,-2,0,0,0,0,0,
+	"Multi-layer conductor Flex cable")])
+])
+])]).
+text('Black',120,306,1,0,1,75,24,173,19,5,0,0,0,0,-65534,75,24,0,0,"",0,0,0,0,325,'',[
+minilines(75,24,0,0,0,0,0,[
+mini_line(75,19,5,0,0,0,[
+str_block(0,75,19,5,0,-1,0,0,0,[
+str_seg('Black','Courier',0,138240,75,19,5,0,-1,0,0,0,0,0,
+	"width")])
+])
+])]).
+text('Black',70,456,1,0,1,210,24,284,19,5,0,0,0,0,-65534,210,24,0,0,"",0,0,0,0,475,'',[
+minilines(210,24,0,0,0,0,0,[
+mini_line(210,19,5,0,0,0,[
+str_block(0,210,19,5,0,-3,0,0,0,[
+str_seg('#ff00ff','Courier',0,138240,210,19,5,0,-3,0,0,0,0,0,
+	"Conductor No 1")])
+])
+])]).
+text('Black',235,391,1,0,1,90,24,288,19,5,0,0,0,0,-65534,90,24,0,0,"",0,0,0,0,410,'',[
+minilines(90,24,0,0,0,0,0,[
+mini_line(90,19,5,0,0,0,[
+str_block(0,90,19,5,0,-3,0,0,0,[
+str_seg('Black','Courier',0,138240,90,19,5,0,-3,0,0,0,0,0,
+	"height")])
+])
+])]).
+box('Black','',70,390,220,420,0,3,1,291,0,0,0,0,0,'3',0,[
+]).
+poly('Black','',2,[
+	70,340,220,340],3,1,1,300,0,0,0,0,0,0,0,'1',0,0,
+    "0","",[
+    0,8,3,0,'8','3','0'],[0,8,3,0,'8','3','0'],[
+]).
+poly('Black','',2,[
+	230,390,230,420],3,1,1,316,0,0,0,0,0,0,0,'1',0,0,
+    "0","",[
+    0,8,3,0,'8','3','0'],[0,8,3,0,'8','3','0'],[
+]).
+poly('Black','',2,[
+	220,340,325,340],3,1,1,319,0,0,0,0,0,0,0,'1',0,0,
+    "0","",[
+    0,8,3,0,'8','3','0'],[0,8,3,0,'8','3','0'],[
+]).
+text('Black',220,306,1,0,1,150,24,320,19,5,0,0,0,0,-65534,150,24,0,0,"",0,0,0,0,325,'',[
+minilines(150,24,0,0,0,0,0,[
+mini_line(150,19,5,0,0,0,[
+str_block(0,150,19,5,0,-1,0,0,0,[
+str_seg('Black','Courier',0,138240,150,19,5,0,-1,0,0,0,0,0,
+	"separation")])
+])
+])]).
+box('#ff0000','',55,360,920,790,0,2,1,322,0,0,0,0,0,'2',0,[
+]).
+box('Black','',330,390,480,420,0,3,1,325,0,0,0,0,0,'3',0,[
+]).
+box('Black','',695,390,845,420,0,3,1,326,0,0,0,0,0,'3',0,[
+]).
+poly('Black','',2,[
+	495,410,655,410],0,4,1,330,0,0,7,0,0,0,0,'4',0,0,
+    "0","",[
+    0,14,6,0,'14','6','0'],[0,14,6,0,'14','6','0'],[
+]).
+text('Black',315,456,1,0,1,210,24,353,19,5,0,0,0,0,-65534,210,24,0,0,"",0,0,0,0,475,'',[
+minilines(210,24,0,0,0,0,0,[
+mini_line(210,19,5,0,0,0,[
+str_block(0,210,19,5,0,-4,0,0,0,[
+str_seg('#ff00ff','Courier',0,138240,210,19,5,0,-4,0,0,0,0,0,
+	"Conductor No 2")])
+])
+])]).
+text('Black',730,816,1,0,1,225,24,356,19,5,0,0,0,0,-65534,225,24,0,0,"",0,0,0,0,835,'',[
+minilines(225,24,0,0,0,0,0,[
+mini_line(225,19,5,0,0,0,[
+str_block(0,225,19,5,0,-2,0,0,0,[
+str_seg('#ff00ff','Courier',0,138240,225,19,5,0,-2,0,0,0,0,0,
+	"Conductor No nc")])
+])
+])]).
+box('Black','',100,740,875,755,0,3,1,369,0,0,0,0,0,'3',0,[
+]).
+box('Black','',130,595,280,625,0,3,1,379,0,0,0,0,0,'3',0,[
+]).
+box('Black','',400,595,553,625,0,3,1,382,0,0,0,0,0,'3',0,[
+]).
+poly('Black','',2,[
+	296,610,384,610],0,4,1,383,0,0,7,0,0,0,0,'4',0,0,
+    "0","",[
+    0,14,6,0,'14','6','0'],[0,14,6,0,'14','6','0'],[
+]).
+poly('Black','',2,[
+	230,665,230,730],0,4,1,391,0,0,1,0,0,0,0,'4',0,0,
+    "0","",[
+    0,14,6,0,'14','6','0'],[0,14,6,0,'14','6','0'],[
+]).
+poly('Black','',2,[
+	750,660,750,725],0,4,1,399,0,0,1,0,0,0,0,'4',0,0,
+    "0","",[
+    0,14,6,0,'14','6','0'],[0,14,6,0,'14','6','0'],[
+]).
+poly('#ff00ff','',2,[
+	850,805,770,745],1,1,1,401,0,0,0,0,0,0,0,'1',0,0,
+    "0","",[
+    0,8,3,0,'8','3','0'],[0,8,3,0,'8','3','0'],[
+]).
+poly('#ff00ff','',2,[
+	175,450,170,405],1,1,1,403,0,0,0,0,0,0,0,'1',0,0,
+    "0","",[
+    0,8,3,0,'8','3','0'],[0,8,3,0,'8','3','0'],[
+]).
+poly('#ff00ff','',2,[
+	425,460,415,405],1,1,1,408,0,0,0,0,0,0,0,'1',0,0,
+    "0","",[
+    0,8,3,0,'8','3','0'],[0,8,3,0,'8','3','0'],[
+]).
+text('Black',950,256,2,0,1,90,48,410,19,5,0,0,0,0,-65534,90,48,0,0,"",0,0,0,0,275,'',[
+minilines(90,48,0,0,0,0,0,[
+mini_line(60,19,5,0,0,0,[
+str_block(0,60,19,5,0,-14,0,0,0,[
+str_seg('Black','Courier',0,138240,60,19,5,0,-14,0,0,0,0,0,
+	"Row ")])
+]),
+mini_line(90,19,5,0,0,0,[
+str_block(0,90,19,5,0,-2,0,0,0,[
+str_seg('Black','Courier',0,138240,90,19,5,0,-2,0,0,0,0,0,
+	"Number")])
+])
+])]).
+poly('Black','',2,[
+	985,310,985,365],1,1,1,412,0,0,0,0,0,0,0,'1',0,0,
+    "0","",[
+    0,8,3,0,'8','3','0'],[0,8,3,0,'8','3','0'],[
+]).
+text('Black',970,386,1,0,1,15,24,413,19,5,0,0,0,0,-65534,15,24,0,0,"",0,0,0,0,405,'',[
+minilines(15,24,0,0,0,0,0,[
+mini_line(15,19,5,0,0,0,[
+str_block(0,15,19,5,0,-3,0,0,0,[
+str_seg('Black','Courier',0,138240,15,19,5,0,-3,0,0,0,0,0,
+	"1")])
+])
+])]).
+text('Black',975,601,1,0,1,15,24,415,19,5,0,0,0,0,-65534,15,24,0,0,"",0,0,0,0,620,'',[
+minilines(15,24,0,0,0,0,0,[
+mini_line(15,19,5,0,0,0,[
+str_block(0,15,19,5,0,-4,0,0,0,[
+str_seg('Black','Courier',0,138240,15,19,5,0,-4,0,0,0,0,0,
+	"2")])
+])
+])]).
+text('Black',940,741,1,0,1,90,24,417,19,5,0,0,0,0,-65534,90,24,0,0,"",0,0,0,0,760,'',[
+minilines(90,24,0,0,0,0,0,[
+mini_line(90,19,5,0,0,0,[
+str_block(0,90,19,5,0,-3,0,0,0,[
+str_seg('Black','Courier',0,138240,90,19,5,0,-3,0,0,0,0,0,
+	"n_rows")])
+])
+])]).
+poly('Black','',2,[
+	980,650,980,715],0,4,1,420,0,0,1,0,0,0,0,'4',0,0,
+    "0","",[
+    0,14,6,0,'14','6','0'],[0,14,6,0,'14','6','0'],[
+]).
+poly('Black','',2,[
+	475,555,475,185],1,1,1,421,0,0,0,0,0,0,0,'1',0,0,
+    "0","",[
+    0,8,3,0,'8','3','0'],[0,8,3,0,'8','3','0'],[
+]).
+poly('Black','',2,[
+	475,555,960,555],1,1,1,422,0,0,0,0,0,0,0,'1',0,0,
+    "0","",[
+    0,8,3,0,'8','3','0'],[0,8,3,0,'8','3','0'],[
+]).
+text('Black',490,171,1,0,1,15,24,423,19,5,0,0,0,0,-65534,15,24,0,0,"",0,0,0,0,190,'',[
+minilines(15,24,0,0,0,0,0,[
+mini_line(15,19,5,0,0,0,[
+str_block(0,15,19,5,0,-2,0,0,0,[
+str_seg('Black','Courier',0,138240,15,19,5,0,-2,0,0,0,0,0,
+	"y")])
+])
+])]).
+text('Black',940,521,1,0,1,15,24,425,19,5,0,0,0,0,-65534,15,24,0,0,"",0,0,0,0,540,'',[
+minilines(15,24,0,0,0,0,0,[
+mini_line(15,19,5,0,0,0,[
+str_block(0,15,19,5,0,-1,0,0,0,[
+str_seg('Black','Courier',0,138240,15,19,5,0,-1,0,0,0,0,0,
+	"x")])
+])
+])]).
+poly('Black','',2,[
+	55,280,915,280],3,1,1,431,0,0,0,0,0,0,0,'1',0,0,
+    "0","",[
+    0,8,3,0,'8','3','0'],[0,8,3,0,'8','3','0'],[
+]).
+text('Black',320,246,1,0,1,240,24,432,19,5,0,0,0,0,-65534,240,24,0,0,"",0,0,0,0,265,'',[
+minilines(240,24,0,0,0,0,0,[
+mini_line(240,19,5,0,0,0,[
+str_block(0,240,19,5,0,-1,0,0,0,[
+str_seg('Black','Courier',0,138240,240,19,5,0,-1,0,0,0,0,0,
+	"dielectric width")])
+])
+])]).
+poly('Black','',2,[
+	30,360,30,785],3,1,1,436,0,0,0,0,0,0,0,'1',0,0,
+    "0","",[
+    0,8,3,0,'8','3','0'],[0,8,3,0,'8','3','0'],[
+]).
+text('Black',-192,584,1,0,1,24,255,437,19,5,0,0,0,0,-65534,255,24,0,0,"",0,1,0,0,603,'',[
+	-192,584,-192,584,63,608,1.74623e-13,-1000,1000,1.74623e-13,193,107,-193,583,64,609],[
+minilines(255,24,0,0,0,0,0,[
+mini_line(255,19,5,0,0,0,[
+str_block(0,255,19,5,0,-3,0,0,0,[
+str_seg('Black','Courier',0,138240,255,19,5,0,-3,0,0,0,0,0,
+	"dielectric height")])
+])
+])]).
+poly('#0000ff','',2,[
+	475,555,430,405],1,1,1,455,0,0,0,0,0,0,0,'1',0,0,
+    "0","",[
+    0,8,3,0,'8','3','0'],[0,8,3,0,'8','3','0'],[
+]).
+text('Black',280,501,1,0,1,180,24,458,19,5,2,0,0,0,-65534,180,24,0,0,"",0,0,0,0,520,'',[
+minilines(180,24,0,0,0,0,0,[
+mini_line(180,19,5,0,0,0,[
+str_block(0,180,19,5,0,-3,0,0,0,[
+str_seg('#0000ff','Courier',0,138240,180,19,5,0,-3,0,0,0,0,0,
+	"row 1 offset")])
+])
+])]).
+poly('#0000ff','',2,[
+	475,555,340,610],1,1,1,462,0,0,0,0,0,0,0,'1',0,0,
+    "0","",[
+    0,8,3,0,'8','3','0'],[0,8,3,0,'8','3','0'],[
+]).
+text('Black',205,561,1,0,1,180,24,464,19,5,0,0,0,0,-65534,180,24,0,0,"",0,0,0,0,580,'',[
+minilines(180,24,0,0,0,0,0,[
+mini_line(180,19,5,0,0,0,[
+str_block(0,180,19,5,0,-3,0,0,0,[
+str_seg('#0000ff','Courier',0,138240,180,19,5,0,-3,0,0,0,0,0,
+	"row 2 offset")])
+])
+])]).
+poly('#0000ff','',2,[
+	475,555,475,745],1,1,1,466,0,0,0,0,0,0,0,'1',0,0,
+    "0","",[
+    0,8,3,0,'8','3','0'],[0,8,3,0,'8','3','0'],[
+]).
+text('Black',490,676,1,0,1,180,24,467,19,5,0,0,0,0,-65534,180,24,0,0,"",0,0,0,0,695,'',[
+minilines(180,24,0,0,0,0,0,[
+mini_line(180,19,5,0,0,0,[
+str_block(0,180,19,5,0,-3,0,0,0,[
+str_seg('#0000ff','Courier',0,138240,180,19,5,0,-3,0,0,0,0,0,
+	"row n offset")])
+])
+])]).
+text('Black',665,436,2,0,1,225,48,470,19,5,0,0,0,0,-65534,225,48,0,0,"",0,0,0,0,455,'',[
+minilines(225,48,0,0,0,0,0,[
+mini_line(225,19,5,0,0,0,[
+str_block(0,225,19,5,0,-6,0,0,0,[
+str_seg('#ff00ff','Courier',0,138240,225,19,5,0,-6,0,0,0,0,0,
+	"Conductor No n,")])
+]),
+mini_line(75,19,5,0,0,0,[
+str_block(0,75,19,5,0,-3,0,0,0,[
+str_seg('#ff00ff','Courier',0,138240,75,19,5,0,-3,0,0,0,0,0,
+	"row 1")])
+])
+])]).
+poly('#ff00ff','',2,[
+	765,435,770,405],1,1,1,559,0,2,0,0,0,0,0,'1',0,0,
+    "0","",[
+    0,8,3,0,'8','3','0'],[0,8,3,0,'8','3','0'],[
+]).
diff --git a/DOCUMENTATION/USER_GUIDE/Tex/creating_a_cable_bundle_model.tex b/DOCUMENTATION/USER_GUIDE/Tex/creating_a_cable_bundle_model.tex
index 56e627e..f6f2211 100644
--- a/DOCUMENTATION/USER_GUIDE/Tex/creating_a_cable_bundle_model.tex
+++ b/DOCUMENTATION/USER_GUIDE/Tex/creating_a_cable_bundle_model.tex
@@ -71,6 +71,10 @@ In addition to the data required to specify a cable bundle, additional flags may
 \item `verbose'    output detailed summary of the software operation and calculation results.\\
 \item `use\_Laplace'    use the numerical Laplace solver to calculate inductance and capacitance matrices for the external domain and any overshielded domains. By default, approximate analytic formulae are used. \\
 \item `plot\_mesh'    output a vtk file which shows the mesh used in Finite Element Laplace calculations.\\
+\item `direct\_solver'  Solve the Finite Element matrix equation using a direct solver i.e. by calculating the matrix inverse. \\
+\item `iterative\_solver'  Solve the Finite Element matrix equation using an iterative solver. This is much more efficient than the direct solver and is the default option \\    
+\item `inf\_gnd' Include the ground plane as a boundary condition on the y=0 boundary in the Finite Element Laplace solution for the bundle cross section. the outer boundary in this case is a semi-circle.   \\
+\item `finite\_gnd' Include the ground plane as a finite conductor in the Finite Element Laplace solution for the bundle cross section. In this case the ground plane is a finite rectangular conductor within a circular boundary.  \\
 \end{enumerate}
 
 If the Laplace solver is used then the mesh generation is be controlled by the parameters
@@ -86,10 +90,12 @@ If the Laplace solver is used then the mesh generation is be controlled by the p
                                        The edge length of elements on a cylindrical conductor of radius r is
                                        $\frac{r}{Laplace\_surface\_mesh\_constant}$. The default value is 3. \\
                                    
+\item `Max\_mesh\_edge\_length'  This (real) parameter determines the maximum finite element mesh edge length for the rectangular conductors of flex cables. It may be used to force an increase in mesh density in flex cables. \\
+                                   
 \end{enumerate}
 
 The default parameters are a compromise between accuracy and computation time for the Laplace solution. 
-The default values may be overridden by the user by appending the following to the end of the \textbf{.bundle\_spec file}:
+The default values may be overridden by the user by appending the following to the end of the \textbf{.bundle\_spec} file:
 
 \begin{verbatim}
 Laplace_boundary_constant
@@ -98,6 +104,14 @@ Laplace_surface_mesh_constant
 5
 \end{verbatim}
 
+If the iterative solver is used to solve the Finite Element matrix equations then the tolerance for the iterative solution may be set using the parameter $cg\_tol$. The default value is $10^{-12}$. The parameter may be set (in this example to 1E-14) by including the following lines int the \textbf{.bundle\_spec} file:
+
+\begin{verbatim}
+cg_tol
+1E-14
+\end{verbatim}
+
+
 A ground plane may be included in the bundle as shown in figure \ref{fig_ground_plane_specification}
 
 \begin{figure}[h]
diff --git a/DOCUMENTATION/USER_GUIDE/Tex/creating_a_cable_model.tex b/DOCUMENTATION/USER_GUIDE/Tex/creating_a_cable_model.tex
index a4aa2d8..e10df90 100644
--- a/DOCUMENTATION/USER_GUIDE/Tex/creating_a_cable_model.tex
+++ b/DOCUMENTATION/USER_GUIDE/Tex/creating_a_cable_model.tex
@@ -214,6 +214,8 @@ The flags which may be applied in a \textbf{cable\_spec} file are as follows:
 \item `use\_Laplace'    use the numerical Laplace solver to calculate inductance and capacitance matrices for the internal domains. By default, approximate analytic formulae are used. \\
 \item `no\_Laplace'    use the (approximate) analytic formulae to calculate inductance and capacitance matrices for the internal domains. \\
 \item `plot\_mesh'    output a vtk file which shows the mesh used in Finite Element Laplace calculations.\\
+\item `direct\_solver'  Solve the Finite Element matrix equation using a direct solver i.e. by calculating the matrix inverse. \\
+\item `iterative\_solver'  Solve the Finite Element matrix equation using an iterative solver. This is much more efficient than the direct solver and is the default option \\
 \end{enumerate}
 
 If the Laplace solver is used then the mesh generation is controlled by the parameter
@@ -229,6 +231,13 @@ Laplace_surface_mesh_constant
 5
 \end{verbatim}
 
+If the iterative solver is used to solve the Finite Element matrix equations then the tolerance for the iterative solution may be set using the parameter $cg\_tol$. The default value is $10^{-12}$. The parameter may be set (in this example to 1E-14) by including the following lines int the \textbf{.cable\_spec} file:
+
+\begin{verbatim}
+cg_tol
+1E-14
+\end{verbatim}
+
 \subsection{Cable models available} \label{available_cable_models}
 
 The available cable models are described below. For each cable type a figure is provided which shows the cable cross section and the conductor numbering used for the cable. The parameters required to specify a cable are outlined and an example \textbf{.cable\_spec} file is provided.
@@ -809,29 +818,41 @@ Overshield
 
 \subsubsection{Flex cable} \label{flex_cable}
 
-Figure \ref{fig:flex_cable} shows the cross section of the flex cable model.
-A description of the model parameters is described in table \ref{table_flex_cable} followed by an example. The flex cable differs from most other cable models in that the number of conductors is a parameter of the model. The conductors are numbered from left to right. 
+Version 4.0.0 of the SACAMOS software introduces a new flex cable model in which more than one row of conductors can be included within the rectangular dielelctric region. This allows flex cables with multiple layers as well as cables with different conductor dimensions and spacings to be simulated. 
+Figure \ref{fig:flex_cable} shows the cross section of the new flex cable model.
+A description of the model parameters is described in table \ref{table_flex_cable} followed by an example. The flex cable differs from most other cable models in that the number of conductors is a parameter of the model. The conductors are numbered from left to right in each row. 
 
 \begin{figure}[h]
 \centering
-\includegraphics[scale=0.5]{./Imgs/flex_cable.eps}
+\includegraphics[scale=0.65]{./Imgs/ML_flex_cable.eps}
 \caption{flex cable}
 \label{fig:flex_cable}
 \end{figure}
 
+
 \begin{table}[h]
 \begin{center}
     \begin{tabular}{ |  p{3cm} | p{3cm} | p{6cm} |}
     \hline
 example value     & unit          & Comment \\ \hline
 8             & integer       & Number of conductors - can be any number of conductors in a flex cable model \\ \hline
-6             & integer       & Number of parameters, always 6 for flex cables \\ \hline
-1.0e-3       & metre         & parameter 1: conductor width (x) \\ \hline
-0.2e-3       & metre         & parameter 2: conductor height (y) \\ \hline
-0.6e-3       & metre         & parameter 3: conductor separation (x)\\ \hline
-1.0e-3       & metre         & parameter 4: dielectric offset in x \\ \hline
-0.2e-3       & metre         & parameter 5: dielectric offset in y \\ \hline
-5E7          & Siemens/metre & parameter 6: conductivity \\ \hline
+6             & integer       & Number of parameters = (number of rows of conductors)*6+4 \\ \hline
+6.0e-3        & metre         & parameter 1: dielectric width (x) \\ \hline
+1.2e-3        & metre         & parameter 2: dielectric height (y) \\ \hline
+2             & integer       & parameter 3: number of rows of conductors\\ \hline
+1.0e-3       & metre         &  parameter 4: row 1 centre offset x               \\ \hline
+0.4e-3       & metre         &  parameter 5: row 1 centre offset y                \\ \hline
+0.6e-3       & metre         &  parameter 6: row 1 conductor width (x dimension)  \\ \hline
+1.0e-4       & metre         &  parameter 7: row 1 conductor height (y dimension)  \\ \hline
+0.2e-3       & metre         &  parameter 8: row 1 conductor separation            \\ \hline
+3            & metre         &  parameter 9: row 1 number of conductors            \\ \hline
+1.0e-3       & metre         &  parameter 10: row 2 centre offset x               \\ \hline
+-0.4e-3      & metre         &  parameter 11: row 2 centre offset y                \\ \hline
+0.6e-3       & metre         &  parameter 12: row 2 conductor width (x dimension)  \\ \hline
+1.0e-4       & metre         &  parameter 13: row 2 conductor height (y dimension)  \\ \hline
+0.2e-3       & metre         &  parameter 14: row 2 conductor separation            \\ \hline
+3            & metre         &  parameter 15: row 2 number of conductors            \\ \hline
+5E7          & Siemens/metre & parameter 16: conductivity \\ \hline
 1	      &  integer      & number of frequency dependent parameters \\ \hline
 $\epsilon\left(j\omega \right)$ & rational function coefficients & Frequency dependent dielectric relative permittivity model\\ \hline
     \end{tabular}
@@ -848,24 +869,30 @@ $\epsilon\left(j\omega \right)$ & rational function coefficients & Frequency dep
 \begin{verbatim}
 #MOD_cable_lib_dir
 .
-Flex_cable
+flex_cable
 3		# number of conductors
-6		# number of parameters
-1.0e-3  	# parameter 1: conductor width (x dimension)
-0.25e-3  	# parameter 2: conductor height (y dimension)
-0.5e-3  	# parameter 3: conductor separation (x dimension)
-0.2e-3  	# parameter 4: dielectric offset x
-0.1e-3  	# parameter 5: dielectric offset y
-5E7  	        # parameter 6: conductivity
+10		# number of parameters
+5.0e-3          # parameter 1: dielectric width (x dimension)
+1.25e-3  	# parameter 2: dielectric height (y dimension)
+1               # parameter 3: number of rows of conductors
+0.0e-3  	# parameter 4: row 1 centre offset x
+0.0e-3  	# parameter 5: row 1 centre offset y
+1.0e-3          # parameter 6: row 1 conductor width (x dimension)
+0.25e-3         # parameter 7: row 1 conductor height (y dimension)
+0.5e-3          # parameter 8: row 1 conductor separation
+3               # parameter 9: row 1 number of conductors
+0.0  	        # parameter 10: conductivity
 1		# number of frequency dependent parameters
 # dielectric relative permittivity model follows
-   1E9          # w normalisation constant
-           1    # a order, a coefficients follow below:
-  2.2      2.0     
-           1    # b order, b coefficients follow below:
-  1.0      1.0
+   1E9        # w normalisation constant
+           0   # a order, a coefficients follow below:
+  2.2         
+           0   # b order, b coefficients follow below:
+  1.0      
 \end{verbatim}
 
+When creating cable bundle models including flex cables the mesh control parameter $Max\_mesh\_edge\_length$ may be used to give an additional degree of control over the Finite Element mash. The number of mesh elements in the y direction on conductors (height) is set by the $Laplace\_surface\_mesh\_constant$ parameter (although the minimum number is two). 
+
 \clearpage
 
 \subsubsection{D connector} \label{Dconnector}
diff --git a/DOCUMENTATION/USER_GUIDE/Tex/introduction.tex b/DOCUMENTATION/USER_GUIDE/Tex/introduction.tex
index 5f64392..674e794 100644
--- a/DOCUMENTATION/USER_GUIDE/Tex/introduction.tex
+++ b/DOCUMENTATION/USER_GUIDE/Tex/introduction.tex
@@ -2,7 +2,7 @@
 
 \section{Software overview}
 
-The purpose of the SACAMOS software is to enable the creation of Spice cable models from the description/ characterisation of cables and bundles of cables together with information required to specify a particular modelling scenario (for example the specification of incident field excitation or transfer impedance coupling model). 
+The purpose of the SACAMOS software is to enable the creation of Spice cable models from the description/ characterisation of cables and bundles of cables together with information required to specify a particular modelling scenario (for example the specification of incident field excitation or transfer impedance coupling model). This User Guide relates to version 4.0.0 of the SACAMOS software.
 
 A cable bundle may consist of multiple individual cables usually with the addition of a ground plane. This is illustrated in figure\ref{fig_cable_bundle} The cables may consist of shielded and/ or unshielded conductors.
 
diff --git a/DOCUMENTATION/USER_GUIDE/Tex/preamble.tex b/DOCUMENTATION/USER_GUIDE/Tex/preamble.tex
index 63e0593..9964ab9 100644
--- a/DOCUMENTATION/USER_GUIDE/Tex/preamble.tex
+++ b/DOCUMENTATION/USER_GUIDE/Tex/preamble.tex
@@ -3,7 +3,7 @@
 \newcommand{\DocumentTitle}{User Guide}
 \newcommand{\DocumentSubTitle}{SACAMOS: State of the Art CAble MOdels for Spice}
 \newcommand{\DocumentSubSubTitle}{Open Souce Cable Models for EMI Simulations}
-\newcommand{\DocumentVersion}{1.1}
+\newcommand{\DocumentVersion}{1.2}
 \newcommand{\DocumentAuthors}{Christopher Smartt\footnote{\UONname, contact: Chris.Smartt@nottingham.ac.uk}, David Thomas$^1$, Steve Greedy$^1$, \\ Jaco Verpoorte\footnote{\NLRname, contact: Jaco.Verpoorte@nlr.nl}, Jesper Lansink Rotgerink$^2$ and Harmen Schippers$^2$}
 \newcommand{\License}{This document is subject to the GNU Free Documentation License (version 2.0).}
 \newcommand{\Reference}{ESA 40000112765/14/NL/HK.}
diff --git a/SRC/GENERAL_MODULES/constants.F90 b/SRC/GENERAL_MODULES/constants.F90
index 4fdb8a5..c62f2ca 100644
--- a/SRC/GENERAL_MODULES/constants.F90
+++ b/SRC/GENERAL_MODULES/constants.F90
@@ -106,6 +106,8 @@ IMPLICIT NONE
                                                  ! if Laplace_surface_mesh_constant=5 we have just over 30 elements on the circumference
                                            
   real(dp) ::  max_mesh_edge_length=1d30          ! the maximum mesh edge length on internal boundaries
+                                           
+  real(dp) ::  cg_tol=1d-12          ! tolerance for conjugate gradient solution of Finite element Laplace matrix equation
                                                
   real(dp) ::  Twisted_pair_equivalent_radius=1.5d0 ! The twisted pair commmon mode interaction is calculated by treating the
                                                     ! common mode as being carried on an 'equivalent cylindrical conductor'
diff --git a/SRC/PUL_PARAMETER_CALCULATION/CG_solve.F90 b/SRC/PUL_PARAMETER_CALCULATION/CG_solve.F90
index 8da0821..c2c95b1 100644
--- a/SRC/PUL_PARAMETER_CALCULATION/CG_solve.F90
+++ b/SRC/PUL_PARAMETER_CALCULATION/CG_solve.F90
@@ -25,9 +25,9 @@
 ! 
 ! The University of Nottingham can be contacted at: ggiemr@nottingham.ac.uk
 !
-! SUBROUTINE solve_real_symm(n, b, x,tol)
+! SUBROUTINE solve_real_symm(n, b, x,tol,itmax)
 ! SUBROUTINE dot ( n, x, y ,res)
-! SUBROUTINE solve_complex_symm(n, b, x,tol)
+! SUBROUTINE solve_complex_symm(n, b, x,tolitmax)
 ! SUBROUTINE zdot ( n, x, y ,res)
 !
 ! NAME
@@ -44,7 +44,7 @@
 !
 ! COMMENTS
 ! 
-SUBROUTINE solve_real_symm(n, b, x,tol)
+SUBROUTINE solve_real_symm(n, b, x,tol,itmax)
 
 USE type_specifications
 
@@ -57,6 +57,7 @@ integer,intent(IN) :: n
 real(dp),intent(IN) :: b(n)
 real(dp),intent(INOUT) :: x(n)   ! x contains the initial guess for x
 real(dp),intent(IN) :: tol
+integer,intent(IN) :: itmax
 
 ! local variables
 
@@ -115,7 +116,7 @@ minres=.TRUE.
   pkb=rkb
 
 ! iteration loop
-  do itloop=1,2*n
+  do itloop=1,itmax
   
 ! calculate ak=(rkb.rk)/(pkb.A.pk)
     
@@ -167,7 +168,11 @@ minres=.TRUE.
 
   end do ! next iteration
   
-! finish
+! We only get here if the iterative solution has not converged after itmax iterations
+
+  run_status='ERROR in solve_real_symm: maximum number of iterations exceeded'
+  CALL write_program_status()
+  STOP 1
 
   RETURN
 
@@ -219,7 +224,7 @@ END SUBROUTINE dot
 !
 ! COMMENTS
 ! 
- SUBROUTINE solve_complex_symm(n, b, x,tol)
+ SUBROUTINE solve_complex_symm(n, b, x,tol,itmax)
 
 USE type_specifications
 
@@ -232,6 +237,7 @@ integer,intent(IN) :: n
 complex(dp),intent(IN) :: b(n)
 complex(dp),intent(INOUT) :: x(n)   ! x contains the initial guess for x
 real(dp),intent(IN) :: tol
+integer,intent(IN) :: itmax
 
 ! local variables
 
@@ -291,7 +297,7 @@ minres=.TRUE.
   pkb=rkb
 
 ! iteration loop
-  do itloop=1,2*n
+  do itloop=1,itmax
   
 ! calculate ak=(rkb.rk)/(pkb.A.pk)
     
@@ -343,7 +349,11 @@ minres=.TRUE.
 
   end do ! next iteration
   
-! finish
+! We only get here if the iterative solution has not converged after itmax iterations
+ 
+  run_status='ERROR in solve_complex_symm: maximum number of iterations exceeded'
+  CALL write_program_status()
+  STOP 1
 
   RETURN
 
diff --git a/SRC/PUL_PARAMETER_CALCULATION/Laplace.F90 b/SRC/PUL_PARAMETER_CALCULATION/Laplace.F90
index efdbdd9..33c9a5b 100644
--- a/SRC/PUL_PARAMETER_CALCULATION/Laplace.F90
+++ b/SRC/PUL_PARAMETER_CALCULATION/Laplace.F90
@@ -284,23 +284,10 @@ integer      :: ierr   ! error code for matrix inversion
 
 ! variables for iterative solver
 
-logical  checkA 
 integer  itnlim 
 real(dp)   rtol   
-integer  nout
-logical  goodb
-logical  precon 
-real(dp)   shift
-
-integer istop, itn
-real(dp)  anorm, acond, rnorm, ynorm
       
-real(dp),allocatable :: r1(:)
-real(dp),allocatable :: r2(:)
-real(dp),allocatable :: vt(:)
-real(dp),allocatable :: wt(:)
-real(dp),allocatable :: yt(:)
-real(dp),allocatable :: bt(:)
+real(dp),allocatable :: bt(:)                ! real vectors for conjugate gradient solution for lossless problems
 real(dp),allocatable :: xt(:)
 
 logical :: lossy_dielectric                  ! flag to indicate lossy dielectric i.e. we must solve a complex problem
@@ -1095,19 +1082,9 @@ if (direct_solver) then
   
 else if(.NOT.lossy_dielectric) then
     
-  checkA = .true.
-  itnlim = N_unknown * 2
-  rtol   = 1.0D-12
-  nout=6
-  goodb=.FALSE.
-  precon = .FALSE.
-  shift=0d0
+  itnlim = N_unknown * 2  ! maximum number of iterations set to twice the number of unknowns
+  rtol   = cg_tol
      
-  allocate(r1(1:N_unknown))
-  allocate(r2(1:N_unknown))
-  allocate(vt(1:N_unknown))
-  allocate(wt(1:N_unknown))
-  allocate(yt(1:N_unknown))
   allocate(xt(1:N_unknown))
   allocate(bt(1:N_unknown))
   
@@ -1122,32 +1099,21 @@ else if(.NOT.lossy_dielectric) then
         b_tmp(1:N_unknown)=-matmul(K_rhs,v_tmp)
         bt(1:N_unknown)=b_tmp(1:N_unknown)
       
-! UoN conjugate gradient solution
-        CALL solve_real_symm(N_unknown, bt, xt, rtol)
+! conjugate gradient solution
+        CALL solve_real_symm(N_unknown, bt, xt, rtol, itnlim)
 
         x(j1,j2,1:N_unknown)=xt(1:N_unknown)
      
       end do
   end do
       
-  deallocate(r1)
-  deallocate(r2)
-  deallocate(vt)
-  deallocate(wt)
-  deallocate(yt)
   deallocate(xt)
   deallocate(bt)
   
 else if (lossy_dielectric) then
 
-  itnlim=4*N_unknown
-  nout=6
-  wantse=.FALSE.
-  atol=1D-8
-  btol=1d-8
-  conlim=1d10
-  damp=0d0
-  allocate(se(1:N_unknown))
+  itnlim = N_unknown * 2  ! maximum number of iterations set to twice the number of unknowns
+  rtol   = cg_tol
         
 ! Iterative solution
    do j1=1,jmax-1
@@ -1155,20 +1121,15 @@ else if (lossy_dielectric) then
       
         v_tmp(1:n_known)=V(j1,j2,1:n_known)
         b_tmp(1:N_unknown)=-matmul(K_rhs,v_tmp)
-        n=N_unknown
-        m=N_unknown
-        
-! UoN conjugate gradient solution
-        rtol   = 1.0D-12
-        CALL solve_complex_symm(N_unknown, b_tmp, x_tmp, rtol)
+              
+! conjugate gradient solution
+        CALL solve_complex_symm(N_unknown, b_tmp, x_tmp, rtol,itnlim )
  
         x(j1,j2,1:N_unknown)=x_tmp(1:N_unknown)
           
       end do
   end do
-  
-  deallocate(se)
-       
+         
 end if
 
 ! STAGE 12 Determine the voltage phi in each node of the mesh
diff --git a/SRC/cable_bundle_model_builder.F90 b/SRC/cable_bundle_model_builder.F90
index 6a75b36..0fca559 100644
--- a/SRC/cable_bundle_model_builder.F90
+++ b/SRC/cable_bundle_model_builder.F90
@@ -347,19 +347,23 @@ integer        :: dim
 
 ! redefine mesh generation parameters if required
     if (INDEX(line,'laplace_boundary_constant').NE.0) then
-      read(bundle_spec_file_unit,*,END=100,ERR=100)Laplace_boundary_constant
+      read(bundle_spec_file_unit,*,END=9000,ERR=9000)Laplace_boundary_constant
     end if
     
     if (INDEX(line,'laplace_surface_mesh_constant').NE.0) then
-      read(bundle_spec_file_unit,*,END=100,ERR=100)Laplace_surface_mesh_constant
+      read(bundle_spec_file_unit,*,END=9000,ERR=9000)Laplace_surface_mesh_constant
     end if
     
     if (INDEX(line,'twisted_pair_equivalent_radius').NE.0) then
-      read(bundle_spec_file_unit,*,END=100,ERR=100)Twisted_pair_equivalent_radius
+      read(bundle_spec_file_unit,*,END=9000,ERR=9000)Twisted_pair_equivalent_radius
     end if
     
     if (INDEX(line,'max_mesh_edge_length').NE.0) then
-      read(bundle_spec_file_unit,*,END=100,ERR=100)max_mesh_edge_length
+      read(bundle_spec_file_unit,*,END=9000,ERR=9000)max_mesh_edge_length
+    end if
+    
+    if (INDEX(line,'cg_tol').NE.0) then
+      read(bundle_spec_file_unit,*,END=9000,ERR=9000)cg_tol
     end if
 
   end do  ! continue until all flags are read - indicated by an end of file.
@@ -485,7 +489,12 @@ integer        :: dim
 
   run_status='Finished_Correctly'
   CALL write_program_status()
-
+  
+  STOP
+ 
+9000    run_status='ERROR reading control parameter from the bundle_spec file'
+        CALL write_program_status()
+        STOP 1
 
 END PROGRAM cable_bundle_model_builder
 
diff --git a/SRC/cable_model_builder.F90 b/SRC/cable_model_builder.F90
index ae06c14..f30ccdf 100644
--- a/SRC/cable_model_builder.F90
+++ b/SRC/cable_model_builder.F90
@@ -430,19 +430,23 @@ integer        :: i
 
 ! redefine mesh generation parameters if required
     if (INDEX(line,'laplace_boundary_constant').NE.0) then
-      read(cable_spec_file_unit,*,END=100,ERR=100)Laplace_boundary_constant
+      read(cable_spec_file_unit,*,END=9000,ERR=9000)Laplace_boundary_constant
     end if
     
     if (INDEX(line,'laplace_surface_mesh_constant').NE.0) then
-      read(cable_spec_file_unit,*,END=100,ERR=100)Laplace_surface_mesh_constant
+      read(cable_spec_file_unit,*,END=9000,ERR=9000)Laplace_surface_mesh_constant
     end if
     
     if (INDEX(line,'twisted_pair_equivalent_radius').NE.0) then
-      read(cable_spec_file_unit,*,END=100,ERR=100)Twisted_pair_equivalent_radius
+      read(cable_spec_file_unit,*,END=9000,ERR=9000)Twisted_pair_equivalent_radius
     end if
     
     if (INDEX(line,'max_mesh_edge_length').NE.0) then
-      read(cable_spec_file_unit,*,END=100,ERR=100)max_mesh_edge_length
+      read(cable_spec_file_unit,*,END=9000,ERR=9000)max_mesh_edge_length
+    end if
+    
+    if (INDEX(line,'cg_tol').NE.0) then
+      read(cable_spec_file_unit,*,END=9000,ERR=9000)cg_tol
     end if
 
   end do  ! continue until all flags are read - indicated by an end of file.
@@ -532,6 +536,12 @@ integer        :: i
   run_status='Finished_Correctly'
   CALL write_program_status()
   
+  STOP
+ 
+9000    run_status='ERROR reading control parameter from the cable_spec file'
+        CALL write_program_status()
+        STOP 1
+  
 END PROGRAM cable_model_builder
 
 
--
libgit2 0.21.2