From 8484ab7de5621c4f83c2ccd5d1a7c586589e588c Mon Sep 17 00:00:00 2001 From: colin Date: Sat, 1 Oct 2022 16:42:43 -0700 Subject: [PATCH] app: stacked cores: complete some 41-xx runs --- .../scripts/inverter_characteristics.py | 4 + .../stacked_cores/scripts/plot_inverters.py | 13 +- .../scripts/stacked_cores_40xx_db.py | 146 +++++++++++++++++- crates/applications/stacked_cores/src/main.rs | 15 +- 4 files changed, 160 insertions(+), 18 deletions(-) diff --git a/crates/applications/stacked_cores/scripts/inverter_characteristics.py b/crates/applications/stacked_cores/scripts/inverter_characteristics.py index ffb471c..7c643a9 100644 --- a/crates/applications/stacked_cores/scripts/inverter_characteristics.py +++ b/crates/applications/stacked_cores/scripts/inverter_characteristics.py @@ -27,6 +27,10 @@ class Piecewise: """ xy is a list of (x, y) pairs """ self.xy = list(xy) + @property + def num_pieces(self) -> int: + return len(self.xy) - 1 + def normalized(self, prev_max: float) -> 'Piecewise': """ map every coordinate from [-prev_max, prev_max] to [0, 1] """ p = prev_max diff --git a/crates/applications/stacked_cores/scripts/plot_inverters.py b/crates/applications/stacked_cores/scripts/plot_inverters.py index 6b333fc..4f7cdcc 100755 --- a/crates/applications/stacked_cores/scripts/plot_inverters.py +++ b/crates/applications/stacked_cores/scripts/plot_inverters.py @@ -56,17 +56,18 @@ of_interest = [] # of_interest += filter_meas(rad_um=800, drive=1e11, couplings=24, wrappings=3) # of_interest += [(p, c.shifted_y(-0.13)) for (p, c) in filter_meas(rad_um=800, drive=1e11, couplings=12, wrappings=7)] -of_interest += filter_meas(rad_um=800, drive=1e11, couplings=8, wrappings=11) -of_interest += filter_meas(rad_um=800, drive=1e11, couplings=10, wrappings=9) -of_interest += filter_meas(rad_um=1200, drive=1e11, couplings=12, wrappings=9) -of_interest += filter_meas(rad_um=1200, drive=1e11, couplings=10, wrappings=11) -of_interest += filter_meas(rad_um=1200, drive=2e11, couplings=12, wrappings=9) +# of_interest += filter_meas(run="40", rad_um=800, drive=1e11, couplings=8, wrappings=11) +# of_interest += filter_meas(run="40", rad_um=800, drive=1e11, couplings=10, wrappings=9) +# of_interest += filter_meas(run="40", rad_um=1200, drive=1e11, couplings=12, wrappings=9) +# of_interest += filter_meas(run="40", rad_um=1200, drive=1e11, couplings=10, wrappings=11) +# of_interest += filter_meas(run="40", rad_um=1200, drive=2e11, couplings=12, wrappings=9) + +of_interest += filter_meas(run="41") # plot all viable inverters # of_interest += [(p, c) for (p, c) in filter_meas() if c.logically_inverted().is_viable_inverter()] - for (params, curve) in of_interest: curve = curve.logically_inverted() curve.plot(title = f"{params.human_name} mapping") diff --git a/crates/applications/stacked_cores/scripts/stacked_cores_40xx_db.py b/crates/applications/stacked_cores/scripts/stacked_cores_40xx_db.py index d346108..1046672 100755 --- a/crates/applications/stacked_cores/scripts/stacked_cores_40xx_db.py +++ b/crates/applications/stacked_cores/scripts/stacked_cores_40xx_db.py @@ -43,13 +43,14 @@ class SimParams: @property def tuple(self): - return (self.um, self.couplings, self.wrappings, self.drive) + return (self.run, self.um, self.couplings, self.wrappings, self.drive) - def matches(self, rad_um: int, drive: float, couplings: int, wrappings: int) -> bool: + def matches(self, run: str, rad_um: int, drive: float, couplings: int, wrappings: int) -> bool: """ all parameters are optional """ match_tuple = ( + self.run if run is None else run, self.um if rad_um is None else rad_um, self.couplings if couplings is None else couplings, self.wrappings if wrappings is None else wrappings, @@ -112,14 +113,18 @@ sims = [ (SimParams40(10, 5, 1200, "1e11"), "fwd_40_1200um_10_11_1_1e11", 8000), (SimParams40(12, 4, 1200, "2e11"), "fwd_40_1200um_12_9_1_2e11", 8000), - (SimParams41(9, 1, 400, "3e9"), None, 20000), (SimParams41(9, 3, 600, "3e9"), None, 20000), + (SimParams41(9, 1, 400, "3e9"), None, 20000), + (SimParams41(10, 3, 800, "25e8"), None, 20000), + (SimParams41(9, 1, 400, "5e9"), None, 20000), + (SimParams41(9, 1, 400, "2e9"), None, 20000), + (SimParams41(9, 1, 400, "1e10"), None, 20000), (SimParams41(10, 3, 800, "3e9"), None, 20000), ] measurements = { real.machine_name: [human, norm, None, None] for (real, human, norm) in sims } -def filter_meas(rad_um: int = None, drive: float = None, couplings: int = None, wrappings: int = None) -> list: +def filter_meas(run: str = None, rad_um: int = None, drive: float = None, couplings: int = None, wrappings: int = None) -> list: """ return only that set of (SimParams, Piecewise) which matches the given criteria. leave any option as `None` to not filter on it. @@ -128,7 +133,9 @@ def filter_meas(rad_um: int = None, drive: float = None, couplings: int = None, return sorted( [ (p, get_meas(p)) for (p, _, _) in sims - if p.matches(rad_um, drive, couplings, wrappings) and get_meas(p) + if p.matches(run, rad_um, drive, couplings, wrappings) \ + and get_meas(p) \ + and get_meas(p).num_pieces > 0 ], key = lambda v: v[0].tuple ) @@ -140,8 +147,9 @@ def set_meas(real: str, expr: str): pw = eval(expr) measurements[real][2] = expr human, norm, _, _ = measurements[real] + measurements[real][3] = pw = pw.normalized(norm) if human: - globals()[human] = measurements[real][3] = pw.normalized(norm) + globals()[human] = pw def try_measure(real: str): try: @@ -1124,13 +1132,139 @@ Piecewise( ) """) +set_meas("41-0.00059999997rad-9coupling-7_1_winding-3e9-drive", """ +Piecewise( + [ + [ -17102, 6449 ], # -2.0 + [ -17031, 6440 ], # -1.5 + [ -16783, 6426 ], # -1.0 + [ -16089, 6493 ], # -0.8 + [ -9028, 8147 ], # -0.6 + [ -6768, 8679 ], # -0.5 + [ -6195, 8807 ], # -0.4 + [ -5589, 8931 ], # -0.3 + [ -5268, 8992 ], # -0.25 + [ -4937, 9056 ], # -0.2 + [ -4735, 9094 ], # -0.17 + [ -4600, 9118 ], # -0.15 + [ -4463, 9142 ], # -0.13 + [ -4257, 9181 ], # -0.1 + [ -4052, 9219 ], # -0.07 + [ -3915, 9246 ], # -0.05 + [ -3573, 9323 ], # 0.0 + [ -3236, 9403 ], # 0.05 + [ -2906, 9484 ], # 0.1 + [ -2270, 9641 ], # 0.2 + [ -1639, 9803 ], # 0.3 + [ 4763, 11378 ], # 0.5 + [ 16092, 13915 ], # 0.8 + [ 16937, 13981 ], # 1.0 + [ 17192, 13998 ], # 1.5 + [ 17253, 14001 ], # 2.0 + ] +) +""") + set_meas("41-0.0004rad-9coupling-3_1_winding-3e9-drive", """ Piecewise( [ + [ -16887, -4873 ], # -2.0 [ -16802, -4812 ], # -1.0 + [ -16749, -4794 ], # -0.8 + [ -16343, -4696 ], # -0.6 + [ -14391, -4098 ], # -0.5 + [ -13065, -3673 ], # -0.4 + [ -12414, -3462 ], # -0.3 + [ -12066, -3349 ], # -0.25 + [ -11687, -3228 ], # -0.2 + [ -11442, -3150 ], # -0.17 + [ -11270, -3094 ], # -0.15 + [ -11088, -3036 ], # -0.13 + [ -10791, -2940 ], # -0.1 + [ -10471, -2836 ], # -0.07 + [ -10248, -2763 ], # -0.05 [ -9667, -2573 ], # 0.0 [ -9056, -2372 ], # 0.05 + [ -8283, -2113 ], # 0.1 + [ -3257, -395 ], # 0.2 + [ 2914, 1681 ], # 0.3 + [ 15191, 5995 ], # 0.5 + [ 16935, 6397 ], # 0.8 [ 16994, 6381 ], # 1.0 + [ 17039, 6389 ], # 1.5 + [ 17079, 6399 ], # 2.0 + ] +) +""") + +set_meas("41-0.0008rad-10coupling-7_1_winding-25e8-drive", """ +Piecewise( + [ + [ -12586, 10173 ], # -1.0 + [ -1330, 11989 ], # -0.17 + [ -1243, 12002 ], # -0.15 + [ -1157, 12014 ], # -0.13 + [ -1034, 12033 ], # -0.1 + [ -916, 12051 ], # -0.07 + [ -841, 12062 ], # -0.05 + [ -662, 12087 ], # 0.0 + [ -506, 12107 ], # 0.05 + [ -378, 12124 ], # 0.1 + [ 12563, 12412 ], # 1.0 + ] +) +""") + +set_meas("41-0.0004rad-9coupling-3_1_winding-5e9-drive", """ +Piecewise( + [ + [ -16858, -15999 ], # -1.0 + [ -12812, -15788 ], # -0.17 + [ -12636, -15779 ], # -0.15 + [ -12458, -15768 ], # -0.13 + [ -12187, -15753 ], # -0.1 + [ -11911, -15737 ], # -0.07 + [ -11721, -15725 ], # -0.05 + [ -11192, -15692 ], # 0.0 + [ -10148, -15605 ], # 0.05 + [ -5572, -15000 ], # 0.1 + [ 17079, 1636 ], # 1.0 + ] +) +""") + +set_meas("41-0.0004rad-9coupling-3_1_winding-2e9-drive", """ +Piecewise( + [ + [ -16571, 2372 ], # -1.0 + [ -5986, 5641 ], # -0.17 + [ -5733, 5725 ], # -0.15 + [ -5481, 5809 ], # -0.13 + [ -5105, 5933 ], # -0.1 + [ -4734, 6057 ], # -0.07 + [ -4491, 6139 ], # -0.05 + [ -3909, 6334 ], # 0.0 + [ -3352, 6521 ], # 0.05 + [ -2818, 6702 ], # 0.1 + [ 16714, 12996 ], # 1.0 + ] +) +""") + +set_meas("41-0.0004rad-9coupling-3_1_winding-1e10-drive", """ +Piecewise( + [ + [ -16931, -16791 ], # -1.0 + [ -15511, -16791 ], # -0.17 + [ -14631, -16790 ], # -0.15 + [ -14115, -16790 ], # -0.13 + [ -13476, -16790 ], # -0.1 + [ -12908, -16788 ], # -0.07 + [ -12523, -16787 ], # -0.05 + [ -11224, -16783 ], # 0.0 + [ -5604, -16743 ], # 0.05 + [ 4926, -14787 ], # 0.1 + [ 17210, -1376 ], # 1.0 ] ) """) diff --git a/crates/applications/stacked_cores/src/main.rs b/crates/applications/stacked_cores/src/main.rs index be46e43..2abfaa5 100644 --- a/crates/applications/stacked_cores/src/main.rs +++ b/crates/applications/stacked_cores/src/main.rs @@ -4006,8 +4006,8 @@ fn main() { 1.00, -1.00, 0.00, - // ][..], - // &[ + ][..], + &[ // establish the slope around the most likely stable/amplifying region -0.05, 0.05, @@ -4041,9 +4041,12 @@ fn main() { ] { for (coupling_loops, s0_loops, s_major, cur_flt) in [ // VIABLE INVERTERS from 40xx, modified for new control - (9, 1, um(400), 3e9), // unstarted - (9, 3, um(600), 3e9), // unstarted - (10, 3, um(800), 25e8), // unstarted; verified geom. + (9, 1, um(400), 1e10), // incomplete; VIABLE INVERTER + // (9, 3, um(600), 3e9), // incomplete; too low slope; too high tx @ 0 + // (9, 1, um(400), 3e9), // incomplete; too low slope; too high tx @ 0 + // (10, 3, um(800), 25e8), // incomplete; verified geom; too low slope; too high tx @ 0 + (9, 1, um(400), 5e9), // incomplete; good tx 0; not enough samples + // (9, 1, um(400), 2e9), // incomplete; too low slope; too high tx @ 0 // (10, 3, um(800), 2e9), // unstarted; verified geom. too low current // (10, 3, um(800), 3e9), // incomplete; verified geom. mildly high current // (10, 3, um(800), 1e9), // incomplete; verified geom. too low current @@ -4086,7 +4089,7 @@ fn main() { let name = asymmetric_inverter_name(¶ms, "41", 2*s0_loops + 1, init_flt); run_sim( &name, - drive_map_2stack_with_init(-init_flt), /* XXX: inversion to preserve legacy orientation */ + drive_map_2stack_with_init2(-init_flt, -1.0), params, ); }