From 8917c4a562bf7dfdc731965301a959373f7c0ade Mon Sep 17 00:00:00 2001 From: colin Date: Tue, 13 Sep 2022 00:49:48 -0700 Subject: [PATCH] app: stacked_cores: define a bunch more sims, especially ones with asymmetric wrappings this complicates the implementation quite a bit... i imagine this whole file will be axed someday and treated as a temporary prototype... we'll see :^) --- crates/applications/stacked_cores/src/main.rs | 533 +++++++++++++++++- crates/post/scripts/stacked_cores_24xx.py | 27 + crates/post/scripts/stacked_cores_28xx.py | 29 + 3 files changed, 585 insertions(+), 4 deletions(-) create mode 100755 crates/post/scripts/stacked_cores_24xx.py create mode 100755 crates/post/scripts/stacked_cores_28xx.py diff --git a/crates/applications/stacked_cores/src/main.rs b/crates/applications/stacked_cores/src/main.rs index 829bf7a..77b277e 100644 --- a/crates/applications/stacked_cores/src/main.rs +++ b/crates/applications/stacked_cores/src/main.rs @@ -17,6 +17,7 @@ use coremem::geom::region::{ Torus, Translate, Union, + WedgeZ, }; use coremem::mat::{Ferroxcube3R1MH, IsoConductorOr, IsomorphicConductor}; use coremem::meas; @@ -85,6 +86,24 @@ enum CouplingMethod { /// couple the points by first directing a loop outside of the core stack, thereby ensuring /// nothing in-between them is coupled. Outside, + + // multi-wrapping related variants: + /// partially couple one core to another, but only place the exterior portion of that loop + DirectHalfExterior, + /// partially couple one core to another, but only place the interior portion of that loop + DirectHalfInterior, + + /// lay a wire from one angular slice to the next -- on the same core. + /// place this wire *above* the core. + SelfAngularTop, + /// lay a wire from one angular slice to the next -- on the same core. + /// place this wire *below* the core. + SelfAngularBot, + + /// lay half a loop around this core -- but only the exterior half. + SelfLoopHalfExterior, + /// lay half a loop around this core -- but only the interior half. + SelfLoopHalfInterior, } #[derive(Clone)] @@ -177,6 +196,46 @@ impl Params { Meters::new(self.sx(), self.sy(), center_z) ) } + /// this is `coupling_direct`, but preserves only either the exterior, or interior coupling + fn coupling_direct_half(&self, from: u32, to: u32, loop_: u32, set_id: u32, of_set: u32, exterior: bool) -> impl Region { + let angle = self.coupling_angle(loop_, set_id, of_set); + let from_z = self.sz(from); + let to_z = self.sz(to); + let center_z = (from_z + to_z) * 0.5; + let coupling_length = (to_z - from_z).abs(); + let torus = ElongatedTorus::new_xz( + Meters::new(self.s_major, 0.0, 0.0), + coupling_length, + self.coupling_major, + self.coupling_minor, + ); + let active_half = if exterior { + // keep only the x > s_major half of the loop + Cube::new( + Meters::new(self.s_major, -1.0, -1.0), + Meters::new(1.0, 1.0, 1.0), + ) + } else { + // keep only the x < s_major half of the loop + Cube::new( + Meters::new(0.0, -1.0, -1.0), + Meters::new(self.s_major, 1.0, 1.0), + ) + }; + Translate::new( + Rotate::about_z( + angle, + Intersection::new2(torus, active_half), + ), + Meters::new(self.sx(), self.sy(), center_z) + ) + } + fn coupling_direct_half_exterior(&self, from: u32, to: u32, loop_: u32, set_id: u32, of_set: u32) -> impl Region { + self.coupling_direct_half(from, to, loop_, set_id, of_set, true) + } + fn coupling_direct_half_interior(&self, from: u32, to: u32, loop_: u32, set_id: u32, of_set: u32) -> impl Region { + self.coupling_direct_half(from, to, loop_, set_id, of_set, false) + } /// like `coupling_direct`, but routes the wires outside the core stack, /// thereby avoiding any accidental coupling of adjacent cores. fn coupling_outside(&self, mut from: u32, mut to: u32, loop_: u32, set_id: u32, of_set: u32) -> impl Region { @@ -279,6 +338,74 @@ impl Params { Meters::new(self.sx(), self.sy(), 0.0), ) } + /// wrap half-way around the core -- either wrap the exterior half of the interior half. + fn coupling_self_loop_half(&self, core: u32, loop_: u32, set_id: u32, of_set: u32, exterior: bool) -> impl Region { + let angle = self.coupling_angle(loop_, set_id, of_set); + + let full_loop = Torus::new_xz( + Meters::new(self.s_major, 0.0, 0.0), + self.coupling_major, + self.coupling_minor, + ); + let active_half = if exterior { + // keep only the x > s_major half of the loop + Cube::new( + Meters::new(self.s_major, -1.0, -1.0), + Meters::new(1.0, 1.0, 1.0), + ) + } else { + // keep only the x < s_major half of the loop + Cube::new( + Meters::new(0.0, -1.0, -1.0), + Meters::new(self.s_major, 1.0, 1.0), + ) + }; + Translate::new( + Rotate::about_z( + angle, + Intersection::new2(full_loop, active_half), + ), + Meters::new(self.sx(), self.sy(), self.sz(core)) + ) + } + fn coupling_self_loop_half_exterior(&self, from: u32, to: u32, loop_: u32, set_id: u32, of_set: u32) -> impl Region { + assert_eq!(from, to); // can only self-couple. + self.coupling_self_loop_half(from, loop_, set_id, of_set, true) + } + fn coupling_self_loop_half_interior(&self, from: u32, to: u32, loop_: u32, set_id: u32, of_set: u32) -> impl Region { + assert_eq!(from, to); // can only self-couple. + self.coupling_self_loop_half(from, loop_, set_id, of_set, false) + } + /// connect one 'slice' of the core to the next 'slice'. + /// use either a wire on "top" of the core, or one on "bottom" + fn coupling_self_angular(&self, core: u32, loop_: u32, set_id: u32, of_set: u32, top: bool) -> impl Region { + let start_angle = self.coupling_angle(loop_, set_id, of_set); + let end_angle = self.coupling_angle(loop_, set_id + 1, of_set); + let z = if top { + self.sz(core) + self.coupling_major + } else { + self.sz(core) - self.coupling_major + }; + let full_loop = Torus::new_xy( + Meters::new(0.0, 0.0, z), + self.s_major, + self.coupling_minor, + ); + let slice = WedgeZ::new(start_angle, end_angle); + Translate::new( + Intersection::new2(full_loop, slice), + Meters::new(self.sx(), self.sy(), 0.0), + ) + } + fn coupling_self_angular_top(&self, from: u32, to: u32, loop_: u32, set_id: u32, of_set: u32) -> impl Region { + assert_eq!(from, to); // can only self-couple. + self.coupling_self_angular(from, loop_, set_id, of_set, true) + } + fn coupling_self_angular_bot(&self, from: u32, to: u32, loop_: u32, set_id: u32, of_set: u32) -> impl Region { + assert_eq!(from, to); // can only self-couple. + self.coupling_self_angular(from, loop_, set_id, of_set, false) + } + fn control_signal_hold(&self, cycle: u32, amp: f32) -> ClockSegment { // simple square wave: @@ -765,6 +892,19 @@ fn drive_map_3stack_through_saturation(gate_amp: f32, drive_amp: f32) -> [[Clock ] } +#[allow(unused)] +fn drive_map_2stack_with_init(amp: f32) -> [[ClockState; 2]; 3] { + use ClockState as C; + [ + // charge S0. + [C::hold(amp), C::hold_low(), ], + // let the cores settle + [C::release(amp),C::release_low()], + // write S0 -> S1. + [C::hold_low(), C::float(), ], + ] +} + fn main() { coremem::init_logging(); // coremem::init_debug(); @@ -2308,7 +2448,7 @@ fn main() { ); } - if true { + if false { let p22xx = params .with_clock_phase_duration(ps(1000)) .with_clock_decay(ps(50)) @@ -2373,6 +2513,369 @@ fn main() { p22xx.clone() ); } + + if false { + let p23xx = params + .with_clock_phase_duration(ps(1000)) + .with_clock_decay(ps(50)) + .with_ctl_conductivity(5e2) + .with_coupling_conductivity(5e3) + .with_s_major(um(400)) + .with_input_magnitude(8e10) + .with_coupling_loops(6) + // couple S0 to S1 + .with_coupling(0, 1, 0, 4, CouplingMethod::DirectHalfExterior) + .with_coupling(0, 1, 3, 4, CouplingMethod::DirectHalfInterior) + // "loops" for S1 (none) + .with_coupling(1, 1, 0, 4, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 1, 4, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 2, 4, CouplingMethod::SelfAngularTop) + // loops for S0: + .with_coupling(0, 0, 0, 4, CouplingMethod::SelfLoopHalfInterior) + .with_coupling(0, 0, 0, 4, CouplingMethod::SelfAngularTop) + .with_coupling(0, 0, 1, 4, CouplingMethod::SelfLoopHalfExterior) + .with_coupling(0, 0, 1, 4, CouplingMethod::SelfAngularBot) + .with_coupling(0, 0, 2, 4, CouplingMethod::SelfLoopHalfInterior) + .with_coupling(0, 0, 2, 4, CouplingMethod::SelfAngularTop) + .with_coupling(0, 0, 3, 4, CouplingMethod::SelfLoopHalfExterior) + ; + + run_sim( + "23-3stack-5_1_winding-8e10-drive-neg-gate-p100", + drive_map_3stack_through_saturation(-1.0, 1.00), + p23xx.clone() + ); + run_sim( + "23-3stack-5_1_winding-8e10-drive-neg-gate-000", + drive_map_3stack_through_saturation(-1.0, 0.00), + p23xx.clone() + ); + run_sim( + "23-3stack-5_1_winding-8e10-drive-neg-gate-n100", + drive_map_3stack_through_saturation(-1.0, -1.00), + p23xx.clone() + ); + + for (cur, scur) in [(8e10, "8e10"), (5e10, "5e10"), (2e10, "2e10"), (1e10, "1e10")] { + let p = p23xx.with_input_magnitude(cur); + for a in [100, 50, 30, 20, 15, 10, 5, 2, 0] { + if a == 0 { + run_sim( + &format!("24-2stack-5_1_winding-{}-drive-neg-gate-000", scur), + drive_map_2stack_with_init(0.00), + p.clone() + ); + } else { + run_sim( + &format!("24-2stack-5_1_winding-{}-drive-neg-gate-p{}", scur, a), + drive_map_2stack_with_init(0.01 * a as f32), + p.clone() + ); + run_sim( + &format!("24-2stack-5_1_winding-{}-drive-neg-gate-n{}", scur, a), + drive_map_2stack_with_init(-0.01 * a as f32), + p.clone() + ); + } + } + } + } + + if false { + let p25xx = params + .with_clock_phase_duration(ps(1000)) + .with_clock_decay(ps(50)) + .with_ctl_conductivity(5e2) + .with_coupling_conductivity(5e3) + .with_s_major(um(400)) + .with_input_magnitude(5e10) + .with_coupling_loops(2) + // couple S0 to S1 + .with_coupling(0, 1, 0, 14, CouplingMethod::DirectHalfExterior) + .with_coupling(0, 1, 13, 14, CouplingMethod::DirectHalfInterior) + // "loops" for S1 (none) + .with_coupling(1, 1, 0, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 1, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 2, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 3, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 4, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 5, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 6, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 7, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 8, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 9, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 10, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 11, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 12, 14, CouplingMethod::SelfAngularTop) + // loops for S0: + .with_coupling(0, 0, 0, 14, CouplingMethod::SelfLoopHalfInterior) + .with_coupling(0, 0, 0, 14, CouplingMethod::SelfAngularTop) + .with_coupling(0, 0, 1, 14, CouplingMethod::SelfLoopHalfExterior) + .with_coupling(0, 0, 1, 14, CouplingMethod::SelfAngularBot) + .with_coupling(0, 0, 2, 14, CouplingMethod::SelfLoopHalfInterior) + .with_coupling(0, 0, 2, 14, CouplingMethod::SelfAngularTop) + .with_coupling(0, 0, 3, 14, CouplingMethod::SelfLoopHalfExterior) + .with_coupling(0, 0, 3, 14, CouplingMethod::SelfAngularBot) + .with_coupling(0, 0, 4, 14, CouplingMethod::SelfLoopHalfInterior) + .with_coupling(0, 0, 4, 14, CouplingMethod::SelfAngularTop) + .with_coupling(0, 0, 5, 14, CouplingMethod::SelfLoopHalfExterior) + .with_coupling(0, 0, 5, 14, CouplingMethod::SelfAngularBot) + .with_coupling(0, 0, 6, 14, CouplingMethod::SelfLoopHalfInterior) + .with_coupling(0, 0, 6, 14, CouplingMethod::SelfAngularTop) + .with_coupling(0, 0, 7, 14, CouplingMethod::SelfLoopHalfExterior) + .with_coupling(0, 0, 7, 14, CouplingMethod::SelfAngularBot) + .with_coupling(0, 0, 8, 14, CouplingMethod::SelfLoopHalfInterior) + .with_coupling(0, 0, 8, 14, CouplingMethod::SelfAngularTop) + .with_coupling(0, 0, 9, 14, CouplingMethod::SelfLoopHalfExterior) + .with_coupling(0, 0, 9, 14, CouplingMethod::SelfAngularBot) + .with_coupling(0, 0, 10,14, CouplingMethod::SelfLoopHalfInterior) + .with_coupling(0, 0, 10,14, CouplingMethod::SelfAngularTop) + .with_coupling(0, 0, 11,14, CouplingMethod::SelfLoopHalfExterior) + .with_coupling(0, 0, 11,14, CouplingMethod::SelfAngularBot) + .with_coupling(0, 0, 12,14, CouplingMethod::SelfLoopHalfInterior) + .with_coupling(0, 0, 12,14, CouplingMethod::SelfAngularTop) + .with_coupling(0, 0, 13,14, CouplingMethod::SelfLoopHalfExterior) + ; + for a in [100, 0, 20, 50, 10, 30, 5] { + for (cur, scur) in [(5e10, "5e10"), (8e10, "8e10"), (1e11, "1e11"), (2e11, "2e11")] { + let p = p25xx.with_input_magnitude(cur); + if a == 0 { + run_sim( + &format!("25-2stack-15_1_winding-{}-drive-neg-gate-000", scur), + drive_map_2stack_with_init(0.00), + p.clone(), + ); + } else { + run_sim( + &format!("25-2stack-15_1_winding-{}-drive-neg-gate-p{}", scur, a), + drive_map_2stack_with_init(0.01 * a as f32), + p.clone(), + ); + run_sim( + &format!("25-2stack-15_1_winding-{}-drive-neg-gate-n{}", scur, a), + drive_map_2stack_with_init(-0.01 * a as f32), + p.clone(), + ); + } + } + } + } + + if false { + let p26xx = params + .with_clock_phase_duration(ps(1000)) + .with_clock_decay(ps(50)) + .with_ctl_conductivity(5e2) + .with_coupling_conductivity(5e3) + .with_s_major(um(400)) + .with_input_magnitude(5e10) + .with_coupling_loops(6) + // couple S0 to S1 + .with_coupling(0, 1, 0, 6, CouplingMethod::DirectHalfExterior) + .with_coupling(0, 1, 5, 6, CouplingMethod::DirectHalfInterior) + // "loops" for S1 (none) + .with_coupling(1, 1, 0, 6, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 1, 6, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 2, 6, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 3, 6, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 4, 6, CouplingMethod::SelfAngularTop) + // loops for S0: + .with_coupling(0, 0, 0, 6, CouplingMethod::SelfLoopHalfInterior) + .with_coupling(0, 0, 0, 6, CouplingMethod::SelfAngularTop) + .with_coupling(0, 0, 1, 6, CouplingMethod::SelfLoopHalfExterior) + .with_coupling(0, 0, 1, 6, CouplingMethod::SelfAngularBot) + .with_coupling(0, 0, 2, 6, CouplingMethod::SelfLoopHalfInterior) + .with_coupling(0, 0, 2, 6, CouplingMethod::SelfAngularTop) + .with_coupling(0, 0, 3, 6, CouplingMethod::SelfLoopHalfExterior) + .with_coupling(0, 0, 3, 6, CouplingMethod::SelfAngularBot) + .with_coupling(0, 0, 4, 6, CouplingMethod::SelfLoopHalfInterior) + .with_coupling(0, 0, 4, 6, CouplingMethod::SelfAngularTop) + .with_coupling(0, 0, 5, 6, CouplingMethod::SelfLoopHalfExterior) + ; + run_sim( + "26-2stack-6x7_1_winding-5e10-drive-neg-gate-000", + drive_map_2stack_with_init(0.00), + p26xx.clone(), + ); + run_sim( + "26-2stack-6x7_1_winding-5e10-drive-neg-gate-p100", + drive_map_2stack_with_init(1.00), + p26xx.clone(), + ); + run_sim( + "26-2stack-6x7_1_winding-5e10-drive-neg-gate-n100", + drive_map_2stack_with_init(-1.00), + p26xx.clone(), + ); + run_sim( + "26-2stack-6x7_1_winding-5e10-drive-neg-gate-n20", + drive_map_2stack_with_init(-0.20), + p26xx.clone(), + ); + run_sim( + "26-2stack-6x7_1_winding-5e10-drive-neg-gate-n30", + drive_map_2stack_with_init(-0.30), + p26xx.clone(), + ); + run_sim( + "26-2stack-6x7_1_winding-5e10-drive-neg-gate-n50", + drive_map_2stack_with_init(-0.50), + p26xx.clone(), + ); + } + + if true { + let p27xx = params + .with_clock_phase_duration(ps(1000)) + .with_clock_decay(ps(50)) + .with_ctl_conductivity(5e2) + .with_coupling_conductivity(5e3) + .with_s_major(um(800)) + .with_input_magnitude(2e11) + .with_coupling_loops(6) + // couple S0 to S1 + .with_coupling(0, 1, 0, 14, CouplingMethod::DirectHalfExterior) + .with_coupling(0, 1, 13, 14, CouplingMethod::DirectHalfInterior) + // "loops" for S1 (none) + .with_coupling(1, 1, 0, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 1, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 2, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 3, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 4, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 5, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 6, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 7, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 8, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 9, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 10, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 11, 14, CouplingMethod::SelfAngularTop) + .with_coupling(1, 1, 12, 14, CouplingMethod::SelfAngularTop) + // loops for S0: + .with_coupling(0, 0, 0, 14, CouplingMethod::SelfLoopHalfInterior) + .with_coupling(0, 0, 0, 14, CouplingMethod::SelfAngularTop) + .with_coupling(0, 0, 1, 14, CouplingMethod::SelfLoopHalfExterior) + .with_coupling(0, 0, 1, 14, CouplingMethod::SelfAngularBot) + .with_coupling(0, 0, 2, 14, CouplingMethod::SelfLoopHalfInterior) + .with_coupling(0, 0, 2, 14, CouplingMethod::SelfAngularTop) + .with_coupling(0, 0, 3, 14, CouplingMethod::SelfLoopHalfExterior) + .with_coupling(0, 0, 3, 14, CouplingMethod::SelfAngularBot) + .with_coupling(0, 0, 4, 14, CouplingMethod::SelfLoopHalfInterior) + .with_coupling(0, 0, 4, 14, CouplingMethod::SelfAngularTop) + .with_coupling(0, 0, 5, 14, CouplingMethod::SelfLoopHalfExterior) + .with_coupling(0, 0, 5, 14, CouplingMethod::SelfAngularBot) + .with_coupling(0, 0, 6, 14, CouplingMethod::SelfLoopHalfInterior) + .with_coupling(0, 0, 6, 14, CouplingMethod::SelfAngularTop) + .with_coupling(0, 0, 7, 14, CouplingMethod::SelfLoopHalfExterior) + .with_coupling(0, 0, 7, 14, CouplingMethod::SelfAngularBot) + .with_coupling(0, 0, 8, 14, CouplingMethod::SelfLoopHalfInterior) + .with_coupling(0, 0, 8, 14, CouplingMethod::SelfAngularTop) + .with_coupling(0, 0, 9, 14, CouplingMethod::SelfLoopHalfExterior) + .with_coupling(0, 0, 9, 14, CouplingMethod::SelfAngularBot) + .with_coupling(0, 0,10, 14, CouplingMethod::SelfLoopHalfInterior) + .with_coupling(0, 0,10, 14, CouplingMethod::SelfAngularTop) + .with_coupling(0, 0,11, 14, CouplingMethod::SelfLoopHalfExterior) + .with_coupling(0, 0,11, 14, CouplingMethod::SelfAngularBot) + .with_coupling(0, 0,12, 14, CouplingMethod::SelfLoopHalfInterior) + .with_coupling(0, 0,12, 14, CouplingMethod::SelfAngularTop) + .with_coupling(0, 0,13, 14, CouplingMethod::SelfLoopHalfExterior) + ; + run_sim( + "27-2stack-6x15_1_winding-2e11-drive-neg-gate-000", + drive_map_2stack_with_init(0.00), + p27xx.clone(), + ); + run_sim( + "27-2stack-6x15_1_winding-2e11-drive-neg-gate-p100", + drive_map_2stack_with_init(1.00), + p27xx.clone(), + ); + run_sim( + "27-2stack-6x15_1_winding-2e11-drive-neg-gate-n100", + drive_map_2stack_with_init(-1.00), + p27xx.clone(), + ); + run_sim( + "27-2stack-6x15_1_winding-2e11-drive-neg-gate-n20", + drive_map_2stack_with_init(-0.20), + p27xx.clone(), + ); + run_sim( + "27-2stack-6x15_1_winding-2e11-drive-neg-gate-n30", + drive_map_2stack_with_init(-0.30), + p27xx.clone(), + ); + run_sim( + "27-2stack-6x15_1_winding-2e11-drive-neg-gate-n50", + drive_map_2stack_with_init(-0.50), + p27xx.clone(), + ); + } + + if false { + let p28xx = params + .with_clock_phase_duration(ps(1000)) + .with_clock_decay(ps(50)) + .with_ctl_conductivity(5e2) + .with_coupling_conductivity(5e3) + .with_s_major(um(400)) + .with_input_magnitude(8e10) + .with_coupling_loops(6) + // 24:24 coupling between S1, S2 + .with_coupling(0, 1, 0, 5, CouplingMethod::Direct) + .with_coupling(0, 1, 1, 5, CouplingMethod::Direct) + .with_coupling(0, 1, 2, 5, CouplingMethod::Direct) + .with_coupling(0, 1, 3, 5, CouplingMethod::Direct) + // 6:6 coupling between S0, S1 + .with_coupling(1, 2, 4, 5, CouplingMethod::Direct) + ; + + run_sim( + "28-3stack-24_6_loop-8e10-drive-neg-gate-p100", + drive_map_3stack_through_saturation(-1.0, 1.00), + p28xx.clone() + ); + run_sim( + "28-3stack-24_6_loop-8e10-drive-neg-gate-000", + drive_map_3stack_through_saturation(-1.0, 0.00), + p28xx.clone() + ); + run_sim( + "28-3stack-24_6_loop-8e10-drive-neg-gate-n100", + drive_map_3stack_through_saturation(-1.0, -1.00), + p28xx.clone() + ); + + run_sim( + "28-3stack-24_6_loop-8e10-drive-neg-gate-n050", + drive_map_3stack_through_saturation(-1.0, -0.50), + p28xx.clone() + ); + run_sim( + "28-3stack-24_6_loop-8e10-drive-neg-gate-n020", + drive_map_3stack_through_saturation(-1.0, -0.20), + p28xx.clone() + ); + run_sim( + "28-3stack-24_6_loop-8e10-drive-neg-gate-n010", + drive_map_3stack_through_saturation(-1.0, -0.10), + p28xx.clone() + ); + run_sim( + "28-3stack-24_6_loop-8e10-drive-neg-gate-p010", + drive_map_3stack_through_saturation(-1.0, 0.10), + p28xx.clone() + ); + run_sim( + "28-3stack-24_6_loop-8e10-drive-neg-gate-p020", + drive_map_3stack_through_saturation(-1.0, 0.20), + p28xx.clone() + ); + run_sim( + "28-3stack-24_6_loop-8e10-drive-neg-gate-p050", + drive_map_3stack_through_saturation(-1.0, 0.50), + p28xx.clone() + ); + } } @@ -2432,8 +2935,30 @@ fn run_sim( for &(from, to, id, of, meth) in ¶ms.couplings { for loop_ in 0..params.coupling_loops { match meth { - CouplingMethod::Direct => driver.fill_region(¶ms.coupling_direct(from, to, loop_, id, of), coupling_mat), - CouplingMethod::Outside => driver.fill_region(¶ms.coupling_outside(from, to, loop_, id, of), coupling_mat), + CouplingMethod::Direct => driver.fill_region( + ¶ms.coupling_direct(from, to, loop_, id, of), coupling_mat + ), + CouplingMethod::Outside => driver.fill_region( + ¶ms.coupling_outside(from, to, loop_, id, of), coupling_mat + ), + CouplingMethod::DirectHalfExterior => driver.fill_region( + ¶ms.coupling_direct_half_exterior(from, to, loop_, id, of), coupling_mat + ), + CouplingMethod::DirectHalfInterior => driver.fill_region( + ¶ms.coupling_direct_half_interior(from, to, loop_, id, of), coupling_mat + ), + CouplingMethod::SelfAngularTop => driver.fill_region( + ¶ms.coupling_self_angular_top(from, to, loop_, id, of), coupling_mat + ), + CouplingMethod::SelfAngularBot => driver.fill_region( + ¶ms.coupling_self_angular_bot(from, to, loop_, id, of), coupling_mat + ), + CouplingMethod::SelfLoopHalfExterior => driver.fill_region( + ¶ms.coupling_self_loop_half_exterior(from, to, loop_, id, of), coupling_mat + ), + CouplingMethod::SelfLoopHalfInterior => driver.fill_region( + ¶ms.coupling_self_loop_half_interior(from, to, loop_, id, of), coupling_mat + ), } } } @@ -2454,7 +2979,7 @@ fn run_sim( &name, params.coupling_direct(from, to, 0, id, of), )); }, - CouplingMethod::Outside => { + _ => { // TODO: dream up a way to sense this current // driver.add_measurement(meas::CurrentLoop::new( // &name, params.coupling_outside(from, to, 0, id, of), diff --git a/crates/post/scripts/stacked_cores_24xx.py b/crates/post/scripts/stacked_cores_24xx.py new file mode 100755 index 0000000..c74c404 --- /dev/null +++ b/crates/post/scripts/stacked_cores_24xx.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 +""" +invoke with the path to a meas.csv file for the stacked_core 24-xx demos +to extract higher-level info from them. +""" +import sys + +from stacked_cores import load_csv, labeled_rows, last_row_before_t, extract_m + +def extract_24xx(path: str): + header, raw_rows = load_csv(path) + rows = labeled_rows(header, raw_rows) + + tx_init = last_row_before_t(rows, 2e-9) + tx_fini = last_row_before_t(rows, 3e-9) + m_init = extract_m(tx_init) + m_fini = extract_m(tx_fini) + + m0 = -(m_fini[0] - m_init[0]) + m1 = m_fini[1] - m_init[1] + + print(f'\t- m0: {m0} ({m_init[0]} -> {m_fini[0]})') + print(f'\t- m1: {m1} ({m_init[1]} -> {m_fini[1]})') + print(f'\t- amp: {m1/m0}') + +if __name__ == '__main__': + extract_24xx(sys.argv[1]) diff --git a/crates/post/scripts/stacked_cores_28xx.py b/crates/post/scripts/stacked_cores_28xx.py new file mode 100755 index 0000000..594e20a --- /dev/null +++ b/crates/post/scripts/stacked_cores_28xx.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 +""" +invoke with the path to a meas.csv file for the stacked_core 28-xx demos +to extract higher-level info from them. +""" +import sys + +from stacked_cores import load_csv, labeled_rows, last_row_before_t, extract_m + +def extract_28xx(path: str): + header, raw_rows = load_csv(path) + rows = labeled_rows(header, raw_rows) + + tx_init = last_row_before_t(rows, 2e-9) + tx_fini = last_row_before_t(rows, 3e-9) + m_init = extract_m(tx_init) + m_fini = extract_m(tx_fini) + + m0 = -(m_fini[0] - m_init[0]) + m1 = m_fini[1] - m_init[1] + m2 = -(m_fini[2] - m_init[2]) + + print(f'\t- m0: {m0} ({m_init[0]} -> {m_fini[0]})') + print(f'\t- m1: {m1} ({m_init[1]} -> {m_fini[1]})') + print(f'\t- m2: {m2} ({m_init[2]} -> {m_fini[2]})') + print(f'\t- amp: {m2/m0}') + +if __name__ == '__main__': + extract_28xx(sys.argv[1])