diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..8aad2d2a3389a8945244ea40c80bfd19d94cea27
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+obj
+_install
+cmake-build-debug
+lib/build
+test/build
+.project
+.cproject
+.settings
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000000000000000000000000000000000000..84d5f63404fe643e4c32dcf03ff3aafe65de35a7
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,15 @@
+# Changelog
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
+and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
+
+## [Unreleased]
+
+## [1.1.0] - 23-06-2020
+
+* Bug related to calibration fixed by Gael in his model
+
+# [1.0.0] - 30-10-2019
+
+* First official release before ESRF re-start with EBS storage ring
diff --git a/Parameters/CH_params.csv b/Parameters/CH_params.csv
new file mode 100644
index 0000000000000000000000000000000000000000..42758b041dff6374a3efeddb7841518228e0fd46
--- /dev/null
+++ b/Parameters/CH_params.csv
@@ -0,0 +1,3 @@
+#S_N     ,        SCALE,  OFFSET,  RADIUS, PSCURROFFSET
+#        ,          [1],     [T],    [mm],          [A]
+CH-01,            1,       0,      13,            0
diff --git a/Parameters/CH_strength.csv b/Parameters/CH_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..c047c02013747b3a27ddfa136d4e0f9d818838a3
--- /dev/null
+++ b/Parameters/CH_strength.csv
@@ -0,0 +1,11 @@
+#Current,     Int.Grad. 
+#[A]    ,           [Tm]
+       0,            0.0
+     0.3, 0.002028966667
+     0.6, 0.004057933333
+     0.9,      0.0060869
+     1.2,     0.00811586
+     1.5,     0.01014483
+     1.8,      0.0121738
+     2.1,      0.0141826
+     2.4,      0.0161824
diff --git a/Parameters/DQ1_corr_matrix.csv b/Parameters/DQ1_corr_matrix.csv
new file mode 100644
index 0000000000000000000000000000000000000000..8e884dcc091a863dbd58cb08d88d8c6d4067b477
--- /dev/null
+++ b/Parameters/DQ1_corr_matrix.csv
@@ -0,0 +1,2 @@
+1,0.562784
+1,-0.176495
diff --git a/Parameters/DQ1_h_strength.csv b/Parameters/DQ1_h_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..9455ff18cd42f6a70e1588ab65ebac80abf1ee56
--- /dev/null
+++ b/Parameters/DQ1_h_strength.csv
@@ -0,0 +1,6 @@
+#Current ,    Int.Grad. 
+#[A]     ,          [Tm]
+        0,             0
+    7.943,     0.0540134
+   17.943,  0.1179568959
+   27.943,  0.1685137273
diff --git a/Parameters/DQ1_params.csv b/Parameters/DQ1_params.csv
new file mode 100644
index 0000000000000000000000000000000000000000..9a34b71a22b9042ed799ea7e48becfcc23dca519
--- /dev/null
+++ b/Parameters/DQ1_params.csv
@@ -0,0 +1,66 @@
+#  S_N ,       SCALE, OFFSET, RADIUS,  PSCURROFFSET
+#      ,         [1],    [T],   [mm],           [A]
+DQ1-036, 1.008373615,      0,      0,   81.13828125
+DQ1-020, 0.999119155,      0,      0,  81.909953125
+DQ1-044, 1.003251239,      0,      0, 81.5634296875
+DQ1-024, 1.002738799,      0,      0, 81.6062421875
+DQ1-038,  1.00024248,      0,      0,   81.81546875
+DQ1-028, 1.001686775,      0,      0, 81.6942890625
+DQ1-055, 1.006981283,      0,      0, 81.2533984375
+DQ1-064, 1.006409071,      0,      0,  81.300796875
+DQ1-008, 1.012088314,      0,      0, 80.8327265625
+DQ1-062, 1.009933405,      0,      0, 81.0096953125
+DQ1-061, 1.002856327,      0,      0,  81.596421875
+DQ1-053, 1.004826194,      0,      0,  81.432203125
+DQ1-016, 1.013598492,      0,      0,    80.7091875
+DQ1-052, 1.009541769,      0,      0, 81.0419453125
+DQ1-063, 1.005227934,      0,      0,    81.3988125
+DQ1-017, 1.004528249,      0,      0,  81.456984375
+DQ1-057, 1.008669776,      0,      0, 81.1138359375
+DQ1-009, 1.009120936,      0,      0,        81.077
+DQ1-039, 1.002436395,      0,      0, 81.6315390625
+DQ1-054, 1.003990772,      0,      0, 81.5017265625
+DQ1-045, 1.008370562,      0,      0,   81.13853125
+DQ1-012, 1.005907811,      0,      0, 81.3423671875
+DQ1-026, 1.006504358,      0,      0, 81.2928984375
+DQ1-048, 1.006637742,      0,      0,   81.28184375
+DQ1-065, 1.008449757,      0,      0, 81.1319921875
+DQ1-014,  1.01114694,      0,      0, 80.9099296875
+DQ1-066, 1.005838519,      0,      0, 81.3481171875
+DQ1-034, 1.002331923,      0,      0, 81.6402734375
+DQ1-004, 1.001618853,      0,      0,  81.699984375
+DQ1-010, 1.011280869,      0,      0,    80.8989375
+DQ1-027, 1.004267391,      0,      0, 81.4786953125
+DQ1-031, 0.999821846,      0,      0, 81.8508203125
+DQ1-060, 1.006628697,      0,      0,   81.28259375
+DQ1-029, 1.001234965,      0,      0,        81.732
+DQ1-040, 1.003654132,      0,      0, 81.5297890625
+DQ1-005, 0.998607355,      0,      0, 81.9530703125
+DQ1-023, 0.998232452,      0,      0,    81.9846875
+DQ1-025,  1.00331744,      0,      0, 81.5578984375
+DQ1-047, 1.006919142,      0,      0, 81.2585390625
+DQ1-018, 1.006863494,      0,      0, 81.2631484375
+DQ1-033,  1.00071578,      0,      0,   81.77571875
+DQ1-019, 1.003695438,      0,      0,   81.52634375
+DQ1-022, 1.004861006,      0,      0,    81.4293125
+DQ1-042, 1.001992388,      0,      0, 81.6686953125
+DQ1-035, 1.003366343,      0,      0,    81.5538125
+DQ1-021, 0.996892335,      0,      0,  82.097890625
+DQ1-003, 1.003546251,      0,      0,  81.538796875
+DQ1-041, 0.999060029,      0,      0, 81.9149296875
+DQ1-050, 1.002760634,      0,      0,  81.604421875
+DQ1-032, 1.002227451,      0,      0,  81.649015625
+DQ1-002,           1,      0,      0,   81.83584375
+DQ1-049, 1.005982089,      0,      0,  81.336203125
+DQ1-011, 1.003941162,      0,      0,  81.505859375
+DQ1-058, 1.005911508,      0,      0,        81.342
+DQ1-006, 1.004362135,      0,      0, 81.4708046875
+DQ1-037,  1.00812309,      0,      0,   81.15896875
+DQ1-030, 1.004119319,      0,      0, 81.4910234375
+DQ1-043, 0.999748087,      0,      0, 81.8570234375
+DQ1-046, 1.007175503,      0,      0, 81.2373203125
+DQ1-059,   1.0079361,      0,      0, 81.1744140625
+DQ1-056, 1.008169512,      0,      0, 81.1551328125
+DQ1-013, 0.995008064,      0,      0, 82.2576953125
+DQ1-015, 1.002410277,      0,      0,   81.63371875
+DQ1-051, 1.002253569,      0,      0,  81.646828125
diff --git a/Parameters/DQ1_strength.csv b/Parameters/DQ1_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..0b4c0dc45abd1bd91ea8f506584fbc1bc85c3344
--- /dev/null
+++ b/Parameters/DQ1_strength.csv
@@ -0,0 +1,103 @@
+#Current   ,        Int.Grad. 
+#[A]       ,               [T]
+          0,                 0
+         50,       23.55330297
+50.60606061,       23.83354564
+51.21212121,       24.11378732
+51.81818182,       24.39402704
+52.42424242,        24.6742638
+53.03030303,       24.95449663
+53.63636364,       25.23472454
+54.24242424,       25.51494655
+54.84848485,       25.79516166
+55.45454545,       26.07536891
+56.06060606,        26.3555673
+56.66666667,       26.63575586
+57.27272727,       26.91593359
+57.87878788,       27.19609951
+58.48484848,       27.47625265
+59.09090909,       27.75639201
+ 59.6969697,       28.03651661
+ 60.3030303,       28.31662537
+60.90909091,         28.596715
+61.51515152,       28.87677999
+62.12121212,       29.15681472
+62.72727273,       29.43681359
+63.33333333,       29.71677098
+63.93939394,       29.99668131
+64.54545455,       30.27653895
+65.15151515,       30.55633829
+65.75757576,       30.83607374
+66.36363636,       31.11573967
+66.96969697,        31.3953305
+67.57575758,        31.6748406
+68.18181818,       31.95426436
+68.78787879,       32.23359619
+69.39393939,       32.51283047
+         70,        32.7919616
+70.60606061,       33.07098369
+71.21212121,       33.34988973
+71.81818182,       33.62867245
+72.42424242,       33.90732458
+73.03030303,       34.18583882
+73.63636364,       34.46420791
+74.24242424,       34.74242455
+74.84848485,       35.02048149
+75.45454545,       35.29837142
+76.06060606,       35.57608708
+76.66666667,       35.85362118
+77.27272727,       36.13096645
+77.87878788,        36.4081156
+78.48484848,       36.68506137
+79.09090909,       36.96179646
+ 79.6969697,        37.2383136
+ 80.3030303,        37.5146053
+80.90909091,       37.79065923
+81.51515152,       38.06645824
+82.12121212,       38.34198495
+82.72727273,       38.61722201
+83.33333333,       38.89215203
+83.93939394,       39.16675764
+84.54545455,       39.44102149
+85.15151515,        39.7149262
+85.75757576,       39.98845439
+86.36363636,       40.26158871
+86.96969697,       40.53431178
+87.57575758,       40.80660623
+88.18181818,        41.0784547
+88.78787879,        41.3498398
+89.39393939,       41.62074418
+         90,       41.89115047
+90.60606061,        42.1610018
+91.21212121,       42.43008332
+91.81818182,       42.69814069
+92.42424242,       42.96491959
+93.03030303,       43.23016566
+93.63636364,       43.49362456
+94.24242424,       43.75504197
+94.84848485,       44.01416353
+95.45454545,       44.27073491
+96.06060606,       44.52450176
+96.66666667,       44.77520976
+97.27272727,       45.02260455
+97.87878788,        45.2664318
+98.48484848,       45.50643717
+99.09090909,       45.74236632
+ 99.6969697,       45.97396492
+100.3030303,       46.20098986
+100.9090909,       46.42345676
+101.5151515,       46.64163997
+102.1212121,       46.85582506
+102.7272727,       47.06629761
+103.3333333,        47.2733432
+103.9393939,       47.47724741
+104.5454545,       47.67829582
+105.1515152,       47.87677401
+105.7575758,       48.07296756
+106.3636364,       48.26716205
+ 106.969697,       48.45964306
+107.5757576,       48.65069617
+108.1818182,       48.84060696
+108.7878788,       49.02966101
+109.3939394,        49.2181439
+        110,       49.40634121
diff --git a/Parameters/DQ2_corr_matrix.csv b/Parameters/DQ2_corr_matrix.csv
new file mode 100644
index 0000000000000000000000000000000000000000..e9a38c8bf01e90ccde6cc4b8ee04bebb5027a395
--- /dev/null
+++ b/Parameters/DQ2_corr_matrix.csv
@@ -0,0 +1,2 @@
+1,0.649842
+1,-0.289596
diff --git a/Parameters/DQ2_h_strength.csv b/Parameters/DQ2_h_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..acdc57392053e6d9f679060d271f263ce068bf40
--- /dev/null
+++ b/Parameters/DQ2_h_strength.csv
@@ -0,0 +1,6 @@
+#Current ,     Int.Grad. 
+#[A]     ,           [Tm]
+     0   ,              0
+ 0.907   ,  0.00309635579
+10.907   ,  0.03606298974
+20.907   ,  0.06780447409
diff --git a/Parameters/DQ2_params.csv b/Parameters/DQ2_params.csv
new file mode 100644
index 0000000000000000000000000000000000000000..da150ba98570fb02f6e0ea4847654a09d7515dc6
--- /dev/null
+++ b/Parameters/DQ2_params.csv
@@ -0,0 +1,34 @@
+#S_N   ,       SCALE, OFFSET, RADIUS,  PSCURROFFSET
+#      ,         [1],    [T],   [mm],           [A]
+DQ2-005, 1.003482896,      0,      0,  89.283140625
+DQ2-001, 0.995422978,      0,      0, 90.0302578125
+DQ2-034, 1.001091583,      0,      0,     89.503125
+DQ2-017, 1.004419409,      0,      0,  89.197484375
+DQ2-018, 1.004764239,      0,      0,  89.165984375
+DQ2-016, 1.003400313,      0,      0,  89.290703125
+DQ2-019, 1.002169227,      0,      0,  89.403609375
+DQ2-014, 1.002561353,      0,      0, 89.3675859375
+DQ2-031, 1.000234523,      0,      0,  89.582421875
+DQ2-008, 1.003438208,      0,      0,  89.287234375
+DQ2-029, 1.002729791,      0,      0,  89.352140625
+DQ2-021, 1.000535845,      0,      0, 89.5545234375
+DQ2-024, 1.002773556,      0,      0,     89.348125
+DQ2-013, 1.004309523,      0,      0,   89.20753125
+DQ2-009, 1.001656716,      0,      0, 89.4509140625
+DQ2-010, 1.003047972,      0,      0, 89.3229765625
+DQ2-030, 1.003225796,      0,      0,    89.3066875
+DQ2-004, 1.004178582,      0,      0,       89.2195
+DQ2-007, 1.001381432,      0,      0, 89.4763359375
+DQ2-027, 1.002429946,      0,      0,  89.379640625
+DQ2-022, 1.003061749,      0,      0, 89.3217109375
+DQ2-025, 0.999329912,      0,      0,  89.666265625
+DQ2-023, 0.999035925,      0,      0,  89.693546875
+DQ2-011, 1.004543046,      0,      0,    89.1861875
+DQ2-020, 1.001213174,      0,      0, 89.4918828125
+DQ2-012, 1.002004005,      0,      0, 89.4188515625
+DQ2-006, 1.008317255,      0,      0,    88.8426875
+DQ2-015, 1.006728238,      0,      0,        88.987
+DQ2-026, 1.000581856,      0,      0,  89.550265625
+DQ2-033, 1.002259601,      0,      0, 89.3952734375
+DQ2-003, 1.000712758,      0,      0,   89.53815625
+DQ2-028, 1.000571853,      0,      0, 89.5511953125
diff --git a/Parameters/DQ2_strength.csv b/Parameters/DQ2_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..977712e959025df7d77f66bdb79eebd8c50dcf0a
--- /dev/null
+++ b/Parameters/DQ2_strength.csv
@@ -0,0 +1,103 @@
+#Current   ,         Int.Grad. 
+#[A]       ,                [T]
+          0,                  0
+         50,             14.262
+    50.6061,            14.4361
+    51.2121,            14.6102
+    51.8182,            14.7842
+    52.4242,            14.9582
+    53.0303,            15.1321
+    53.6364,            15.3059
+    54.2424,            15.4796
+    54.8485,            15.6532
+    55.4545,            15.8265
+    56.0606,            15.9997
+    56.6667,            16.1727
+    57.2727,            16.3455
+    57.8788,             16.518
+    58.4848,            16.6903
+    59.0909,            16.8623
+     59.697,             17.034
+     60.303,            17.2053
+    60.9091,            17.3764
+    61.5152,            17.5471
+    62.1212,            17.7176
+    62.7273,            17.8878
+    63.3333,            18.0577
+    63.9394,            18.2275
+    64.5455,             18.397
+    65.1515,            18.5664
+    65.7576,            18.7356
+    66.3636,            18.9047
+    66.9697,            19.0737
+    67.5758,            19.2427
+    68.1818,            19.4115
+    68.7879,            19.5803
+    69.3939,            19.7491
+         70,            19.9179
+    70.6061,            20.0868
+    71.2121,            20.2556
+    71.8182,            20.4245
+    72.4242,            20.5935
+    73.0303,            20.7625
+    73.6364,            20.9317
+    74.2424,            21.1009
+    74.8485,            21.2702
+    75.4545,            21.4396
+    76.0606,            21.6091
+    76.6667,            21.7787
+    77.2727,            21.9485
+    77.8788,            22.1185
+    78.4848,            22.2886
+    79.0909,            22.4588
+     79.697,            22.6293
+     80.303,            22.7999
+    80.9091,            22.9708
+    81.5152,            23.1417
+    82.1212,            23.3126
+    82.7273,            23.4836
+    83.3333,            23.6545
+    83.9394,            23.8252
+    84.5455,            23.9958
+    85.1515,            24.1662
+    85.7576,            24.3362
+    86.3636,            24.5059
+    86.9697,            24.6751
+    87.5758,            24.8439
+    88.1818,            25.0121
+    88.7879,            25.1798
+    89.3939,            25.3468
+         90,             25.513
+    90.6061,            25.6785
+    91.2121,            25.8433
+    91.8182,            26.0074
+    92.4242,            26.1707
+    93.0303,            26.3334
+    93.6364,            26.4954
+    94.2424,            26.6569
+    94.8485,            26.8177
+    95.4545,             26.978
+    96.0606,            27.1377
+    96.6667,            27.2969
+    97.2727,            27.4556
+    97.8788,            27.6138
+    98.4848,            27.7716
+    99.0909,             27.929
+     99.697,             28.086
+    100.303,            28.2427
+   100.9091,             28.399
+   101.5152,             28.555
+   102.1212,            28.7107
+   102.7273,            28.8661
+   103.3333,            29.0212
+   103.9394,            29.1762
+   104.5455,            29.3309
+   105.1515,            29.4854
+   105.7576,            29.6398
+   106.3636,             29.794
+   106.9697,             29.948
+   107.5758,             30.102
+   108.1818,            30.2559
+   108.7879,            30.4097
+   109.3939,            30.5635
+        110,            30.7173
diff --git a/Parameters/O_params.csv b/Parameters/O_params.csv
new file mode 100644
index 0000000000000000000000000000000000000000..727a860ff29f20c177775e9968a9fe13004acae1
--- /dev/null
+++ b/Parameters/O_params.csv
@@ -0,0 +1,66 @@
+#S_N    ,  SCALE,  OFFSET,  RADIUS, PSCURROFFSET
+#       ,    [1],  [T/m2],    [mm],          [A]
+OF1B-021,      1,       0,       0,            0
+OF1D-032,      1,       0,       0,            0
+OF1B-012,      1,       0,       0,            0
+OF1D-009,      1,       0,       0,            0
+OF1B-003,      1,       0,       0,            0
+OF1B-022,      1,       0,       0,            0
+OF1B-014,      1,       0,       0,            0
+OF1D-010,      1,       0,       0,            0
+OF1B-018,      1,       0,       0,            0
+OF1D-001,      1,       0,       0,            0
+OF1B-004,      1,       0,       0,            0
+OF1D-016,      1,       0,       0,            0
+OF1B-023,      1,       0,       0,            0
+OF1D-014,      1,       0,       0,            0
+OF1B-011,      1,       0,       0,            0
+OF1D-008,      1,       0,       0,            0
+OF1B-019,      1,       0,       0,            0
+OF1D-021,      1,       0,       0,            0
+OF1B-024,      1,       0,       0,            0
+OF1D-019,      1,       0,       0,            0
+OF1B-030,      1,       0,       0,            0
+OF1D-006,      1,       0,       0,            0
+OF1B-008,      1,       0,       0,            0
+OF1D-015,      1,       0,       0,            0
+OF1B-026,      1,       0,       0,            0
+OF1D-031,      1,       0,       0,            0
+OF1B-010,      1,       0,       0,            0
+OF1D-017,      1,       0,       0,            0
+OF1B-025,      1,       0,       0,            0
+OF1D-007,      1,       0,       0,            0
+OF1B-002,      1,       0,       0,            0
+OF1D-028,      1,       0,       0,            0
+OF1B-033,      1,       0,       0,            0
+OF1D-013,      1,       0,       0,            0
+OF1B-027,      1,       0,       0,            0
+OF1D-025,      1,       0,       0,            0
+OF1B-031,      1,       0,       0,            0
+OF1D-026,      1,       0,       0,            0
+OF1B-013,      1,       0,       0,            0
+OF1D-004,      1,       0,       0,            0
+OF1B-001,      1,       0,       0,            0
+OF1D-020,      1,       0,       0,            0
+OF1B-016,      1,       0,       0,            0
+OF1D-027,      1,       0,       0,            0
+OF1B-005,      1,       0,       0,            0
+OF1D-022,      1,       0,       0,            0
+OF1B-006,      1,       0,       0,            0
+OF1D-030,      1,       0,       0,            0
+OF1B-028,      1,       0,       0,            0
+OF1D-011,      1,       0,       0,            0
+OF1B-009,      1,       0,       0,            0
+OF1D-003,      1,       0,       0,            0
+OF1B-017,      1,       0,       0,            0
+OF1D-024,      1,       0,       0,            0
+OF1B-007,      1,       0,       0,            0
+OF1D-005,      1,       0,       0,            0
+OF1B-015,      1,       0,       0,            0
+OF1D-029,      1,       0,       0,            0
+OF1B-034,      1,       0,       0,            0
+OF1D-002,      1,       0,       0,            0
+OF1B-029,      1,       0,       0,            0
+OF1D-018,      1,       0,       0,            0
+OF1B-032,      1,       0,       0,            0
+OF1D-023,      1,       0,       0,            0
diff --git a/Parameters/O_strength.csv b/Parameters/O_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..b84e3040c2085af4527b642622d0f6a859fabf87
--- /dev/null
+++ b/Parameters/O_strength.csv
@@ -0,0 +1,14 @@
+#Current   ,       Int.Grad. 
+#[A]       ,           [T/m2]
+          0,                0
+         10,      661.3693193
+         20,      1311.191644
+         30,      1954.470671
+         40,      2585.908965
+         50,      3198.699874
+         60,      3783.899544
+         70,      4320.014357
+         80,      4765.140876
+         90,      5079.593905
+        100,      5323.792587
+        110,      5532.894482
diff --git a/Parameters/QD2-QF4-QD5_params.csv b/Parameters/QD2-QF4-QD5_params.csv
new file mode 100644
index 0000000000000000000000000000000000000000..9ddb54b65fe902a92540776cfede14a0ae2a391a
--- /dev/null
+++ b/Parameters/QD2-QF4-QD5_params.csv
@@ -0,0 +1,265 @@
+#S_N    ,        SCALE,  OFFSET,  RADIUS, PSCURROFFSET
+#       ,          [1],     [T],    [mm],          [A]
+QD2-001 ,  1.001479145,       0,       0,            0
+QD2-002 ,  0.995528142,       0,       0,            0
+QD2-003 ,  1.000617475,       0,       0,            0
+QD2-004 ,  0.998624389,       0,       0,            0
+QD2-005 ,  0.999305341,       0,       0,            0
+QD2-006 ,    1.0015563,       0,       0,            0
+QD2-007 ,    0.9987787,       0,       0,            0
+QD2-008 ,  0.996449521,       0,       0,            0
+QD2-009 ,  0.997221365,       0,       0,            0
+QD2-010 ,  1.003176567,       0,       0,            0
+QD2-011 ,  1.001479145,       0,       0,            0
+QD2-012 ,  1.002713633,       0,       0,            0
+QD2-013 ,  1.003318926,       0,       0,            0
+QD2-014 ,  0.997838839,       0,       0,            0
+QD2-015 ,  1.005414078,       0,       0,            0
+QD2-016 ,   1.00447669,       0,       0,            0
+QD2-017 ,  0.999614078,       0,       0,            0
+QD2-018 ,  1.004411056,       0,       0,            0
+QD2-019 ,  0.999922816,       0,       0,            0
+QD2-020 ,  1.004862612,       0,       0,            0
+QD2-021 ,  1.003704847,       0,       0,            0
+QD2-022 ,  0.999550256,       0,       0,            0
+QD2-023 ,  1.004256745,       0,       0,            0
+QD2-024 ,  1.000476122,       0,       0,            0
+QD2-025 ,  0.999550256,       0,       0,            0
+QD2-026 ,  1.002019233,       0,       0,            0
+QD2-027 ,  0.999010167,       0,       0,            0
+QD2-028 ,  0.997775678,       0,       0,            0
+QD2-029 ,  0.996541189,       0,       0,            0
+QD2-030 ,  0.999845631,       0,       0,            0
+QD2-031 ,    1.0029451,       0,       0,            0
+QD2-032 ,  1.003485189,       0,       0,            0
+QD2-033 ,    0.9987787,       0,       0,            0
+QD2-034 ,  1.000154369,       0,       0,            0
+QD2-035 ,  0.996926967,       0,       0,            0
+QD2-036 ,  0.995615322,       0,       0,            0
+QD2-037 ,  0.993763589,       0,       0,            0
+QD2-038 ,  1.000090345,       0,       0,            0
+QD2-039 ,  0.999318789,       0,       0,            0
+QD2-040 ,  0.998315767,       0,       0,            0
+QD2-041 ,  1.001016211,       0,       0,            0
+QD2-042 ,  0.998238611,       0,       0,            0
+QD2-043 ,  1.005877011,       0,       0,            0
+QD2-044 ,  1.007265811,       0,       0,            0
+QD2-045 ,  1.002790789,       0,       0,            0
+QD2-046 ,  1.001864922,       0,       0,            0
+QD2-047 ,  1.004565367,       0,       0,            0
+QD2-048 ,  1.001852424,       0,       0,            0
+QD2-049 ,  1.008808923,       0,       0,            0
+QD2-050 ,   0.99945971,       0,       0,            0
+QD2-051 ,  0.999318789,       0,       0,            0
+QD2-052 ,  1.003870967,       0,       0,            0
+QD2-053 ,  1.006097561,       0,       0,            0
+QD2-054 ,  1.001942078,       0,       0,            0
+QD2-055 ,  1.001479145,       0,       0,            0
+QD2-056 ,  1.001324833,       0,       0,            0
+QD2-057 ,  1.002096389,       0,       0,            0
+QD2-058 ,  0.998547233,       0,       0,            0
+QD2-059 ,  1.005954167,       0,       0,            0
+QD2-060 ,  0.997775678,       0,       0,            0
+QD2-061 ,  0.997929989,       0,       0,            0
+QD2-062 ,  0.999305341,       0,       0,            0
+QD2-063 ,  0.999150973,       0,       0,            0
+QD2-064 ,  0.998701544,       0,       0,            0
+QD2-065 ,    1.0036395,       0,       0,            0
+QD2-066 ,  1.006262789,       0,       0,            0
+QD2-067 ,  0.998238611,       0,       0,            0
+QD2-068 ,  0.994535144,       0,       0,            0
+QD2-069 ,  0.998547233,       0,       0,            0
+QD2-070 ,  0.996078255,       0,       0,            0
+QD2-071 ,  1.007728745,       0,       0,            0
+QD2-072 ,  1.000553278,       0,       0,            0
+QD2-073 ,  0.998470078,       0,       0,            0
+QD2-074 ,  1.001401989,       0,       0,            0
+QD2-075 ,  0.997081278,       0,       0,            0
+QD2-076 ,  0.999936033,       0,       0,            0
+QD2-077 ,  1.000630433,       0,       0,            0
+QD2-078 ,  1.001710611,       0,       0,            0
+QD2-079 ,  0.999550256,       0,       0,            0
+QD2-080 ,  0.999858878,       0,       0,            0
+QD2-081 ,  1.002019233,       0,       0,            0
+QD2-082 ,    1.0036395,       0,       0,            0
+QD2-083 ,  0.999010167,       0,       0,            0
+QD2-084 ,  0.996464033,       0,       0,            0
+QD2-085 ,  1.002482167,       0,       0,            0
+QD2-086 ,  0.999010167,       0,       0,            0
+QD2-087 ,    1.0043339,       0,       0,            0
+QD2-088 ,  1.003330878,       0,       0,            0
+QD2-089 ,  0.998547233,       0,       0,            0
+QD2-090 ,  1.000476122,       0,       0,            0
+QD2-091 ,  1.006648567,       0,       0,            0
+QD2-092 ,  1.000707589,       0,       0,            0
+QD2-093 ,  1.003716656,       0,       0,            0
+QD2-094 ,  0.998238611,       0,       0,            0
+QD2-095 ,  0.996232567,       0,       0,            0
+QD2-096 ,  1.005954167,       0,       0,            0
+QD2-097 ,    1.0050283,       0,       0,            0
+QD2-098 ,  0.999087322,       0,       0,            0
+QD2-099 ,    1.0050283,       0,       0,            0
+QD2-100 ,  0.998701544,       0,       0,            0
+QD2-101 ,  0.998624389,       0,       0,            0
+QD2-102 ,    0.9987787,       0,       0,            0
+QD2-103 ,  0.999858878,       0,       0,            0
+QD2-104 ,    1.0057227,       0,       0,            0
+QD2-105 ,  1.002713633,       0,       0,            0
+QD2-106 ,  1.002713633,       0,       0,            0
+QD2-107 ,  0.999164478,       0,       0,            0
+QD2-108 ,  1.004256745,       0,       0,            0
+QD2-109 ,  1.002790789,       0,       0,            0
+QD2-110 ,    1.0043339,       0,       0,            0
+QD2-111 ,  1.000939056,       0,       0,            0
+QD2-112 ,  1.001401989,       0,       0,            0
+QD2-113 ,  1.009580478,       0,       0,            0
+QD2-114 ,  0.998161456,       0,       0,            0
+QD2-115 ,  1.006185634,       0,       0,            0
+QD2-116 ,  1.001389318,       0,       0,            0
+QD2-117 ,  1.005634455,       0,       0,            0
+QD2-118 ,  1.002327856,       0,       0,            0
+QD2-119 ,  1.006031322,       0,       0,            0
+QD2-120 ,    1.0043339,       0,       0,            0
+QD2-121 ,  1.005105456,       0,       0,            0
+QD2-122 ,  1.000849027,       0,       0,            0
+QD2-123 ,  1.006715036,       0,       0,            0
+QD2-124 ,  1.004719678,       0,       0,            0
+QD2-125 ,  1.001942078,       0,       0,            0
+QD2-126 ,  1.006880034,       0,       0,            0
+QD2-127 ,  0.999164478,       0,       0,            0
+QD2-128 ,  1.003870967,       0,       0,            0
+QD2-129 ,  1.003485189,       0,       0,            0
+QD2-130 ,  1.001479145,       0,       0,            0
+QD2-131 ,  1.004951145,       0,       0,            0
+QD2-132 ,  1.005954167,       0,       0,            0
+QD2-133 ,  1.004873989,       0,       0,            0
+QD2-134 ,  1.003099411,       0,       0,            0
+QD2-135 ,  1.004642522,       0,       0,            0
+QD2-136 ,  1.004179589,       0,       0,            0
+QD2-137 ,  1.004642522,       0,       0,            0
+QD2-138 ,  1.001710611,       0,       0,            0
+QD2-139 ,  1.003241741,       0,       0,            0
+QD2-140 ,  1.004322322,       0,       0,            0
+QD2-141 ,  1.005402902,       0,       0,            0
+QD2-142 ,  0.999627411,       0,       0,            0
+QD2-143 ,  1.004245137,       0,       0,            0
+QD2-144 ,  1.007342967,       0,       0,            0
+QD2-145 ,  1.003562345,       0,       0,            0
+QD2-146 ,  1.001620871,       0,       0,            0
+QD2-147 ,  0.998842235,       0,       0,            0
+QD2-148 ,  1.000385922,       0,       0,            0
+QD2-149 ,  0.998070392,       0,       0,            0
+QD2-150 ,   1.00285582,       0,       0,            0
+QD2-151 ,  1.001312133,       0,       0,            0
+QD2-152 ,  1.001698055,       0,       0,            0
+QD2-153 ,  0.997375733,       0,       0,            0
+QD2-154 ,  1.001929608,       0,       0,            0
+QD2-155 ,  0.996449521,       0,       0,            0
+QD2-156 ,  0.997993208,       0,       0,            0
+QD2-157 ,  0.997607286,       0,       0,            0
+QD2-158 ,  0.999150973,       0,       0,            0
+QD2-159 ,  1.000385922,       0,       0,            0
+QD2-160 ,  0.999922816,       0,       0,            0
+QD2-161 ,  0.997916023,       0,       0,            0
+QD2-162 ,            1,       0,       0,            0
+QD2-163 ,  1.000771843,       0,       0,            0
+QD2-164 ,  1.003782031,       0,       0,            0
+QD2-165 ,  1.001698055,       0,       0,            0
+QD2-166 ,  1.000617475,       0,       0,            0
+QD2-167 ,  0.999382525,       0,       0,            0
+QD2-168 ,  0.997929989,       0,       0,            0
+QD2-169 ,  1.003022256,       0,       0,            0
+QD2-170 ,  0.996758259,       0,       0,            0
+QD2-171 ,  1.004642522,       0,       0,            0
+QD2-172 ,  1.001929608,       0,       0,            0
+QD2-173 ,  0.997775678,       0,       0,            0
+QD2-174 ,  0.998533498,       0,       0,            0
+QD2-175 ,  0.997532768,       0,       0,            0
+QD2-176 ,  1.000694659,       0,       0,            0
+QD2-177 ,  0.997684471,       0,       0,            0
+QD2-178 ,  1.002083977,       0,       0,            0
+QD2-179 ,  0.997684471,       0,       0,            0
+QD2-180 ,  1.001698055,       0,       0,            0
+QD2-181 ,  0.997452918,       0,       0,            0
+QD2-182 ,  1.002547082,       0,       0,            0
+QD2-183 ,  0.994442729,       0,       0,            0
+QD2-184 ,  1.002933004,       0,       0,            0
+QD2-185 ,  1.000321811,       0,       0,            0
+QD2-186 ,    1.0112779,       0,       0,            0
+QD2-187 ,  1.006108478,       0,       0,            0
+QD2-188 ,  0.998161456,       0,       0,            0
+QD2-189 ,  1.000244656,       0,       0,            0
+QD2-190 ,  1.000476122,       0,       0,            0
+QD2-191 ,  0.998855856,       0,       0,            0
+QD2-192 ,  0.998392922,       0,       0,            0
+QD2-193 ,  0.999704567,       0,       0,            0
+QD2-194 ,  0.996078255,       0,       0,            0
+QD2-195 ,  1.003392444,       0,       0,            0
+QD2-196 ,  1.000077101,       0,       0,            0
+QD2-197 ,    1.0001675,       0,       0,            0
+QD2-198 ,  0.996926967,       0,       0,            0
+QD2-199 ,  1.003099411,       0,       0,            0
+QD2-200 ,  0.997544211,       0,       0,            0
+QD2-201 ,  0.997235589,       0,       0,            0
+QD2-202 ,    0.9966955,       0,       0,            0
+QD2-203 ,  1.002636478,       0,       0,            0
+QD2-204 ,  0.998470078,       0,       0,            0
+QD2-205 ,  1.000013189,       0,       0,            0
+QD2-206 ,  1.000553278,       0,       0,            0
+QD2-207 ,  1.004719678,       0,       0,            0
+QD2-208 ,  0.997004122,       0,       0,            0
+QD2-209 ,  0.999858878,       0,       0,            0
+QD2-210 ,  0.995846789,       0,       0,            0
+QD2-211 ,  1.003330878,       0,       0,            0
+QD2-212 ,  1.008943716,       0,       0,            0
+QD2-213 ,  1.006725723,       0,       0,            0
+QD2-214 ,  0.999087322,       0,       0,            0
+QD2-215 ,  1.005568389,       0,       0,            0
+QD2-216 ,  1.007265811,       0,       0,            0
+QD2-217 ,  1.009426167,       0,       0,            0
+QD2-218 ,  0.999936033,       0,       0,            0
+QD2-219 ,  1.003870967,       0,       0,            0
+QD2-220 ,  1.004025278,       0,       0,            0
+QD2-221 ,    1.0001675,       0,       0,            0
+QD2-222 ,  1.001633456,       0,       0,            0
+QD2-223 ,  1.006339945,       0,       0,            0
+QD2-224 ,  1.000090345,       0,       0,            0
+QD2-225 ,  1.007574434,       0,       0,            0
+QD2-226 ,    1.0112779,       0,       0,            0
+QD2-227 ,  1.011200745,       0,       0,            0
+QD2-228 ,  1.002327856,       0,       0,            0
+QF4E-001,  1.000090345,       0,       0,            0
+QF4E-002,  0.998689283,       0,       0,            0
+QF4E-003,  1.001698055,       0,       0,            0
+QF4E-004,  1.001633456,       0,       0,            0
+QF4E-005,  0.996849811,       0,       0,            0
+QF4E-006,  1.003793811,       0,       0,            0
+QF4E-007,  1.000707589,       0,       0,            0
+QF4E-008,  1.004013584,       0,       0,            0
+QF4E-009,  1.000784745,       0,       0,            0
+QF4E-010,  1.004090769,       0,       0,            0
+QF4E-011,  0.999691263,       0,       0,            0
+QF4E-012,   0.99714418,       0,       0,            0
+QF4E-013,  1.004565367,       0,       0,            0
+QF4E-014,  1.000939056,       0,       0,            0
+QF4E-015,  1.002238345,       0,       0,            0
+QF4E-016,  0.999936033,       0,       0,            0
+QF4E-017,  0.997467056,       0,       0,            0
+QF4E-018,  1.000707589,       0,       0,            0
+QF4E-019,  0.999858878,       0,       0,            0
+QF4E-020,  1.002482167,       0,       0,            0
+QF4E-021,  1.000553278,       0,       0,            0
+QF4E-022,  1.002019233,       0,       0,            0
+QF4E-023,  0.997698522,       0,       0,            0
+QF4E-024,  1.000398967,       0,       0,            0
+QF4E-025,  1.005557271,       0,       0,            0
+QF4E-026,  1.000308737,       0,       0,            0
+QF4E-027,  1.005171349,       0,       0,            0
+QF4E-028,  0.998161456,       0,       0,            0
+QF4E-029,  1.004785428,       0,       0,            0
+QF4E-030,  1.000630433,       0,       0,            0
+QF4E-031,  1.000090345,       0,       0,            0
+QF4E-032,  0.999704567,       0,       0,            0
+QF4E-033,  1.002636478,       0,       0,            0
+QF4E-034,  1.007420123,       0,       0,            0
+QF4E-035,    0.9980843,       0,       0,            0
diff --git a/Parameters/QD2-QF4-QD5_strength.csv b/Parameters/QD2-QF4-QD5_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..6ee65c1ac10051f795d818205ffe21d16ef0fc55
--- /dev/null
+++ b/Parameters/QD2-QF4-QD5_strength.csv
@@ -0,0 +1,103 @@
+#Current   ,       Int.Grad. 
+#[A]       ,              [T]
+          0,                0
+         10,        1.5344273
+11.01010101,      1.680715587
+12.02020202,      1.827007776
+13.03030303,      1.973307772
+14.04040404,      2.119619478
+15.05050505,      2.265946797
+16.06060606,      2.412291425
+17.07070707,      2.558647463
+18.08080808,      2.705007376
+19.09090909,      2.851363629
+ 20.1010101,      2.997708688
+21.11111111,      3.144036412
+22.12121212,      3.290344791
+23.13131313,       3.43663258
+24.14141414,      3.582898535
+25.15151515,      3.729141416
+26.16161616,       3.87536206
+27.17171717,      4.021566648
+28.18181818,      4.167762209
+29.19191919,      4.313955769
+ 30.2020202,      4.460154343
+31.21212121,      4.606361877
+32.22222222,      4.752575486
+33.23232323,      4.898791356
+34.24242424,      5.045005674
+35.25252525,      5.191214622
+36.26262626,      5.337413784
+37.27272727,      5.483597583
+38.28282828,      5.629760306
+39.29292929,      5.775896242
+ 40.3030303,      5.921999679
+41.31313131,      6.068064943
+42.32323232,      6.214086418
+43.33333333,      6.360058494
+44.34343434,      6.505975561
+45.35353535,      6.651832154
+46.36363636,      6.797630411
+47.37373737,      6.943383754
+48.38383838,      7.089106516
+49.39393939,      7.234813029
+ 50.4040404,      7.380517037
+51.41414141,      7.526209349
+52.42424242,      7.671850983
+53.43434343,      7.817400967
+54.44444444,      7.962818328
+55.45454545,      8.108063155
+56.46464646,      8.253126863
+57.47474747,      8.398036557
+58.48484848,      8.542821284
+59.49494949,       8.68751009
+60.50505051,      8.832130415
+61.51515152,       8.97667274
+62.52525253,      9.121090587
+63.53535354,      9.265335872
+64.54545455,       9.40936051
+65.55555556,      9.553115717
+66.56565657,      9.696539842
+67.57575758,      9.839559945
+68.58585859,      9.982102699
+ 69.5959596,      10.12409478
+70.60606061,      10.26546199
+71.61616162,      10.40611704
+72.62626263,      10.54596258
+73.63636364,      10.68490099
+74.64646465,      10.82283465
+75.65656566,      10.95965535
+76.66666667,      11.09512379
+77.67676768,      11.22891228
+78.68686869,       11.3606915
+ 79.6969697,      11.49013209
+80.70707071,      11.61689792
+81.71717172,       11.7405827
+82.72727273,      11.86073871
+83.73737374,      11.97691773
+84.74747475,      12.08867152
+85.75757576,      12.19558747
+86.76767677,      12.29756288
+87.77777778,      12.39465464
+88.78787879,      12.48692099
+ 89.7979798,      12.57442012
+90.80808081,      12.65722858
+91.81818182,      12.73555837
+92.82828283,      12.80968223
+93.83838384,      12.87987315
+94.84848485,      12.94640414
+95.85858586,      13.00954739
+96.86868687,      13.06956985
+97.87878788,      13.12673645
+98.88888889,      13.18131211
+ 99.8989899,      13.23356177
+100.9090909,      13.28372212
+101.9191919,      13.33187732
+102.9292929,      13.37806014
+103.9393939,      13.42230334
+104.9494949,      13.46463965
+ 105.959596,      13.50515121
+ 106.969697,      13.54414964
+ 107.979798,      13.58201323
+ 108.989899,      13.61912026
+        110,        13.655849
diff --git a/Parameters/QD3_params.csv b/Parameters/QD3_params.csv
new file mode 100644
index 0000000000000000000000000000000000000000..166cdd95fa9c304de36c51e3bd3f3bdde5819d11
--- /dev/null
+++ b/Parameters/QD3_params.csv
@@ -0,0 +1,66 @@
+#S_N   ,        SCALE,  OFFSET,  RADIUS, PSCURROFFSET
+#      ,          [1],     [T],    [mm],          [A]
+QD3-001,            1,       0,       0,            0
+QD3-002,      1.00212,       0,       0,            0
+QD3-003,     0.999579,       0,       0,            0
+QD3-004,      1.00731,       0,       0,            0
+QD3-005,      1.00593,       0,       0,            0
+QD3-006,      1.00455,       0,       0,            0
+QD3-007,       1.0036,       0,       0,            0
+QD3-008,      1.00384,       0,       0,            0
+QD3-009,      1.00402,       0,       0,            0
+QD3-010,      1.00056,       0,       0,            0
+QD3-011,      1.00255,       0,       0,            0
+QD3-012,      1.00538,       0,       0,            0
+QD3-013,      1.00442,       0,       0,            0
+QD3-014,      1.00408,       0,       0,            0
+QD3-015,      1.01143,       0,       0,            0
+QD3-016,      1.00366,       0,       0,            0
+QD3-017,      1.00339,       0,       0,            0
+QD3-018,      1.00322,       0,       0,            0
+QD3-019,  1.000908096,       0,       0,            0
+QD3-020,      1.00013,       0,       0,            0
+QD3-021,       1.0006,       0,       0,            0
+QD3-022,       1.0032,       0,       0,            0
+QD3-023,      1.00408,       0,       0,            0
+QD3-024,      1.00109,       0,       0,            0
+QD3-025,      1.00034,       0,       0,            0
+QD3-026,      1.00346,       0,       0,            0
+QD3-027,      1.00363,       0,       0,            0
+QD3-028,       1.0011,       0,       0,            0
+QD3-029,      1.00331,       0,       0,            0
+QD3-030,      1.00157,       0,       0,            0
+QD3-031,      1.00365,       0,       0,            0
+QD3-032,     0.999716,       0,       0,            0
+QD3-033,      1.00271,       0,       0,            0
+QD3-034,      1.00261,       0,       0,            0
+QD3-035,      1.00037,       0,       0,            0
+QD3-036,      1.00291,       0,       0,            0
+QD3-037,      1.00205,       0,       0,            0
+QD3-038,      1.00297,       0,       0,            0
+QD3-039,      1.00468,       0,       0,            0
+QD3-040,      1.00107,       0,       0,            0
+QD3-041,      1.00624,       0,       0,            0
+QD3-042,      1.00375,       0,       0,            0
+QD3-043,      1.00281,       0,       0,            0
+QD3-044,      1.00549,       0,       0,            0
+QD3-045,      1.00486,       0,       0,            0
+QD3-046,     0.999459,       0,       0,            0
+QD3-047,  1.000787746,       0,       0,            0
+QD3-048,      1.00243,       0,       0,            0
+QD3-049,      1.00166,       0,       0,            0
+QD3-050,      1.00363,       0,       0,            0
+QD3-051,      1.00433,       0,       0,            0
+QD3-052,        1.003,       0,       0,            0
+QD3-053,      1.00977,       0,       0,            0
+QD3-054,      1.00507,       0,       0,            0
+QD3-055,      1.00406,       0,       0,            0
+QD3-056,      1.01083,       0,       0,            0
+QD3-057,      1.01017,       0,       0,            0
+QD3-058,      1.00659,       0,       0,            0
+QD3-059,      1.00574,       0,       0,            0
+QD3-060,      1.01025,       0,       0,            0
+QD3-061,      1.00795,       0,       0,            0
+QD3-062,      1.00871,       0,       0,            0
+QD3-063,      0.99965,       0,       0,            0
+QD3-064,       1.0107,       0,       0,            0
diff --git a/Parameters/QD3_strength.csv b/Parameters/QD3_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..f8e9e24560121bca360115a8f8aefbbe01c638b0
--- /dev/null
+++ b/Parameters/QD3_strength.csv
@@ -0,0 +1,103 @@
+#Current   ,   Int.Grad. 
+#[A]       ,         [T]
+          0,           0
+	 10,   1.1977514
+11.01010101, 1.312614258
+12.02020202, 1.427472632
+13.03030303, 1.542322038
+14.04040404,  1.65715799
+15.05050505, 1.771976006
+16.06060606, 1.886773676
+17.07070707, 2.001555743
+18.08080808, 2.116328485
+19.09090909, 2.231098184
+ 20.1010101, 2.345871115
+21.11111111, 2.460650076
+22.12121212, 2.575427518
+23.13131313, 2.690193983
+24.14141414, 2.804940011
+25.15151515, 2.919656154
+26.16161616, 3.034338475
+27.17171717, 3.148997198
+28.18181818, 3.263644789
+29.19191919, 3.378293717
+ 30.2020202,  3.49295642
+31.21212121, 3.607639055
+32.22222222, 3.722333768
+33.23232323, 3.837030809
+34.24242424, 3.951720425
+35.25252525, 4.066392885
+36.26262626, 4.181040596
+37.27272727, 4.295660128
+38.28282828, 4.410248528
+39.29292929, 4.524802842
+ 40.3030303, 4.639320081
+41.31313131, 4.753794393
+42.32323232, 4.868215077
+43.33333333, 4.982570963
+44.34343434, 5.096850882
+45.35353535, 5.211043857
+46.36363636, 5.325149332
+47.37373737, 5.439182193
+48.38383838, 5.553158577
+49.39393939, 5.667094622
+ 50.4040404, 5.781005988
+51.41414141, 5.894889749
+52.42424242,  6.00871884
+53.43434343, 6.122464583
+54.44444444, 6.236098299
+55.45454545, 6.349591557
+56.46464646, 6.462923259
+57.47474747, 6.576080656
+58.48484848, 6.689051457
+59.49494949, 6.801823369
+60.50505051, 6.914383797
+61.51515152, 7.026713217
+62.52525253, 7.138785171
+63.53535354, 7.250572902
+64.54545455,  7.36204965
+65.55555556, 7.473186995
+66.56565657, 7.583925915
+67.57575758,  7.69418054
+68.58585859, 7.803864086
+ 69.5959596, 7.912889768
+70.60606061,  8.02116953
+71.61616162, 8.128596256
+72.62626263, 8.235048156
+73.63636364, 8.340403066
+74.64646465,  8.44453882
+75.65656566, 8.547322279
+76.66666667, 8.648484702
+77.67676768, 8.747665889
+78.68686869, 8.844503926
+ 79.6969697, 8.938636901
+80.70707071, 9.029707767
+81.71717172, 9.117409723
+82.72727273,  9.20146561
+83.73737374, 9.281598651
+84.74747475, 9.357532071
+85.75757576, 9.429031495
+86.76767677,  9.49623161
+87.77777778, 9.559457127
+88.78787879, 9.619034329
+ 89.7979798, 9.675289497
+90.80808081, 9.728541328
+91.81818182, 9.779052439
+92.82828283, 9.827060319
+93.83838384, 9.872802336
+94.84848485, 9.916515857
+95.85858586, 9.958422656
+96.86868687, 9.998646104
+97.87878788, 10.03727129
+98.88888889, 10.07438323
+ 99.8989899, 10.11006691
+100.9090909,  10.1444033
+101.9191919, 10.17745135
+102.9292929, 10.20926264
+103.9393939, 10.23988873
+104.9494949, 10.26938121
+ 105.959596, 10.29781542
+ 106.969697, 10.32537733
+ 107.979798, 10.35228502
+ 108.989899, 10.37875655
+        110,    10.40501
diff --git a/Parameters/QF1IJ_params.csv b/Parameters/QF1IJ_params.csv
new file mode 100644
index 0000000000000000000000000000000000000000..7c861a6beb2290763143d502a17a3c1c99e42806
--- /dev/null
+++ b/Parameters/QF1IJ_params.csv
@@ -0,0 +1,4 @@
+#S_N     ,  SCALE,  OFFSET,  RADIUS, PSCURROFFSET
+#        ,    [1],     [T],    [mm],          [A]
+QFI-00001,      1,       0,       0,            0
+QFI-00002,      1,       0,       0,            0
diff --git a/Parameters/QF1IJ_strength.csv b/Parameters/QF1IJ_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..713ac2403ded4bbb3d2396937d917212e50f9838
--- /dev/null
+++ b/Parameters/QF1IJ_strength.csv
@@ -0,0 +1,103 @@
+#Current   ,   Int.Grad. 
+#[A]       ,         [T]
+          0,           0
+	 10, 0.735983333
+11.51515152, 0.843530539
+13.03030303, 0.951074081
+14.54545455, 1.058610294
+16.06060606, 1.166135513
+17.57575758, 1.273646073
+19.09090909,  1.38113831
+20.60606061, 1.488608601
+22.12121212, 1.596054941
+23.63636364, 1.703477424
+25.15151515, 1.810876287
+26.66666667, 1.918251766
+28.18181818, 2.025604095
+ 29.6969697, 2.132933512
+31.21212121, 2.240240067
+32.72727273, 2.347522437
+34.24242424, 2.454778686
+35.75757576, 2.562006873
+37.27272727, 2.669205059
+38.78787879, 2.776371305
+ 40.3030303, 2.883503668
+41.81818182, 2.990599894
+43.33333333, 3.097657026
+44.84848485, 3.204672015
+46.36363636, 3.311641809
+47.87878788, 3.418563358
+49.39393939, 3.525433612
+50.90909091,  3.63224962
+52.42424242, 3.739009936
+53.93939394, 3.845714273
+55.45454545, 3.952362373
+56.96969697, 4.058953977
+58.48484848, 4.165488828
+         60, 4.271966667
+61.51515152, 4.378386174
+63.03030303, 4.484741781
+64.54545455, 4.591026858
+66.06060606, 4.697234774
+67.57575758,   4.8033589
+69.09090909, 4.909392605
+70.60606061, 5.015329288
+72.12121212,  5.12116351
+73.63636364, 5.226891341
+75.15151515, 5.332508951
+76.66666667, 5.438012509
+78.18181818, 5.543398185
+ 79.6969697,  5.64866215
+81.21212121, 5.753797964
+82.72727273, 5.858779911
+84.24242424, 5.963573633
+85.75757576, 6.068144734
+87.27272727, 6.172458813
+88.78787879, 6.276481475
+ 90.3030303, 6.380178365
+91.81818182, 6.483524714
+93.33333333, 6.586517138
+94.84848485, 6.689155142
+96.36363636, 6.791438235
+97.87878788, 6.893365922
+99.39393939, 6.994937713
+100.9090909, 7.096144422
+102.4242424, 7.196846832
+103.9393939, 7.296805621
+105.4545455, 7.395778895
+ 106.969697, 7.493524758
+108.4848485, 7.589801314
+        110, 7.684366667
+111.5151515, 7.776989393
+ 113.030303,  7.86747995
+114.5454545, 7.955659266
+116.0606061,  8.04134827
+117.5757576,  8.12436789
+119.0909091, 8.204539054
+120.6060606, 8.281687513
+122.1212121, 8.355826457
+123.6363636, 8.427212567
+125.1515152, 8.496118799
+126.6666667, 8.562818107
+128.1818182, 8.627583446
+129.6969697,  8.69068777
+131.2121212,  8.75238341
+132.7272727, 8.812770272
+134.2424242, 8.871879944
+135.7575758, 8.929743691
+137.2727273, 8.986392779
+138.7878788, 9.041858475
+140.3030303, 9.096172003
+141.8181818, 9.149355719
+143.3333333, 9.201412202
+144.8484848, 9.252341352
+146.3636364, 9.302143069
+147.8787879, 9.350817253
+149.3939394, 9.398363805
+150.9090909, 9.444788781
+152.4242424, 9.490190334
+153.9393939, 9.534737514
+155.4545455, 9.578601196
+ 156.969697, 9.621952255
+158.4848485, 9.664961565
+        160,      9.7078
diff --git a/Parameters/QF1_params.csv b/Parameters/QF1_params.csv
new file mode 100644
index 0000000000000000000000000000000000000000..ae8f3be41645302843627de983b8d898fd2cc032
--- /dev/null
+++ b/Parameters/QF1_params.csv
@@ -0,0 +1,68 @@
+#S_N   ,        SCALE,  OFFSET,  RADIUS, PSCURROFFSET
+#      ,          [1],     [T],    [mm],          [A]
+QF1-001,     0.994635,       0,       0,            0
+QF1-002,     0.995946,       0,       0,            0
+QF1-003,     0.998005,       0,       0,            0
+QF1-004,      1.00093,       0,       0,            0
+QF1-005,      1.00095,       0,       0,            0
+QF1-006,      1.00262,       0,       0,            0
+QF1-007,      1.00232,       0,       0,            0
+QF1-008,     0.997615,       0,       0,            0
+QF1-009,     0.997707,       0,       0,            0
+QF1-010,     0.998303,       0,       0,            0
+QF1-011,      1.00232,       0,       0,            0
+QF1-012,     0.995052,       0,       0,            0
+QF1-013,     0.998748,       0,       0,            0
+QF1-014,     0.998033,       0,       0,            0
+QF1-015,     0.996753,       0,       0,            0
+QF1-016,  0.998030791,       0,       0,            0
+QF1-017,     0.997794,       0,       0,            0
+QF1-018,     0.996662,       0,       0,            0
+QF1-019,  0.996180929,       0,       0,            0
+QF1-020,     0.998212,       0,       0,            0
+QF1-021,     0.994098,       0,       0,            0
+QF1-022,     0.992906,       0,       0,            0
+QF1-023,     0.998748,       0,       0,            0
+QF1-024,     0.999523,       0,       0,            0
+QF1-025,      1.00268,       0,       0,            0
+QF1-026,      1.00203,       0,       0,            0
+QF1-027,      1.00206,       0,       0,            0
+QF1-028,       1.0025,       0,       0,            0
+QF1-029,      1.00232,       0,       0,            0
+QF1-030,      1.00334,       0,       0,            0
+QF1-031,      1.00203,       0,       0,            0
+QF1-032,      1.00248,       0,       0,            0
+QF1-033,      1.00319,       0,       0,            0
+QF1-034,      1.00054,       0,       0,            0
+QF1-035,     0.999702,       0,       0,            0
+QF1-036,     0.996841,       0,       0,            0
+QF1-037,     0.998271,       0,       0,            0
+QF1-038,      1.00042,       0,       0,            0
+QF1-039,     0.999285,       0,       0,            0
+QF1-040,     0.999642,       0,       0,            0
+QF1-041,     0.998152,       0,       0,            0
+QF1-042,     0.999523,       0,       0,            0
+QF1-043,     0.999225,       0,       0,            0
+QF1-044,     0.999463,       0,       0,            0
+QF1-045,            1,       0,       0,            0
+QF1-046,     0.999854,       0,       0,            0
+QF1-047,       1.0003,       0,       0,            0
+QF1-048,     0.998212,       0,       0,            0
+QF1-049,      0.99884,       0,       0,            0
+QF1-050,      1.00152,       0,       0,            0
+QF1-051,       1.0037,       0,       0,            0
+QF1-052,     0.998124,       0,       0,            0
+QF1-053,      1.00191,       0,       0,            0
+QF1-054,      1.00471,       0,       0,            0
+QF1-055,      1.00504,       0,       0,            0
+QF1-056,      1.00337,       0,       0,            0
+QF1-057,       1.0079,       0,       0,            0
+QF1-058,      1.00182,       0,       0,            0
+QF1-059,       1.0017,       0,       0,            0
+QF1-060,      1.00393,       0,       0,            0
+QF1-061,       1.0023,       0,       0,            0
+QF1-062,            1,       0,       0,            0
+QF1-063,      1.00403,       0,       0,            0
+QF1-064,      1.00376,       0,       0,            0
+QF1-065,      1.00155,       0,       0,            0
+QF1-066,      0.99845,       0,       0,            0
diff --git a/Parameters/QF1_strength.csv b/Parameters/QF1_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..4ebb3900bcf85bf13619497ead6ae19c2d853061
--- /dev/null
+++ b/Parameters/QF1_strength.csv
@@ -0,0 +1,103 @@
+#Current   ,      Int.Grad. 
+#[A]       ,            [T]
+          0,              0
+         10,      2.0970197
+11.01010101,    2.297465587
+12.02020202,    2.497915516
+13.03030303,    2.698373526
+14.04040404,    2.898843661
+15.05050505,    3.099329961
+16.06060606,    3.299833932
+17.07070707,    3.500348352
+18.08080808,     3.70086412
+19.09090909,    3.901372136
+ 20.1010101,      4.1018633
+21.11111111,    4.302330326
+22.12121212,    4.502771317
+23.13131313,     4.70318537
+24.14141414,    4.903571582
+25.15151515,    5.103929061
+26.16161616,     5.30426057
+27.17171717,    5.504578277
+28.18181818,    5.704895843
+29.19191919,    5.905226924
+ 30.2020202,    6.105585116
+31.21212121,    6.305970273
+32.22222222,    6.506351592
+33.23232323,    6.706694124
+34.24242424,    6.906962918
+35.25252525,    7.107123235
+36.26262626,    7.307165539
+37.27272727,    7.507129258
+38.28282828,     7.70705944
+39.29292929,    7.907001137
+ 40.3030303,    8.106998973
+41.31313131,    8.307064641
+42.32323232,    8.507154017
+43.33333333,    8.707217565
+44.34343434,    8.907205753
+45.35353535,    9.107069553
+46.36363636,    9.306786923
+47.37373737,    9.506375833
+48.38383838,    9.705857492
+49.39393939,    9.905253108
+ 50.4040404,    10.10458349
+51.41414141,    10.30385385
+52.42424242,    10.50304916
+53.43434343,    10.70215303
+54.44444444,    10.90114908
+55.45454545,    11.10002054
+56.46464646,     11.2987401
+57.47474747,    11.49726834
+58.48484848,    11.69556519
+59.49494949,    11.89359061
+60.50505051,    12.09130538
+61.51515152,    12.28869029
+62.52525253,    12.48574609
+63.53535354,    12.68247439
+64.54545455,     12.8788768
+65.55555556,    13.07495227
+66.56565657,    13.27065053
+67.57575758,    13.46587812
+68.58585859,    13.66054012
+ 69.5959596,    13.85454161
+70.60606061,    14.04778558
+71.61616162,    14.24014379
+72.62626263,    14.43146399
+73.63636364,    14.62159329
+74.64646465,    14.81037882
+75.65656566,    14.99766542
+76.66666667,    15.18326973
+77.67676768,    15.36698943
+78.68686869,     15.5486218
+ 79.6969697,    15.72796415
+80.70707071,    15.90480056
+81.71717172,    16.07877865
+82.72727273,    16.24946554
+83.73737374,     16.4164273
+84.74747475,    16.57923002
+85.75757576,    16.73746097
+86.76767677,    16.89089196
+87.77777778,    17.03938981
+88.78787879,    17.18282213
+ 89.7979798,    17.32105652
+90.80808081,     17.4539818
+91.81818182,    17.58164348
+92.82828283,    17.70415732
+93.83838384,    17.82163941
+94.84848485,    17.93420584
+95.85858586,    18.04196937
+96.86868687,    18.14502185
+97.87878788,    18.24344699
+98.88888889,    18.33732845
+ 99.8989899,    18.42674993
+100.9090909,    18.51179774
+101.9191919,    18.59257245
+102.9292929,    18.66917941
+103.9393939,    18.74172401
+104.9494949,     18.8103116
+ 105.959596,    18.87514354
+ 106.969697,    18.93686731
+ 107.979798,    18.99625995
+ 108.989899,    19.05409849
+        110,       19.11116
diff --git a/Parameters/QF6_params.csv b/Parameters/QF6_params.csv
new file mode 100644
index 0000000000000000000000000000000000000000..b4061f8e4fccede65c88f4f699c4200185a4562e
--- /dev/null
+++ b/Parameters/QF6_params.csv
@@ -0,0 +1,68 @@
+#S_N     ,        SCALE,  OFFSET,  RADIUS, PSCURROFFSET
+#        ,          [1],     [T],    [mm],          [A]
+QF6-16059,            1,       0,       0,            0
+QF6-16060,     0.999527,       0,       0,            0
+QF6-16418,     0.998776,       0,       0,            0
+QF6-16419,  0.998061799,       0,       0,            0
+QF6-16420,   0.99906851,       0,       0,            0
+QF6-16421,  0.999351953,       0,       0,            0
+QF6-16422,  1.000358665,       0,       0,            0
+QF6-16423,     0.997441,       0,       0,            0
+QF6-16424,      1.00064,       0,       0,            0
+QF6-16425,  0.997524234,       0,       0,            0
+QF6-16426,  0.997074635,       0,       0,            0
+QF6-16427,  0.998511398,       0,       0,            0
+QF6-16428,  0.997103956,       0,       0,            0
+QF6-16429,  0.997885868,       0,       0,            0
+QF6-16430,  0.997944512,       0,       0,            0
+QF6-16431,     0.996718,       0,       0,            0
+QF6-16432,  0.997719712,       0,       0,            0
+QF6-16433,  0.998394111,       0,       0,            0
+QF6-16434,   0.99813999,       0,       0,            0
+QF6-16435,  0.998306146,       0,       0,            0
+QF6-16436,  0.998482076,       0,       0,            0
+QF6-16437,  0.998902354,       0,       0,            0
+QF6-16438,  0.998677554,       0,       0,            0
+QF6-16439,  0.998960997,       0,       0,            0
+QF6-16440,     0.999026,       0,       0,            0
+QF6-16441,     0.998442,       0,       0,            0
+QF6-16442,     0.999444,       0,       0,            0
+QF6-16443,     0.998581,       0,       0,            0
+QF6-16444,  0.999236425,       0,       0,            0
+QF6-16445,  0.999349548,       0,       0,            0
+QF6-16446,     0.998748,       0,       0,            0
+QF6-16447,     0.999638,       0,       0,            0
+QF6-16448,  0.999321267,       0,       0,            0
+QF6-16449,     0.999082,       0,       0,            0
+QF6-16450,     0.999666,       0,       0,            0
+QF6-16451,     0.998415,       0,       0,            0
+QF6-16452,  1.000735294,       0,       0,            0
+QF6-16453,     0.999889,       0,       0,            0
+QF6-16454,       1.0005,       0,       0,            0
+QF6-16455,      1.00033,       0,       0,            0
+QF6-16456,     0.996301,       0,       0,            0
+QF6-16457,     0.999166,       0,       0,            0
+QF6-16458,     0.999805,       0,       0,            0
+QF6-16459,     0.996746,       0,       0,            0
+QF6-16460,     0.997024,       0,       0,            0
+QF6-16461,     0.996996,       0,       0,            0
+QF6-16462,     0.997886,       0,       0,            0
+QF6-16463,     0.996606,       0,       0,            0
+QF6-16464,     0.995271,       0,       0,            0
+QF6-16465,     0.996885,       0,       0,            0
+QF6-16466,     0.996551,       0,       0,            0
+QF6-16467,     0.996996,       0,       0,            0
+QF6-16468,     0.998109,       0,       0,            0
+QF6-16469,  0.999048962,       0,       0,            0
+QF6-16470,     0.997942,       0,       0,            0
+QF6-16471,     0.997413,       0,       0,            0
+QF6-16472,     0.996996,       0,       0,            0
+QF6-16473,     0.997274,       0,       0,            0
+QF6-16474,     0.997191,       0,       0,            0
+QF6-16475,     0.998526,       0,       0,            0
+QF6-16476,      0.99669,       0,       0,            0
+QF6-16477,     0.997246,       0,       0,            0
+QF6-16478,     0.996523,       0,       0,            0
+QF6-16479,     0.997024,       0,       0,            0
+QF6-16480,      0.99911,       0,       0,            0
+QF6-16481,     0.998554,       0,       0,            0
diff --git a/Parameters/QF6_strength.csv b/Parameters/QF6_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..4410447bb05b617a04900aa00ccc5cd4a790ee7f
--- /dev/null
+++ b/Parameters/QF6_strength.csv
@@ -0,0 +1,103 @@
+#Current   ,   Int.Grad. 
+#[A]       ,         [T]
+          0,           0
+	 10,   4.8381057
+11.01010101, 5.309790224
+12.02020202, 5.781444181
+13.03030303, 6.253037002
+14.04040404,  6.72453812
+15.05050505, 7.195916967
+16.06060606, 7.667150484
+17.07070707, 8.138241462
+18.08080808, 8.609198255
+19.09090909, 9.080029216
+ 20.1010101,   9.5507427
+21.11111111, 10.02134783
+22.12121212, 10.49185598
+23.13131313, 10.96227898
+24.14141414, 11.43262864
+25.15151515, 11.90291672
+26.16161616, 12.37313684
+27.17171717, 12.84323594
+28.18181818, 13.31315356
+29.19191919, 13.78282926
+ 30.2020202, 14.25220272
+31.21212121,  14.7212447
+32.22222222, 15.18999532
+33.23232323, 15.65850402
+34.24242424, 16.12682031
+35.25252525, 16.59499334
+36.26262626, 17.06303632
+37.27272727, 17.53089254
+38.28282828, 17.99849728
+39.29292929, 18.46578582
+ 40.3030303, 18.93269377
+41.31313131, 19.39918272
+42.32323232, 19.86525832
+43.33333333, 20.33093051
+44.34343434, 20.79620918
+45.35353535, 21.26110358
+46.36363636, 21.72558595
+47.37373737, 22.18957373
+48.38383838, 22.65297993
+49.39393939, 23.11571754
+ 50.4040404, 23.57770039
+51.41414141, 24.03887417
+52.42424242, 24.49922597
+53.43434343, 24.95874566
+54.44444444,  25.4174231
+55.45454545, 25.87522826
+56.46464646, 26.33154575
+57.47474747,  26.7850931
+58.48484848,  27.2345516
+59.49494949,  27.6786025
+60.50505051, 28.11592527
+61.51515152, 28.54515768
+62.52525253, 28.96489584
+63.53535354, 29.37373405
+64.54545455,  29.7702666
+65.55555556, 30.15310646
+66.56565657, 30.52120955
+67.57575758, 30.87383285
+68.58585859, 31.21024353
+ 69.5959596, 31.52970877
+70.60606061, 31.83155581
+71.61616162, 32.11601021
+72.62626263, 32.38398911
+73.63636364, 32.63642744
+74.64646465, 32.87426012
+75.65656566, 33.09843152
+76.66666667, 33.31000256
+77.67676768, 33.51011278
+78.68686869, 33.69990319
+ 79.6969697,  33.8805148
+80.70707071, 34.05306116
+81.71717172, 34.21837218
+82.72727273, 34.37711048
+83.73737374, 34.52993649
+84.74747475, 34.67751066
+85.75757576, 34.82045497
+86.76767677, 34.95905659
+87.77777778, 35.09343031
+88.78787879, 35.22368951
+ 89.7979798, 35.34994755
+90.80808081, 35.47232532
+91.81818182, 35.59099919
+92.82828283, 35.70617041
+93.83838384, 35.81804036
+94.84848485, 35.92681041
+95.85858586, 36.03267776
+96.86868687, 36.13581324
+97.87878788, 36.23637744
+98.88888889, 36.33453092
+ 99.8989899, 36.43043424
+100.9090909, 36.52421516
+101.9191919,  36.6158239
+102.9292929, 36.70515097
+103.9393939,  36.7920868
+104.9494949, 36.87652186
+ 105.959596, 36.95843775
+ 106.969697, 37.03823987
+ 107.979798, 37.11645666
+ 108.989899, 37.19361655
+        110,   37.270248
diff --git a/Parameters/QF8_params.csv b/Parameters/QF8_params.csv
new file mode 100644
index 0000000000000000000000000000000000000000..8e97d6f3defc1941fefd5afaf61fb4c7e2d1844e
--- /dev/null
+++ b/Parameters/QF8_params.csv
@@ -0,0 +1,67 @@
+#S_N     ,        SCALE,  OFFSET,  RADIUS, PSCURROFFSET
+#        ,          [1],     [T],    [mm],          [A]
+QF8-16061,            1,       0,       0,            0
+QF8-16354,   1.00241145,       0,       0,            0
+QF8-16355,     0.998327,       0,       0,            0
+QF8-16356,      1.00109,       0,       0,            0
+QF8-16357,  1.001670525,       0,       0,            0
+QF8-16358,     0.999073,       0,       0,            0
+QF8-16359,    1.0006092,       0,       0,            0
+QF8-16360,    1.0016505,       0,       0,            0
+QF8-16361,  1.001510325,       0,       0,            0
+QF8-16362,      1.00199,       0,       0,            0
+QF8-16363,  1.001400188,       0,       0,            0
+QF8-16364,  1.000948624,       0,       0,            0
+QF8-16365,      1.00167,       0,       0,            0
+QF8-16366,  1.001560388,       0,       0,            0
+QF8-16367,  1.001560388,       0,       0,            0
+QF8-16368,  1.001310075,       0,       0,            0
+QF8-16369,     0.998372,       0,       0,            0
+QF8-16370,  0.997763648,       0,       0,            0
+QF8-16371,  0.997312084,       0,       0,            0
+QF8-16372,   0.99947979,       0,       0,            0
+QF8-16373,  0.998373409,       0,       0,            0
+QF8-16374,     0.997649,       0,       0,            0
+QF8-16375,  0.998034986,       0,       0,            0
+QF8-16376,  0.997724687,       0,       0,            0
+QF8-16377,     0.999367,       0,       0,            0
+QF8-16378,  0.998418465,       0,       0,            0
+QF8-16379,  0.997424224,       0,       0,            0
+QF8-16380,     0.997513,       0,       0,            0
+QF8-16381,  0.997627478,       0,       0,            0
+QF8-16382,  0.997650506,       0,       0,            0
+QF8-16383,  0.996927604,       0,       0,            0
+QF8-16384,   0.99722097,       0,       0,            0
+QF8-16385,   0.99835038,       0,       0,            0
+QF8-16386,     0.997423,       0,       0,            0
+QF8-16387,      0.99887,       0,       0,            0
+QF8-16388,     0.995795,       0,       0,            0
+QF8-16389,      0.99896,       0,       0,            0
+QF8-16390,     0.997038,       0,       0,            0
+QF8-16391,     0.996925,       0,       0,            0
+QF8-16392,     0.996473,       0,       0,            0
+QF8-16393,  0.997469819,       0,       0,            0
+QF8-16394,     0.997287,       0,       0,            0
+QF8-16395,     0.998124,       0,       0,            0
+QF8-16396,      0.99844,       0,       0,            0
+QF8-16397,     0.998531,       0,       0,            0
+QF8-16398,     0.998779,       0,       0,            0
+QF8-16399,     0.998463,       0,       0,            0
+QF8-16400,      0.99887,       0,       0,            0
+QF8-16401,      0.99948,       0,       0,            0
+QF8-16402,     0.999186,       0,       0,            0
+QF8-16403,     0.999887,       0,       0,            0
+QF8-16404,     0.999164,       0,       0,            0
+QF8-16405,     0.998395,       0,       0,            0
+QF8-16406,     0.998078,       0,       0,            0
+QF8-16407,      0.99792,       0,       0,            0
+QF8-16408,     0.999729,       0,       0,            0
+QF8-16409,     0.997649,       0,       0,            0
+QF8-16410,     0.998372,       0,       0,            0
+QF8-16411,     0.998553,       0,       0,            0
+QF8-16412,     0.998146,       0,       0,            0
+QF8-16413,     0.998553,       0,       0,            0
+QF8-16414,     0.998463,       0,       0,            0
+QF8-16415,     0.998598,       0,       0,            0
+QF8-16416,     0.997965,       0,       0,            0
+QF8-16417,     0.998011,       0,       0,            0
diff --git a/Parameters/QF8_strength.csv b/Parameters/QF8_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..f41677feb40af97eb6e4b95bf2e717420d45a55e
--- /dev/null
+++ b/Parameters/QF8_strength.csv
@@ -0,0 +1,103 @@
+#Current   ,   Int.Grad. 
+#[A]       ,         [T]
+          0,           0
+         10,   5.9291105
+11.01010101, 6.506950791
+12.02020202, 7.084739005
+13.03030303, 7.662423067
+14.04040404, 8.239950899
+15.05050505, 8.817270428
+16.06060606, 9.394354158
+17.07070707, 9.971259251
+18.08080808, 10.54806108
+19.09090909, 11.12483501
+ 20.1010101, 11.70165639
+21.11111111, 12.27855902
+22.12121212, 12.85545323
+23.13131313, 13.43222656
+24.14141414, 14.00876652
+25.15151515, 14.58496076
+26.16161616,  15.1607472
+27.17171717, 15.73619305
+28.18181818, 16.31138601
+29.19191919, 16.88641378
+ 30.2020202, 17.46136385
+31.21212121, 18.03627676
+32.22222222,  18.6110884
+33.23232323, 19.18572047
+34.24242424, 19.76009467
+35.25252525,  20.3341329
+36.26262626, 20.90777934
+37.27272727,  21.4810215
+38.28282828, 22.05385184
+39.29292929, 22.62626284
+ 40.3030303, 23.19824746
+41.31313131, 23.76983684
+42.32323232, 24.34112677
+43.33333333, 24.91221932
+44.34343434, 25.48321656
+45.35353535, 26.05421782
+46.36363636, 26.62517677
+47.37373737, 27.19583103
+48.38383838, 27.76590076
+49.39393939, 28.33510611
+ 50.4040404, 28.90317146
+51.41414141, 29.46998525
+52.42424242, 30.03564909
+53.43434343, 30.60027879
+54.44444444, 31.16399019
+55.45454545, 31.72687839
+56.46464646,  32.2884279
+57.47474747, 32.84742754
+58.48484848, 33.40262824
+59.49494949, 33.95278096
+60.50505051, 34.49662338
+61.51515152, 35.03258776
+62.52525253, 35.55880101
+63.53535354, 36.07337672
+64.54545455, 36.57442849
+65.55555556, 37.06011437
+66.56565657, 37.52940923
+67.57575758, 37.98200479
+68.58585859, 38.41761713
+ 69.5959596, 38.83596232
+70.60606061, 39.23674846
+71.61616162, 39.61956407
+72.62626263, 39.98390568
+73.63636364, 40.32926743
+74.64646465, 40.65514349
+75.65656566, 40.96113797
+76.66666667, 41.24821392
+77.67676768, 41.51825096
+78.68686869, 41.77314587
+ 79.6969697, 42.01479541
+80.70707071, 42.24503083
+81.71717172,  42.4650067
+82.72727273, 42.67547839
+83.73737374, 42.87719614
+84.74747475, 43.07091016
+85.75757576, 43.25735049
+86.76767677, 43.43707147
+87.77777778, 43.61053696
+88.78787879, 43.77821009
+ 89.7979798, 43.94055398
+90.80808081, 44.09801076
+91.81818182, 44.25086751
+92.82828283,  44.3993418
+93.83838384, 44.54365085
+94.84848485, 44.68401192
+95.85858586, 44.82063097
+96.86868687, 44.95364277
+97.87878788, 45.08315441
+98.88888889, 45.20927294
+ 99.8989899, 45.33210537
+100.9090909, 45.45174721
+101.9191919, 45.56823155
+102.9292929, 45.68157049
+103.9393939, 45.79177611
+104.9494949,  45.8988605
+ 105.959596, 46.00292373
+ 106.969697, 46.10447502
+ 107.979798, 46.20414233
+ 108.989899, 46.30255366
+        110,   46.400337
diff --git a/Parameters/SD1_meas_strengths.csv b/Parameters/SD1_meas_strengths.csv
new file mode 100644
index 0000000000000000000000000000000000000000..909e8a5b69822fd7cd649f8530962123fa4c9ba7
--- /dev/null
+++ b/Parameters/SD1_meas_strengths.csv
@@ -0,0 +1,80 @@
+110,  0,  0,  0, 0,          0,           0,            0,  0.39132577
+110, -1,  0,  0, 0,  1.1501182, -0.66383386,            0,  0.38944691
+110,  1,  0,  0, 0, -1.1635841,  0.67025274,            0,  0.39332756
+110,  0, -1,  0, 0,          0, -0.66467267,  0.024550673,  0.39235324
+110,  0,  1,  0, 0,          0,  0.65155417, -0.023284031,  0.39038149
+110, -1, -1,  0, 0,  1.1621387,  -1.3425758,  0.024028165,  0.39041904
+110, -1,  0, -1, 0,          0,  -1.3452284,            0,  0.38745737
+110,  0, -1,  0, 1,          0,  -1.3351675,            0,  0.39335856
+100,  0,  0,  0, 0,          0,           0,            0,  0.38461921
+100, -1,  0,  0, 0,  1.2787005, -0.74253875,            0,  0.38232836
+100,  1,  0,  0, 0, -1.1937727,  0.68623567,            0,  0.38671353
+100,  0, -1,  0, 0,          0, -0.68650347,  0.025292592,  0.38567767
+100,  0,  1,  0, 0,          0,  0.72330528,  -0.02750244,  0.38349053
+100, -1, -1,  0, 0,  1.2714435,  -1.4402887,  0.026243648,  0.38340858
+100, -1,  0, -1, 0,          0,  -1.5607061,            0,  0.37987751
+100,  0, -1,  0, 1,          0,  -1.4378369,            0,  0.38674933
+ 90,  0,  0,  0, 0,          0,           0,            0,  0.37533423
+ 90, -1,  0,  0, 0,  1.4777839,  -0.8384766,            0,  0.37239322
+ 90,  1,  0,  0, 0, -1.3533567,   0.7891354,            0,  0.37794849
+ 90,  0, -1,  0, 0,          0, -0.77707219,  0.030847132,  0.37663537
+ 90,  0,  1,  0, 0,          0,  0.83695167, -0.034087729,   0.3738606
+ 90, -1, -1,  0, 0,  1.4591732,  -1.6440003,  0.032182999,  0.37374863
+ 90, -1,  0, -1, 0,          0,  -1.8038282,            0,   0.3691757
+ 90,  0, -1,  0, 1,          0,  -1.6452072,            0,  0.37797067
+ 80,  0,  0,  0, 0,          0,           0,            0,  0.36187235
+ 80, -1,  0,  0, 0,  1.7998065,  -1.0299394,            0,  0.35771045
+ 80,  1,  0,  0, 0, -1.6067977,  0.92982244,            0,  0.36540413
+ 80,  0, -1,  0, 0,          0, -0.90831369,  0.040485654,  0.36363944
+ 80,  0,  1,  0, 0,          0,   1.0208418, -0.046234325,  0.35978532
+ 80, -1, -1,  0, 0,   1.762218,  -1.9577762,  0.042972408,  0.35960573
+ 80, -1,  0, -1, 0,          0,  -2.2311296,            0,  0.35285065
+ 80,  0, -1,  0, 1,          0,  -1.9737542,            0,  0.36542395
+ 70,  0,  0,  0, 0,          0,           0,            0,  0.33894792
+ 70, -1,  0,  0, 0,  2.3733745,  -1.3721114,            0,  0.33172613
+ 70,  1,  0,  0, 0, -2.0680969,   1.1890743,            0,  0.34482303
+ 70,  0, -1,  0, 0,          0,   -1.175702,  0.062889218,  0.34188455
+ 70,  0,  1,  0, 0,          0,   1.3406454, -0.075050615,   0.3352752
+ 70, -1, -1,  0, 0,  2.3068781,  -2.5519035,  0.068253338,  0.33502284
+ 70, -1,  0, -1, 0,          0,   -3.008872,            0,  0.32249334
+ 70,  0, -1,  0, 1,          0,  -2.5775909,            0,  0.34485462
+ 60,  0,  0,  0, 0,          0,           0,            0,  0.29841006
+ 60, -1,  0,  0, 0,   2.652873,  -1.5336357,            0,  0.28823239
+ 60,  1,  0,  0, 0, -2.5584202,   1.4744229,            0,  0.30780306
+ 60,  0, -1,  0, 0,          0,  -1.4726236,  0.093248427,  0.30307946
+ 60,  0,  1,  0, 0,          0,   1.5211933, -0.099605083,  0.29329637
+ 60, -1, -1,  0, 0,  2.6067286,  -2.9905975,  0.095834076,   0.2931734
+ 60, -1,  0, -1, 0,          0,  -3.2325485,            0,  0.27667019
+ 60,  0, -1,  0, 1,          0,  -3.0181408,            0,   0.3078343
+ 50,  0,  0,  0, 0,          0,           0,            0,  0.25123465
+ 50, -1,  0,  0, 0,  2.7259889,  -1.5476594,            0,  0.24026804
+ 50,  1,  0,  0, 0, -2.6735978,   1.5492308,            0,  0.26171482
+ 50,  0, -1,  0, 0,          0,  -1.5299723,   0.10206889,   0.2564376
+ 50,  0,  1,  0, 0,          0,   1.5950747,   -0.1057945,    0.245727
+ 50, -1, -1,  0, 0,  2.6903429,  -3.0834398,    0.1033278,   0.2456789
+ 50, -1,  0, -1, 0,          0,  -3.2706251,            0,  0.22820123
+ 50,  0, -1,  0, 1,          0,  -3.1341119,            0,  0.26175153
+ 40,  0,  0,  0, 0,          0,           0,            0,  0.20250557
+ 40, -1,  0,  0, 0,  2.7639694,  -1.5857712,            0,  0.19106695
+ 40,  1,  0,  0, 0, -2.7296219,   1.5663034,            0,  0.21347074
+ 40,  0, -1,  0, 0,          0,  -1.5637187,   0.10596395,  0.20795508
+ 40,  0,  1,  0, 0,          0,   1.5946362,  -0.10912155,  0.19678156
+ 40, -1, -1,  0, 0,  2.7347431,  -3.1553888,   0.10707929,  0.19674422
+ 40, -1,  0, -1, 0,          0,   -3.311069,            0,  0.17872633
+ 40,  0, -1,  0, 1,          0,  -3.1857505,            0,   0.2135158
+ 30,  0,  0,  0, 0,          0,           0,            0,  0.15270723
+ 30, -1,  0,  0, 0,   2.785069,  -1.6102738,            0,  0.14095382
+ 30,  1,  0,  0, 0, -2.7596579,    1.575951,            0,   0.1640238
+ 30,  0, -1,  0, 0,          0,  -1.6033742,     0.108702,  0.15830521
+ 30,  0,  1,  0, 0,          0,   1.6025754,  -0.11101157,  0.14679548
+ 30, -1, -1,  0, 0,  2.7646718,  -3.1937265,    0.1095781,  0.14678493
+ 30, -1,  0, -1, 0,          0,  -3.3176663,            0,  0.12847863
+ 30,  0, -1,  0, 1,          0,  -3.2254729,            0,  0.16406035
+ 20,  0,  0,  0, 0,          0,           0,            0,  0.10224476
+ 20, -1,  0,  0, 0,  2.7916446,  -1.5984979,            0, 0.090399466
+ 20,  1,  0,  0, 0,  -2.777302,   1.6038731,            0,   0.1137675
+ 20,  0, -1,  0, 0,          0,  -1.6022323,   0.11028539,  0.10795376
+ 20,  0,  1,  0, 0,          0,   1.6132804,  -0.11157605, 0.096315093
+ 20, -1, -1,  0, 0,  2.7718439,  -3.1959195,   0.11046519, 0.096309587
+ 20, -1,  0, -1, 0,          0,  -3.3046281,            0, 0.077966653
+ 20,  0, -1,  0, 1,          0,  -3.2323408,            0,  0.11379937
diff --git a/Parameters/SD1_params.csv b/Parameters/SD1_params.csv
new file mode 100644
index 0000000000000000000000000000000000000000..2fedc80646b499329faf10ba3d0e01f6b59029ab
--- /dev/null
+++ b/Parameters/SD1_params.csv
@@ -0,0 +1,132 @@
+#S_N     ,        SCALE,  OFFSET,  RADIUS, PSCURROFFSET
+#        ,          [1],     [T],    [mm],          [A]
+SD1-16055,  0.992569719,       0,      13,            0
+SD1-16056,  0.994885651,       0,      13,            0
+SD1-16110,  0.980893564,       0,      13,            0
+SD1-16111,  0.999002863,       0,      13,            0
+SD1-16112,  0.998230886,       0,      13,            0
+SD1-16113,  0.994628325,       0,      13,            0
+SD1-16114,  1.001415292,       0,      13,            0
+SD1-16115,  1.002058606,       0,      13,            0
+SD1-16116,  0.999903503,       0,      13,            0
+SD1-16117,  0.999581846,       0,      13,            0
+SD1-16118,  0.999356686,       0,      13,            0
+SD1-16119,  0.998391714,       0,      13,            0
+SD1-16120,  0.999678343,       0,      13,            0
+SD1-16121,  0.999035028,       0,      13,            0
+SD1-16122,   1.00022516,       0,      13,            0
+SD1-16123,   0.99932452,       0,      13,            0
+SD1-16124,  0.998456046,       0,      13,            0
+SD1-16125,    1.0011258,       0,      13,            0
+SD1-16126,  0.999935669,       0,      13,            0
+SD1-16127,  1.000064331,       0,      13,            0
+SD1-16128,  0.998552543,       0,      13,            0
+SD1-16129,  0.999903503,       0,      13,            0
+SD1-16130,  0.997426743,       0,      13,            0
+SD1-16131,  0.998777703,       0,      13,            0
+SD1-16132,  0.998102223,       0,      13,            0
+SD1-16133,  0.999517514,       0,      13,            0
+SD1-16134,  0.998359548,       0,      13,            0
+SD1-16135,  0.995561131,       0,      13,            0
+SD1-16136,  0.996783428,       0,      13,            0
+SD1-16137,  0.999807006,       0,      13,            0
+SD1-16138,  0.998745537,       0,      13,            0
+SD1-16139,    0.9988742,       0,      13,            0
+SD1-16140,  0.999517514,       0,      13,            0
+SD1-16141,    0.9988742,       0,      13,            0
+SD1-16142,  1.000482486,       0,      13,            0
+SD1-16143,  0.998391714,       0,      13,            0
+SD1-16144,  1.000096497,       0,      13,            0
+SD1-16145,  0.999388851,       0,      13,            0
+SD1-16146,  0.997233748,       0,      13,            0
+SD1-16147,   0.99797356,       0,      13,            0
+SD1-16148,   0.99909936,       0,      13,            0
+SD1-16149,  0.999035028,       0,      13,            0
+SD1-16150,  0.999967834,       0,      13,            0
+SD1-16151,  0.995882788,       0,      13,            0
+SD1-16152,  0.999131526,       0,      13,            0
+SD1-16153,  0.999228023,       0,      13,            0
+SD1-16154,  0.998584708,       0,      13,            0
+SD1-16155,  0.999035028,       0,      13,            0
+SD1-16156,  0.999871337,       0,      13,            0
+SD1-16157,  0.998842034,       0,      13,            0
+SD1-16158,  0.998842034,       0,      13,            0
+SD1-16159,  0.997684068,       0,      13,            0
+SD1-16160,  0.998777703,       0,      13,            0
+SD1-16161,  0.998842034,       0,      13,            0
+SD1-16162,  0.998745537,       0,      13,            0
+SD1-16163,  0.999678343,       0,      13,            0
+SD1-16164,  0.998906366,       0,      13,            0
+SD1-16165,  0.999388851,       0,      13,            0
+SD1-16166,   1.00045032,       0,      13,            0
+SD1-16167,  0.998584708,       0,      13,            0
+SD1-16168,   0.99864904,       0,      13,            0
+SD1-16169,  0.999260188,       0,      13,            0
+SD1-16170,  0.999485349,       0,      13,            0
+SD1-16171,  0.999067194,       0,      13,            0
+SD1-16172,  1.001769114,       0,      13,            0
+SD1-16173,  0.997491074,       0,      13,            0
+SD1-16174,  0.995593297,       0,      13,            0
+SD1-16175,  0.997137251,       0,      13,            0
+SD1-16176,  0.998295217,       0,      13,            0
+SD1-16177,  0.999035028,       0,      13,            0
+SD1-16178,  1.000321657,       0,      13,            0
+SD1-16179,   1.00247676,       0,      13,            0
+SD1-16180,   1.00022516,       0,      13,            0
+SD1-16181,            1,       0,      13,            0
+SD1-16182,   0.99981462,       0,      13,            0
+SD1-16183,  1.000514651,       0,      13,            0
+SD1-16184,   0.99977484,       0,      13,            0
+SD1-16185,  0.999871337,       0,      13,            0
+SD1-16186,  0.999356686,       0,      13,            0
+SD1-16187,  0.998295217,       0,      13,            0
+SD1-16188,  0.999388851,       0,      13,            0
+SD1-16189,  1.000556139,       0,      13,            0
+SD1-16190,  1.000578983,       0,      13,            0
+SD1-16191,  0.998393376,       0,      13,            0
+SD1-16192,    0.9988742,       0,      13,            0
+SD1-16193,   0.99990731,       0,      13,            0
+SD1-16194,  1.000064331,       0,      13,            0
+SD1-16195,  1.000418154,       0,      13,            0
+SD1-16196,  1.002541092,       0,      13,            0
+SD1-16197,  1.001157966,       0,      13,            0
+SD1-16198,            1,       0,      13,            0
+SD1-16199,  1.001865612,       0,      13,            0
+SD1-16200,  0.999967834,       0,      13,            0
+SD1-16201,  1.003699058,       0,      13,            0
+SD1-16202,  1.001769114,       0,      13,            0
+SD1-16203,  1.001061469,       0,      13,            0
+SD1-16204,  1.000321657,       0,      13,            0
+SD1-16205,  0.998745537,       0,      13,            0
+SD1-16206,  0.998520377,       0,      13,            0
+SD1-16207,  0.997684068,       0,      13,            0
+SD1-16208,   0.99977484,       0,      13,            0
+SD1-16209,  1.001672617,       0,      13,            0
+SD1-16210,   1.00067548,       0,      13,            0
+SD1-16211,  1.000964972,       0,      13,            0
+SD1-16212,  1.002894915,       0,      13,            0
+SD1-16213,  1.000707646,       0,      13,            0
+SD1-16214,  1.001383126,       0,      13,            0
+SD1-16215,  1.000192994,       0,      13,            0
+SD1-16216,  1.002187269,       0,      13,            0
+SD1-16217,  1.001833446,       0,      13,            0
+SD1-16218,   1.00247676,       0,      13,            0
+SD1-16219,  1.000707646,       0,      13,            0
+SD1-16220,   1.00247676,       0,      13,            0
+SD1-16221,  0.999421017,       0,      13,            0
+SD1-16222,  1.002122937,       0,      13,            0
+SD1-16223,  0.997780565,       0,      13,            0
+SD1-16224,  0.996912091,       0,      13,            0
+SD1-16225,  0.999935669,       0,      13,            0
+SD1-16226,  1.000932806,       0,      13,            0
+SD1-16227,  1.001608286,       0,      13,            0
+SD1-16228,  1.001222297,       0,      13,            0
+SD1-16229,  1.002122937,       0,      13,            0
+SD1-16230,  0.999485349,       0,      13,            0
+SD1-16231,   0.99954968,       0,      13,            0
+SD1-16232,  0.999903503,       0,      13,            0
+SD1-16233,  0.997812731,       0,      13,            0
+SD1-16234,  0.998166554,       0,      13,            0
+SD1-16235,  0.997105085,       0,      13,            0
+SD1-16236,  0.997491074,       0,      13,            0
+SD1-16237,  1.001029303,       0,      13,            0
diff --git a/Parameters/SF2_meas_strengths.csv b/Parameters/SF2_meas_strengths.csv
new file mode 100644
index 0000000000000000000000000000000000000000..794c2e56cafcce222881a95a88dac81c8c8293ff
--- /dev/null
+++ b/Parameters/SF2_meas_strengths.csv
@@ -0,0 +1,88 @@
+110,  0,  0,  0, 0,          0,           0,            0,   -0.4780733
+110, -1,  0,  0, 0,  1.3950052, -0.80620205,            0,  -0.48056751
+110,  1,  0,  0, 0, -1.3951166,  0.80076873,            0,  -0.47576591
+110,  0, -1,  0, 0,          0, -0.80639672,  0.028603606,  -0.47689965
+110,  0,  1,  0, 0,          0,  0.80683374, -0.030529544,  -0.47931737
+110, -1, -1,  0, 0,  1.3919518,    -1.63554,  0.029075079,  -0.47930586
+110, -1,  0, -1, 0,          0,    -1.65496,            0,  -0.48289144
+110,  0, -1,  0, 1,          0,   -1.623215,            0,  -0.47565967
+100,  0,  0,  0, 0,          0,           0,            0,  -0.46945745
+100, -1,  0,  0, 0,  1.4634557, -0.83275515,            0,  -0.47204888
+100,  1,  0,  0, 0, -1.5718861,  0.90267563,            0,  -0.46654454
+100,  0, -1,  0, 0,          0, -0.88526332,  0.034508098,  -0.46796662
+100,  0,  1,  0, 0,          0,  0.84287727, -0.031993087,  -0.47074682
+100, -1, -1,  0, 0,  1.4708734,  -1.7414696,  0.033898029,   -0.4706181
+100, -1,  0, -1, 0,          0,  -1.7035432,            0,  -0.47466427
+100,  0, -1,  0, 1,          0,  -1.7662524,            0,  -0.46648154
+ 90,  0,  0,  0, 0,          0,           0,            0,  -0.45755029
+ 90, -1,  0,  0, 0,  1.6659548, -0.95759189,            0,  -0.46084395
+ 90,  1,  0,  0, 0, -1.8269746,   1.0500335,            0,  -0.45379007
+ 90,  0, -1,  0, 0,          0,  -1.0285978,   0.04368183,  -0.45565566
+ 90,  0,  1,  0, 0,          0,  0.95545244, -0.039445508,  -0.45923111
+ 90, -1, -1,  0, 0,  1.6857958,  -2.0094006,  0.042448148,  -0.45905235
+ 90, -1,  0, -1, 0,          0,  -1.9614869,            0,  -0.46422702
+ 90,  0, -1,  0, 1,          0,  -2.0368993,            0,  -0.45373222
+ 80,  0,  0,  0, 0,          0,           0,            0,  -0.44003561
+ 80, -1,  0,  0, 0,  1.9899557,  -1.1545449,            0,   -0.4447037
+ 80,  1,  0,  0, 0, -2.2618406,   1.3028783,            0,  -0.43446919
+ 80,  0, -1,  0, 0,          0,  -1.2866434,  0.061626617,  -0.43721703
+ 80,  0,  1,  0, 0,          0,   1.1419036,  -0.05305732,  -0.44238719
+ 80, -1, -1,  0, 0,  2.0161369,  -2.4287524,  0.058342896,   -0.4421351
+ 80, -1,  0, -1, 0,          0,  -2.3422308,            0,  -0.44947329
+ 80,  0, -1,  0, 1,          0,  -2.4831328,            0,  -0.43439412
+ 70,  0,  0,  0, 0,          0,           0,            0,  -0.40820229
+ 70, -1,  0,  0, 0,  2.6280446,  -1.5199389,            0,  -0.41664791
+ 70,  1,  0,  0, 0, -2.9684057,   1.6944635,            0,  -0.39801276
+ 70,  0, -1,  0, 0,          0,  -1.7035434,   0.10399511,  -0.40295544
+ 70,  0,  1,  0, 0,          0,   1.4969898, -0.088223681,  -0.41244611
+ 70, -1, -1,  0, 0,  2.6505754,  -3.1795273,  0.095419303,  -0.41198912
+ 70, -1,  0, -1, 0,          0,  -3.0707862,            0,  -0.42526531
+ 70,  0, -1,  0, 1,          0,  -3.2611794,            0,  -0.39784101
+ 60,  0,  0,  0, 0,          0,           0,            0,   -0.3564145
+ 60, -1,  0,  0, 0,  3.0614791,  -1.7454534,            0,  -0.36846954
+ 60,  1,  0,  0, 0, -3.1568239,   1.8120166,            0,  -0.34356526
+ 60,  0, -1,  0, 0,          0,  -1.8164403,   0.12451512,  -0.34989229
+ 60,  0,  1,  0, 0,          0,   1.7779056,  -0.11817096,  -0.36247826
+ 60, -1, -1,  0, 0,  3.0553594,  -3.5539913,   0.12063816,  -0.36216456
+ 60, -1,  0, -1, 0,          0,  -3.6091566,            0,  -0.38141501
+ 60,  0, -1,  0, 1,          0,   -3.627142,            0,  -0.34341821
+ 50,  0,  0,  0, 0,          0,           0,            0,  -0.29943752
+ 50, -1,  0,  0, 0,  3.1574378,  -1.8160866,            0,  -0.31247371
+ 50,  1,  0,  0, 0, -3.2184687,   1.8362588,            0,  -0.28581831
+ 50,  0, -1,  0, 0,          0,  -1.8591126,   0.12984973,  -0.29253399
+ 50,  0,  1,  0, 0,          0,   1.8280977,  -0.12598853,  -0.30597752
+ 50, -1, -1,  0, 0,  3.1527452,  -3.6632078,   0.12739734,  -0.30571523
+ 50, -1,  0, -1, 0,          0,  -3.7241209,            0,  -0.32648796
+ 50,  0, -1,  0, 1,          0,  -3.7120409,            0,  -0.28565511
+ 40,  0,  0,  0, 0,          0,           0,            0,  -0.24105391
+ 40, -1,  0,  0, 0,   3.200058,  -1.8290169,            0,   -0.2545366
+ 40,  1,  0,  0, 0, -3.2475967,   1.8755319,            0,  -0.22700857
+ 40,  0, -1,  0, 0,          0,  -1.8661945,   0.13284159,  -0.23393081
+ 40,  0,  1,  0, 0,          0,    1.861587,   -0.1295291,  -0.24780934
+ 40, -1, -1,  0, 0,  3.2008855,  -3.6958697,    0.1309787,  -0.24754415
+ 40, -1,  0, -1, 0,          0,  -3.7533569,            0,  -0.26892644
+ 40,  0, -1,  0, 1,          0,  -3.7549887,            0,  -0.22687127
+ 30,  0,  0,  0, 0,          0,           0,            0,  -0.18169324
+ 30, -1,  0,  0, 0,  3.2313793,  -1.8601023,            0,  -0.19550346
+ 30,  1,  0,  0, 0, -3.2694335,   1.8709174,            0,   -0.1673784
+ 30,  0, -1,  0, 0,          0,  -1.8995627,    0.1346297,  -0.17444831
+ 30,  0,  1,  0, 0,          0,   1.8712746,  -0.13190454,  -0.18859535
+ 30, -1, -1,  0, 0,  3.2253497,  -3.7403297,   0.13315827,  -0.18834792
+ 30, -1,  0, -1, 0,          0,  -3.8084009,            0,  -0.21016414
+ 30,  0, -1,  0, 1,          0,  -3.7845304,            0,  -0.16725312
+ 20,  0,  0,  0, 0,          0,           0,            0,  -0.12161662
+ 20, -1,  0,  0, 0,  3.2550023,  -1.8706089,            0,  -0.13561915
+ 20,  1,  0,  0, 0, -3.2739649,    1.882543,            0,  -0.10720349
+ 20,  0, -1,  0, 0,          0,   -1.893418,   0.13516918,  -0.11433002
+ 20,  0,  1,  0, 0,          0,   1.8758647,   -0.1334285,  -0.12863398
+ 20, -1, -1,  0, 0,  3.2429583,  -3.7570491,    0.1343213,  -0.12840909
+ 20, -1,  0, -1, 0,          0,  -3.8339562,            0,  -0.15052575
+ 20,  0, -1,  0, 1,          0,  -3.7961488,            0,  -0.10707085
+ 10,  0,  0,  0, 0,          0,           0,            0, -0.063066252
+ 10, -1,  0,  0, 0,  3.2124901,  -1.8471744,            0, -0.076583117
+ 10,  1,  0,  0, 0, -3.3419757,   1.9284879,            0, -0.047749121
+ 10,  0, -1,  0, 0,          0,  -1.9347616,   0.14188972, -0.055311546
+ 10,  0,  1,  0, 0,          0,   1.8675401,  -0.12997399, -0.069812223
+ 10, -1, -1,  0, 0,  3.2491775,  -3.7629275,   0.13565743,  -0.06933181
+ 10, -1,  0, -1, 0,          0,  -3.8035862,            0, -0.091223523
+ 10,  0, -1,  0, 1,          0,  -3.8172669,            0, -0.047637925
diff --git a/Parameters/SF2_params.csv b/Parameters/SF2_params.csv
new file mode 100644
index 0000000000000000000000000000000000000000..ad2493e266f233322e31c54561a7d5e3555067b0
--- /dev/null
+++ b/Parameters/SF2_params.csv
@@ -0,0 +1,67 @@
+#S_N     ,        SCALE,  OFFSET,  RADIUS, PSCURROFFSET
+#        ,          [1],     [T],    [mm],          [A]
+SF2-16058,  0.994438745,       0,      13,            0
+SF2-16238,  0.998974137,       0,      13,            0
+SF2-16239,  1.000134982,       0,      13,            0
+SF2-16240,            1,       0,      13,            0
+SF2-16241,  1.001403812,       0,      13,            0
+SF2-16242,  1.000350953,       0,      13,            0
+SF2-16243,  1.000647913,       0,      13,            0
+SF2-16244,  0.997840289,       0,      13,            0
+SF2-16245,  1.001781761,       0,      13,            0
+SF2-16246,  1.000107986,       0,      13,            0
+SF2-16247,  0.998542195,       0,      13,            0
+SF2-16248,  1.001376816,       0,      13,            0
+SF2-16249,  1.000350953,       0,      13,            0
+SF2-16250,  1.000107986,       0,      13,            0
+SF2-16251,  0.996841423,       0,      13,            0
+SF2-16252,  1.002348685,       0,      13,            0
+SF2-16253,  1.001187841,       0,      13,            0
+SF2-16254,  0.999136116,       0,      13,            0
+SF2-16255,  0.994438745,       0,      13,            0
+SF2-16256,  0.997570326,       0,      13,            0
+SF2-16257,  1.002699638,       0,      13,            0
+SF2-16258,  0.998893148,       0,      13,            0
+SF2-16259,  1.002051725,       0,      13,            0
+SF2-16260,  0.998380217,       0,      13,            0
+SF2-16261,  1.000890881,       0,      13,            0
+SF2-16262,  1.001673776,       0,      13,            0
+SF2-16263,  0.998272232,       0,      13,            0
+SF2-16264,  1.001457805,       0,      13,            0
+SF2-16265,  0.994438745,       0,      13,            0
+SF2-16266,  1.002888613,       0,      13,            0
+SF2-16267,  1.003671508,       0,      13,            0
+SF2-16268,  1.000188975,       0,      13,            0
+SF2-16269,  0.999082123,       0,      13,            0
+SF2-16270,  0.999217105,       0,      13,            0
+SF2-16271,  1.000377949,       0,      13,            0
+SF2-16272,  1.000431942,       0,      13,            0
+SF2-16273,  0.999892014,       0,      13,            0
+SF2-16274,  1.000026996,       0,      13,            0
+SF2-16275,  1.002672642,       0,      13,            0
+SF2-16276,  1.004427407,       0,      13,            0
+SF2-16277,  1.000485935,       0,      13,            0
+SF2-16278,  1.001538794,       0,      13,            0
+SF2-16279,            1,       0,      13,            0
+SF2-16280,  1.000755899,       0,      13,            0
+SF2-16281,   1.00059392,       0,      13,            0
+SF2-16282,  1.000161978,       0,      13,            0
+SF2-16283,  0.999865018,       0,      13,            0
+SF2-16284,  1.000404946,       0,      13,            0
+SF2-16285,  0.994438745,       0,      13,            0
+SF2-16286,  1.001430808,       0,      13,            0
+SF2-16287,  1.001457805,       0,      13,            0
+SF2-16288,  1.001484801,       0,      13,            0
+SF2-16289,  1.000647913,       0,      13,            0
+SF2-16290,  1.001133848,       0,      13,            0
+SF2-16291,  1.000863884,       0,      13,            0
+SF2-16292,  1.001538794,       0,      13,            0
+SF2-16293,  1.001700772,       0,      13,            0
+SF2-16294,  1.000566924,       0,      13,            0
+SF2-16295,  1.001133848,       0,      13,            0
+SF2-16296,  1.000620917,       0,      13,            0
+SF2-16297,  1.002429674,       0,      13,            0
+SF2-16298,  1.001214837,       0,      13,            0
+SF2-16299,  1.001727768,       0,      13,            0
+SF2-16300,  1.001646779,       0,      13,            0
+SF2-16301,  1.001592787,       0,      13,            0
diff --git a/Parameters/SH1_SH3_h_strength.csv b/Parameters/SH1_SH3_h_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..7b10ac32ed0730548d30f0cdf3707559647162b4
--- /dev/null
+++ b/Parameters/SH1_SH3_h_strength.csv
@@ -0,0 +1,12 @@
+#Current,    Int.Grad. 
+#[A]    ,          [Tm]
+       0,             0
+ 0.26667,   0.001805061
+ 0.53333,   0.003637018
+     0.8,   0.005495871
+  1.0667,   0.007349891
+  1.3333,   0.009203181
+     1.6,   0.011055744
+  1.8667,   0.012888188
+  2.1333,     0.0147084
+     2.4,   0.016516378
diff --git a/Parameters/SH1_SH3_sq_strength.csv b/Parameters/SH1_SH3_sq_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..a68e6c466a3bf4df4316a17d72c48e5c37b0745a
--- /dev/null
+++ b/Parameters/SH1_SH3_sq_strength.csv
@@ -0,0 +1,11 @@
+#Current,   Int.Grad. 
+#[A]    ,          [T]
+       0,            0
+ 0.53333,  0.081016541
+  1.0667,   0.16134213
+     1.6,   0.24073587
+  2.1333,   0.31870389
+  2.6667,   0.39314961
+     3.2,   0.45147696
+  3.7333,   0.49480939
+  4.2667,   0.53024685
diff --git a/Parameters/SH1_SH3_v_strength.csv b/Parameters/SH1_SH3_v_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..a39d654f53b2e76b145c4c07b97395388d72c9de
--- /dev/null
+++ b/Parameters/SH1_SH3_v_strength.csv
@@ -0,0 +1,12 @@
+#Current,  Int.Grad. 
+#[A]    ,        [Tm]
+       0,           0
+ 0.53333, 0.001360387
+  1.0667, 0.002715177
+     1.6, 0.004067117
+  2.1333, 0.005414052
+  2.6667, 0.006750694
+     3.2, 0.008060268
+  3.7333, 0.009291842
+  4.2667, 0.010400214
+     4.8, 0.011256173
diff --git a/Parameters/SH2_h_strength.csv b/Parameters/SH2_h_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..7b10ac32ed0730548d30f0cdf3707559647162b4
--- /dev/null
+++ b/Parameters/SH2_h_strength.csv
@@ -0,0 +1,12 @@
+#Current,    Int.Grad. 
+#[A]    ,          [Tm]
+       0,             0
+ 0.26667,   0.001805061
+ 0.53333,   0.003637018
+     0.8,   0.005495871
+  1.0667,   0.007349891
+  1.3333,   0.009203181
+     1.6,   0.011055744
+  1.8667,   0.012888188
+  2.1333,     0.0147084
+     2.4,   0.016516378
diff --git a/Parameters/SH2_sq_strength.csv b/Parameters/SH2_sq_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..63f43edce05ae63bbd311787b3df17dddc8fa838
--- /dev/null
+++ b/Parameters/SH2_sq_strength.csv
@@ -0,0 +1,11 @@
+#Current,   Int.Grad. 
+#[A]    ,         [Tm]
+       0,            0
+ 0.53333,  0.080003834
+  1.0667,  0.159325353
+     1.6,  0.237726672
+  2.1333,  0.314720091
+  2.6667,   0.38823524
+     3.2,  0.445833498
+  3.7333,  0.488624273
+  4.2667,  0.523618764
diff --git a/Parameters/SH2_v_strength.csv b/Parameters/SH2_v_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..a91a26f2c2ac3e8645807a41cf3c8f461330e0fd
--- /dev/null
+++ b/Parameters/SH2_v_strength.csv
@@ -0,0 +1,12 @@
+#Current,   Int.Grad. 
+#[A]    ,         [Tm]
+       0,            0
+ 0.53333,  0.001343383
+  1.0667,  0.002681237
+     1.6,  0.004016278
+  2.1333,  0.005346376
+  2.6667,   0.00666631
+     3.2,  0.007959515
+  3.7333,  0.009175693
+  4.2667,  0.010270211
+     4.8,  0.011115471
diff --git a/Parameters/SHI_corr_matrix.csv b/Parameters/SHI_corr_matrix.csv
new file mode 100644
index 0000000000000000000000000000000000000000..ca893a2544028218dfb319b12ea5523791579c66
--- /dev/null
+++ b/Parameters/SHI_corr_matrix.csv
@@ -0,0 +1,4 @@
+1,-0.0886,0.0493,0.0886,-0.0493
+0,1,-1,1,-1
+0,1,1,1,1
+-0.35,-1.31,1,1.31,-1
diff --git a/Parameters/SHI_h_strength.csv b/Parameters/SHI_h_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..c047c02013747b3a27ddfa136d4e0f9d818838a3
--- /dev/null
+++ b/Parameters/SHI_h_strength.csv
@@ -0,0 +1,11 @@
+#Current,     Int.Grad. 
+#[A]    ,           [Tm]
+       0,            0.0
+     0.3, 0.002028966667
+     0.6, 0.004057933333
+     0.9,      0.0060869
+     1.2,     0.00811586
+     1.5,     0.01014483
+     1.8,      0.0121738
+     2.1,      0.0141826
+     2.4,      0.0161824
diff --git a/Parameters/SHI_sext_strength.csv b/Parameters/SHI_sext_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..2d3140253edf3ede8d975b4e0805bb52f59a9a0d
--- /dev/null
+++ b/Parameters/SHI_sext_strength.csv
@@ -0,0 +1,13 @@
+#Current,   Int.Grad. 
+#[A]   ,        [T/m]
+      0,          0.0
+      1,  2.996889577
+      2,  5.993779154
+      3,     8.990668
+      4,    11.987558
+      5,  14.98444789
+      6,  17.98133746
+      7,  20.97822704
+      8,      23.6602
+      9,      25.8065
+     10,      27.5725
diff --git a/Parameters/SHI_sq_strength.csv b/Parameters/SHI_sq_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..60de7721cf113cb86c87f6a8336832819776a550
--- /dev/null
+++ b/Parameters/SHI_sq_strength.csv
@@ -0,0 +1,12 @@
+#Current,  Int.Grad. 
+#[A]    ,         [T]
+       0,         0.0
+ 1.06666, 0.072921909
+ 2.13333,  0.14531671
+ 3.19999,  0.21716061
+ 4.26666,  0.28783524
+ 5.33333,  0.35644257
+ 6.39999,  0.41839668
+ 7.46666,   0.4659577
+ 8.53333,   0.5026322
+ 9.59999,  0.53335905
diff --git a/Parameters/SHI_v_strength.csv b/Parameters/SHI_v_strength.csv
new file mode 100644
index 0000000000000000000000000000000000000000..0f4a34340547d0d329a59508ae463699f7ca0780
--- /dev/null
+++ b/Parameters/SHI_v_strength.csv
@@ -0,0 +1,12 @@
+#Current ,   Int.Grad. 
+#[A]     ,         [Tm]
+        0,          0.0
+  1.06666, 0.0012244331
+  2.13333, 0.0024446759
+  3.19999, 0.0036616087
+  4.26666, 0.0048763485
+  5.33333, 0.0060823154
+  6.39999, 0.0072807183
+  7.46666, 0.0084496508
+  8.53333, 0.0095203075
+  9.59999,  0.010499059
diff --git a/Parameters/SH_corr_matrix.csv b/Parameters/SH_corr_matrix.csv
new file mode 100644
index 0000000000000000000000000000000000000000..0d016b4a070413c68af0c78e93a4d409a9e4d536
--- /dev/null
+++ b/Parameters/SH_corr_matrix.csv
@@ -0,0 +1,3 @@
+1.0,0,0
+0,1.0,-1.0613636
+0,0.96181738,1.0
diff --git a/README.md b/README.md
index b85faa61f06c117b94330cbc8ef520254438e479..71804580568cb1eb30f31f79ebdaa90e44db4407 100644
--- a/README.md
+++ b/README.md
@@ -1,92 +1,81 @@
 # MagnetModel
 
