Compare commits

...

5 Commits

Author SHA1 Message Date
colin 87366cf473 app: stacked_cores: define an "or gate" sim + script for post-processing
extract transfer characteristics with e.g.
```
extract_meas.py ../../../out/applications/stacked_cores/52-or--0.0004rad-5000ctl_cond-20000coupling_cond-2000ps-100ps-3ctl-3coupling-3_1_winding-49999998976e0-drive- 2e-9 4e-9 8e-9
```
2022-11-01 00:11:50 -07:00
colin 9d2fbf8b07 app: stacked_cores: expand the 48-xx run set 2022-10-31 20:49:11 -07:00
colin 267a204e7e app: stacked_cores: complete some more 51-xx runs with variable winding ratios 2022-10-29 01:05:51 -07:00
colin fc0ce9f083 app: stacked_cores: 51-xx: try some higher-current variants; schedule some 5:1 and 7:1 inverter runs 2022-10-28 05:18:18 -07:00
colin 0c7df48234 app: stacked_cores: 51-xx: complete some experiments using single-clock cascaded cores
i'm able to get 0.8x amplification between the first and the third core.
this is *less* than the amplification i got when cascading only one core
of the first, so not likely a good direction to pursue, though i haven't
yet explored that much of the parameter space.
2022-10-28 02:43:12 -07:00
4 changed files with 609 additions and 65 deletions

View File

@ -0,0 +1,102 @@
#!/usr/bin/env python3
"""
invoke with the path to a meas.csv file for the stacked_core 51-xx or later demos
to extract higher-level info from them.
"""
import os
import sys
import re
from stacked_cores import load_csv, labeled_rows, last_row_before_t, extract_m
from stacked_cores_39xx import extract_polarity
class MeasRow:
def __init__(self, t_sec: float, m: list):
self.t_sec = t_sec
self.m = m
def __repr__(self) -> str:
m = ", ".join(f"{v:6}" for v in self.m)
return f"MeasRow({self.t_sec}, [{m}])"
@staticmethod
def from_dict(row_data: dict) -> 'MeasRow':
t_sec = row_data["time"]
m = [int(m + 0.5) for m in extract_m(row_data)]
return MeasRow(t_sec, m)
def format_float_tuple(t: tuple) -> str:
formatted_elems = [f"{e:= 05.3f}," for e in t]
return f"({' '.join(formatted_elems)})"
def format_list(l: list) -> str:
if len(l) == 0: return "[]"
if len(l) == 1: return f"{l}"
formatted_elems = [f"\t{e}" for e in l]
return "\n".join(["["] + formatted_elems + ["]"])
def indented(s: str) -> str:
return s.replace('\n', '\n\t')
class ParameterizedMeas:
def __init__(self, meas = None):
self.meas = meas or {}
def add_meas(self, params: tuple, meas_rows: list):
self.meas[tuple(params)] = meas_rows
def __repr__(self) -> str:
meas_entries = "\n".join(
f"\t{format_float_tuple(k)}: {indented(format_list(v))}," for (k, v) in sorted(self.meas.items())
)
return f"ParameterizedMeas({{\n{meas_entries}\n}})"
def extract_rows(path: str, times: list) -> list:
header, raw_rows = load_csv(path)
rows = labeled_rows(header, raw_rows)
meas_rows = []
for t in times:
row = last_row_before_t(rows, t)
if not row: return None
meas_rows.append(MeasRow.from_dict(row))
# validate the sim has run to completion
if meas_rows[-1].t_sec < 0.95 * t: return None
meas_rows[-1].t_sec = t # make pretty
return meas_rows
def parse_param(s: str) -> float:
""" parse a parameter in the form of 'p050' or 'n0015' or '000' """
if s == "000":
return 0.0
sign = {'n': -1, 'p': 1}[s[0]]
mag = int(s[1:])
max_mag = 10**(len(s[1:]) - 1)
return sign * mag / max_mag
def extract_params(pstr: str) -> list:
""" extract parameters from a string like -n100-000 """
pieces = [p for p in pstr.split("-") if p]
return [parse_param(p) for p in pieces]
def extract_parameterized_meas(stem: str, times: list) -> ParameterizedMeas:
""" given some stem, parse all parameterized measurements associated with that stem """
base_dir, prefix = os.path.split(stem)
built = ParameterizedMeas()
for entry in os.listdir(base_dir):
if entry.startswith(prefix):
meas_rows = extract_rows(os.path.join(base_dir, entry, "meas.csv"), times)
if not meas_rows: continue
params = extract_params(entry[len(prefix):])
built.add_meas(params, meas_rows)
return built
if __name__ == "__main__":
print(extract_parameterized_meas(sys.argv[1], [float(f) for f in sys.argv[2:]]))

View File

@ -3,6 +3,9 @@
from fake_cores_db import *
from stacked_cores_40xx_db import *
_3e10 = "30000001024e0"
_5e10 = "49999998976e0"
class SimParamsCascaded(SimParams):
def __init__(self, p1: SimParams, p2: SimParams):
super().__init__(p1.couplings, p1.wrappings_spec, p1.um, p1.drive_str)
@ -186,6 +189,9 @@ _48xx_study = from_params(
SimParams48(5e2, 1e5, 10000, 500, 9, 1, 400, "1e10"),
# y0=0.62, slope0=1.3 until x=0.20
SimParams48(5e2, 1e5, 10000, 500, 9, 1, 400, "5e9"),
# y0=0.90, slope0=1.3 to x=0.04
SimParams48(5e2, 2e4, 2000, 100, 6, 2, 400, "2e10"),
]
)
@ -231,10 +237,22 @@ _49xx_study = from_params(
# SimParams50(1e4, 2e4, 2000, 100, 5, 1, 400, "2e10"),
# y(0)=0.30, y(1)=0.40, slope0>0.09
# SimParams50(2e4, 2e4, 2000, 100, 5, 1, 400, "1e10"),
]
)
_51xx_study = from_params(
[
SimParams51(5e2, 2e4, 2000, 100, 5, 1, 400, _5e10),
SimParams51(1e3, 2e4, 2000, 100, 5, 1, 400, "2e10"),
SimParams51(2e3, 2e4, 2000, 100, 5, 1, 400, "1e10"),
SimParams51(2e3, 2e4, 2000, 100, 5, 1, 400, "2e10"),
SimParams51(2e3, 2e4, 2000, 100, 5, 1, 400, _3e10),
SimParams51(5e3, 2e4, 2000, 100, 5, 1, 400, _3e10),
SimParams51(5e3, 2e4, 2000, 100, 5, 1, 400, _5e10),
SimParams51(2e3, 2e4, 2000, 100, 3, 2, 400, "2e10"),
SimParams51(2e3, 2e4, 2000, 100, 3, 2, 400, _5e10),
SimParams51(2e3, 2e4, 2000, 100, 2, 3, 400, _5e10),
SimParams51(2e3, 2e4, 2000, 100, 2, 3, 400, 1e11),
]
)
@ -257,7 +275,8 @@ _49xx_study = from_params(
# of_interest += inverters_with_steepest_slope0
# of_interest += _47xx_all
# of_interest += _48xx_study
of_interest += _49xx_study
# of_interest += _49xx_study
of_interest += _51xx_study
# plot cascaded inverter -> buffer
# for (inv_p, inv_curve) in filter_meas(is_inverter=True):
@ -279,10 +298,10 @@ of_interest += _49xx_study
for (params, curve) in of_interest:
curve = curve.flat_extrapolation()
curve.plot(title = f"{params.human_name} mapping")
curve.plot_slope(title = f"{params.human_name} slope")
fwd = curve.logically_inverted() if params.is_inverter else curve
fwd.plot(title = f"{params.human_name} mapping")
fwd.plot_slope(title = f"{params.human_name} slope")
if not params.is_inverter:
curve = curve.logically_inverted()
inv = fwd.logically_inverted()
# if params.is_inverter or True:
# curve.plot_equilibrium(title = f"{params.human_name} equilibrium")
# inv.plot_equilibrium(title = f"{params.human_name} equilibrium")

View File

@ -6,8 +6,9 @@ import subprocess
import sys
# these floats can't be represented as f32, so stringify bad on the rust side
_15e9 = "15000000512e0"
_3e10 = "30000001024e0"
_15e9 = "15000000512e0"
_3e10 = "30000001024e0"
_5e10 = "49999998976e0"
_15e10 = "149999992832e0"
class SimParams:
@ -245,12 +246,16 @@ class SimParams51(SimParamsV3):
return True
@property
def t_last(self) -> float:
def t_init(self) -> float:
return 1e-12 * self.clock_length_ps
@property
def t_mid(self) -> float:
return 2e-12 * self.clock_length_ps
@property
def t_init(self) -> float:
return 1e-12 * self.clock_length_ps
def t_last(self) -> float:
return 2e-12 * self.clock_length_ps
sims = [
# params, human friendly db name, normalization
@ -443,6 +448,8 @@ sims = [
(SimParams48(5e3, 5e4,10000, 500, 9, 1, 400, "5e8"), None, 20000),
(SimParams48(5e3, 5e4,10000, 500, 9, 1, 400, "1e9"), None, 20000),
(SimParams48(5e2, 2e4, 2000, 100, 6, 2, 400, "2e10"), None, 20000),
(SimParams50(5e2, 1e4, 1000, 50, 5, 1, 400, "1e10"), None, 20000),
(SimParams50(5e2, 2e4, 2000, 100, 5, 1, 400, "1e10"), None, 20000),
(SimParams50(1e3, 2e4, 2000, 100, 5, 1, 400, "5e9"), None, 20000),
@ -460,9 +467,17 @@ sims = [
(SimParams50(5e3, 4e4, 4000, 200, 5, 1, 400, "1e10"), None, 20000),
(SimParams50(5e3, 4e4, 4000, 200, 5, 1, 400, "2e10"), None, 20000),
(SimParams51(5e2, 2e4, 2000, 100, 5, 1, 400, _5e10), None, 20000),
(SimParams51(1e3, 2e4, 2000, 100, 5, 1, 400, "2e10"), None, 20000),
(SimParams51(2e3, 2e4, 2000, 100, 5, 1, 400, "1e10"), None, 20000),
(SimParams51(2e3, 2e4, 2000, 100, 5, 1, 400, "2e10"), None, 20000),
(SimParams51(2e3, 2e4, 2000, 100, 5, 1, 400, _3e10), None, 20000),
(SimParams51(5e3, 2e4, 2000, 100, 5, 1, 400, _3e10), None, 20000),
(SimParams51(5e3, 2e4, 2000, 100, 5, 1, 400, _5e10), None, 20000),
(SimParams51(2e3, 2e4, 2000, 100, 3, 2, 400, "2e10"), None, 20000),
(SimParams51(2e3, 2e4, 2000, 100, 3, 2, 400, _5e10), None, 20000),
(SimParams51(2e3, 2e4, 2000, 100, 2, 3, 400, _5e10), None, 20000),
(SimParams51(2e3, 2e4, 2000, 100, 2, 3, 400, 1e11), None, 20000),
]
measurements = { real.machine_name: [human, norm, None, None] for (real, human, norm) in sims }
@ -4598,9 +4613,21 @@ Piecewise(
set_meas("48-0.0004rad-1000ctl_cond-10000coupling_cond-2000ps-100ps-9ctl-9coupling-3_1_winding-2e10-drive", """
Piecewise(
[
[ -17334, 4023 ], # -1.000
[ -17188, 4205 ], # -0.300
[ -17159, 4240 ], # -0.250
[ -17124, 4279 ], # -0.200
[ -17116, 4289 ], # -0.190
[ -17108, 4300 ], # -0.180
[ -17098, 4310 ], # -0.170
[ -17090, 4322 ], # -0.160
[ -17081, 4333 ], # -0.150
[ -17071, 4344 ], # -0.140
[ -17062, 4357 ], # -0.130
[ -17054, 4372 ], # -0.120
[ -17044, 4388 ], # -0.110
[ -17025, 4410 ], # -0.100
[ -16991, 4445 ], # -0.090
[ -16910, 4521 ], # -0.080
[ -16651, 4757 ], # -0.070
[ -15978, 5402 ], # -0.060
@ -4621,7 +4648,13 @@ Piecewise(
[ -5461, 15432 ], # -0.038
[ -3740, 16411 ], # -0.035
[ -875, 16724 ], # -0.030
[ 4807, 16835 ], # -0.020
[ 9949, 16844 ], # -0.010
[ 11921, 16847 ], # 0.000
[ 14540, 16851 ], # 0.050
[ 15809, 16852 ], # 0.070
[ 16620, 16852 ], # 0.120
[ 16986, 16850 ], # 1.000
]
)
""")
@ -4634,16 +4667,25 @@ Piecewise(
[ 893, -7705 ], # -0.300
[ 1302, -7574 ], # -0.250
[ 1728, -7439 ], # -0.200
[ 1816, -7411 ], # -0.190
[ 1905, -7383 ], # -0.180
[ 1996, -7355 ], # -0.170
[ 2087, -7326 ], # -0.160
[ 2181, -7297 ], # -0.150
[ 2276, -7267 ], # -0.140
[ 2371, -7238 ], # -0.130
[ 2468, -7207 ], # -0.120
[ 2566, -7177 ], # -0.110
[ 2665, -7146 ], # -0.100
[ 2765, -7114 ], # -0.090
[ 2867, -7083 ], # -0.080
[ 2970, -7051 ], # -0.070
[ 3074, -7018 ], # -0.060
[ 3179, -6986 ], # -0.050
[ 3286, -6952 ], # -0.040
[ 3393, -6919 ], # -0.030
[ 3502, -6885 ], # -0.020
[ 3611, -6851 ], # -0.010
[ 3722, -6817 ], # 0.000
[ 4293, -6640 ], # 0.050
[ 4528, -6567 ], # 0.070
@ -4708,10 +4750,20 @@ Piecewise(
[ -10183, 12278 ], # -0.300
[ -5878, 15315 ], # -0.250
[ -1569, 15892 ], # -0.200
[ -708, 15955 ], # -0.190
[ 152, 16015 ], # -0.180
[ 1013, 16070 ], # -0.170
[ 1873, 16116 ], # -0.160
[ 2732, 16157 ], # -0.150
[ 3590, 16193 ], # -0.140
[ 4445, 16227 ], # -0.130
[ 5293, 16260 ], # -0.120
[ 6125, 16291 ], # -0.110
[ 6858, 16317 ], # -0.100
[ 7485, 16339 ], # -0.090
[ 8086, 16360 ], # -0.080
[ 8666, 16380 ], # -0.070
[ 9223, 16400 ], # -0.060
[ 9385, 16405 ], # -0.057
[ 9492, 16408 ], # -0.055
[ 9545, 16410 ], # -0.054
@ -4725,10 +4777,16 @@ Piecewise(
[ 10112, 16428 ], # -0.043
[ 10162, 16429 ], # -0.042
[ 10211, 16431 ], # -0.041
[ 10260, 16432 ], # -0.040
[ 10356, 16435 ], # -0.038
[ 10498, 16440 ], # -0.035
[ 10723, 16446 ], # -0.030
[ 11003, 16455 ], # -0.020
[ 11120, 16458 ], # -0.010
[ 11211, 16460 ], # 0.000
[ 11518, 16469 ], # 0.050
[ 11606, 16471 ], # 0.070
[ 11805, 16476 ], # 0.120
[ 18116, 16679 ], # 1.000
]
)
@ -4832,9 +4890,14 @@ Piecewise(
[ 923, -7540 ], # -0.300
[ 1350, -7404 ], # -0.250
[ 1793, -7265 ], # -0.200
[ 1975, -7208 ], # -0.180
[ 2069, -7179 ], # -0.170
[ 2164, -7149 ], # -0.160
[ 2260, -7119 ], # -0.150
[ 2357, -7089 ], # -0.140
[ 2456, -7058 ], # -0.130
[ 2556, -7027 ], # -0.120
[ 2657, -6996 ], # -0.110
[ 2760, -6964 ], # -0.100
[ 3073, -6866 ], # -0.070
[ 3288, -6800 ], # -0.050
@ -4859,13 +4922,25 @@ Piecewise(
[ -10136, 1101 ], # -0.300
[ -5768, 3505 ], # -0.250
[ -1389, 5290 ], # -0.200
[ -517, 5596 ], # -0.190
[ 352, 5890 ], # -0.180
[ 1219, 6176 ], # -0.170
[ 2085, 6455 ], # -0.160
[ 2947, 6730 ], # -0.150
[ 3796, 6999 ], # -0.140
[ 4636, 7263 ], # -0.130
[ 5471, 7524 ], # -0.120
[ 6294, 7781 ], # -0.110
[ 7077, 8026 ], # -0.100
[ 7840, 8264 ], # -0.090
[ 8565, 8491 ], # -0.080
[ 9217, 8696 ], # -0.070
[ 9792, 8878 ], # -0.060
[ 10163, 8994 ], # -0.050
[ 10267, 9026 ], # -0.040
[ 10356, 9053 ], # -0.030
[ 10440, 9079 ], # -0.020
[ 10523, 9104 ], # -0.010
[ 10603, 9129 ], # 0.000
[ 10982, 9244 ], # 0.050
[ 11124, 9287 ], # 0.070
@ -4878,6 +4953,41 @@ Piecewise(
)
""")
set_meas("48-0.0004rad-500ctl_cond-20000coupling_cond-2000ps-100ps-6ctl-6coupling-5_1_winding-2e10-drive", """
Piecewise(
[
[ -18414, 11031 ], # -1.000
[ -18111, 11626 ], # -0.300
[ -18048, 11747 ], # -0.250
[ -17962, 11929 ], # -0.200
[ -17937, 11980 ], # -0.190
[ -17905, 12038 ], # -0.180
[ -17847, 12138 ], # -0.170
[ -17743, 12312 ], # -0.160
[ -17486, 12730 ], # -0.150
[ -17062, 13404 ], # -0.140
[ -16465, 14325 ], # -0.130
[ -15561, 15520 ], # -0.120
[ -13589, 16528 ], # -0.110
[ -11006, 16749 ], # -0.100
[ -8330, 16800 ], # -0.090
[ -5637, 16837 ], # -0.080
[ -2938, 16844 ], # -0.070
[ -243, 16846 ], # -0.060
[ 2441, 16844 ], # -0.050
[ 5074, 16843 ], # -0.040
[ 7375, 16844 ], # -0.030
[ 8177, 16844 ], # -0.020
[ 8671, 16844 ], # -0.010
[ 9037, 16844 ], # 0.000
[ 10339, 16844 ], # 0.050
[ 10842, 16844 ], # 0.070
[ 14825, 16845 ], # 0.120
[ 17592, 16842 ], # 1.000
]
)
""")
set_meas("50-0.0004rad-500ctl_cond-10000coupling_cond-1000ps-50ps-5ctl-5coupling-3_1_winding-1e10-drive", """
Piecewise(
[
@ -5157,10 +5267,201 @@ Piecewise(
)
""")
set_meas("51-0.0004rad-500ctl_cond-20000coupling_cond-2000ps-100ps-5ctl-5coupling-3_1_winding-49999998976e0-drive", """
Piecewise(
[
[ -17584, -6603 ], # -1.000, M1=-2536
[ -17456, -6667 ], # -0.350, M1=-2377
[ -17393, -6696 ], # -0.300, M1=-2309
[ -17002, -6914 ], # -0.250, M1=-1975
[ -14787, -8326 ], # -0.200, M1= -491
[ -8494, -11989 ], # -0.150, M1= 3186
[ -2111, -14126 ], # -0.100, M1= 6269
[ 4214, -15241 ], # -0.050, M1= 8808
[ 10359, -15908 ], # 0.000, M1=11011
[ 14576, -16159 ], # 0.050, M1=12412
[ 16005, -16197 ], # 0.100, M1=12901
[ 16645, -16197 ], # 0.200, M1=13173
[ 16909, -16185 ], # 1.000, M1=13354
]
)
""")
set_meas("51-0.0004rad-1000ctl_cond-20000coupling_cond-2000ps-100ps-5ctl-5coupling-3_1_winding-2e10-drive", """
Piecewise(
[
[ 16910, -16375 ], # 1.000
[ -17462, 955 ], # -1.000, M1=-6544
[ -11848, -3516 ], # -0.350, M1=-2673
[ -8384, -6316 ], # -0.300, M1= -516
[ -4922, -8983 ], # -0.250, M1= 1553
[ -1482, -11476 ], # -0.200, M1= 3520
[ 1903, -13698 ], # -0.150, M1= 5384
[ 5191, -15268 ], # -0.100, M1= 7122
[ 8322, -15915 ], # -0.050, M1= 8725
[ 11174, -16156 ], # 0.000, M1=10122
[ 13214, -16263 ], # 0.050, M1=11025
[ 14526, -16312 ], # 0.100, M1=11538
[ 16070, -16357 ], # 0.200, M1=12096
[ 16910, -16375 ], # 1.000, M1=12480
]
)
""")
set_meas("51-0.0004rad-2000ctl_cond-20000coupling_cond-2000ps-100ps-5ctl-5coupling-3_1_winding-1e10-drive", """
Piecewise(
[
[ -17412, 7351 ], # -1.000, M1=-9661
[ -5507, 1206 ], # -0.350, M1=-3475
[ -2926, -132 ], # -0.300, M1=-2233
[ -374, -1375 ], # -0.250, M1=-1051
[ 2145, -2528 ], # -0.200, M1= 93
[ 4593, -3593 ], # -0.150, M1= 1189
[ 6922, -4577 ], # -0.100, M1= 2205
[ 9061, -5432 ], # -0.050, M1= 3096
[ 10849, -6119 ], # 0.000, M1= 3826
[ 12083, -6573 ], # 0.050, M1= 4335
[ 13169, -6962 ], # 0.100, M1= 4781
[ 14949, -7537 ], # 0.200, M1= 5498
[ 16881, -8016 ], # 1.000, M1= 6376
]
)
""")
set_meas("51-0.0004rad-2000ctl_cond-20000coupling_cond-2000ps-100ps-5ctl-5coupling-3_1_winding-2e10-drive", """
Piecewise(
[
[ -17596, 4048 ], # -1.000, M1=-7725
[ -17162, 3838 ], # -0.350, M1=-7354
[ -16533, 3548 ], # -0.300, M1=-6886
[ -13668, 1824 ], # -0.250, M1=-5211
[ -8574, -1224 ], # -0.200, M1=-2500
[ -3482, -4166 ], # -0.150, M1= 127
[ 1525, -6940 ], # -0.100, M1= 2643
[ 6355, -9461 ], # -0.050, M1= 4983
[ 10815, -11658 ], # 0.000, M1= 7056
[ 13837, -13075 ], # 0.050, M1= 8459
[ 15352, -13707 ], # 0.100, M1= 9179
[ 16596, -14137 ], # 0.200, M1= 9832
[ 16938, -14287 ], # 1.000, M1=10139
]
)
""")
set_meas("51-0.0004rad-2000ctl_cond-20000coupling_cond-2000ps-100ps-5ctl-5coupling-3_1_winding-30000001024e0-drive", """
Piecewise(
[
[ -17699, 1454 ], # -1.000, M1=-6236
[ -17551, 1379 ], # -0.350, M1=-6069
[ -17522, 1350 ], # -0.300, M1=-6025
[ -17425, 1317 ], # -0.250, M1=-5948
[ -16719, 1033 ], # -0.200, M1=-5451
[ -11661, -2116 ], # -0.150, M1=-2565
[ -4081, -6784 ], # -0.100, M1= 1528
[ 3400, -10964 ], # -0.050, M1= 5393
[ 10508, -14107 ], # 0.000, M1= 8877
[ 16171, -15692 ], # 0.100, M1=11522
[ 16692, -15776 ], # 0.200, M1=11822
[ 16959, -15828 ], # 1.000, M1=12067
]
)
""")
set_meas("51-0.0004rad-5000ctl_cond-20000coupling_cond-2000ps-100ps-5ctl-5coupling-3_1_winding-30000001024e0-drive", """
Piecewise(
[
[ -18072, 5436 ], # -1.000, M1=-7703
[ -17883, 5390 ], # -0.350, M1=-7524
[ -17859, 5365 ], # -0.300, M1=-7486
[ -17831, 5381 ], # -0.250, M1=-7471
[ -17796, 5380 ], # -0.200, M1=-7440
[ -17738, 5369 ], # -0.150, M1=-7391
[ -16762, 5145 ], # -0.100, M1=-6795
[ -4256, 769 ], # -0.050, M1=-1544
[ 9643, -3986 ], # 0.000, M1= 4057
[ 15927, -5962 ], # 0.050, M1= 6589
[ 16601, -6128 ], # 0.100, M1= 6942
[ 16747, -6163 ], # 0.200, M1= 7068
[ 17073, -6302 ], # 1.000, M1= 7390
]
)
""")
set_meas("51-0.0004rad-5000ctl_cond-20000coupling_cond-2000ps-100ps-5ctl-5coupling-3_1_winding-49999998976e0-drive", """
Piecewise(
[
[ -18258, 2488 ], # -1.000, M1=-5473
[ -18044, 2435 ], # -0.350, M1=-5284
[ -18016, 2439 ], # -0.300, M1=-5261
[ -17985, 2424 ], # -0.250, M1=-5225
[ -17949, 2414 ], # -0.200, M1=-5187
[ -17906, 2405 ], # -0.150, M1=-5142
[ -17849, 2419 ], # -0.100, M1=-5102
[ -15109, 1672 ], # -0.050, M1=-3758
[ 8689, -4897 ], # 0.000, M1= 4806
[ 16381, -7002 ], # 0.050, M1= 7767
[ 16601, -7024 ], # 0.100, M1= 7888
[ 16749, -7082 ], # 0.200, M1= 8032
[ 17125, -7188 ], # 1.000, M1= 8350
]
)
""")
set_meas("51-0.0004rad-2000ctl_cond-20000coupling_cond-2000ps-100ps-3ctl-3coupling-5_1_winding-2e10-drive", """
Piecewise(
[
[ -17109, 7082 ], # -1.000, M1=-10230
[ -13678, 6078 ], # -0.350, M1=-9021
[ -10605, 5162 ], # -0.300, M1=-8102
[ -7507, 4334 ], # -0.250, M1=-7225
[ -4413, 3616 ], # -0.200, M1=-6377
[ -1375, 3013 ], # -0.150, M1=-5588
[ 1551, 2490 ], # -0.100, M1=-4862
[ 4314, 2033 ], # -0.050, M1=-4207
[ 6844, 1617 ], # 0.000, M1=-3613
[ 8990, 1226 ], # 0.050, M1=-3115
[ 11075, 819 ], # 0.100, M1=-2636
[ 15249, -43 ], # 0.200, M1=-1660
[ 16849, -309 ], # 1.000, M1=-1196
]
)
""")
set_meas("51-0.0004rad-2000ctl_cond-20000coupling_cond-2000ps-100ps-3ctl-3coupling-5_1_winding-49999998976e0-drive", """
Piecewise(
[
[ -17321, 427 ], # -1.000, M1=-6935
[ -17218, 384 ], # -0.350, M1=-6841
[ -17204, 379 ], # -0.300, M1=-6827
[ -17173, 385 ], # -0.250, M1=-6817
[ -17096, 388 ], # -0.200, M1=-6792
[ -16357, 152 ], # -0.150, M1=-6472
[ -9419, -2287 ], # -0.100, M1=-4280
[ -1497, -4809 ], # -0.050, M1=-1873
[ 6332, -7139 ], # 0.000, M1= 473
[ 13416, -9136 ], # 0.050, M1= 2536
[ 16310, -9904 ], # 0.100, M1= 3368
[ 16709, -9989 ], # 0.200, M1= 3522
[ 16912, -10051 ], # 1.000, M1= 3670
]
)
""")
set_meas("51-0.0004rad-2000ctl_cond-20000coupling_cond-2000ps-100ps-2ctl-2coupling-7_1_winding-49999998976e0-drive", """
Piecewise(
[
[ -16983, 3748 ], # -1.000, M1=-9308
[ -16836, 3708 ], # -0.350, M1=-9223
[ -16816, 3724 ], # -0.300, M1=-9230
[ -16760, 3729 ], # -0.250, M1=-9220
[ -15731, 3548 ], # -0.200, M1=-9013
[ -10811, 2528 ], # -0.150, M1=-8083
[ -5747, 1384 ], # -0.100, M1=-7037
[ -756, 388 ], # -0.050, M1=-6076
[ 4031, -524 ], # 0.000, M1=-5170
[ 8551, -1241 ], # 0.050, M1=-4402
[ 12996, -1856 ], # 0.100, M1=-3697
[ 16579, -2292 ], # 0.200, M1=-3156
[ 16819, -2309 ], # 1.000, M1=-3077
]
)
""")

View File

@ -1324,6 +1324,25 @@ fn drive_map_fork_then_join_m2_out(amp0: f32) -> [[ClockState; 4]; 3] {
]
}
#[allow(unused)]
fn drive_map_or_gate(amp0: f32, amp1: f32) -> [[ClockState; 4]; 4] {
use ClockState as C;
// amplitudes are inverted from what you would expect.
// hold(-1) puts the core into a positive M
[
// init S0 pos, S1 pos; charge S2 neg, S3 neg
[C::release(-amp0), C::release(-amp1), C::release_high(), C::release_high()],
// clear S0 -> S2, S1 -> S2
// NB: we might slightly prefer to do this in two separate steps, but doing it in one cycle is
// quicker to simulate.
[C::hold_high(), C::hold_high(), C::float(), C::float()],
// relax S0, S1, so that S2 isn't unnecessarily loaded in the next cycle
[C::release_high(), C::release_high(), C::float(), C::float()],
// clear S2 -> S3
[C::hold_high(), C::hold_high(), C::hold_high(), C::float()],
]
}
fn asymmetric_inverter_name(p: &Params, sim_id: &str, windings: u32, init_flt: f32) -> String {
let init_int = (init_flt.abs() * 100.0 + 0.5) as u32;
let init_level = if init_flt > 0.0 {
@ -1337,13 +1356,8 @@ fn asymmetric_inverter_name(p: &Params, sim_id: &str, windings: u32, init_flt: f
let s_major = p.s_major;
let coupling_loops = p.coupling_loops;
let mut input_leading = p.input_magnitude as u64;
let mut input_exp = 0;
while input_leading != 0 && input_leading % 10 == 0 {
input_leading /= 10;
input_exp += 1;
}
format!("{sim_id}-{s_major}rad-{coupling_loops}coupling-{windings}_1_winding-{input_leading}e{input_exp}-drive-{init_level}")
let input_str = exp_format(p.input_magnitude);
format!("{sim_id}-{s_major}rad-{coupling_loops}coupling-{windings}_1_winding-{input_str}-drive-{init_level}")
}
@ -1360,18 +1374,11 @@ fn asymmetric_inverter_name_v2(p: &Params, sim_id: &str, ctl_loops: u32, couplin
let s_major = p.s_major;
let mut input_leading = p.input_magnitude as u64;
let mut input_exp = 0;
while input_leading != 0 && input_leading % 10 == 0 {
input_leading /= 10;
input_exp += 1;
}
format!("{sim_id}-{s_major}rad-{ctl_loops}ctl-{coupling_loops}coupling-{windings}_1_winding-{input_leading}e{input_exp}-drive-{init_level}")
let input_str = exp_format(p.input_magnitude);
format!("{sim_id}-{s_major}rad-{ctl_loops}ctl-{coupling_loops}coupling-{windings}_1_winding-{input_str}-drive-{init_level}")
}
/// v3 has coupling_loops specified externally,
/// and encodes conductivities + clocks
fn asymmetric_inverter_name_v3(p: &Params, sim_id: &str, ctl_loops: u32, coupling_loops: u32, windings: u32, init_flt: f32) -> String {
fn init_float_str(init_flt: f32) -> String {
let init_int = (init_flt.abs() * 1000.0 + 0.5) as u32;
let init_int_str = if init_int % 10 == 0 {
format!("{:03}", init_int / 10)
@ -1379,13 +1386,29 @@ fn asymmetric_inverter_name_v3(p: &Params, sim_id: &str, ctl_loops: u32, couplin
format!("{:04}", init_int)
};
let init_level = if init_flt > 0.0 {
if init_flt > 0.0 {
format!("p{init_int_str}")
} else if init_flt < 0.0 {
format!("n{init_int_str}")
} else {
init_int_str
};
}
}
fn exp_format(e: f32) -> String {
let mut e_leading = e as u64;
let mut e_exp = 0;
while e_leading != 0 && e_leading % 10 == 0 {
e_leading /= 10;
e_exp += 1;
}
format!("{}e{}", e_leading, e_exp)
}
/// v3 has coupling_loops specified externally,
/// and encodes conductivities + clocks
fn asymmetric_inverter_name_v3(p: &Params, sim_id: &str, ctl_loops: u32, coupling_loops: u32, windings: u32, init_flt: f32) -> String {
let init_level = init_float_str(init_flt);
let s_major = p.s_major;
let ctl_cond = p.ctl_conductivity as u64;
@ -1393,13 +1416,22 @@ fn asymmetric_inverter_name_v3(p: &Params, sim_id: &str, ctl_loops: u32, couplin
let clock_length = (p.clock_phase_duration * 1e12 + 0.5) as u64;
let clock_decay = (p.clock_decay * 1e12 + 0.5) as u64;
let mut input_leading = p.input_magnitude as u64;
let mut input_exp = 0;
while input_leading != 0 && input_leading % 10 == 0 {
input_leading /= 10;
input_exp += 1;
}
format!("{sim_id}-{s_major}rad-{ctl_cond}ctl_cond-{coupling_cond}coupling_cond-{clock_length}ps-{clock_decay}ps-{ctl_loops}ctl-{coupling_loops}coupling-{windings}_1_winding-{input_leading}e{input_exp}-drive-{init_level}")
let input_str = exp_format(p.input_magnitude);
format!("{sim_id}-{s_major}rad-{ctl_cond}ctl_cond-{coupling_cond}coupling_cond-{clock_length}ps-{clock_decay}ps-{ctl_loops}ctl-{coupling_loops}coupling-{windings}_1_winding-{input_str}-drive-{init_level}")
}
fn asymmetric_binary_gate_name(p: &Params, sim_id: &str, ctl_loops: u32, coupling_loops: u32, windings: u32, init_flt_a: f32, init_flt_b: f32) -> String {
let init_level_a = init_float_str(init_flt_a);
let init_level_b = init_float_str(init_flt_b);
let s_major = p.s_major;
let ctl_cond = p.ctl_conductivity as u64;
let coupling_cond = p.coupling_conductivity as u64;
let clock_length = (p.clock_phase_duration * 1e12 + 0.5) as u64;
let clock_decay = (p.clock_decay * 1e12 + 0.5) as u64;
let input_str = exp_format(p.input_magnitude);
format!("{sim_id}-{s_major}rad-{ctl_cond}ctl_cond-{coupling_cond}coupling_cond-{clock_length}ps-{clock_decay}ps-{ctl_loops}ctl-{coupling_loops}coupling-{windings}_1_winding-{input_str}-drive-{init_level_a}-{init_level_b}")
}
/// couple `sender` to the `sender+1` core by using `loops` loops, including a crossover so that
@ -5159,20 +5191,20 @@ fn main() {
// 0.03,
// 0.04,
// 0.05,
-0.055,
-0.045,
-0.043,
-0.053,
-0.052,
-0.041,
-0.054,
-0.051,
-0.049,
-0.057,
-0.047,
-0.042,
-0.038,
-0.035,
// -0.055,
// -0.045,
// -0.043,
// -0.053,
// -0.052,
// -0.041,
// -0.054,
// -0.051,
// -0.049,
// -0.057,
// -0.047,
// -0.042,
// -0.038,
// -0.035,
// targeted for (1e3, 1e4, ps(2000), ps(100), 9, 1, um(400), 1e10)
// -0.08,
// -0.09,
@ -5318,11 +5350,16 @@ fn main() {
// -0.23,
][..],
&[
// establish the domain/range
1.00,
-1.00,
][..],
&[
-0.10,
-0.05,
0.00,
-0.10,
-0.15,
-0.20,
-0.15,
// -0.35,
// -0.50,
// -0.25,
@ -5333,11 +5370,6 @@ fn main() {
// 0.20,
// 0.35,
][..],
&[
// establish the domain/range
1.00,
-1.00,
][..],
&[
-0.05,
-0.15,
@ -5382,6 +5414,9 @@ fn main() {
][..],
] {
for (ctl_cond, coupling_cond, clock_duration, clock_decay, coupling_loops, s0_loops, s_major, cur_flt) in [
// in progress
(5e2, 2e4, ps(2000), ps(100), 6, 2, um(400), 2e10),
// (2e2, 1e4, ps(1000), ps(50), 9, 1, um(400), 1e10), // complete. y0=0.64, slope0=1.4
// (5e2, 1e4, ps(1000), ps(50), 9, 1, um(400), 1e10), // complete. y0=0.62, slope0=1.4
// (5e2, 1e4, ps(1000), ps(50), 9, 1, um(400), 2e10), // complete. y0=0.66, slope0=1.2
@ -5557,7 +5592,7 @@ fn main() {
}
}
}
if true {
if false {
for init_set in [
&[
// targeted
@ -5573,24 +5608,43 @@ fn main() {
&[
-0.20,
-0.10,
0.10,
-0.05,
][..],
&[
0.05,
-0.15,
-0.25,
-0.30,
-0.35,
0.20,
-0.30,
0.10,
0.05,
][..],
&[
-0.50,
][..],
&[
-0.17,
-0.12,
-0.07,
-0.22,
-0.27,
-0.02,
][..],
] {
for (ctl_cond, coupling_cond, clock_duration, clock_decay, coupling_loops, s0_loops, s_major, cur_flt) in [
// from 50-xx
(2e3, 2e4, ps(2000), ps(100), 3, 2, um(400), 2e10),
(2e3, 2e4, ps(2000), ps(100), 2, 3, um(400), 5e10),
(2e3, 2e4, ps(2000), ps(100), 3, 2, um(400), 5e10),
(2e3, 2e4, ps(2000), ps(100), 2, 3, um(400), 1e11),
(5e3, 2e4, ps(2000), ps(100), 5, 1, um(400), 5e10),
(5e2, 2e4, ps(2000), ps(100), 5, 1, um(400), 5e10),
(1e3, 2e4, ps(2000), ps(100), 5, 1, um(400), 2e10),
(2e3, 2e4, ps(2000), ps(100), 5, 1, um(400), 1e10),
(2e3, 2e4, ps(2000), ps(100), 5, 1, um(400), 2e10),
(2e3, 2e4, ps(2000), ps(100), 5, 1, um(400), 3e10),
(5e3, 2e4, ps(2000), ps(100), 5, 1, um(400), 3e10),
// (2e3, 2e4, ps(2000), ps(100), 5, 1, um(400), 1e10),
] {
for &init_flt in init_set {
@ -5625,6 +5679,74 @@ fn main() {
}
}
}
if true {
for init_set in [
&[
// targeted
][..],
&[
// establish the domain/range
( 1.00, 1.00),
(-1.00, -1.00),
(-1.00, 1.00),
( 1.00, -1.00),
][..],
&[
(0.00, 0.00),
(-1.00, 0.00),
][..],
] {
for (ctl_cond, coupling_cond, clock_duration, clock_decay, coupling_loops, s0_loops, s_major, cur_flt) in [
(5e3, 2e4, ps(2000), ps(100), 3, 1, um(400), 5e10),
(5e2, 2e4, ps(2000), ps(100), 3, 1, um(400), 5e10),
(1e3, 2e4, ps(2000), ps(100), 3, 1, um(400), 2e10),
(2e3, 2e4, ps(2000), ps(100), 3, 1, um(400), 1e10),
(2e3, 2e4, ps(2000), ps(100), 3, 1, um(400), 2e10),
(2e3, 2e4, ps(2000), ps(100), 3, 1, um(400), 3e10),
(5e3, 2e4, ps(2000), ps(100), 3, 1, um(400), 3e10),
] {
for &(init_flt_a, init_flt_b) in init_set {
// coupling loops (M0 -> M2) + (M1 -> M2) + (M2 -> M3) + control slots
let slots_per_asym = 2*s0_loops;
let net_slots = 3*slots_per_asym + 1;
let mut params = params_v2
.with_clock_phase_duration(clock_duration)
.with_clock_decay(clock_decay)
.with_ctl_conductivity(ctl_cond)
.with_coupling_conductivity(coupling_cond)
.with_s_major(s_major)
.with_coupling_loops(coupling_loops)
.with_input_magnitude(cur_flt)
// control loops
.with_coupling(0, 0, 0, net_slots, CouplingMethod::Control)
.with_coupling(1, 1, 0, net_slots, CouplingMethod::Control)
.with_coupling(2, 2, 0, net_slots, CouplingMethod::Control)
.with_coupling(3, 3, 0, net_slots, CouplingMethod::Control)
;
for i in 0..slots_per_asym {
// couple input core 0 to core 2
params = params.with_coupling(0, 2, 1+i, net_slots, CouplingMethod::Outside);
// couple input core 1 to core 2
params = params.with_coupling(1, 2, 1+i + slots_per_asym, net_slots, CouplingMethod::Direct);
}
// couple OR gate core 2 to output core 3
params = couple_asymmetric_buffer(&params, 2 /* sender core */, s0_loops, 1 + 2*slots_per_asym /* slot offset */, net_slots);
let name = asymmetric_binary_gate_name(
&params, "52-or-", coupling_loops /* ctl loops */, coupling_loops, 2*s0_loops + 1, init_flt_a, init_flt_b
);
run_sim(
&name,
drive_map_or_gate(init_flt_a, init_flt_b),
params,
);
}
}
}
}
}