+Library in charge of magnetic strenghs to coil currents calculation. This library implements computation in the two directions (from currents to magnetic coeffs and from magnetic coeffs to currents). Thank's to **Gael Lebec** (from ASD) who is the author of the sextupole model.
 
 
-## Getting started
 
-To make it easy for you to get started with GitLab, here's a list of recommended next steps.
+## Elettra 2.0 fork
 
-Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
+The library is a fork from the original esrf library. Reasons for forking:
+ 1) Elettra 2.0 has some differences in the combined magnets composition (set of multipoles) and in the excitation schemes for combined magnets.
+ 2) We must use our local gitlab repository in order to use the INAU deployment system.
 
-## Add your files
+### Credits
 
-- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
-- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
+Thanks to Jean-Luc Pons (ESRF) , author of the libray , and Simone Maria Liuzzo (ESRF) for provinding the initial tutorial and training.
 
-```
-cd existing_repo
-git remote add origin https://gitlab.elettra.eu/dt/lib/MagnetModel.git
-git branch -M main
-git push -uf origin main
-```
-
-## Integrate with your tools
-
-- [ ] [Set up project integrations](https://gitlab.elettra.eu/dt/lib/MagnetModel/-/settings/integrations)
-
-## Collaborate with your team
-
-- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
-- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
-- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
-- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
-- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
+## Cloning the original project
 
-## Test and Deploy
+To clone this project, simply type:
 
-Use the built-in continuous integration in GitLab.
+```
+git clone git@gitlab.esrf.fr:accelerators/Magnets/MagnetModel.git
+```
 
-- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
-- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
-- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
-- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
-- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
+## Building and Installation
 
-***
+### Dependencies
 
-# Editing this README
+The project has the following dependencies.
 
-When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
+#### Project Dependencies 
 
-## Suggestions for a good README
-Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
+* [Eigen](http://eigen.tuxfamily.org/index.php?title=Main_Page)
 
-## Name
-Choose a self-explaining name for your project.
+#### Toolchain Dependencies
 
-## Description
-Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
+* C++11 compliant compiler.
+* CMake 3.0 or greater is required to perform the build. 
 
-## Badges
-On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
 
-## Visuals
-Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
+### Build library
 
-## Installation
-Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
+Instructions on building the project.
 
-## Usage
-Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
+CMake example:
 
-## Support
-Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
+```bash
+cd MagnetModel/lib
+mkdir -p build/<os>
+cd build/<os>
+cmake ../.. -DCMAKE_INSTALL_PREFIX=<folder where lib must be installed>
+make
+```
+**INSTALL_DIR** for elettra and elettra2 is /runtime
 
-## Roadmap
-If you have ideas for releases in the future, it is a good idea to list them in the README.
+### Installation
 
-## Contributing
-State if you are open to contributions and what your requirements are for accepting them.
+In the same folder than above
 
-For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
+```bash
+make install
+```
+The include files and the library will be installed in the folder given during the cmake command
 
-You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
+## Tests
 
-## Authors and acknowledgment
-Show your appreciation to those who have contributed to the project.
+To build the test software:
+* Adapt the **INSTALL_DIR** variable in the CMakeLists.txt file to the folder you have used as installation folder.
 
-## License
-For open source projects, say how it is licensed.
+```bash
+cd SextuCorrModels/test
+mkdir -p build/<os>
+cd build/<os>
+cmake ../..
+make
+```
+To run the test software (in the same folder than above)
 
-## Project status
-If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
+```bash
+./TestSextuCorr <Path to the Parameter files folder>
+```
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e2cd09b36d0c548b13f86f428ac7244af154f0f4
--- /dev/null
+++ b/lib/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(magnet_model)
+
+set(CMAKE_CXX_FLAGS "-g -O2")
+set(INCL_USER /usr/include/eigen3)
+include_directories(${INCL_USER})
+add_library(MagnetModel SHARED SH5Magnet.cpp SH3Magnet.cpp DipoleQuadrupole.cpp Quadrupole.cpp Octupole.cpp Sextupole.cpp Corrector.cpp Magnet.cpp Multipole.cpp SextuCorrModel.cpp Interpolation.cpp)
+
+set_target_properties(MagnetModel PROPERTIES VERSION 3.0.0 SOVERSION 3)
+
+
+install(TARGETS MagnetModel DESTINATION lib)
+install(FILES SH5Magnet.h SH3Magnet.h DipoleQuadrupole.h Octupole.h Quadrupole.h Sextupole.h Corrector.h Magnet.h Multipole.h SextuCorrModel.h Interpolation.h DESTINATION include)
diff --git a/lib/Corrector.cpp b/lib/Corrector.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5c804a9637ad765a6cb484e3a61da498d91868be
--- /dev/null
+++ b/lib/Corrector.cpp
@@ -0,0 +1,72 @@
+#include "Corrector.h"
+
+namespace MagnetModel {
+
+//-----------------------------------------------------
+// Init a Corrector
+int Corrector::init(bool focusing,double scale,std::string strength_file_name, std::string param_file_name, std::string mag_s_n) {
+
+  // Magnet type
+  set_magnet_type("corrector");
+  this->focusing = focusing;
+
+  // Initialize scales, offsets, etc.
+  set_params_from_file(param_file_name, mag_s_n);
+  set_scale( scale * get_scale()  );
+
+  // Initialize the excitation curve
+  set_excitation_from_file(strength_file_name);
+
+  return 0;
+
+}
+
+bool Corrector::has_main_current() {
+  return true;
+}
+
+void Corrector::get_strength_names(std::vector<std::string>& names) {
+  // The following names are used to create Tango attributes
+  names.clear();
+  names.push_back("Strength");
+}
+
+void Corrector::get_strength_units(std::vector<std::string>& units) {
+  // The following units are used to create Tango attributes properties
+  units.clear();
+  units.push_back("rad");
+}
+
+//-----------------------------------------------------
+// Compute strength(s) from current(s) in standard unit
+void Corrector::compute_strengths(double magnet_rigidity_inv,std::vector<double>& in_currents,std::vector<double>& out_strengths) {
+
+  if (in_currents.size() != 1)
+    throw std::invalid_argument(get_magnet_type()+"::compute_strengths() 1 currents expected");
+
+  out_strengths.resize(1);
+  if(focusing) {
+    out_strengths[0] = get_excitation_linear(in_currents[0]) * magnet_rigidity_inv;
+  } else {
+    out_strengths[0] = -get_excitation_linear(in_currents[0]) * magnet_rigidity_inv;
+  }
+
+}
+
+//-----------------------------------------------------
+// Compute current(s) from strength(s)
+void Corrector::compute_currents(double magnet_rigidity,std::vector<double>& in_strengths,std::vector<double>& out_currents) {
+
+  if (in_strengths.size() != 1)
+    throw std::invalid_argument(get_magnet_type()+"::compute_currents() 1 strengths expected");
+
+  out_currents.resize(1);
+  if(focusing) {
+    out_currents[0] = solve_main_strength_linear(in_strengths[0] * magnet_rigidity);
+  } else {
+    out_currents[0] = solve_main_strength_linear(-in_strengths[0] * magnet_rigidity);
+  }
+
+}
+
+} // end namespace MagnetModel
diff --git a/lib/Corrector.h b/lib/Corrector.h
new file mode 100644
index 0000000000000000000000000000000000000000..6f3687f28c3d0f590a83a414213b39dcebe7d0a8
--- /dev/null
+++ b/lib/Corrector.h
@@ -0,0 +1,28 @@
+#pragma once
+
+#include "Magnet.h"
+
+namespace MagnetModel {
+
+class Corrector: public Magnet {
+
+public:
+  // Constructor and initialization
+  Corrector() : Magnet(0, 0, 0, 0) {}
+  int init(bool focusing,double scale,std::string strength_file_name, std::string param_file_name, std::string mag_s_n);
+
+  // Implementation of virtual methods (described in Magnet.h)
+  bool has_main_current();
+  void get_strength_names(std::vector<std::string>& names);
+  virtual void get_strength_units(std::vector<std::string>& units);
+  void compute_strengths(double magnet_rigidity_inv,std::vector<double>& in_currents,std::vector<double>& out_strengths);
+  void compute_currents(double magnet_rigidity,std::vector<double>& in_strengths,std::vector<double>& out_currents);
+  void compute_pseudo_currents_from_currents(std::vector<double>& in_currents,std::vector<double>& out_currents) {};
+  void compute_strength_from_pseudo(double magnet_rigidity_inv,int idx,double& in_current,double& out_strength) {};
+
+protected:
+  bool focusing;
+
+};
+
+} // end namespace MagnetModel
diff --git a/lib/DipoleQuadrupole.cpp b/lib/DipoleQuadrupole.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d7248db87521dc5a845dc32e88b4dbeed0091bd4
--- /dev/null
+++ b/lib/DipoleQuadrupole.cpp
@@ -0,0 +1,102 @@
+#include "DipoleQuadrupole.h"
+
+namespace MagnetModel {
+
+//-----------------------------------------------------
+// Init a DQ
+int DipoleQuadrupole::init(bool focusing, double scale, std::string strength_file_name, std::string param_file_name,
+           std::string dipole_strength_file_name,std::string matrix_file_name, std::string mag_s_n) {
+
+  // Magnet type
+  set_magnet_type("dipolequadrupole");
+  this->focusing = focusing;
+
+  // Initialize scales, offsets, etc.
+  set_params_from_file(param_file_name, mag_s_n);
+
+  // Initialize the excitation curve
+  set_scale( scale*get_scale() );
+  set_excitation_from_file(strength_file_name);
+
+  // Initialise the dipole excitation curve
+  dipole.set_excitation_from_file(dipole_strength_file_name);
+
+  // Load the matrix
+  load_matrix(matrix_file_name,2,2,M);
+
+  // Compute pseudo inverse
+  Mp = M.completeOrthogonalDecomposition().pseudoInverse();
+
+  return 0;
+
+}
+
+
+bool DipoleQuadrupole::has_main_current() {
+  return true;
+}
+
+void DipoleQuadrupole::get_strength_names(std::vector<std::string>& names) {
+  // The following names are used to create Tango attributes
+  names.clear();
+  names.push_back("Strength");
+  names.push_back("Strength_H");
+}
+
+void DipoleQuadrupole::get_strength_units(std::vector<std::string>& units) {
+  // The following units are used to create Tango attributes properties
+  units.clear();
+  units.push_back("m-1");
+  units.push_back("rad");
+}
+
+//-----------------------------------------------------
+// Compute strength(s) from current(s) in standard unit
+void DipoleQuadrupole::compute_strengths(double magnet_rigidity_inv,std::vector<double>& in_currents,std::vector<double>& out_strengths) {
+
+  if (in_currents.size() != 2)
+    throw std::invalid_argument(get_magnet_type()+"::compute_strengths() 2 currents expected");
+
+  // Compute pseudo currents
+  auto mapped_currents = Eigen::Map<Eigen::VectorXd>(in_currents.data(), in_currents.size());
+  Eigen::VectorXd pI = M * mapped_currents;
+  double dpI = pI(1) - get_pseudo_current_offset();
+  double dSign = (dpI<0.0)?-1.0:1.0;
+
+  // Compute strengths
+  out_strengths.resize(2);
+  out_strengths[1] = -dSign*dipole.get_excitation_linear(fabs(dpI)) * magnet_rigidity_inv;
+  if(focusing) {
+    out_strengths[0] = get_excitation_linear(pI(0)) * magnet_rigidity_inv;
+  } else {
+    out_strengths[0] = -get_excitation_linear(pI(0)) * magnet_rigidity_inv;
+  }
+
+}
+
+//-----------------------------------------------------
+// Compute current(s) from strength(s)
+void DipoleQuadrupole::compute_currents(double magnet_rigidity,std::vector<double>& in_strengths,std::vector<double>& out_currents) {
+
+  if (in_strengths.size() != 2)
+    throw std::invalid_argument(get_magnet_type()+"::compute_currents() 2 strengths expected");
+
+  // Compute pseudo currents
+  Eigen::Vector2d pI;
+  double dStrength = in_strengths[1] * magnet_rigidity;
+  double dSign = (dStrength<0.0)?-1.0:1.0;
+  pI(1) = -dSign*dipole.solve_main_strength_linear(fabs(dStrength)) + get_pseudo_current_offset();
+
+  if(focusing) {
+    pI(0) = solve_main_strength_linear(in_strengths[0] * magnet_rigidity);
+  } else {
+    pI(0) = solve_main_strength_linear(-in_strengths[0] * magnet_rigidity);
+  }
+
+  Eigen::VectorXd I = Mp * pI;
+  out_currents.resize(2);
+  Eigen::Map<Eigen::VectorXd>(out_currents.data(),out_currents.size()) = I;
+
+}
+
+} // end namespace MagnetModel
\ No newline at end of file
diff --git a/lib/DipoleQuadrupole.h b/lib/DipoleQuadrupole.h
new file mode 100644
index 0000000000000000000000000000000000000000..1322746898c46e5c9712b08a7fcedc6cdc7ef206
--- /dev/null
+++ b/lib/DipoleQuadrupole.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#include "Quadrupole.h"
+
+namespace MagnetModel {
+
+class DipoleQuadrupole : public Magnet {
+
+public:
+// Constructor and initialization
+  DipoleQuadrupole() : Magnet(0, 1, 0, 0) {}
+
+  int init(bool focusing, double scale, std::string strength_file_name, std::string param_file_name,
+           std::string dipole_strength_file_name,std::string matrix_file_name, std::string mag_s_n);
+
+  // Implementation of virtual methods (described in Magnet.h)
+  bool has_main_current();
+  void get_strength_names(std::vector<std::string> &names);
+  void get_strength_units(std::vector<std::string> &units);
+  void compute_strengths(double magnet_rigidity_inv, std::vector<double> &in_currents, std::vector<double> &out_strengths);
+  void compute_currents(double magnet_rigidity, std::vector<double> &in_strengths, std::vector<double> &out_currents);
+  void compute_pseudo_currents_from_currents(std::vector<double>& in_currents,std::vector<double>& out_currents) {};
+  void compute_strength_from_pseudo(double magnet_rigidity_inv,int idx,double& in_current,double& out_strength) {};
+
+private:
+  bool focusing;
+  Magnet dipole;
+  Eigen::MatrixXd M;  // Pseudo current matrix
+  Eigen::MatrixXd Mp; // Pseudo current inverse matrix
+
+};
+
+} // end namespace MagnetModel
\ No newline at end of file
diff --git a/lib/Interpolation.cpp b/lib/Interpolation.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e92011509b7e4fecc49e587e45a31d69847336da
--- /dev/null
+++ b/lib/Interpolation.cpp
@@ -0,0 +1,379 @@
+#include "Interpolation.h"
+#include <algorithm>
+#include "math.h"
+#include <iostream>
+
+namespace MagnetModel {
+
+//-----------------------------------------------------
+// Constructor
+Interpolation::Interpolation() {
+	points.clear();
+	linear_coefs.clear();
+	spline_coefs.clear();
+}
+
+//-----------------------------------------------------
+// Constructor
+Interpolation::Interpolation(std::vector<double> x, std::vector<double> y) {
+	
+	// Set the points, etc.
+	set_points(x, y);
+}
+
+//-----------------------------------------------------
+// Set and sort the points
+// Pre-compute the slopes for linear interpolation
+int Interpolation::set_points(std::vector<double> x, std::vector<double> y) {
+	
+	// Clear previous points
+	points.clear();
+
+	// Build the set of points
+	int n = x.size();
+	for (int k = 0; k < n; k++) {
+		std::vector<double> point_k;
+		point_k.push_back(x[k]);
+		point_k.push_back(y[k]);
+		points.push_back(point_k);
+	}
+	
+	
+	/*std::cout <<"===============\n";
+	double x0 = points[0][0];
+	double y0 = points[0][1];	
+	std::cout<<"x: "<< x0 << ", y:"<< y0 <<"\n";*/
+
+	// Sort the points in increasing x values
+	sort_points(points);
+
+	/*std::cout <<"------------\n";
+	x0 = points[0][0];
+	y0 = points[0][1];	
+	std::cout<<"x: "<< x0 << ", y:"<< y0 <<"\n";*/
+
+	// Compute the slopes
+	set_linear_coefs();
+
+	// Compute spline coefficients
+	set_spline_coefs();
+	
+	return 0;
+}
+
+//-----------------------------------------------------
+// Initialize the coefficients (i.e. slopes) for the linear interpolations
+int Interpolation::set_linear_coefs() {
+
+	// Initialize
+	int n = points.size() - 1;
+	linear_coefs.clear();
+
+	// Compute the slopes
+	for(int i = 0; i < n; i++)
+		linear_coefs.push_back((points[i + 1][1] - points[i][1]) / (points[i + 1][0] - points[i][0]));
+
+	return 0;
+}
+
+//-----------------------------------------------------
+// Initialize the coefficients for spline interpolation
+// Adapted from https://kluge.in-chemnitz.de/opensource/spline/
+int Interpolation::set_spline_coefs() {
+
+	// Initialize
+	int n = points.size();
+	Eigen::MatrixXd m = Eigen::MatrixXd::Zero(n, n);
+	Eigen::MatrixXd u(n, 1);
+	
+	// Fill the matrix and vectors
+	for (int i = 1; i < n - 1; i++) {
+		// Tri-diagonal matrix
+		m(i, i - 1) = 1. / 3. * (points[i][0] - points[i - 1][0]);
+		m(i, i) = 2. / 3. * (points[i + 1][0] - points[i - 1][0]);
+		m(i, i + 1) = 1. / 3. * (points[i + 1][0] - points[i][0]);
+		// Vector
+		u(i) = (points[i + 1][1] - points[i][1]) / (points[i + 1][0] - points[i][0])
+					- (points[i][1] - points[i - 1][1]) / (points[i][0] - points[i - 1][0]);
+	}
+	// Boundary conditions
+	m(0, 0) = 2.;
+	m(0, 1) = 0;
+	m(n - 1, n - 1) = 2.;
+	m(n - 1, n - 2) = 0;
+	u(0) = 0;
+	u(n - 1) = 0;
+
+	// Compute the quadratic coefficients from the inverse of m
+	Eigen::VectorXd b = m.colPivHouseholderQr().solve(u);
+	
+	// Linear coefficients
+	Eigen::VectorXd c(n);
+	for (int i = 0; i < n - 1; i++)
+		c(i) = (points[i + 1][1] - points[i][1]) / (points[i + 1][0] - points[i][0]) - 1. / 3. * (2. * b(i) + b(i + 1)) * (points[i + 1][0] - points[i][0]);
+
+	// Cubic coefficients
+	Eigen::VectorXd a(n);
+	for (int i = 0; i < n - 1; i++)
+		a(i) = 1. / 3. * (b(i + 1) - b(i)) / (points[i + 1][0] - points[i][0]);
+
+	// Compute the last coefficients from boundary conditions
+	double h = points[n - 1][0] - points[n - 2][0];
+	a(n - 1) = 0;
+	c(n - 1) = 3. * a(n - 2) * h * h + 2. * b(n - 2) * h + c(n - 2);
+
+	// Set the spline coefficients
+	spline_coefs.clear();
+	for (int i = 0; i < n - 1; i++) {
+		std::vector<double> coef_i;
+		coef_i.push_back(a(i));
+		coef_i.push_back(b(i));
+		coef_i.push_back(c(i));
+		spline_coefs.push_back(coef_i);
+	}
+
+	return 0;
+}
+
+//-----------------------------------------------------
+int Interpolation::find_interval(double x) {
+
+	// Find the interval [x_i, x_i+1]
+	// binary search, right most item.
+	int R = points.size();
+	int L = 0;
+	int m;
+
+	while(L<R) {
+		m = (L + R) / 2;
+		if( x < points[m][0] ) {
+			R = m;
+		} else {
+			L = m + 1;
+		}
+	}
+	
+	return (R<=0)?0:(R-1);
+
+}
+
+//-----------------------------------------------------
+// Linear interpolation at x
+double Interpolation::linear(double x) {
+
+	// Find the interval [x_i, x_i+1]
+	int i = find_interval(x);
+
+	// Linear interpolation
+  if(i==points.size()-1)
+    // Linear extrapolation at the end
+    i--;
+
+  return (x - points[i][0]) * linear_coefs[i] + points[i][1];
+
+}
+
+//-----------------------------------------------------
+// Derivative of the linear interpolation at x
+double Interpolation::linear_derivative(double x) {
+
+	// Find the interval [x_i, x_i+1]
+	int i = find_interval(x);
+
+  if(i==points.size()-1)
+    // Linear extrapolation at the end
+    i--;
+
+	// Return the slope
+	return linear_coefs[i];
+
+}
+
+//-----------------------------------------------------
+// Spline interpolation at x
+double Interpolation::spline(double x) {
+
+	// Find the interval [x_i, x_i+1]
+	int n = points.size() - 1;
+	int i = find_interval(x);
+
+	// Spline interpolation
+	double y;
+	if (x < points[0][0])
+		// Linear interpolation if x < x_0
+		y = (x - points[0][0]) * linear_coefs[0] + points[0][1];
+	else if (x < points[n][0])	
+		// Spline interpolation
+		y = spline_coefs[i][0] * (x - points[i][0]) * (x - points[i][0]) * (x - points[i][0]) + spline_coefs[i][1] * (x - points[i][0]) * (x - points[i][0])
+				+ spline_coefs[i][2] * (x - points[i][0]) + points[i][1];
+	else 
+		// Linear interpolation if x > x_N-1
+		y = (x - points[n][0]) * linear_coefs[n-1] + points[n][1];
+
+	return y;
+}
+
+//-----------------------------------------------------
+// Derivative ofthe spline interpolation at x
+double Interpolation::spline_derivative(double x) {
+
+	// Find the interval [x_i, x_i+1]
+	int n = points.size() - 1;
+	int i = find_interval(x);
+
+	// Derivative of the spline interpolation
+	double dy_dx;
+	if (x < points[0][0])
+		// Linear interpolation if x < x_0
+		dy_dx = linear_coefs[0];
+	else if (x < points[n][0])
+		// Spline interpolation
+		dy_dx = 3 * spline_coefs[i][0] * (x - points[i][0]) * (x - points[i][0]) + 2 * spline_coefs[i][1] * (x - points[i][0]) + spline_coefs[i][2];
+	else
+		// Linear interpolation if x > x_N-1
+		dy_dx = linear_coefs[n - 1];
+
+	return dy_dx;
+}
+
+//-----------------------------------------------------
+// Sort the points in increasing x order
+void Interpolation::sort_points(std::vector<std::vector<double>> & v) {
+
+	// Define a lamba for comparing the points
+	auto comp = [](std::vector<double> xy_1, std::vector<double> xy_2) { return (xy_1[0] < xy_2[0]); };
+
+	// Sort increasing x values
+	std::stable_sort(v.begin(), v.end(), comp);	
+	
+}
+
+//-----------------------------------------------------
+// Return inverse curve
+Interpolation Interpolation::inverse() {
+  std::vector<double> x;
+  std::vector<double> y;
+  for (size_t k = 0; k < points.size(); k++) {
+    x.emplace_back(points[k][0]);
+    y.emplace_back(points[k][1]);
+  }
+  return Interpolation(y, x);
+}
+
+
+//-----------------------------------------------------
+// Constructor
+NInterpolation::NInterpolation() {
+	x_values.clear();
+	y_values.clear();
+	n_interpolation.clear();
+	r = 0;
+	c = 0;
+}
+
+//-----------------------------------------------------
+// Constructor
+NInterpolation::NInterpolation(std::vector<double> x, std::vector<Eigen::MatrixXd> y) {
+
+	set_points(x, y);
+}
+
+//-----------------------------------------------------
+// Initialize a set of interpolation functions
+int NInterpolation::set_points(std::vector<double> x, std::vector<Eigen::MatrixXd> y) {
+	
+	// Initialize x values
+	x_values = x;
+
+	// Initialize y values
+	y_values = y;
+
+	// Initialize interpolation functions
+	n_interpolation.clear();
+	c = y[0].cols();
+	r = y[0].rows();
+	int n = x_values.size();
+	// For each function
+	for (int i = 0; i < r; i++) 
+		for (int j = 0; j < c; j++) {
+			// Initialize a vector
+			std::vector<double> v;
+			v.clear();
+			// Get the values at each current
+			for (int k = 0; k < n; k++)
+				v.push_back(y[k](i, j));
+			// Build and store the interpolation function
+			Interpolation interp(x, v);
+			n_interpolation.push_back(interp);
+		}
+	
+	return 0;
+}
+
+//-----------------------------------------------------
+// Spline interpolation at x
+Eigen::MatrixXd NInterpolation::spline(double x) {
+
+	// Initialize
+	Eigen::MatrixXd m;
+	m.resize(r, c);
+	
+	// Spline interpolation
+	spline(x, m);
+
+	// Return the N dimensional value at x
+	return m;
+}
+
+//-----------------------------------------------------
+// Spline interpolation at x
+int NInterpolation::spline(double x, Eigen::MatrixXd& m) {
+
+	// Check that m is compatible
+	if ((m.rows() != r) || (m.cols() != c)) return -1;
+
+	// Spline interpolation
+	int k = 0;
+	for (int i = 0; i < r; i++)
+		for (int j = 0; j < c; j++) {
+			m(i, j) = n_interpolation[k].spline(x);
+			k++;
+		}
+
+	return 0;
+}
+
+//-----------------------------------------------------
+// Linear interpolation at x
+Eigen::MatrixXd NInterpolation::linear(double x) {
+
+	// Initialize
+	Eigen::MatrixXd m;
+	m.resize(r, c);
+
+	// Spline interpolation
+	linear(x, m);
+
+	// Return the N dimensional value at x
+	return m;
+}
+
+//-----------------------------------------------------
+// Linear interpolation at x
+int NInterpolation::linear(double x, Eigen::MatrixXd& m) {
+
+	// Check that m is compatible
+	if ((m.rows() != r) || (m.cols() != c)) return -1;
+
+	// Spline interpolation
+	int k = 0;
+	for (int i = 0; i < r; i++)
+		for (int j = 0; j < c; j++) {
+			m(i, j) = n_interpolation[k].linear(x);
+			k++;
+		}
+
+	return 0;
+}
+
+} // end namespace MagnetModel
diff --git a/lib/Interpolation.h b/lib/Interpolation.h
new file mode 100644
index 0000000000000000000000000000000000000000..463339b510ef3263363a0916dca37ad926e491ab
--- /dev/null
+++ b/lib/Interpolation.h
@@ -0,0 +1,68 @@
+#pragma once
+
+#include <vector>
+#include <iostream>
+#include <Eigen/Dense>
+
+namespace MagnetModel {
+
+// --- Single interpolation function
+class Interpolation {
+
+public:
+	// Constructors
+	Interpolation();
+	Interpolation(std::vector<double> x, std::vector<double> y);
+	// Set points
+	int set_points(std::vector<double> x, std::vector<double> y);
+	// Sort the points in increasing x order
+	void sort_points(std::vector<std::vector<double>> & v);
+	// Initialize the coefficients for linear interpolation
+	int set_linear_coefs();
+	// Initialize the coefficients for spline interpolation
+	int set_spline_coefs();
+	// Linear interpolation
+	double linear(double x);
+	// Spline interpolation
+	double spline(double x);
+	// Derivative of the linear interpolation
+	double linear_derivative(double x);
+	// Derivative of the spline interpolation
+	double spline_derivative(double x);
+	// Return inverse curve
+	Interpolation inverse();
+	
+private:
+	// Find the interval [x_i, x_i+1]
+	int find_interval(double x);
+	std::vector<std::vector<double>> points;		// ((x_0, y_0), (x_1, y_1), ...)
+	std::vector<double> linear_coefs;				// Coefficients (slopes) for linear interpolation
+	std::vector<std::vector<double>> spline_coefs;	// Coefficients for spline interpolation
+};
+
+// --- Interpolate several functions evaluated at the same x value,
+//        ie a N dimensional function of x
+class NInterpolation {
+
+public:
+	// Constructors
+	NInterpolation();
+	NInterpolation(std::vector<double> x, std::vector<Eigen::MatrixXd> y);
+	// Set points
+	int set_points(std::vector<double> x, std::vector<Eigen::MatrixXd> y);
+	// Linear interpolation
+	Eigen::MatrixXd linear(double x);
+	int linear(double x, Eigen::MatrixXd& m);
+	// Spline interpolation
+	Eigen::MatrixXd spline(double x);
+	int spline(double x, Eigen::MatrixXd & m);
+
+private:
+	std::vector<double> x_values;				// x values
+	std::vector<Eigen::MatrixXd> y_values;		// y values
+	std::vector<Interpolation> n_interpolation;	// interpolation functions
+	int r;										// number rows
+	int c;										// number of columns
+};
+
+} // end namespace MagnetModel
diff --git a/lib/Magnet.cpp b/lib/Magnet.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9b05b5c28993df5a2aeee40397e221476a2c1901
--- /dev/null
+++ b/lib/Magnet.cpp
@@ -0,0 +1,483 @@
+#include "Magnet.h"
+
+namespace MagnetModel {
+
+//-----------------------------------------------------
+// Constructor 
+Magnet::Magnet()
+{
+	current_main = 0;	
+	current_corr.assign(1, 0);	
+	Multipole multi;
+	multipole = multi;
+	magnet_type = "unknown";
+	solver_max_iter = 20;
+	solver_tolerance = 1e-9;
+	scale = 1.0;
+	offset = 0.0;
+}
+
+//-----------------------------------------------------
+// Constructor 
+Magnet::Magnet(double curr_main, int n_corr, int n_multi)
+{
+	current_main = curr_main;	
+	current_corr.assign(n_corr, 0);	
+	Multipole multi(n_multi);
+	multipole = multi;
+	magnet_type = "unknown";
+	solver_max_iter = 20;
+	solver_tolerance = 1e-9;
+	scale = 1.0;
+	offset = 0.0;
+}
+
+//-----------------------------------------------------
+// Constructor 
+Magnet::Magnet(double curr_main, int n_corr, int n_multi, double r)
+{
+	current_main = curr_main;	
+	current_corr.assign(n_corr, 0);	
+	Multipole multi(n_multi, r);
+	multipole = multi;
+	magnet_type = "unknown";
+	solver_max_iter = 20;
+	solver_tolerance = 1e-9;
+	scale = 1.0;
+	offset = 0.0;
+}
+
+//-----------------------------------------------------
+// Set main magnet current [A]
+int Magnet::set_current_main(double curr_main) 
+{
+	current_main = curr_main;
+	return 0;
+}
+
+//-----------------------------------------------------
+// Get main magnet current [A]
+double Magnet::get_current_main() 
+{
+	return current_main;
+}
+
+//-----------------------------------------------------
+// Set corrector magnet currents [A]
+int Magnet::set_current_corr(const std::vector<double>& curr_corr)
+{
+	current_corr = curr_corr;
+	return 0;
+}
+
+//-----------------------------------------------------
+// Get corrector magnet currents [A]
+std::vector<double> Magnet::get_current_corr() 
+{
+	return current_corr;
+}
+
+//-----------------------------------------------------
+// Return corrector number
+size_t Magnet::get_corrector_number() {
+	return current_corr.size();
+}
+
+//-----------------------------------------------------
+// Same as above, using references
+int Magnet::get_current_corr(std::vector<double>& curr_corr) {
+	
+	curr_corr = current_corr;
+	return 0;
+}
+
+//-----------------------------------------------------
+// Set magnet type
+int Magnet::set_magnet_type(std::string m_type_str)
+{
+	magnet_type = m_type_str;
+	return 0;
+}
+
+//-----------------------------------------------------
+// Get magnet type
+std::string Magnet::get_magnet_type()
+{
+	return magnet_type;
+}
+
+//-----------------------------------------------------
+// Set multipoles
+int Magnet::set_multipoles(const Multipole& multi) 
+{
+	multipole = multi;
+	return 0;
+}
+//-----------------------------------------------------
+// Get multipoles
+Multipole Magnet::get_multipoles() 
+{
+	return multipole;
+}
+//-----------------------------------------------------
+// Get multipoles
+int Magnet::get_multipoles(Multipole& multi)
+{
+	multi = multipole;
+	return 0;
+}
+
+//-----------------------------------------------------
+// Set the multipole strengths from the a and b vector
+int Magnet::set_multipole_strengths(const std::vector<double>& a, const std::vector<double>& b) 
+{
+	multipole.set_an(a);
+	multipole.set_bn(b);
+	return 0;
+}
+
+//-----------------------------------------------------
+// Set the magnet scale
+int Magnet::set_scale(double s)
+{
+	scale = s;
+	return 0;
+}
+//-----------------------------------------------------
+// Get the magnet scale
+double Magnet::get_scale()
+{
+	return scale;
+}
+
+//-----------------------------------------------------
+// Set the magnet offset
+int Magnet::set_offset(double o)
+{
+	offset = o;
+	return 0;
+}
+
+//-----------------------------------------------------
+// Get the magnet offset
+double Magnet::get_offset()
+{
+	return offset;
+}
+
+//-----------------------------------------------------
+// pseudo current offset (for DQ mdoel)
+double Magnet::get_pseudo_current_offset() {
+  return pseudo_current_offset;
+}
+
+
+//-----------------------------------------------------
+// Load a matrix from a file
+int Magnet::load_matrix(std::string file_name,int row,int col,Eigen::MatrixXd &m) {
+
+  // --- Init
+  std::ifstream file;
+
+  // --- open parameter file
+  file.open(file_name);
+  // Check if file does not exist
+  if (!file)
+    throw std::invalid_argument(get_magnet_type()+"::load_matrix() "+file_name+" file not found");
+
+  // --- Read the file
+  int r = 0;
+  std::vector<double> data;
+  while (!file.eof() && r<row) {
+
+    // Get a line from the file
+    std::string line;
+    std::getline(file,line);
+
+    // Skip comment and empty line
+    if(line.empty() || line[0]=='#')
+      continue;
+
+    std::vector<std::string> items;
+    split(items,line,',');
+    if(items.size()!=col) {
+      file.close();
+      throw std::invalid_argument(
+              get_magnet_type()+"::load_matrix() " + file_name + " " + std::to_string(col) + " items per line expected");
+    }
+    try {
+      for(int i=0;i<items.size();i++)
+        data.push_back(std::stod(items[i]));
+    } catch (std::exception& e) {
+      throw std::invalid_argument(
+              get_magnet_type()+"::load_matrix() " + file_name + " incorrect number in " + line);
+    }
+
+  }
+
+  // --- Close the file
+  file.close();
+
+  if(data.size()!=row*col)
+    throw std::invalid_argument(
+            get_magnet_type()+"::load_matrix() " + file_name + " " + std::to_string(row) + "x" + std::to_string(col) + " matrix expected");
+
+  // Set the matrix
+  m = Eigen::Map<Eigen::Array<double, -1, -1, Eigen::RowMajor>>(data.data(),row,col);
+
+  // --- Return without error
+  return 0;
+
+}
+
+//-----------------------------------------------------
+// Load an excitation curve
+int Magnet::set_excitation_from_file(std::string file_name)
+{
+  // --- Init
+  std::ifstream file;
+
+  // --- open parameter file
+  file.open(file_name);
+  // Check if file does not exist
+  if (!file)
+    throw std::invalid_argument(get_magnet_type()+"::set_excitation_from_file() "+file_name+" file not found");
+
+  // --- Read the file
+  std::vector<double> x;
+  std::vector<double> y;
+  double scale = get_scale();
+  double offset = get_offset();
+
+  while (!file.eof()) {
+
+    // Get a line from the file
+    std::string line;
+    std::getline(file,line);
+
+    // Skip comment and empty line
+    if(line.empty() || line[0]=='#')
+      continue;
+
+    std::vector<std::string> items;
+    split(items,line,',');
+    if(items.size()!=2) {
+      file.close();
+      throw std::invalid_argument(
+              get_magnet_type()+"::set_excitation_from_file() " + file_name + " 2 items per line expected");
+    }
+    try {
+      x.push_back(std::stod(items[0]));
+      y.push_back(std::stod(items[1]) * scale + offset);
+    } catch (std::exception& e) {
+      throw std::invalid_argument(
+              get_magnet_type()+"::set_excitation_from_file() " + file_name + " incorrect number in " + line);
+    }
+
+  }
+
+  // --- Close the file
+  file.close();
+
+  // Set the excitation curve
+  Interpolation ex_curve(x, y);
+  set_excitation_curve(ex_curve);
+
+  // --- Return without error
+  return 0;
+
+}
+
+//-----------------------------------------------------
+// Set the magnet parameters using a configuration file
+int Magnet::set_params_from_file(std::string file_name, std::string mag_s_n) {
+	
+	// --- Init 
+	std::ifstream file;
+	std::string param;
+	bool s_n_found = false;
+
+	// --- open parameter file
+	file.open(file_name);
+	// Check if file does not exist
+	if (!file)
+		throw std::invalid_argument("Magnet::set_params_from_file() "+file_name+" file not found");
+
+	while (!file.eof() && !s_n_found) {
+		std::string line;
+		std::getline(file,line);
+
+		// Skip comment and empty line
+		if(line.empty() || line[0]=='#')
+			continue;
+
+		std::vector<std::string> items;
+		split(items,line,',');
+		if(items.size()!=5) {
+			file.close();
+			throw std::invalid_argument("Magnet::set_params_from_file() " + file_name +
+				" 5 items per line expected (serial,scale,offset,radius,pscurroffset)");
+		}
+
+		// Check the serial number
+		if (!items[0].compare(mag_s_n)) {
+			s_n_found = true;
+			// Set serial number
+			try {
+				serial_number = mag_s_n; 
+				// Read scale
+				scale = std::stod(items[1]);
+				// Read offset
+				offset = std::stod(items[2]);
+				// Read reference radius
+				multipole.set_radius(std::stod(items[3]));
+				// Read pseudo current offset
+				pseudo_current_offset = std::stod(items[4]);
+			} catch (std::exception& e) {
+				throw std::invalid_argument( get_magnet_type()+"::set_params_from_file() " + file_name + " incorrect number in " + line);
+			}
+
+		}
+	}
+
+	// Close the file
+	file.close();
+
+	// If the specified S/N does not exits
+	if (!s_n_found)
+		throw std::invalid_argument("Magnet::set_params_from_file() "+mag_s_n+" not found in " + file_name);
+
+	// --- Return without error
+	return 0;
+}
+
+//-----------------------------------------------------
+// Set the excitation curve
+int Magnet::set_excitation_curve(Interpolation ex_curve) {
+
+	excitation_curve = ex_curve;
+	rexcitation_curve = ex_curve.inverse();
+	return 0;
+}
+//-----------------------------------------------------
+// Get the excitation curve
+Interpolation Magnet::get_excitation_curve() {
+
+	return excitation_curve;
+}
+
+//-----------------------------------------------------
+// Get the excitation 
+// WARNING: using this function, the impact of the corrector currents is not taken into account
+double Magnet::get_excitation() {
+
+	return excitation_curve.spline(current_main);
+}
+
+//-----------------------------------------------------
+// Get the excitation for a given current
+double Magnet::get_excitation(double curr_main) {
+
+	return excitation_curve.spline(curr_main);
+
+}
+
+//-----------------------------------------------------
+// Get the excitation 
+// WARNING: using this function, the impact of the corrector currents is not taken into account
+double Magnet::get_excitation_linear() {
+
+	return excitation_curve.linear(current_main);
+}
+
+//-----------------------------------------------------
+// Get the excitation for a given current
+double Magnet::get_excitation_linear(double curr_main) {
+
+	return excitation_curve.linear(curr_main);
+
+}
+
+//-----------------------------------------------------
+// Solve the current for the given strength
+double Magnet::solve_main_strength_linear(double target_strength) {
+	return rexcitation_curve.linear(target_strength);
+}
+
+//-----------------------------------------------------
+// Solve the current for the given strength using the Newton's method
+double Magnet::solve_main_strength(double target_strength) {
+
+	// Initial current
+	double i_k = current_main;
+	double strength_k;
+
+	// Iterate
+	for (int k = 0; k < solver_max_iter; k++) {
+		// New value for the current
+		strength_k = excitation_curve.spline(i_k);
+		i_k -= (strength_k - target_strength) / excitation_curve.spline_derivative(i_k);
+		// Convergence test
+		if (abs(strength_k - target_strength) < solver_tolerance) break;
+	}
+
+	return i_k;
+
+}
+
+//-----------------------------------------------------
+// Set the solver tolerance
+int Magnet::set_solver_tolerance(double eps) {
+	solver_tolerance = eps;
+	return 0;
+}
+
+//-----------------------------------------------------
+// Get the solver tolerance
+double Magnet::get_solver_tolerance() {
+	return solver_tolerance;
+}
+
+//-----------------------------------------------------
+// Set the solver maximum number of iterations
+int Magnet::set_solver_max_iterations(int max_iter) {
+	solver_max_iter = max_iter;
+	return 0;
+}
+
+//-----------------------------------------------------
+// Get the solver maximum number of iterations
+int Magnet::get_solver_max_iterations() {
+	return solver_max_iter;
+}
+
+//-----------------------------------------------------
+// Split given string into tokens using specified separator
+std::string trim(const std::string &s)
+{
+  auto start = s.begin();
+  while (start != s.end() && std::isspace(*start))
+    start++;
+  auto end = s.end();
+  do {
+    end--;
+  } while (std::distance(start, end) > 0 && std::isspace(*end));
+
+  return std::string(start, end + 1);
+}
+
+void Magnet::split(std::vector<std::string> &tokens, const std::string &text, char sep) {
+
+  size_t start = 0, end = 0;
+  tokens.clear();
+
+  while ((end = text.find(sep, start)) != std::string::npos) {
+    tokens.push_back(trim(text.substr(start, end - start)));
+    start = end + 1;
+  }
+
+  tokens.push_back(trim(text.substr(start)));
+
+}
+
+} // end namespace MagnetModel
\ No newline at end of file
diff --git a/lib/Magnet.h b/lib/Magnet.h
new file mode 100644
index 0000000000000000000000000000000000000000..e73a94992b1d941f5940207fcaab92b49452a701
--- /dev/null
+++ b/lib/Magnet.h
@@ -0,0 +1,107 @@
+#pragma once
+
+#include <vector>
+#include <iostream>
+#include <fstream>
+#include <string>
+#include "Multipole.h"
+#include "Interpolation.h"
+#include <cmath>
+
+namespace MagnetModel {
+
+class Magnet 
+{
+public:
+	// --- Constructors
+	Magnet();
+	Magnet(double curr_main, int n_corr, int n_multi);
+	Magnet(double curr_main, int n_corr, int n_multi, double r);
+	// --- Set and get attributes
+	// Main current
+	int set_current_main(double curr_main);
+	double get_current_main();
+	// Corrector currents
+	int set_current_corr(const std::vector<double>& curr_corr);
+	std::vector<double> get_current_corr();
+	int get_current_corr(std::vector<double>& curr_corr);
+	size_t get_corrector_number();
+	// Magnet type
+	int set_magnet_type(std::string m_type_str);
+	std::string get_magnet_type();
+	// Multipoles
+	int set_multipoles(const Multipole& multi);
+	Multipole get_multipoles();
+	int get_multipoles(Multipole&  multi);
+	int set_multipole_strengths(const std::vector<double>& a, const std::vector<double>& b);
+	// Scale
+	int set_scale(double s);
+	double get_scale();
+	// Offset
+	int set_offset(double o);
+	double get_offset();
+	// pseudo current offset (for DQ mdoel)
+	double get_pseudo_current_offset();
+	// Laod a matrix from a file
+	int load_matrix(std::string file_name,int row,int col,Eigen::MatrixXd &m);
+	// Load magnet parameters from file
+	int set_params_from_file(std::string file_name, std::string mag_s_n);
+	// Load excitation curve
+	int set_excitation_from_file(std::string file_name);
+	// Set excitation curve
+	int set_excitation_curve(Interpolation ex_curve);
+	// Get excitation curve
+	Interpolation get_excitation_curve();
+	// Read excitation value
+	double get_excitation();
+	// Read excitation value
+	double get_excitation(double curr_main);
+	// Read excitation value
+	double get_excitation_linear();
+	// Read excitation value
+	double get_excitation_linear(double curr_main);
+	// Solve the current for the given strength
+	double solve_main_strength(double target_strength);
+	// Solve the current for the given strength
+	double solve_main_strength_linear(double target_strength);
+	// Set the tolerance of the solver
+	int set_solver_tolerance(double eps);
+	// Get the solver tolerance
+	double get_solver_tolerance();
+	// Set the maximum number of iterations
+	int set_solver_max_iterations(int max_iter);
+	// Get the maximum number of iterations
+	int get_solver_max_iterations();
+	// Return true if model has a main current
+	virtual bool has_main_current() { return true; };
+	// Return strength names (main,skew,h,v)
+	virtual void get_strength_names(std::vector<std::string>& names) {};
+	// Return strength unit (rad,m-1,m-2,m-3)
+	virtual void get_strength_units(std::vector<std::string>& units) {};
+	// Compute strength(s) from current(s) in standard unit
+	virtual void compute_strengths(double magnet_rigidity_inv,std::vector<double>& in_currents,std::vector<double>& out_strengths) {};
+	// Compute current(s) from strength(s)
+	virtual void compute_currents(double magnet_rigidity,std::vector<double>& in_strengths,std::vector<double>& out_currents) {};
+  // Compute pseudo currents from currents (SH Only)
+  virtual void compute_pseudo_currents_from_currents(std::vector<double>& in_currents,std::vector<double>& out_currents) {};
+  // Compute strength from pseudo currents (SH Only, idx=0 for H,idx=0 for V,idx=0 for SQ,idx=3 for SEXT)
+  virtual void compute_strength_from_pseudo(double magnet_rigidity_inv,int idx,double& in_current,double& out_strength) {};
+
+private:
+	std::string serial_number;		// Magnet serial number
+	std::string magnet_type;		// Magnet type
+	double current_main;			// Main magnet current	
+	std::vector<double> current_corr;	// Corrector currents (the number of channels depends on the magnet type)
+	Multipole multipole;			// Field multipoles, used for strength computations
+	double scale;				// Scale to be applied to the excitation curve (calibration)
+	double offset;				// field offset (hysteresis)
+	double pseudo_current_offset;		// For DQ model
+	Interpolation excitation_curve;		// Excitation curve
+	Interpolation rexcitation_curve;	// Inverse Excitation curve
+	double solver_tolerance;
+	int solver_max_iter;
+protected:
+	void split(std::vector<std::string> &tokens, const std::string &text, char sep);
+};
+
+} // end namespace MagnetModel
diff --git a/lib/Multipole.cpp b/lib/Multipole.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d478bfa0d51104e8d7f8c6afc210d120935510f3
--- /dev/null
+++ b/lib/Multipole.cpp
@@ -0,0 +1,98 @@
+#include "Multipole.h"
+
+namespace MagnetModel {
+
+//-----------------------------------------------------
+// Constructor 
+Multipole::Multipole()
+{
+	radius = 10;				// Reference radius
+	an.assign(1, 0);			// Skew multipoles
+	bn.assign(1, 0);			// Normal multipoles
+}
+//-----------------------------------------------------
+// Constructor 
+Multipole::Multipole(int n)
+{
+	radius = 10;				// Reference radius
+	an.assign(n, 0);			// Skew multipoles
+	bn.assign(n, 0);			// Normal multipoles
+}
+//-----------------------------------------------------
+// Constructor 
+Multipole::Multipole(int n, double r)
+{
+	radius = r;					// Reference radius
+	an.assign(n, 0);			// Skew multipoles
+	bn.assign(n, 0);			// Normal multipoles
+}
+
+//-----------------------------------------------------
+// Get the reference radius
+double Multipole::get_radius() {
+	return radius;
+}
+
+//-----------------------------------------------------
+// Get the reference radius
+int Multipole::set_radius(double r) {
+	radius = r;
+	return 0;
+}
+
+//-----------------------------------------------------
+// Get the skew multipoles  
+std::vector<double> Multipole::get_an() {
+	return an;
+}
+
+//-----------------------------------------------------
+// Get the skew multipoles  
+int Multipole::get_an(std::vector<double>& a) {
+	a = an;
+	return 0;
+}
+//-----------------------------------------------------
+// Get the normal multipoles  
+std::vector<double> Multipole::get_bn() {
+	return bn;
+};
+
+//-----------------------------------------------------
+// Get the normal multipoles  
+int Multipole::get_bn(std::vector<double>& b) {
+	b = bn;
+	return 0;
+}
+
+//-----------------------------------------------------
+// Get the normal and skew  multipoles  
+int Multipole::get_an_bn(std::vector<double>& a, std::vector<double>& b) {
+	a = an;
+	b = bn;
+	return 0;
+};
+
+//-----------------------------------------------------
+// Set the skew multipoles
+int Multipole::set_an(const std::vector<double>& a) {
+	an = a;
+	return 0;
+}
+
+//-----------------------------------------------------
+// Set the skew multipoles
+int Multipole::set_bn(const std::vector<double>& b) {
+	bn = b;
+	return 0;
+};
+
+// ---------------------------------------------------- -
+// Set the normal and skew  multipoles  
+int Multipole::set_an_bn(const std::vector<double>& a, const std::vector<double>& b) {
+	an = a;
+	bn = b;
+	return 0;
+};
+
+} // end namespace MagnetModel
\ No newline at end of file
diff --git a/lib/Multipole.h b/lib/Multipole.h
new file mode 100644
index 0000000000000000000000000000000000000000..a887748166e9bb6a29ef17888edccb2e3458c96a
--- /dev/null
+++ b/lib/Multipole.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <vector>
+
+namespace MagnetModel {
+
+class Multipole
+{
+public:
+	// --- Constructors
+	Multipole();
+	Multipole(int n);
+	Multipole(int n, double r);
+	// --- Get and set the reference radius
+	double get_radius();
+	int set_radius(double r);
+	// --- Get and set the multipoles
+	std::vector<double> get_an();
+	std::vector<double> get_bn();
+	int get_an(std::vector<double>& a);
+	int get_bn(std::vector<double>& b);
+	int get_an_bn(std::vector<double>& a, std::vector<double>& b);
+	int set_an(const std::vector<double>& a);
+	int set_bn(const std::vector<double>& b);
+	int set_an_bn(const std::vector<double>& a, const std::vector<double>& b);
+
+private:
+	double radius;			// Reference radius [mm]
+	std::vector<double> an;	// Skew multipole values at reference radius [Tmm]
+	std::vector<double> bn; // Normal multipole values at reference radius [Tmm]
+};
+
+} // end namespace MagnetModel
\ No newline at end of file
diff --git a/lib/Octupole.cpp b/lib/Octupole.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..bab24871680a26f9d872eab816141ba569a43953
--- /dev/null
+++ b/lib/Octupole.cpp
@@ -0,0 +1,72 @@
+#include "Octupole.h"
+
+namespace MagnetModel {
+
+//-----------------------------------------------------
+// Init a Octupole
+int Octupole::init(bool focusing,double scale,std::string strength_file_name, std::string param_file_name, std::string mag_s_n) {
+
+  // Magnet type
+  set_magnet_type("octupole");
+  this->focusing = focusing;
+
+  // Initialize scales, offsets, etc.
+  set_params_from_file(param_file_name, mag_s_n);
+  set_scale( scale * get_scale()  );
+
+  // Initialize the excitation curve
+  set_excitation_from_file(strength_file_name);
+
+  return 0;
+
+}
+
+bool Octupole::has_main_current() {
+  return true;
+}
+
+void Octupole::get_strength_names(std::vector<std::string>& names) {
+  // The following names are used to create Tango attributes
+  names.clear();
+  names.push_back("Strength");
+}
+
+void Octupole::get_strength_units(std::vector<std::string>& units) {
+  // The following units are used to create Tango attributes properties
+  units.clear();
+  units.push_back("m-3");
+}
+
+//-----------------------------------------------------
+// Compute strength(s) from current(s) in standard unit
+void Octupole::compute_strengths(double magnet_rigidity_inv,std::vector<double>& in_currents,std::vector<double>& out_strengths) {
+
+  if (in_currents.size() != 1)
+    throw std::invalid_argument(get_magnet_type()+"::compute_strengths() 1 currents expected");
+
+  out_strengths.resize(1);
+  if(focusing) {
+    out_strengths[0] = get_excitation_linear(in_currents[0]) * magnet_rigidity_inv;
+  } else {
+    out_strengths[0] = -get_excitation_linear(in_currents[0]) * magnet_rigidity_inv;
+  }
+
+}
+
+//-----------------------------------------------------
+// Compute current(s) from strength(s)
+void Octupole::compute_currents(double magnet_rigidity,std::vector<double>& in_strengths,std::vector<double>& out_currents) {
+
+  if (in_strengths.size() != 1)
+    throw std::invalid_argument(get_magnet_type()+"::compute_currents() 1 strengths expected");
+
+  out_currents.resize(1);
+  if(focusing) {
+    out_currents[0] = solve_main_strength_linear(in_strengths[0] * magnet_rigidity);
+  } else {
+    out_currents[0] = solve_main_strength_linear(-in_strengths[0] * magnet_rigidity);
+  }
+
+}
+
+} // end namespace MagnetModel
\ No newline at end of file
diff --git a/lib/Octupole.h b/lib/Octupole.h
new file mode 100644
index 0000000000000000000000000000000000000000..0b9aad3480d47d4ef0cd214f0ae3fcd16fc8a66c
--- /dev/null
+++ b/lib/Octupole.h
@@ -0,0 +1,28 @@
+#pragma once
+
+#include "Magnet.h"
+
+namespace MagnetModel {
+
+class Octupole: public Magnet {
+
+public:
+  // Constructor and initialization
+  Octupole() : Magnet(0, 0, 0, 0) {}
+  int init(bool focusing,double scale,std::string strength_file_name, std::string param_file_name, std::string mag_s_n);
+
+  // Implementation of virtual methods (described in Magnet.h)
+  bool has_main_current();
+  void get_strength_names(std::vector<std::string>& names);
+  virtual void get_strength_units(std::vector<std::string>& units);
+  void compute_strengths(double magnet_rigidity_inv,std::vector<double>& in_currents,std::vector<double>& out_strengths);
+  void compute_currents(double magnet_rigidity,std::vector<double>& in_strengths,std::vector<double>& out_currents);
+  void compute_pseudo_currents_from_currents(std::vector<double>& in_currents,std::vector<double>& out_currents) {};
+  void compute_strength_from_pseudo(double magnet_rigidity_inv,int idx,double& in_current,double& out_strength) {};
+
+protected:
+  bool focusing;
+
+};
+
+} // end namespace MagnetModel
\ No newline at end of file
diff --git a/lib/Quadrupole.cpp b/lib/Quadrupole.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..7d642431ffc38f00ebe9440dd47e08b8971fb5b5
--- /dev/null
+++ b/lib/Quadrupole.cpp
@@ -0,0 +1,72 @@
+#include "Quadrupole.h"
+
+namespace MagnetModel {
+
+//-----------------------------------------------------
+// Init a quadrupole
+int Quadrupole::init(bool focusing,double scale,std::string strength_file_name, std::string param_file_name, std::string mag_s_n) {
+
+  // Magnet type
+  set_magnet_type("quadrupole");
+  this->focusing = focusing;
+
+  // Initialize scales, offsets, etc.
+  set_params_from_file(param_file_name, mag_s_n);
+
+  // Initialize the excitation curve
+  set_scale(get_scale()*scale);
+  set_excitation_from_file(strength_file_name);
+
+  return 0;
+
+}
+
+bool Quadrupole::has_main_current() {
+  return true;
+}
+
+void Quadrupole::get_strength_names(std::vector<std::string>& names) {
+  // The following names are used to create Tango attributes
+  names.clear();
+  names.push_back("Strength");
+}
+
+void Quadrupole::get_strength_units(std::vector<std::string>& units) {
+  // The following units are used to create Tango attributes properties
+  units.clear();
+  units.push_back("m-1");
+}
+
+//-----------------------------------------------------
+// Compute strength(s) from current(s) in standard unit
+void Quadrupole::compute_strengths(double magnet_rigidity_inv,std::vector<double>& in_currents,std::vector<double>& out_strengths) {
+
+  if (in_currents.size() != 1)
+    throw std::invalid_argument(get_magnet_type()+"::compute_strengths() 1 currents expected");
+
+  out_strengths.resize(1);
+  if(focusing) {
+    out_strengths[0] = get_excitation_linear(in_currents[0]) * magnet_rigidity_inv;
+  } else {
+    out_strengths[0] = -get_excitation_linear(in_currents[0]) * magnet_rigidity_inv;
+  }
+
+}
+
+//-----------------------------------------------------
+// Compute current(s) from strength(s)
+void Quadrupole::compute_currents(double magnet_rigidity,std::vector<double>& in_strengths,std::vector<double>& out_currents) {
+
+  if (in_strengths.size() != 1)
+    throw std::invalid_argument(get_magnet_type()+"::compute_currents() 1 strengths expected");
+
+  out_currents.resize(1);
+  if(focusing) {
+    out_currents[0] = solve_main_strength_linear(in_strengths[0] * magnet_rigidity);
+  } else {
+    out_currents[0] = solve_main_strength_linear(-in_strengths[0] * magnet_rigidity);
+  }
+
+}
+
+} // end namespace MagnetModel
diff --git a/lib/Quadrupole.h b/lib/Quadrupole.h
new file mode 100644
index 0000000000000000000000000000000000000000..8ee3cdf7f98682ca94a924ded2098ba7f2833414
--- /dev/null
+++ b/lib/Quadrupole.h
@@ -0,0 +1,27 @@
+#pragma once
+
+#include "Magnet.h"
+
+namespace MagnetModel {
+
+class Quadrupole: public Magnet {
+
+public:
+  // Constructor and initialization
+  Quadrupole() : Magnet(0, 0, 0, 0) {}
+  int init(bool focusing,double scale,std::string strength_file_name, std::string param_file_name, std::string mag_s_n);
+
+  // Implementation of virtual methods (described in Magnet.h)
+  bool has_main_current();
+  void get_strength_names(std::vector<std::string>& names);
+  virtual void get_strength_units(std::vector<std::string>& units);
+  void compute_strengths(double magnet_rigidity_inv,std::vector<double>& in_currents,std::vector<double>& out_strengths);
+  void compute_currents(double magnet_rigidity,std::vector<double>& in_strengths,std::vector<double>& out_currents);
+  void compute_pseudo_currents_from_currents(std::vector<double>& in_currents,std::vector<double>& out_currents) {};
+  void compute_strength_from_pseudo(double magnet_rigidity_inv,int idx,double& in_current,double& out_strength) {};
+
+protected:
+  bool focusing;
+};
+
+} // end namespace MagnetModel
\ No newline at end of file
diff --git a/lib/SH3Magnet.cpp b/lib/SH3Magnet.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..ac802f2ef12fcc13ac20b31c62e479fe5d23eea6
--- /dev/null
+++ b/lib/SH3Magnet.cpp
@@ -0,0 +1,133 @@
+#include "SH3Magnet.h"
+
+namespace MagnetModel {
+
+//-----------------------------------------------------
+// Init a SH magnet (3 correctors for h,v and skew quad)
+int SH3Magnet::init(double scale,std::string h_strength_file_name, std::string v_strength_file_name,
+                    std::string sq_strength_file_name,std::string matrix_file_name) {
+
+  // Magnet type
+  set_magnet_type("sh3magnet");
+
+  // Initialise the H excitation curve
+  h.set_scale(scale);
+  h.set_excitation_from_file(h_strength_file_name);
+
+  // Initialise the V excitation curve
+  v.set_scale(scale);
+  v.set_excitation_from_file(v_strength_file_name);
+
+  // Initialise the skew quad excitation curve
+  sq.set_scale(scale);
+  sq.set_excitation_from_file(sq_strength_file_name);
+
+  // Load the matrix
+  load_matrix(matrix_file_name,3,3,M);
+
+  // Compute pseudo inverse
+  Mp = M.completeOrthogonalDecomposition().pseudoInverse();
+
+  return 0;
+
+}
+
+
+bool SH3Magnet::has_main_current() {
+  return false;
+}
+
+void SH3Magnet::get_strength_names(std::vector<std::string>& names) {
+  // The following names are used to create Tango attributes
+  names.clear();
+  names.push_back("Strength_H");
+  names.push_back("Strength_V");
+  names.push_back("Strength_SQ");
+}
+
+void SH3Magnet::get_strength_units(std::vector<std::string>& units) {
+  // The following units are used to create Tango attributes properties
+  units.clear();
+  units.push_back("rad");
+  units.push_back("rad");
+  units.push_back("m-1");
+}
+
+//-----------------------------------------------------
+// Compute strength(s) from current(s) in standard unit
+void SH3Magnet::compute_strengths(double magnet_rigidity_inv,std::vector<double>& in_currents,std::vector<double>& out_strengths) {
+
+  if (in_currents.size() != 3)
+    throw std::invalid_argument(get_magnet_type()+"::compute_strengths() 3 currents expected");
+
+  // Compute pseudo currents
+  auto mapped_currents = Eigen::Map<Eigen::VectorXd>(in_currents.data(), in_currents.size());
+  Eigen::VectorXd pI = M * mapped_currents;
+  double hSign = (pI(0)<0.0)?-1.0:1.0;
+  double vSign = (pI(1)<0.0)?-1.0:1.0;
+  double sSign = (pI(2)<0.0)?-1.0:1.0;
+
+  // Compute strengths
+  out_strengths.resize(3);
+  out_strengths[0] = hSign*h.get_excitation_linear(fabs(pI(0))) * magnet_rigidity_inv;
+  out_strengths[1] = -vSign*v.get_excitation_linear(fabs(pI(1))) * magnet_rigidity_inv;
+  out_strengths[2] = -sSign*sq.get_excitation_linear(fabs(pI(2))) * magnet_rigidity_inv;
+
+}
+
+//-----------------------------------------------------
+// Compute current(s) from strength(s)
+void SH3Magnet::compute_currents(double magnet_rigidity,std::vector<double>& in_strengths,std::vector<double>& out_currents) {
+
+  if (in_strengths.size() != 3)
+    throw std::invalid_argument(get_magnet_type()+"::compute_currents() 3 strengths expected");
+
+  // Compute pseudo currents
+  Eigen::Vector3d pI;
+  double hStrength = in_strengths[0] * magnet_rigidity;
+  double vStrength = in_strengths[1] * magnet_rigidity;
+  double sStrength = in_strengths[2] * magnet_rigidity;
+  double hSign = (hStrength<0.0)?-1.0:1.0;
+  double vSign = (vStrength<0.0)?-1.0:1.0;
+  double sSign = (sStrength<0.0)?-1.0:1.0;
+  pI(0) = hSign*h.solve_main_strength_linear(fabs(hStrength));
+  pI(1) = -vSign*v.solve_main_strength_linear(fabs(vStrength));
+  pI(2) = -sSign*sq.solve_main_strength_linear(fabs(sStrength));
+
+  out_currents.resize(3);
+  Eigen::Map<Eigen::VectorXd>(out_currents.data(),out_currents.size()) = Mp * pI;
+
+}
+
+//-----------------------------------------------------
+// Compute pseudo current(s) from current(s)
+void SH3Magnet::compute_pseudo_currents_from_currents(std::vector<double>& in_currents,std::vector<double>& out_currents) {
+
+  auto mapped_currents = Eigen::Map<Eigen::VectorXd>(in_currents.data(), in_currents.size());
+  out_currents.resize(3);
+  Eigen::Map<Eigen::VectorXd>(out_currents.data(),out_currents.size()) = M * mapped_currents;
+
+}
+
+//-----------------------------------------------------
+// Compute strength from pseudo currents (SH Only, idx=0 for H,idx=0 for V,idx=0 for SQ)
+void SH3Magnet::compute_strength_from_pseudo(double magnet_rigidity_inv,int idx,double& in_current,double& out_strength) {
+
+  double sign = (in_current<0.0)?-1.0:1.0;
+  switch(idx) {
+    case 0:
+      out_strength = sign * h.get_excitation_linear(fabs(in_current)) * magnet_rigidity_inv;
+      break;
+    case 1:
+      out_strength = - sign * v.get_excitation_linear(fabs(in_current)) * magnet_rigidity_inv;
+      break;
+    case 2:
+      out_strength = - sign * sq.get_excitation_linear(fabs(in_current)) * magnet_rigidity_inv;
+      break;
+    default:
+      throw std::invalid_argument(get_magnet_type()+"::compute_strength_from_pseudo() invalid index");
+  }
+
+}
+
+} // end namespace MagnetModel
\ No newline at end of file
diff --git a/lib/SH3Magnet.h b/lib/SH3Magnet.h
new file mode 100644
index 0000000000000000000000000000000000000000..0bc108ccb6677fa2d0e3a333f16772ac62cefb3a
--- /dev/null
+++ b/lib/SH3Magnet.h
@@ -0,0 +1,36 @@
+#pragma once
+
+#include "Magnet.h"
+
+namespace MagnetModel {
+
+class SH3Magnet : public Magnet {
+
+public:
+// Constructor and initialization
+  SH3Magnet() : Magnet(0, 3, 0, 0) {}
+
+  int init(double scale,std::string h_strength_file_name, std::string v_strength_file_name,
+           std::string sq_strength_file_name,std::string matrix_file_name);
+
+  // Implementation of virtual methods (described in Magnet.h)
+  bool has_main_current();
+  void get_strength_names(std::vector<std::string> &names);
+  void get_strength_units(std::vector<std::string> &units);
+  void compute_strengths(double magnet_rigidity_inv, std::vector<double> &in_currents, std::vector<double> &out_strengths);
+  void compute_currents(double magnet_rigidity, std::vector<double> &in_strengths, std::vector<double> &out_currents);
+  void compute_pseudo_currents_from_currents(std::vector<double>& in_currents,std::vector<double>& out_currents);
+  void compute_currents_from_pseudo_currents(std::vector<double>& in_currents,std::vector<double>& out_currents);
+  void compute_strength_from_pseudo(double magnet_rigidity_inv,int idx,double& in_current,double& out_strength);
+
+private:
+
+  Magnet h;
+  Magnet v;
+  Magnet sq;
+  Eigen::MatrixXd M;  // Pseudo current matrix
+  Eigen::MatrixXd Mp; // Pseudo current inverse matrix
+
+};
+
+} // end namespace MagnetModel
\ No newline at end of file
diff --git a/lib/SH5Magnet.cpp b/lib/SH5Magnet.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..721464140624e90b0f9b135ee862376b1509dda1
--- /dev/null
+++ b/lib/SH5Magnet.cpp
@@ -0,0 +1,148 @@
+#include "SH5Magnet.h"
+
+namespace MagnetModel {
+
+//-----------------------------------------------------
+// Init a SH magnet (5 correctors for setxu, h,v and skew quad)
+int SH5Magnet::init(double scale,std::string s_strength_file_name, std::string h_strength_file_name,
+                    std::string v_strength_file_name, std::string sq_strength_file_name,std::string matrix_file_name) {
+
+  // Magnet type
+  set_magnet_type("sh5magnet");
+
+  // Set current and initialise sextu excitation curve
+  set_scale(scale);
+  set_excitation_from_file(s_strength_file_name);
+
+  // Initialise the H excitation curve
+  h.set_scale(scale);
+  h.set_excitation_from_file(h_strength_file_name);
+
+  // Initialise the V excitation curve
+  v.set_scale(scale);
+  v.set_excitation_from_file(v_strength_file_name);
+
+  // Initialise the skew quad excitation curve
+  sq.set_scale(scale);
+  sq.set_excitation_from_file(sq_strength_file_name);
+
+  // Load the matrix
+  load_matrix(matrix_file_name,4,5,M);
+
+  // Compute pseudo inverse
+  Mp = M.completeOrthogonalDecomposition().pseudoInverse();
+
+  return 0;
+
+}
+
+
+bool SH5Magnet::has_main_current() {
+  return false;
+}
+
+void SH5Magnet::get_strength_names(std::vector<std::string>& names) {
+  // The following names are used to create Tango attributes
+  names.clear();
+  names.push_back("Strength");
+  names.push_back("Strength_H");
+  names.push_back("Strength_V");
+  names.push_back("Strength_SQ");
+}
+
+void SH5Magnet::get_strength_units(std::vector<std::string>& units) {
+  // The following units are used to create Tango attributes properties
+  units.clear();
+  units.push_back("m-2");
+  units.push_back("rad");
+  units.push_back("rad");
+  units.push_back("m-1");
+}
+
+//-----------------------------------------------------
+// Compute strength(s) from current(s) in standard unit
+void SH5Magnet::compute_strengths(double magnet_rigidity_inv,std::vector<double>& in_currents,std::vector<double>& out_strengths) {
+
+  if (in_currents.size() != 5)
+    throw std::invalid_argument(get_magnet_type()+"::compute_strengths() 5 currents expected");
+
+  // Compute pseudo currents
+  auto mapped_currents = Eigen::Map<Eigen::VectorXd>(in_currents.data(), in_currents.size());
+  Eigen::VectorXd pI = M * mapped_currents;
+  double hSign = (pI(0)<0.0)?-1.0:1.0;
+  double vSign = (pI(1)<0.0)?-1.0:1.0;
+  double sqSign = (pI(2)<0.0)?-1.0:1.0;
+  double sxSign = (pI(3)<0.0)?-1.0:1.0;
+
+  // Compute strengths
+  out_strengths.resize(4);
+  out_strengths[0] = -sxSign*get_excitation_linear(fabs(pI(3))) * magnet_rigidity_inv;
+  out_strengths[1] = hSign*h.get_excitation_linear(fabs(pI(0))) * magnet_rigidity_inv;
+  out_strengths[2] = -vSign*v.get_excitation_linear(fabs(pI(1))) * magnet_rigidity_inv;
+  out_strengths[3] = -sqSign*sq.get_excitation_linear(fabs(pI(2))) * magnet_rigidity_inv;
+
+}
+
+//-----------------------------------------------------
+// Compute current(s) from strength(s)
+void SH5Magnet::compute_currents(double magnet_rigidity,std::vector<double>& in_strengths,std::vector<double>& out_currents) {
+
+  if (in_strengths.size() != 4)
+    throw std::invalid_argument(get_magnet_type()+"::compute_currents() 4 strengths expected");
+
+  // Compute pseudo currents
+  Eigen::Vector4d pI;
+  double sxStrength = in_strengths[0] * magnet_rigidity;
+  double hStrength = in_strengths[1] * magnet_rigidity;
+  double vStrength = in_strengths[2] * magnet_rigidity;
+  double sqStrength = in_strengths[3] * magnet_rigidity;
+  double sxSign = (sxStrength<0.0)?-1.0:1.0;
+  double hSign = (hStrength<0.0)?-1.0:1.0;
+  double vSign = (vStrength<0.0)?-1.0:1.0;
+  double sqSign = (sqStrength<0.0)?-1.0:1.0;
+  pI(0) = hSign*h.solve_main_strength_linear(fabs(hStrength));
+  pI(1) = -vSign*v.solve_main_strength_linear(fabs(vStrength));
+  pI(2) = -sqSign*sq.solve_main_strength_linear(fabs(sqStrength));
+  pI(3) = -sxSign*solve_main_strength_linear(fabs(sxStrength));
+
+  out_currents.resize(5);
+  Eigen::Map<Eigen::VectorXd>(out_currents.data(),out_currents.size()) = Mp * pI;
+
+}
+
+//-----------------------------------------------------
+// Compute pseudo current(s) from current(s) in standard unit
+void SH5Magnet::compute_pseudo_currents_from_currents(std::vector<double>& in_currents,std::vector<double>& out_currents) {
+
+  auto mapped_currents = Eigen::Map<Eigen::VectorXd>(in_currents.data(), in_currents.size());
+  out_currents.resize(4);
+  Eigen::Map<Eigen::VectorXd>(out_currents.data(),out_currents.size()) = M * mapped_currents;
+
+}
+
+//-----------------------------------------------------
+// Compute strength from pseudo currents (SH Only, idx=0 for H,idx=0 for V,idx=0 for SQ,idx=3 for SEXT)
+void SH5Magnet::compute_strength_from_pseudo(double magnet_rigidity_inv,int idx,double& in_current,double& out_strength) {
+
+  double sign = (in_current<0.0)?-1.0:1.0;
+  switch(idx) {
+    case 0:
+      out_strength = sign * h.get_excitation_linear(fabs(in_current)) * magnet_rigidity_inv;
+      break;
+    case 1:
+      out_strength = -sign * v.get_excitation_linear(fabs(in_current)) * magnet_rigidity_inv;
+      break;
+    case 2:
+      out_strength = -sign * sq.get_excitation_linear(fabs(in_current)) * magnet_rigidity_inv;
+      break;
+    case 3:
+      out_strength = -sign * get_excitation_linear(fabs(in_current)) * magnet_rigidity_inv;
+      break;
+    default:
+      throw std::invalid_argument(get_magnet_type()+"::compute_strength_from_pseudo() invalid index");
+  }
+
+}
+
+
+} // end namespace MagnetModel
\ No newline at end of file
diff --git a/lib/SH5Magnet.h b/lib/SH5Magnet.h
new file mode 100644
index 0000000000000000000000000000000000000000..4d2f7922fe9f3c12ab350c4d90ea69d623bcab31
--- /dev/null
+++ b/lib/SH5Magnet.h
@@ -0,0 +1,37 @@
+#pragma once
+
+#include "Magnet.h"
+
+namespace MagnetModel {
+
+class SH5Magnet : public Magnet {
+
+public:
+// Constructor and initialization
+  SH5Magnet() : Magnet(0, 5, 0, 0) {}
+
+  int init(double scale,std::string s_strength_file_name, std::string h_strength_file_name, std::string v_strength_file_name,
+           std::string sq_strength_file_name,std::string matrix_file_name);
+
+  // Implementation of virtual methods (described in Magnet.h)
+  bool has_main_current();
+  void get_strength_names(std::vector<std::string> &names);
+  void get_strength_units(std::vector<std::string> &units);
+  void compute_strengths(double magnet_rigidity_inv, std::vector<double> &in_currents, std::vector<double> &out_strengths);
+  void compute_currents(double magnet_rigidity, std::vector<double> &in_strengths, std::vector<double> &out_currents);
+  void compute_pseudo_currents_from_currents(std::vector<double>& in_currents,std::vector<double>& out_currents);
+  void compute_currents_from_pseudo_currents(std::vector<double>& in_currents,std::vector<double>& out_currents);
+  void compute_strength_from_pseudo(double magnet_rigidity_inv,int idx,double& in_current,double& out_strength);
+
+private:
+
+  bool focusing;
+  Magnet h;
+  Magnet v;
+  Magnet sq;
+  Eigen::MatrixXd M;  // Pseudo current matrix
+  Eigen::MatrixXd Mp; // Pseudo current inverse matrix
+
+};
+
+} // end namespace MagnetModel
\ No newline at end of file
diff --git a/lib/SextuCorrModel.cpp b/lib/SextuCorrModel.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..53b9da1c65eceeb54ec92cf66b9a9e2bb8c737d8
--- /dev/null
+++ b/lib/SextuCorrModel.cpp
@@ -0,0 +1,383 @@
+#include "SextuCorrModel.h"
+
+namespace MagnetModel {
+
+//-----------------------------------------------------
+// Construtor
+SextuCorrModel::SextuCorrModel() {
+	corr_type = "a1";
+	sym_matrix = sym_a1();
+	linear_forms.clear();
+	initialized = false;
+}
+//-----------------------------------------------------
+// Construtor
+// s = "a1", "b1", "a2" or "b3"
+SextuCorrModel::SextuCorrModel(std::string s) {
+
+	// Set corrector type and symmetry matrix
+	if (s == "a1") {
+		corr_type = s;
+		sym_matrix = sym_a1();
+	} else if (s == "b1") {
+		corr_type = s;
+		sym_matrix = sym_b1();
+	} else if (s == "a2") {
+		corr_type = s;
+		sym_matrix = sym_a2();
+	} else if (s == "b3") {
+		corr_type = s;
+		sym_matrix = sym_b3();
+	}
+	else corr_type = "unknown";
+
+	// Reset linear forms
+	linear_forms.clear();
+	initialized = false;
+}
+
+//-----------------------------------------------------
+// Set the corrector type
+int SextuCorrModel::set_corr_type(std::string s)
+{
+	corr_type = s;
+	return 0;
+}
+
+//-----------------------------------------------------
+// Get the corrector type
+std::string SextuCorrModel::get_corr_type()
+{
+	return corr_type;
+}
+
+//-----------------------------------------------------
+// Set the symmetry matrix
+int SextuCorrModel::set_sym_matrix(Eigen::MatrixXd m)
+{
+	sym_matrix = m;
+	return 0;
+}
+
+//-----------------------------------------------------
+// Get the symmetry matrix
+Eigen::MatrixXd SextuCorrModel::get_sym_matrix()
+{
+	return sym_matrix;
+}
+
+//-----------------------------------------------------
+// Get the symmetry matrix using references
+int SextuCorrModel::get_sym_matrix(Eigen::MatrixXd& m)
+{
+	m = sym_matrix;
+	return 0;
+}
+
+//-----------------------------------------------------
+// Build a main current vector from the measured strengths
+int SextuCorrModel::set_all_main_currents(std::vector<std::vector <double>> m_strengths) {
+	
+	// Initialize
+	int n = m_strengths.size() / 8;
+	int i;
+	all_main_currents.clear();
+
+	// Read all main currents in m_strengths
+	for (i = 0; i < n; i++)
+		all_main_currents.push_back(m_strengths[8 * i][0]);
+
+	return 0;
+}
+
+//-----------------------------------------------------
+// Return the vector of main currents
+std::vector<double> SextuCorrModel::get_all_main_currents() 
+{
+	return all_main_currents;
+}
+
+//-----------------------------------------------------
+// Symmetry matrix for skew dipole
+Eigen::Matrix<double, 13, 13> SextuCorrModel::sym_a1() {
+
+	// Build the symmetry matrix for the a_1 corrector
+	Eigen::Matrix<double, 13, 13> mat;
+
+	// Initialize
+	mat << 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	// i1
+		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,		// i2
+		-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,		// i3		// GLB 28/05/2019	Sign corrected
+		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,		// i4
+		0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,		// i1^2
+		0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,		// i1 * i2
+		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,		// i1 * i3
+		0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0,		// i1 * i4
+		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,		// i2^2		// GLB 28/05/2019	Set to zero (symmetry)
+		0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0,		// i2 * i3	// GLB 28/05/2019	Sign corrected
+		0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0,		// i3^2
+		0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0,		// i3 * i4
+		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;		// i4^2		// GLB 28/05/2019	Set to zero (symmetry)
+
+	// Return the matrix
+	return mat;
+}
+
+//-----------------------------------------------------
+// Symmetry matrix for normal dipole
+Eigen::Matrix<double, 13, 13> SextuCorrModel::sym_b1() {
+
+	// Build the symmetry matrix for the b_1 corrector
+	Eigen::Matrix<double, 13, 13> mat;
+
+	// Initialize
+	mat << 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	// i1
+		0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,		// i2
+		1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,		// i3		// GLB 28/05/2019	Sign corrected
+		0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,		// i4
+		0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,		// i1^2
+		0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,		// i1 * i2
+		0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,		// i1 * i3
+		0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0,		// i1 * i4
+		0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,		// i2^2
+		0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,		// i2 * i3	// GLB 28/05/2019	Sign corrected 
+		0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,		// i3^2
+		0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0,		// i3 * i4
+		0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0;		// i4^2
+
+	// Return the matrix
+	return mat;
+}
+
+//-----------------------------------------------------
+// Symmetry matrix for skew quadrupole
+Eigen::Matrix<double, 13, 13> SextuCorrModel::sym_a2() {
+
+	// Build the symmetry matrix for the a_2 corrector
+	Eigen::Matrix<double, 13, 13> mat;
+
+	// Initialize
+	mat << 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	// i1
+		0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,		// i2
+		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,		// i3
+		0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,		// i4
+		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,		// i1^2
+		0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,		// i1 * i2
+		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,		// i1 * i3
+		0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0,		// i1 * i4	// GLB 28/05/2019	Sign corrected
+		0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,		// i2^2		// GLB 28/05/2019	Sign corrected
+		0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,		// i2 * i3	// GLB 28/05/2019	Sign corrected
+		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,		// i3^2
+		0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,		// i3 * i4	// GLB 28/05/2019	Sign corrected
+		0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0;		// i4^2		// GLB 28/05/2019	Sign corrected
+
+	// Return the matrix
+	return mat;
+}
+
+//-----------------------------------------------------
+// Symmetry matrix for normal sextupole
+Eigen::Matrix<double, 13, 13> SextuCorrModel::sym_b3() {
+
+	// Build the symmetry matrix for the b_3 corrector
+	Eigen::Matrix<double, 13, 13> mat;
+
+	// Initialize
+	mat << 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,		// i1
+		0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,			// i2
+		1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,			// i3		// GLB 28/05/2019	Sign corrected
+		0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,			// i4
+		0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,			// i1^2
+		0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,			// i1 * i2
+		0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,			// i1 * i3
+		0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0,			// i1 * i4
+		0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,			// i2^2
+		0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,			// i2 * i3
+		0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,			// i3^2
+		0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,			// i3 * i4
+		0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0;			// i4^2		// GLB 28/05/2019	Sign corrected
+
+	// Return the matrix
+	return mat;
+}
+
+//-----------------------------------------------------
+// Fill a row vector of linear and quadratic terms from the corrector currents
+Eigen::Matrix<double, 1, 13> SextuCorrModel::current_vector(std::vector<double> c_curr) {
+
+	 Eigen::Matrix<double, 1, 13> v_curr;
+	 current_vector(c_curr, v_curr);
+
+	// Return 
+	return v_curr;
+}
+
+//-----------------------------------------------------
+// Same as above, using references
+// All computations are described here
+int SextuCorrModel::current_vector(const std::vector<double>& c_curr, Eigen::Matrix<double, 1, 13>& v_curr) {
+
+	// Initialize the vector with the corrector currents
+	double i1 = c_curr[0];
+	double i2 = c_curr[1];
+	double i3 = c_curr[2];
+	double i4 = c_curr[3];
+	v_curr << i1, i2, i3, i4, i1*i1, i1*i2, i1*i3, i1*i4, i2*i2, i2*i3, i3*i3, i3*i4, i4*i4;			// i2*i4 term suppressed
+
+	return 0;
+}
+
+//-----------------------------------------------------
+// Build a matrix from all corrector currents at a given main current
+// Each row include linear and quadratic terms for a given current set
+int SextuCorrModel::current_matrix(int k, const std::vector<std::vector <double>>& m_strengths, Eigen::Matrix<double, 7, 13>& m_curr) {
+
+	// Initialize
+	int i;
+	int ret = 0;
+	double i0;
+	std::vector<double> c_curr = {0, 0, 0, 0};
+
+	// Fill the matrix with the currents
+	i0 = m_strengths[8 * k][0]; // main current
+	for (i = 1; i < 8; i++) {
+		// Check the main current
+		if (m_strengths[8 * k + i][0] != i0) {
+			std::cout << "Warning: Main current differs from reference." << std::endl;
+			ret = -1;
+		}
+		else {
+			// Corrector currents, channels 1 to 4
+			c_curr[0] = m_strengths[8 * k + i][1];
+			c_curr[1] = m_strengths[8 * k + i][2];
+			c_curr[2] = m_strengths[8 * k + i][3];
+			c_curr[3] = m_strengths[8 * k + i][4];
+		}
+		// The ith matrix row is the current vector
+		m_curr.row(i - 1) = current_vector(c_curr);
+	}
+
+	return ret;
+
+}
+
+//-----------------------------------------------------
+// Build a matrix from all corrector currents at a given main current
+// Same as above, return values
+Eigen::Matrix<double, 7, 13> SextuCorrModel::current_matrix(int k, const std::vector<std::vector <double>>& m_strengths) {
+
+	// Initialize
+	Eigen::Matrix<double, 7, 13> m_curr;
+
+	// Current matrix
+	current_matrix(k, m_strengths, m_curr);
+
+	// Return the current matrix
+	return m_curr;
+}
+
+//-----------------------------------------------------
+// Build a column vector from the measured multipole strengths at main current k
+Eigen::MatrixXd SextuCorrModel::multipole_vector(int k, const std::vector<std::vector <double>>& m_strengths) {
+
+	// Initialize
+	int i, j, l = 0;
+	Eigen::Matrix<double, 7, 1> v;
+	bool corr_type_valid = true;
+
+	// Select the data according to the corrector type
+	if (corr_type == "a1") j = 1;
+	else if (corr_type == "b1") j = 2;
+	else if (corr_type == "a2") j = 3;
+	else if (corr_type == "b3") { j = 4; l = 1; }
+	else { corr_type_valid = false; std::cout << "Error: Unknown corrector type" << std::endl; }
+
+	// Fill the vector with the strengths
+	if (corr_type_valid) 
+		for (i = 1; i < 8; i++) 
+			v[i - 1] = m_strengths[8 * k + i][4 + j] - l * m_strengths[8 * k][8];
+	else
+		for (i = 1; i < 8; i++)
+			v[i - 1] = 0;
+
+	// Return the strengths
+	return v;
+
+}
+
+//-----------------------------------------------------
+// Build the linear form at main current k
+Eigen::MatrixXd SextuCorrModel::build_linear_form(int k, const std::vector<std::vector <double>>& m_strengths) {
+
+	// Strength vector
+	Eigen::MatrixXd strength = multipole_vector(k, m_strengths);
+
+	// Current matrix
+	Eigen::MatrixXd curr_mat = current_matrix(k, m_strengths) * sym_matrix;
+
+	// Compute the linear form
+	Eigen::MatrixXd lf = sym_matrix * curr_mat.bdcSvd(Eigen::ComputeThinU | Eigen::ComputeThinV).solve(strength);
+
+	// Return the linear form at main current k
+	return lf.transpose();
+}
+
+//-----------------------------------------------------
+// Build the linear forms for all currents
+int SextuCorrModel::build_linear_forms_all_currents(const std::vector<std::vector <double>>& m_strengths) {
+
+	// Initialize
+	int n = m_strengths.size() / 8;
+	int i;
+	linear_forms.clear();
+
+	// Linear forms at all currents k
+	for (i = 0; i < n; i++)	
+		linear_forms.push_back(build_linear_form(i, m_strengths));
+
+	// Return 0 if no error
+	return 0;	
+}
+
+//-----------------------------------------------------
+// Build and interpole all the linear forms
+int SextuCorrModel::initialize_model(const std::vector<std::vector <double>>& m_strengths) {
+
+	// Main currents 
+	set_all_main_currents(m_strengths);
+
+	// Linear forms at all currents
+	build_linear_forms_all_currents(m_strengths);
+
+	// Interpolation functions
+	NInterpolation n_interp(all_main_currents, linear_forms);
+	interp_linear_forms = n_interp;
+
+	// Set to initialized state
+	initialized = true;
+
+	// Return 0 if no error
+	return 0;
+}
+
+//-----------------------------------------------------
+// Interpolate the linear form at a given main current
+Eigen::MatrixXd SextuCorrModel::interpolated_linear_form(double curr) {
+
+	return interp_linear_forms.spline(curr);
+
+}
+
+
+//-----------------------------------------------------
+// Same as above, using references
+int SextuCorrModel::interpolated_linear_form(double curr, Eigen::MatrixXd& lf) {
+
+	if (!initialized) return -1;
+
+	interp_linear_forms.spline(curr, lf);
+
+	return 0;
+}
+
+} // end namespace MagnetModel
\ No newline at end of file
diff --git a/lib/SextuCorrModel.h b/lib/SextuCorrModel.h
new file mode 100644
index 0000000000000000000000000000000000000000..35dac24640743d7c98c74f01a292452fe6b1ea1d
--- /dev/null
+++ b/lib/SextuCorrModel.h
@@ -0,0 +1,59 @@
+#pragma once
+
+#include <Eigen/Dense>
+#include <Eigen/SVD>
+#include <Eigen/LU>
+#include <iostream>
+#include <vector>
+#include "Interpolation.h"
+
+namespace MagnetModel {
+
+class SextuCorrModel {
+
+public:
+	// --- Constructors
+	SextuCorrModel();
+	SextuCorrModel(std::string s);
+	// --- Set and get attributes
+	// Corrector type
+	int set_corr_type(std::string s);
+	std::string get_corr_type();
+	// Symmetry matrix
+	int set_sym_matrix(Eigen::MatrixXd m);
+	Eigen::MatrixXd get_sym_matrix();
+	int get_sym_matrix(Eigen::MatrixXd& m);
+	// Set all main current values
+	int set_all_main_currents(std::vector<std::vector <double>> m_strengths);
+	std::vector<double> get_all_main_currents();
+	// --- Symmetry matrices (a1 for skew dipole, b1 for normal dipole, etc.)
+	Eigen::Matrix<double, 13, 13> sym_a1();
+	Eigen::Matrix<double, 13, 13> sym_b1();
+	Eigen::Matrix<double, 13, 13> sym_a2();
+	Eigen::Matrix<double, 13, 13> sym_b3();
+	// --- Corrector current vector and matrix
+	// Fill a row vector of linear and quadratic terms from the corrector currents
+	Eigen::Matrix<double, 1, 13> current_vector(std::vector<double> c_curr);
+	int current_vector(const std::vector<double>& c_curr, Eigen::Matrix<double, 1, 13>& v_curr);
+	Eigen::Matrix<double, 7, 13> current_matrix(int k, const std::vector<std::vector <double>>& m_strengths);
+	int current_matrix(int k, const std::vector<std::vector <double>>& m_strengths, Eigen::Matrix<double, 7, 13>& m_curr);
+	// --- Multipole vector
+	Eigen::MatrixXd multipole_vector(int k, const std::vector<std::vector <double>>& m_strengths);
+	// --- Build the models at main current k and for all main currents
+	Eigen::MatrixXd build_linear_form(int k, const std::vector<std::vector <double>>& m_strengths);
+	int build_linear_forms_all_currents(const std::vector<std::vector <double>>& m_strengths);
+	int initialize_model(const std::vector<std::vector <double>>& m_strengths);
+	// --- Interpolated linear form
+	Eigen::MatrixXd interpolated_linear_form(double curr);
+	int interpolated_linear_form(double curr, Eigen::MatrixXd& lf);
+
+private:
+	std::string corr_type;						// Type of corrector (a1 for skew dipole, b1 for normal dipole, etc.)
+	Eigen::MatrixXd sym_matrix;					// symmetry matrix
+	std::vector<Eigen::MatrixXd> linear_forms;	// Container of linear forms at given main current
+	std::vector<double> all_main_currents;		// Contains all values of the main current
+	NInterpolation interp_linear_forms;			// Interpolation functions for linear forms
+	bool initialized;							// True if the model is initialized
+};
+
+} // end namespace MagnetModel
\ No newline at end of file
diff --git a/lib/Sextupole.cpp b/lib/Sextupole.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..841efe1c6e71f7d688cd9e8f40d56c18306972fa
--- /dev/null
+++ b/lib/Sextupole.cpp
@@ -0,0 +1,541 @@
+#include "Sextupole.h"
+#include "SextuCorrModel.h"
+
+namespace MagnetModel {
+
+//-----------------------------------------------------
+// Init a sextupole 
+int Sextupole::init(double curr_main, std::vector<double> curr_corr, double r) {
+	
+	// Magnet type
+	set_magnet_type("sextupole");
+	// Set currents
+	set_current_main(curr_main);
+	set_current_corr(curr_corr);
+	// Multipoles
+	Multipole multi(3, r); // multipoles a1 to b3 at reference radius r
+	set_multipoles(multi);
+	// Sextupole corrector models
+	SextuCorrModel a1("a1");
+	a1_corr = a1;
+	SextuCorrModel b1("b1");
+	b1_corr = b1;
+	SextuCorrModel a2("a2");
+	a2_corr = a2;
+	SextuCorrModel b3("b3");
+	b3_corr = b3;
+	// Temporary values for an and bn, used during field computations
+	calc_linear_form_a1.resize(1, 13);
+	calc_linear_form_b1.resize(1, 13);
+	calc_linear_form_a2.resize(1, 13);
+	calc_linear_form_b3.resize(1, 13);
+	calc_an.resize(3);
+	calc_an[0] = calc_an[1] = calc_an[2] = 0;
+	calc_bn.resize(3);
+	calc_bn[0] = calc_bn[1] = calc_bn[2] = 0;
+	calc_curr_corr.resize(4);
+	// Default solver
+	solver = 1;
+
+	// Return without error
+	return 0;
+}
+// Same as above + read parameters and init the corrector models
+int Sextupole::init(double curr_main, std::vector<double> curr_corr, double r, std::string file_name) {
+
+	// Initialize the sextupole
+	init(curr_main, curr_corr, r);
+
+	// Initialize the models
+	return set_model_from_file(file_name);
+
+}
+
+// Same as above + read all parameters in files and all currents set to 0
+int Sextupole::init(std::string strength_file_name, std::string param_file_name, std::string mag_s_n) {
+
+	// Currents
+	double curr_main = 0;
+	std::vector<double> curr_corr = { 0, 0, 0, 0 };
+
+	// Initialize the sextupole
+	init(curr_main, curr_corr, 10);
+
+	// Initialize scales, offsets, etc. 
+	if (set_params_from_file(param_file_name, mag_s_n) != 0) return -1;
+
+	// Initialize the corrector models
+	if(set_model_from_file(strength_file_name) != 0 ) return -1;
+
+	return 0;
+
+}
+
+
+//-----------------------------------------------------
+// Read the measured strengths from a file
+// Used at initialization
+int Sextupole::set_meas_strengths_from_file(std::string file_name) 
+{
+	// --- Init 
+	std::ifstream file;
+	int i;
+	std::vector<double> meas_line(9, 0);
+
+	// --- open parameter file
+	file.open(file_name);
+	// Check if file does not exist
+	if (!file)
+    throw std::invalid_argument("Sextupole::set_meas_strengths_from_file() "+file_name+" file not found");
+
+	// Clear existing values, if any
+	meas_strengths.clear();
+	
+	// --- Read the file
+	
+	while (!file.eof()) {
+		// Get a line from the file
+    std::string line;
+    std::getline(file,line);
+
+    // Skip comment and empty line
+    if(line.empty() || line[0]=='#')
+      continue;
+
+    std::vector<std::string> items;
+    split(items,line,',');
+    if(items.size()!=9) {
+      file.close();
+      throw std::invalid_argument(
+              "Sextupole::set_meas_strengths_from_file() " + file_name + " 9 items per line expected");
+    }
+		for (i = 0; i < 9; i++)
+					meas_line[i] = std::stod(items[i]);
+		// Insert the line at the end
+  	meas_strengths.push_back(meas_line);
+
+	}
+	
+	// --- Close the file
+	file.close();
+
+	// --- Return without error
+	return 0;
+
+}
+
+//-----------------------------------------------------
+// Apply scale and offset to measured strengths
+int Sextupole::apply_scale_to_meas_strengths() {
+
+	// --- Get the scale and offset
+	double scale = get_scale();
+	double offset = get_offset();
+
+	// --- Apply to the measured strengths
+	size_t n = meas_strengths.size();
+	for (size_t k = 0; k < n; k++) {
+		meas_strengths[k][5] = scale * meas_strengths[k][5];
+		meas_strengths[k][6] = scale * meas_strengths[k][6];
+		meas_strengths[k][7] = scale * meas_strengths[k][7];
+		meas_strengths[k][8] = offset + scale * meas_strengths[k][8];
+	}
+
+	return 0;
+}
+
+//-----------------------------------------------------
+// Get the measured strengths
+std::vector<std::vector <double>> Sextupole::get_meas_strengths() {
+	
+	return meas_strengths;
+}
+
+//-----------------------------------------------------
+// Compute and set the excitation curve from the measured strengths
+int Sextupole::set_excitation_curve_from_meas_strengths() {
+
+	// Initialize
+	std::vector<double> curr;
+	std::vector<double> b3;
+	curr.clear();
+	b3.clear();
+	int n = meas_strengths.size();
+	int i;
+
+	if (!n) return -1;
+
+	// Read the excitation values in the meas_strengths
+	for (i = 0; i < n; i += 8) {
+		curr.push_back(meas_strengths[i][0]);
+		b3.push_back(meas_strengths[i][8]);
+	}
+
+	// New excitation curve
+	Interpolation ex_curve(curr, b3);
+	
+	// Set the excitation curve
+	set_excitation_curve(ex_curve);
+
+	// Return
+	return 0;
+
+}
+
+//-----------------------------------------------------
+// Set the corrector models and the excitation curve from a file
+int Sextupole::set_model_from_file(std::string file_name) {
+
+	// Read the strengths
+	int i = set_meas_strengths_from_file(file_name);
+	if (i) return i;
+
+	// Apply the scale and offset
+	apply_scale_to_meas_strengths();
+
+	// Set the excitation curve
+	set_excitation_curve_from_meas_strengths();
+
+	// Set the corrector models
+	a1_corr.initialize_model(meas_strengths);
+	b1_corr.initialize_model(meas_strengths);
+	a2_corr.initialize_model(meas_strengths);
+	b3_corr.initialize_model(meas_strengths);
+
+	// Return 
+	return 0;
+}
+
+//-----------------------------------------------------
+// Compute the multipoles from the currents
+int Sextupole::multipoles_from_currents(double curr_main, const std::vector<double>& curr_corr) {
+
+	// --- Corrector current vector with linear and quadratic terms
+	a1_corr.current_vector(curr_corr, calc_curr_vector);
+	calc_curr_vector_tr = calc_curr_vector.transpose();
+
+	// --- Sextupole from excitation curve
+	double b3_main = get_excitation(curr_main);
+
+	// --- Compute the multipoles
+	// - a1
+	// Get linear form at main current
+	if (a1_corr.interpolated_linear_form(curr_main, calc_linear_form_a1)) return -1;
+	// Compute the strength
+	calc_an[0] = (calc_linear_form_a1 * calc_curr_vector_tr)(0);
+
+	// - b1
+	// Get linear form at main current
+	if (b1_corr.interpolated_linear_form(curr_main, calc_linear_form_b1)) return -1;
+	// Get the symmetry matrix
+	calc_bn[0] = (calc_linear_form_b1 * calc_curr_vector_tr)(0);
+
+	// - a2
+	// Get linear form at main current
+	if (a2_corr.interpolated_linear_form(curr_main, calc_linear_form_a2)) return -1;
+	// Compute the strength
+	calc_an[1] = (calc_linear_form_a2 * calc_curr_vector_tr)(0);
+
+	// - b3
+	// Get linear form at main current
+	if (b3_corr.interpolated_linear_form(curr_main, calc_linear_form_b3)) return -1;
+	// Get the symmetry matrix
+	calc_bn[2] = b3_main + (calc_linear_form_b3 * calc_curr_vector_tr)(0);
+
+	return 0;
+}
+
+//-----------------------------------------------------
+// Set the multipoles and the currents from the specified currents
+int Sextupole::set_multipoles_from_currents(double curr_main, const std::vector<double>& curr_corr) {
+
+	
+	// --- Compute the multipoles
+	if (multipoles_from_currents(curr_main, curr_corr)) return -1;
+
+	// --- Set the currents Currents
+	set_current_main(curr_main);
+	set_current_corr(curr_corr);
+
+	// --- Set the multipoles
+	set_multipole_strengths(calc_an, calc_bn);
+
+	return 0;
+}
+
+//-----------------------------------------------------
+// Linear solver for the specified multipole strengths
+// Enforce a zero contribution of the corrector to b3
+// Non-linear terms are neglected: to be used for initialization only
+int Sextupole::solve_linear(double a1, double b1, double a2, double b3) {
+
+	// --- Compute the initial point
+	// Build the target matrix
+	calc_an_bn_target << a1, b1, a2, 0;
+
+	// Compute the main current
+	calc_curr_main = solve_main_strength(b3);
+
+	// Compute all linear forms at the initial main current
+	a1_corr.interpolated_linear_form(calc_curr_main, calc_linear_form_a1);
+	b1_corr.interpolated_linear_form(calc_curr_main, calc_linear_form_b1);
+	a2_corr.interpolated_linear_form(calc_curr_main, calc_linear_form_a2);
+	b3_corr.interpolated_linear_form(calc_curr_main, calc_linear_form_b3);
+
+	// Compute the response matrix at the initial main current
+	calc_resp_matrix.row(0) << calc_linear_form_a1(0), calc_linear_form_a1(1), calc_linear_form_a1(2), calc_linear_form_a1(3);
+	calc_resp_matrix.row(1) << calc_linear_form_b1(0), calc_linear_form_b1(1), calc_linear_form_b1(2), calc_linear_form_b1(3);
+	calc_resp_matrix.row(2) << calc_linear_form_a2(0), calc_linear_form_a2(1), calc_linear_form_a2(2), calc_linear_form_a2(3);
+	calc_resp_matrix.row(3) << calc_linear_form_b3(0), calc_linear_form_b3(1), calc_linear_form_b3(2), calc_linear_form_b3(3);
+
+	// Compute the initial values of the corrector currents
+	calc_curr_corr_mat = calc_resp_matrix.inverse() * calc_an_bn_target;
+	
+	// Set the values
+	calc_curr_corr[0] = calc_curr_corr_mat(0);
+	calc_curr_corr[1] = calc_curr_corr_mat(1);
+	calc_curr_corr[2] = calc_curr_corr_mat(2);
+	calc_curr_corr[3] = calc_curr_corr_mat(3);
+
+	return 0;
+}
+
+//-----------------------------------------------------
+// Compute the jacobian matrix 
+int Sextupole::jacobian_matrix(const std::vector<double>& current_corr, bool compute_linear_form) {
+
+	// Extract the corrector currents 
+	double i1 = current_corr[0];
+	double i2 = current_corr[1];
+	double i3 = current_corr[2];
+	double i4 = current_corr[3];
+
+	// Compute all linear forms at the initial main current
+	if (compute_linear_form) {
+		a1_corr.interpolated_linear_form(calc_curr_main, calc_linear_form_a1);
+		b1_corr.interpolated_linear_form(calc_curr_main, calc_linear_form_b1);
+		a2_corr.interpolated_linear_form(calc_curr_main, calc_linear_form_a2);
+		b3_corr.interpolated_linear_form(calc_curr_main, calc_linear_form_b3);
+	}
+
+	// Jacobian matrix
+	// Row 0: da_1/di_1, da_1/di_2, da_1/di_3, da_1/di_4
+	calc_jacobian_mat(0, 0) = calc_linear_form_a1(0) + 2 * calc_linear_form_a1(4) * i1 + calc_linear_form_a1(5) * i2 + calc_linear_form_a1(6) * i3 + calc_linear_form_a1(7) * i4;
+	calc_jacobian_mat(0, 1) = calc_linear_form_a1(1) + calc_linear_form_a1(5) * i1 + 2 * calc_linear_form_a1(8) * i2 + calc_linear_form_a1(9) * i3;
+	calc_jacobian_mat(0, 2) = calc_linear_form_a1(2) + calc_linear_form_a1(6) * i1 + calc_linear_form_a1(9) * i2 + 2 * calc_linear_form_a1(10) * i3 + calc_linear_form_a1(11) * i4;
+	calc_jacobian_mat(0, 3) = calc_linear_form_a1(3) + calc_linear_form_a1(7) * i1 + calc_linear_form_a1(11) * i3 + 2 * calc_linear_form_a1(12) * i4;
+	// Row 1: db_1/di_1, db_1/di_2, db_1/di_3, db_1/di_4
+	calc_jacobian_mat(1, 0) = calc_linear_form_b1(0) + 2 * calc_linear_form_b1(4) * i1 + calc_linear_form_b1(5) * i2 + calc_linear_form_b1(6) * i3 + calc_linear_form_b1(7) * i4;
+	calc_jacobian_mat(1, 1) = calc_linear_form_b1(1) + calc_linear_form_b1(5) * i1 + 2 * calc_linear_form_b1(8) * i2 + calc_linear_form_b1(9) * i3;
+	calc_jacobian_mat(1, 2) = calc_linear_form_b1(2) + calc_linear_form_b1(6) * i1 + calc_linear_form_b1(9) * i2 + 2 * calc_linear_form_b1(10) * i3 + calc_linear_form_b1(11) * i4;
+	calc_jacobian_mat(1, 3) = calc_linear_form_b1(3) + calc_linear_form_b1(7) * i1 + calc_linear_form_b1(11) * i3 + 2 * calc_linear_form_b1(12) * i4;
+	// Row 2: da_2/di_1, da_2/di_2, da_2/di_3, da_2/di_4
+	calc_jacobian_mat(2, 0) = calc_linear_form_a2(0) + 2 * calc_linear_form_a2(4) * i1 + calc_linear_form_a2(5) * i2 + calc_linear_form_a2(6) * i3 + calc_linear_form_a2(7) * i4;
+	calc_jacobian_mat(2, 1) = calc_linear_form_a2(1) + calc_linear_form_a2(5) * i1 + 2 * calc_linear_form_a2(8) * i2 + calc_linear_form_a2(9) * i3;
+	calc_jacobian_mat(2, 2) = calc_linear_form_a2(2) + calc_linear_form_a2(6) * i1 + calc_linear_form_a2(9) * i2 + 2 * calc_linear_form_a2(10) * i3 + calc_linear_form_a2(11) * i4;
+	calc_jacobian_mat(2, 3) = calc_linear_form_a2(3) + calc_linear_form_a2(7) * i1 + calc_linear_form_a2(11) * i3 + 2 * calc_linear_form_a2(12) * i4;
+	// Row 3: db_3/di_1, db_3/di_2, db_3/di_3, db_3/di_4
+	calc_jacobian_mat(3, 0) = calc_linear_form_b3(0) + 2 * calc_linear_form_b3(4) * i1 + calc_linear_form_b3(5) * i2 + calc_linear_form_b3(6) * i3 + calc_linear_form_b3(7) * i4;
+	calc_jacobian_mat(3, 1) = calc_linear_form_b3(1) + calc_linear_form_b3(5) * i1 + 2 * calc_linear_form_b3(8) * i2 + calc_linear_form_b3(9) * i3;
+	calc_jacobian_mat(3, 2) = calc_linear_form_b3(2) + calc_linear_form_b3(6) * i1 + calc_linear_form_b3(9) * i2 + 2 * calc_linear_form_b3(10) * i3 + calc_linear_form_b3(11) * i4;
+	calc_jacobian_mat(3, 3) = calc_linear_form_b3(3) + calc_linear_form_b3(7) * i1 + calc_linear_form_b3(11) * i3 + 2 * calc_linear_form_b3(12) * i4;
+
+	return 0;
+}
+
+//-----------------------------------------------------
+// Get the jacobian matrix
+int Sextupole::get_jacobian_matrix(Eigen::Matrix<double, 4, 4>& jacobian_mat) {
+
+	get_current_corr(calc_curr_corr);
+	jacobian_matrix(calc_curr_corr, true);
+	jacobian_mat = calc_jacobian_mat;
+	return 0;
+}
+
+//-----------------------------------------------------
+// Non-linear solver for strengths (Newton's method)
+// Enforce a zero contribution of the corrector to b3
+int Sextupole::solve_newton(double a1, double b1, double a2, double b3) {
+
+	// Set the target multipole vector
+	solve_linear(a1, b1, a2, b3);
+	// Initialize the currents
+	calc_curr_corr_mat << calc_curr_corr[0], calc_curr_corr[1], calc_curr_corr[2], calc_curr_corr[3];
+	// Build the target matrix
+	calc_an_bn_target << a1, b1, a2, b3;
+
+	// Get the solver parameters
+	int solver_max_iter = get_solver_max_iterations();
+	double solver_tolerance = get_solver_tolerance();
+
+	// Iterate
+	for (calc_iter = 0; calc_iter < solver_max_iter; calc_iter++) {
+		// Compute multipoles
+		multipoles_from_currents(calc_curr_main, calc_curr_corr);
+		extract_an_bn(calc_an_bn);	// Result in cal_an_bn
+		// Compute the jacobian matrix
+		jacobian_matrix(calc_curr_corr, false); // Result in calc_jacobian_mat
+		// New value of the corrector currents
+		calc_curr_corr_mat -= calc_jacobian_mat.inverse() * (calc_an_bn - calc_an_bn_target);
+		calc_curr_corr = { calc_curr_corr_mat(0), calc_curr_corr_mat(1), calc_curr_corr_mat(2), calc_curr_corr_mat(3) };
+		// Convergence test
+		if ((calc_an_bn_target - calc_an_bn).norm() < solver_tolerance) break;
+	}
+
+	if (calc_iter == solver_max_iter) return -1;
+	else return 0;
+}
+
+//-----------------------------------------------------
+// Read the values of a1, b1, a2 and b3 and put it in a vector
+int Sextupole::extract_an_bn(Eigen::Matrix<double, 4, 1>& an_bn) {
+
+	an_bn(0) = calc_an[0];
+	an_bn(1) = calc_bn[0];
+	an_bn(2) = calc_an[1];
+	an_bn(3) = calc_bn[2];
+
+	return 0;
+
+}
+
+//-----------------------------------------------------
+// Get the currents computed with the solver
+int Sextupole::get_solver_results(double& curr_main, std::vector<double>& curr_corr) {
+
+	curr_main = calc_curr_main;
+	curr_corr = calc_curr_corr;
+	return 0;
+}
+
+//-----------------------------------------------------
+// Get the number of iterations before convergence 
+int Sextupole::get_iterations() {
+	return calc_iter;
+}
+//-----------------------------------------------------
+// Set the multipoles and the currents from the specified multipoles
+int Sextupole::set_currents_from_multipoles(Multipole& multi) {
+
+	// Extract the useful multipole values
+	multi.get_an_bn(calc_an, calc_bn);
+	double a_1 = calc_an[0];
+	double b_1 = calc_bn[0];
+	double a_2 = calc_an[1];
+	double b_3 = calc_bn[2];
+	
+	// Compute and set the currents
+	switch (solver) {
+	case 0: // Linear solver
+		if (solve_linear(a_1, b_1, a_2, b_3)) return -1;
+		break;
+	case 1: // Newton's method
+		if (solve_newton(a_1, b_1, a_2, b_3)) return -1;
+	}
+	
+	// Set the currents
+	set_current_main(calc_curr_main);
+	set_current_corr(calc_curr_corr);
+
+	// Set the multipoles
+	set_multipoles(multi);
+
+	return 0;
+
+}
+
+//-----------------------------------------------------
+// Set the solver type
+// 0: linear
+// 1: Newton's method
+// Constrained minimization to be implemented
+int Sextupole::set_solver(unsigned char s) {
+	solver = s;
+	return 0;
+}
+
+//-----------------------------------------------------
+// Get the solver type
+unsigned char Sextupole::get_solver_results() {
+	return solver;
+}
+
+bool Sextupole::has_main_current() {
+  return true;
+}
+
+void Sextupole::get_strength_names(std::vector<std::string>& names) {
+  // The following names are used to create Tango attributes
+  names.clear();
+  names.push_back("Strength");
+  names.push_back("Strength_H");
+  names.push_back("Strength_V");
+  names.push_back("Strength_SQ");
+}
+
+void Sextupole::get_strength_units(std::vector<std::string>& units) {
+  // The following units are used to create Tango attributes properties
+  units.clear();
+  units.push_back("m-2");
+  units.push_back("rad");
+  units.push_back("rad");
+  units.push_back("m-1");
+}
+
+//-----------------------------------------------------
+// Compute strength(s) from current(s) in standard unit
+void Sextupole::compute_strengths(double magnet_rigidity_inv,std::vector<double>& in_currents,std::vector<double>& out_strengths) {
+
+  if (in_currents.size() != 5)
+    throw std::invalid_argument("Sextupole::compute_strengths() 5 currents expected");
+
+  std::vector<double> corr_currents;
+  for (int i = 0;i < 4;i++)
+    corr_currents.push_back(in_currents[i + 1]);
+
+  set_current_main(in_currents[0]);
+  set_current_corr(corr_currents);
+  set_multipoles_from_currents(in_currents[0],corr_currents);
+  Multipole mp = get_multipoles();
+  std::vector<double> an = mp.get_an(); // a0[Tmm] a1[T] a2[T/mm]
+  std::vector<double> bn = mp.get_bn(); // b0[Tmm] b1[T] b2[T/mm]
+  out_strengths.resize(4);
+  out_strengths[0] = -(bn[2] * (magnet_rigidity_inv / 1e-3));
+  out_strengths[1] = bn[0] * (magnet_rigidity_inv / 1e3);
+  out_strengths[2] = -(an[0] * (magnet_rigidity_inv / 1e3));
+  out_strengths[3] = -(an[1] * magnet_rigidity_inv);
+
+}
+
+//-----------------------------------------------------
+// Compute current(s) from strength(s)
+void Sextupole::compute_currents(double magnet_rigidity,std::vector<double>& in_strengths,std::vector<double>& out_currents) {
+
+  if (in_strengths.size() != 4)
+    throw std::invalid_argument("Sextupole::compute_currents() 4 strengths expected");
+
+  double b3 = -(in_strengths[0] * (magnet_rigidity * 1e-3));
+  double b1 = in_strengths[1] * (magnet_rigidity * 1e3);
+  double a1 = -(in_strengths[2] * (magnet_rigidity * 1e3));
+  double a2 = -(in_strengths[3] * magnet_rigidity);
+  std::vector<double> an = {a1,a2,0};
+  std::vector<double> bn = {b1,0,b3};
+  Multipole mp = get_multipoles();
+  mp.set_an_bn(an, bn);
+  set_solver(1); // Newton's method
+  set_currents_from_multipoles(mp);
+
+  double curr_main;
+  std::vector<double> curr_corr = { 0, 0, 0, 0 };
+  get_solver_results(curr_main, curr_corr);
+  out_currents.resize(5);
+  out_currents[0] = curr_main;
+  out_currents[1] = curr_corr[0];
+  out_currents[2] = curr_corr[1];
+  out_currents[3] = curr_corr[2];
+  out_currents[4] = curr_corr[3];
+
+}
+
+} // end namespace MagnetModel
\ No newline at end of file
diff --git a/lib/Sextupole.h b/lib/Sextupole.h
new file mode 100644
index 0000000000000000000000000000000000000000..f1974d1bb3ca96a56dec35edd0dd9dd3a2f16fd4
--- /dev/null
+++ b/lib/Sextupole.h
@@ -0,0 +1,86 @@
+#pragma once
+
+#include "Magnet.h"
+#include "SextuCorrModel.h"
+
+namespace MagnetModel {
+
+class Sextupole : public Magnet {
+
+public:
+	// Constructor and initialization
+	Sextupole() : Magnet(0, 4, 3, 10) {}
+	int init(double curr_main, std::vector<double> curr_corr, double r);
+	int init(double curr_main, std::vector<double> curr_corr, double r, std::string file_name);
+	int init(std::string strength_file_name, std::string param_file_name, std::string mag_s_n);
+	// Set the strengths from a file
+	int set_meas_strengths_from_file(std::string file_name);	// Load measured strenghts (needed for building the NL model)
+	// Apply scale and offset to meas_strengths
+	int apply_scale_to_meas_strengths();
+	// Get the strengths
+	std::vector<std::vector <double>> get_meas_strengths();
+	// Compute and set the excitation curve
+	int set_excitation_curve_from_meas_strengths();
+	// Set the corrector models and the excitation curve from a file
+	int set_model_from_file(std::string file_name);
+	// Compute the multipoles at a given set of currents
+	int multipoles_from_currents(double curr_main, const std::vector<double>& curr_corr);
+	// Compute and set the multipoles at a given set of currents
+	int set_multipoles_from_currents(double curr_main, const std::vector<double>& curr_corr);
+	// Linear solver for strengths -- Enforce db3_corr = 0
+	int solve_linear(double a1, double b1, double a2, double b3);
+	// Compute the jacobian matrix
+	int jacobian_matrix(const std::vector<double>& current_corr, bool compute_linear_form=true);
+	// Get the jacobian matrix
+	int get_jacobian_matrix(Eigen::Matrix<double, 4, 4>& jacobian_matrix);
+	// Non-linear solver for strengths, based on Newton's method -- Enforce db3_corr = 0
+	int solve_newton(double a1, double b1, double a2, double b3);
+	// Read the values of a1, b1, a2 and b3 and put it in a vector
+	int extract_an_bn(Eigen::Matrix<double, 4, 1>& an_bn);
+	// Get the computed current values
+	int get_solver_results(double& curr_main, std::vector<double>& curr_corr);
+	// Get the number of iterations before convergence of the last NL solve
+	int get_iterations();
+	// Compute the currents from the multipoles
+	int set_currents_from_multipoles(Multipole& multi);
+	// Set the solver type
+	int set_solver(unsigned char s);
+	// Get the solver type
+	unsigned char get_solver_results();
+
+  // Implementation of virtual methods (described in Magnet.h)
+  bool has_main_current();
+  void get_strength_names(std::vector<std::string>& names);
+  void get_strength_units(std::vector<std::string>& units);
+  void compute_strengths(double magnet_rigidity_inv,std::vector<double>& in_currents,std::vector<double>& out_strengths);
+  void compute_currents(double magnet_rigidity,std::vector<double>& in_strengths,std::vector<double>& out_currents);
+  void compute_pseudo_currents_from_currents(std::vector<double>& in_currents,std::vector<double>& out_currents) {};
+  void compute_strength_from_pseudo(double magnet_rigidity_inv,int idx,double& in_current,double& out_strength) {};
+
+private:
+	std::vector<std::vector <double>> meas_strengths; // Measured strengths from parameter file
+	SextuCorrModel a1_corr;				// Model for a1 channel
+	SextuCorrModel b1_corr;				// Model for b1 channel
+	SextuCorrModel a2_corr;				// Model for a2 channel
+	SextuCorrModel b3_corr;				// Model for b3 channel
+	Eigen::Matrix<double, 1, 13> calc_curr_vector;
+	Eigen::MatrixXd calc_curr_vector_tr;
+	Eigen::MatrixXd calc_linear_form_a1;
+	Eigen::MatrixXd calc_linear_form_b1;
+	Eigen::MatrixXd calc_linear_form_a2;
+	Eigen::MatrixXd calc_linear_form_b3;
+	Eigen::Matrix<double, 4, 1> calc_an_bn;
+	Eigen::Matrix<double, 4, 1> calc_an_bn_target;
+	Eigen::Matrix<double, 4, 4> calc_resp_matrix;
+	Eigen::Matrix<double, 4, 4> calc_jacobian_mat;
+	std::vector<double> calc_curr_corr;
+	Eigen::Matrix<double, 4, 1> calc_curr_corr_mat;
+	double calc_curr_main;
+	Multipole calc_multi;
+	int calc_iter;
+	std::vector<double> calc_an;
+	std::vector<double> calc_bn;
+	unsigned char solver;
+};
+
+} // end namespace MagnetModel
\ No newline at end of file
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..af2185d98b35a8fa4ca98b72c64e76bc64c86482
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1,17 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(app_project)
+
+set(INSTALL_DIR /homelocal/claudio/src/gitlab/dt/lib/MagnetModel)
+
+set(INCL_USER ${INSTALL_DIR}/lib)
+set(INCL_EIGEN /usr/include/eigen3)
+include_directories(${INCL_USER} ${INCL_EIGEN})
+
+set(LIB_USER ${INSTALL_DIR}/lib/build/deb_12-X86_64)
+link_directories(${LIB_USER})
+
+add_executable(TestSextuCorr Main.cpp)
+
+target_link_libraries(TestSextuCorr MagnetModel)
+
diff --git a/test/Main.cpp b/test/Main.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..aea3f6df2480fd025d96e0be1b5a262a716f8a34
--- /dev/null
+++ b/test/Main.cpp
@@ -0,0 +1,345 @@
+// MagnetCorrModels.cpp : Defines the entry point for the console application.
+//
+
+#include <iostream>
+#include <chrono>
+#include <ctime>
+#include "Sextupole.h"
+#include "Corrector.h"
+using namespace MagnetModel;
+
+// Basic test functions
+Sextupole model_init(std::string path, std::string strengths_name, std::string param_name, std::string mag_name);
+void model_check(Sextupole& sextu, double i_main, double i_ch1, double i_ch2, double i_ch3, double i_ch4);
+void model_multi_from_currents(Sextupole& sextu, double i_main, double i_ch1, double i_ch2, double i_ch3, double i_ch4);
+void model_currents_from_multi(Sextupole& sextu, double a_1, double b_1, double a_2, double b_3, std::string l_or_nl);
+
+Corrector corr_init(std::string path, std::string strengths_name, std::string param_name, std::string mag_name);
+void corr_check(Corrector& corr, double incurr);
+
+//-----------------------------------------------------
+// sextupole test funtction
+int testS(int argc,char *argv[])
+{
+	if (argc != 2) {
+		std::cerr << "TestSextuCorr usage: TestSextuCorr <Path to parameter files folder>" << std::endl;
+		exit(-1);
+	}
+	std::string path(argv[1]);
+	if (path[path.size() - 1] != '/') {
+		path.append(1,'/');
+	}
+	
+	// --- Initialize
+	// Magnet file names
+	std::string meas_strength_filename = "SD1_meas_strengths.csv";
+	std::string param_filename = "SD1_params.csv";
+	// Build the model
+	Sextupole sextu = model_init(path, meas_strength_filename, param_filename, "SD1-16055");
+	// --- Check the model
+	// Initial values for the currents
+	double i_main = 92;
+	double i_ch1 = -0.1557478, i_ch2 = 0.91462704, i_ch3 = 0.166953941, i_ch4 = 0.043270705;
+	model_check(sextu, i_main, i_ch1, i_ch2, i_ch3, i_ch4);
+	// Main loop
+	std::string str_in;
+	double a_1, b_1, a_2, b_3;
+	while (true) {
+		std::cout << "Commands: \"q\" to quit, \"c\" to enter currents, \"m\" to enter multipoles\n";
+		std::cin >> str_in;
+		if (!str_in.compare("q") ) 
+			break;
+		else if ( !str_in.compare("c") ) {
+			std::cout << "I_main [A]: "; std::cin >> str_in; i_main = stod(str_in);
+			std::cout << "I_channel_1 [A]: "; std::cin >> str_in; i_ch1 = stod(str_in);
+			std::cout << "I_channel_2 [A]: "; std::cin >> str_in; i_ch2 = stod(str_in);
+			std::cout << "I_channel_3 [A]: "; std::cin >> str_in; i_ch3 = stod(str_in);
+			std::cout << "I_channel_4 [A]: "; std::cin >> str_in; i_ch4 = stod(str_in);
+			model_multi_from_currents(sextu, i_main, i_ch1, i_ch2, i_ch3, i_ch4);
+		}
+		else if ( !str_in.compare("m") ) {
+			std::cout << "a_1 [Tmm]: "; std::cin >> str_in; a_1 = stod(str_in);
+			std::cout << "b_1 [Tmm]: "; std::cin >> str_in; b_1 = stod(str_in);
+			std::cout << "a_2 [T]: "; std::cin >> str_in; a_2 = stod(str_in);
+			std::cout << "b_3 [T/mm]: "; std::cin >> str_in; b_3 = stod(str_in);
+			model_currents_from_multi(sextu, a_1, b_1, a_2, b_3, "l"); // Linear solver
+			model_currents_from_multi(sextu, a_1, b_1, a_2, b_3, "nl"); // NL solver
+		}
+	}
+
+    return 0;
+}
+
+//-----------------------------------------------------
+// Test function
+// Initialize a sextupole model using the specified files
+Sextupole model_init(std::string path, std::string meas_strength_filename, std::string param_filename, std::string mag_name) {
+
+	std::chrono::time_point<std::chrono::system_clock> t0, t1;
+	t0 = std::chrono::system_clock::now();
+
+	// Initialize a Sextupole 
+	Sextupole sextu;
+
+	// Initialise the magnet
+  try {
+	  sextu.init(path + meas_strength_filename, path + param_filename, mag_name);
+  } catch (std::exception& e) {
+    std::cerr << "Fatal error: " << e.what() << std::endl;
+    std::exit(-1);
+  }
+	t1 = std::chrono::system_clock::now();
+
+	std::cout << "-----------------------------------------\n";
+	std::cout << "Model built in " << std::chrono::duration_cast<std::chrono::microseconds>(t1 - t0).count() << " us\n";
+
+	// Return the model
+	return sextu;
+}
+
+//-----------------------------------------------------
+// Test function
+// Compute the multipoles from the specified current, then the currents from the computed multipoles
+void model_check(Sextupole& sextu, double i_main, double i_ch1, double i_ch2, double i_ch3, double i_ch4) {
+
+	std::chrono::time_point<std::chrono::system_clock> t0, t1, t2, t3, t4, t5, t6;
+	t0 = std::chrono::system_clock::now();
+
+	// Corrector current vector
+	std::vector<double> i_corr = { i_ch1, i_ch2, i_ch3, i_ch4 };
+	// Set the currents
+	t1 = std::chrono::system_clock::now();
+	sextu.set_current_main(i_main);
+	sextu.set_current_corr(i_corr);
+
+	// Compute and set the multipoles
+	sextu.set_multipoles_from_currents(i_main, i_corr);
+	t2 = std::chrono::system_clock::now();
+
+	// Extract the multipoles
+	Multipole multi;
+	multi = sextu.get_multipoles();
+	std::vector<double> an = multi.get_an();
+	std::vector<double> bn = multi.get_bn();
+
+	// Inverse (linear solver)
+	t3 = std::chrono::system_clock::now();
+	sextu.solve_linear(an[0], bn[0], an[1], bn[2]);
+	t4 = std::chrono::system_clock::now();
+	double curr_main_lin;
+	std::vector<double> curr_corr_lin = { 0, 0, 0, 0 };
+	sextu.get_solver_results(curr_main_lin, curr_corr_lin);
+	// Check the results
+	sextu.set_multipoles_from_currents(curr_main_lin, curr_corr_lin);
+	Multipole multi_lin;
+	multi_lin = sextu.get_multipoles();
+	std::vector<double> an_lin = multi_lin.get_an();
+	std::vector<double> bn_lin = multi_lin.get_bn();
+
+	// Inverse (NL solver)
+	double eps = 1e-9; // Precision
+	t5 = std::chrono::system_clock::now();
+	sextu.solve_newton(an[0], bn[0], an[1], bn[2]);
+	t6 = std::chrono::system_clock::now();
+	double curr_main_nl;
+	std::vector<double> curr_corr_nl = { 0, 0, 0, 0 };
+	sextu.get_solver_results(curr_main_nl, curr_corr_nl);
+	// Check the results
+	sextu.set_multipoles_from_currents(curr_main_nl, curr_corr_nl);
+	Multipole multi_nl;
+	multi_nl = sextu.get_multipoles();
+	std::vector<double> an_nl = multi_nl.get_an();
+	std::vector<double> bn_nl = multi_nl.get_bn();
+
+	std::cout << "-----------------------------------------\n";
+	std::cout << "CURRENTS\n";
+	std::cout << "Main current: " << i_main << " A\n";
+	std::cout << "Corrector current: " << i_corr[0] << " A, " << i_corr[1] << " A, " << i_corr[2] << " A, " << i_corr[3] << " A\n";
+	std::cout << '\n';
+	std::cout << "MULTIPOLES FROM CURRENTS\n";
+	std::cout << "a1: " << an[0] << " Tmm, b1: " << bn[0] << " Tmm\n";
+	std::cout << "a2: " << an[1] << " T, b2: " << bn[1] << " T\n";
+	std::cout << "a3: " << an[2] << " T/mm, b3: " << bn[2] << " T/mm\n";
+	std::cout << '\n';
+	std::cout << "Multipoles computated in " << std::chrono::duration_cast<std::chrono::microseconds>(t2 - t1).count() << " us\n";
+	std::cout << "-----------------------------------------\n";
+	std::cout << "LINEAR SOLVER\n";
+	std::cout << "Main current: " << curr_main_lin << " A\n";
+	std::cout << "Corrector current: " << curr_corr_lin[0] << " A, " << curr_corr_lin[1] << " A, " << curr_corr_lin[2] << " A, " << curr_corr_lin[3] << " A\n";
+	std::cout << '\n';
+	std::cout << "Currents computed in " << std::chrono::duration_cast<std::chrono::microseconds>(t4 - t3).count() << " us\n";
+	std::cout << "MULTIPOLES FROM CURRENTS / LINEAR SOLVER\n";
+	std::cout << "a1: " << an_lin[0] << " Tmm, b1: " << bn_lin[0] << " Tmm\n";
+	std::cout << "a2: " << an_lin[1] << " T, b2: " << bn_lin[1] << " T\n";
+	std::cout << "a3: " << an_lin[2] << " T/mm, b3: " << bn_lin[2] << " T/mm\n";
+	std::cout << '\n';
+	std::cout << "-----------------------------------------\n";
+	std::cout << "NON-LINEAR SOLVER\n";
+	std::cout << "Main current: " << curr_main_nl << " A\n";
+	std::cout << "Corrector current: " << curr_corr_nl[0] << " A, " << curr_corr_nl[1] << " A, " << curr_corr_nl[2] << " A, " << curr_corr_nl[3] << " A\n";
+	std::cout << '\n';
+	std::cout << "Converged in " << sextu.get_iterations() << " iterations\n";
+	std::cout << "Currents computed in " << std::chrono::duration_cast<std::chrono::microseconds>(t6 - t5).count() << " us\n";
+	std::cout << "MULTIPOLES FROM CURRENTS / NL SOLVER\n";
+	std::cout << "a1: " << an_nl[0] << " Tmm, b1: " << bn_nl[0] << " Tmm\n";
+	std::cout << "a2: " << an_nl[1] << " T, b2: " << bn_nl[1] << " T\n";
+	std::cout << "a3: " << an_nl[2] << " T/mm, b3: " << bn_nl[2] << " T/mm\n";
+	std::cout << '\n';
+}
+
+//-----------------------------------------------------
+// Test function
+// Compute the multipoles from the specified currents
+void model_multi_from_currents(Sextupole& sextu, double i_main, double i_ch1, double i_ch2, double i_ch3, double i_ch4) {
+	
+	// Set the currents
+	std::vector<double> i_corr = { i_ch1, i_ch2, i_ch3, i_ch4 };
+	sextu.set_current_main(i_main);
+	sextu.set_current_corr(i_corr);
+
+	// Compute and set the multipoles
+	sextu.set_multipoles_from_currents(i_main, i_corr);
+
+	// Extract the multipoles
+	Multipole multi = sextu.get_multipoles();
+	std::vector<double> an = multi.get_an();
+	std::vector<double> bn = multi.get_bn();
+
+	std::cout << "-----------------------------------------\n";
+	std::cout << "MULTIPOLES FROM CURRENTS\n";
+	std::cout << "a1: " << an[0] << " Tmm, b1: " << bn[0] << " Tmm\n";
+	std::cout << "a2: " << an[1] << " T, b2: " << bn[1] << " T\n";
+	std::cout << "a3: " << an[2] << " T/mm, b3: " << bn[2] << " T/mm\n";
+	std::cout << '\n';
+	
+}
+
+//-----------------------------------------------------
+// Test function
+// Compute the currents from the multipoles
+void model_currents_from_multi(Sextupole& sextu, double a_1, double b_1, double a_2, double b_3, std::string l_or_nl) {
+
+	
+	// Define the multipoles and change the strengths in a multipole object
+	std::vector<double> an = { a_1, a_2, 0 };
+	std::vector<double> bn = { b_1, 0, b_3 };
+	Multipole multi = sextu.get_multipoles(); // By doing so, we get the a_n, b_n and the reference radius
+	multi.set_an_bn(an, bn);
+
+	// Set the solver
+	if (!l_or_nl.compare("l")) sextu.set_solver(0); // Linear solver
+	else sextu.set_solver(1); // Newton's method (default value)
+
+	// Solve
+	sextu.set_currents_from_multipoles(multi);
+
+	// Get the computed currents
+	// Get the results
+	double curr_main;
+	std::vector<double> curr_corr = { 0, 0, 0, 0 };
+	sextu.get_solver_results(curr_main, curr_corr);
+	
+	// The linear and the NL solver can also be called directly, as shown below
+	/* 
+	// Solve
+	if (l_or_nl.compare("l"))
+		sextu.solve_linear(a_1, b_1, a_2, b_3);
+	else sextu.solve_newton(a_1, b_1, a_2, b_3);
+	// Get the results
+	double curr_main;
+	std::vector<double> curr_corr = { 0, 0, 0, 0 };
+	sextu.get_solver_results(curr_main, curr_corr);
+	// Set the currents and compute the multipoles
+	sextu.set_multipoles_from_currents(curr_main, curr_corr);
+	// Get the results
+	Multipole multi_lin = sextu.get_multipoles();
+	an = multi_lin.get_an();
+	bn = multi_lin.get_bn();
+	*/
+
+	std::cout << "-----------------------------------------\n";
+	std::cout << "SOLVER: "; if (!l_or_nl.compare("l")) std::cout << "Linear\n"; else std::cout << "Newton's method\n";
+	std::cout << "Main current: " << curr_main << " A\n";
+	std::cout << "Corrector current: " << curr_corr[0] << " A, " << curr_corr[1] << " A, " << curr_corr[2] << " A, " << curr_corr[3] << " A\n";
+	std::cout << '\n';
+	std::cout << "MULTIPOLES FROM CURRENTS\n";
+	std::cout << "a1: " << an[0] << " Tmm, b1: " << bn[0] << " Tmm\n";
+	std::cout << "a2: " << an[1] << " T, b2: " << bn[1] << " T\n";
+	std::cout << "a3: " << an[2] << " T/mm, b3: " << bn[2] << " T/mm\n";
+	std::cout << '\n';
+
+}
+
+//-----------------------------------------------------
+// Test function
+// Initialize a corrector model using the specified files
+Corrector corr(std::string path, std::string meas_strength_filename, std::string param_filename, std::string mag_name) {
+
+	std::chrono::time_point<std::chrono::system_clock> t0, t1;
+	t0 = std::chrono::system_clock::now();
+
+	// Initialize a Sextupole
+	Corrector corr;
+
+	// Initialise the magnet
+  try {
+	  corr.init(true, 1.0, path + meas_strength_filename, path + param_filename, mag_name);
+  } catch (std::exception& e) {
+    std::cerr << "Fatal error: " << e.what() << std::endl;
+    std::exit(-1);
+  }
+	t1 = std::chrono::system_clock::now();
+
+	std::cout << "-----------------------------------------\n";
+	std::cout << "Model built in " << std::chrono::duration_cast<std::chrono::microseconds>(t1 - t0).count() << " us\n";
+
+	// Return the model
+	return corr;
+}
+
+void corr_check(Corrector& corr, double incurr)
+{
+	std::vector<std::string> strengths, units;
+	corr.get_strength_names(strengths);
+	corr.get_strength_units(units);
+	std::cout << corr.has_main_current() << " " << strengths[0] << " "<< units[0] << std::endl;
+	std::vector<double> in, out, inv_out;
+	in.push_back(incurr);
+	double rigidity = 1;
+	corr.compute_strengths(rigidity, in,out);
+	std::cout << out[0] << std::endl;
+	corr.compute_currents(rigidity,out,inv_out);
+	std::cout << inv_out[0] << std::endl;
+
+}
+// corrector test main
+int testC(int argc, char* argv[])
+{
+	if (argc != 2) {
+			std::cerr << "TestSextuCorr usage: TestSextuCorr <Path to parameter files folder>" << std::endl;
+			exit(-1);
+		}
+		std::string path(argv[1]);
+		if (path[path.size() - 1] != '/') {
+			path.append(1,'/');
+		}
+
+		// --- Initialize
+		// Magnet file names
+		std::string meas_strength_filename = "CH_strength.csv";
+		std::string param_filename = "CH_params.csv";
+		// Build the model
+		Corrector ch = corr(path, meas_strength_filename, param_filename, "CH-01");
+		// --- Check the model
+		corr_check(ch, 1.0);
+
+
+	    return 0;
+}
+
+//--------------------------
+int main(int argc,char *argv[])
+{
+	 return testC(argc,argv);
+}
+