app: stacked_cores: more multi-core experiments
This commit is contained in:
@@ -3503,6 +3503,13 @@ fn main() {
|
|||||||
.with_coupling_loops(8)
|
.with_coupling_loops(8)
|
||||||
;
|
;
|
||||||
for (scur, cur) in [("2e10", 2e10), ("15e9", 15e9), ("1e10", 1e10), ] {
|
for (scur, cur) in [("2e10", 2e10), ("15e9", 15e9), ("1e10", 1e10), ] {
|
||||||
|
for (tx, inv) in [
|
||||||
|
(2, 0),
|
||||||
|
(3, 0),
|
||||||
|
(3, 1),
|
||||||
|
(4, 1),
|
||||||
|
(4, 2),
|
||||||
|
] {
|
||||||
for (sinit, finit) in [
|
for (sinit, finit) in [
|
||||||
("p100", 1.00),
|
("p100", 1.00),
|
||||||
("n100", -1.00),
|
("n100", -1.00),
|
||||||
@@ -3515,31 +3522,53 @@ fn main() {
|
|||||||
("n020", -0.20),
|
("n020", -0.20),
|
||||||
// ("p080", 0.80),
|
// ("p080", 0.80),
|
||||||
] {
|
] {
|
||||||
let params = p38xx.with_input_magnitude(cur);
|
let name = &format!("38-{}:{}tx_shunt_cores-{}-8loop-n100rx-p100shunt-{}tx", tx, inv, scur, sinit);
|
||||||
|
let params = p38xx
|
||||||
|
.with_input_magnitude(cur)
|
||||||
|
.with_coupling(0, tx+inv, 0, 1, CouplingMethod::Direct);
|
||||||
|
match (tx, inv) {
|
||||||
|
(2, 0) => run_sim(
|
||||||
|
name,
|
||||||
|
drive_map_nstack_pos_minv::<2, 0>(finit, 1.00),
|
||||||
|
params,
|
||||||
|
),
|
||||||
|
(3, 0) => run_sim(
|
||||||
|
name,
|
||||||
|
drive_map_nstack_pos_minv::<3, 0>(finit, 1.00),
|
||||||
|
params,
|
||||||
|
),
|
||||||
|
(3, 1) => run_sim(
|
||||||
|
name,
|
||||||
|
drive_map_nstack_pos_minv::<3, 1>(finit, 1.00),
|
||||||
|
params,
|
||||||
|
),
|
||||||
// run_sim(
|
// run_sim(
|
||||||
// &format!("38-{}:{}tx_shunt_cores-{}-8loop-n100rx-p100shunt-{}tx", 3, 2, scur, sinit),
|
// &format!("38-{}:{}tx_shunt_cores-{}-8loop-n100rx-p100shunt-{}tx", 3, 2, scur, sinit),
|
||||||
// drive_map_nstack_pos_minv::<3, 2>(finit, 1.00),
|
// drive_map_nstack_pos_minv::<3, 2>(finit, 1.00),
|
||||||
// params
|
// params
|
||||||
// .with_coupling(0, 3+2, 0, 1, CouplingMethod::Direct)
|
// .with_coupling(0, 3+2, 0, 1, CouplingMethod::Direct)
|
||||||
// );
|
// );
|
||||||
run_sim(
|
(4, 1) => run_sim(
|
||||||
&format!("38-{}:{}tx_shunt_cores-{}-8loop-n100rx-p100shunt-{}tx", 4, 2, scur, sinit),
|
name,
|
||||||
|
drive_map_nstack_pos_minv::<4, 1>(finit, 1.00),
|
||||||
|
params,
|
||||||
|
),
|
||||||
|
(4, 2) => run_sim(
|
||||||
|
name,
|
||||||
drive_map_nstack_pos_minv::<4, 2>(finit, 1.00),
|
drive_map_nstack_pos_minv::<4, 2>(finit, 1.00),
|
||||||
params
|
params,
|
||||||
.with_coupling(0, 4+2, 0, 1, CouplingMethod::Direct)
|
),
|
||||||
);
|
|
||||||
// run_sim(
|
// run_sim(
|
||||||
// &format!("38-{}:{}tx_shunt_cores-{}-8loop-n100rx-p100shunt-{}tx", 4, 3, scur, sinit),
|
// &format!("38-{}:{}tx_shunt_cores-{}-8loop-n100rx-p100shunt-{}tx", 4, 3, scur, sinit),
|
||||||
// drive_map_nstack_pos_minv::<4, 3>(finit, 1.00),
|
// drive_map_nstack_pos_minv::<4, 3>(finit, 1.00),
|
||||||
// params
|
// params
|
||||||
// .with_coupling(0, 4+3, 0, 1, CouplingMethod::Direct)
|
// .with_coupling(0, 4+3, 0, 1, CouplingMethod::Direct)
|
||||||
// );
|
// );
|
||||||
run_sim(
|
(5, 2) => run_sim(
|
||||||
&format!("38-{}:{}tx_shunt_cores-{}-8loop-n100rx-p100shunt-{}tx", 5, 2, scur, sinit),
|
name,
|
||||||
drive_map_nstack_pos_minv::<5, 2>(finit, 1.00),
|
drive_map_nstack_pos_minv::<5, 2>(finit, 1.00),
|
||||||
params
|
params,
|
||||||
.with_coupling(0, 5+2, 0, 1, CouplingMethod::Direct)
|
),
|
||||||
);
|
|
||||||
// run_sim(
|
// run_sim(
|
||||||
// &format!("38-{}:{}tx_shunt_cores-{}-8loop-n100rx-p100shunt-{}tx", 5, 3, scur, sinit),
|
// &format!("38-{}:{}tx_shunt_cores-{}-8loop-n100rx-p100shunt-{}tx", 5, 3, scur, sinit),
|
||||||
// drive_map_nstack_pos_minv::<5, 3>(finit, 1.00),
|
// drive_map_nstack_pos_minv::<5, 3>(finit, 1.00),
|
||||||
@@ -3552,18 +3581,16 @@ fn main() {
|
|||||||
// params
|
// params
|
||||||
// .with_coupling(0, 5+4, 0, 1, CouplingMethod::Direct)
|
// .with_coupling(0, 5+4, 0, 1, CouplingMethod::Direct)
|
||||||
// );
|
// );
|
||||||
run_sim(
|
(6, 2) => run_sim(
|
||||||
&format!("38-{}:{}tx_shunt_cores-{}-8loop-n100rx-p100shunt-{}tx", 6, 2, scur, sinit),
|
name,
|
||||||
drive_map_nstack_pos_minv::<6, 2>(finit, 1.00),
|
drive_map_nstack_pos_minv::<6, 2>(finit, 1.00),
|
||||||
params
|
params,
|
||||||
.with_coupling(0, 6+2, 0, 1, CouplingMethod::Direct)
|
),
|
||||||
);
|
(6, 3) => run_sim(
|
||||||
run_sim(
|
name,
|
||||||
&format!("38-{}:{}tx_shunt_cores-{}-8loop-n100rx-p100shunt-{}tx", 6, 3, scur, sinit),
|
|
||||||
drive_map_nstack_pos_minv::<6, 3>(finit, 1.00),
|
drive_map_nstack_pos_minv::<6, 3>(finit, 1.00),
|
||||||
params
|
params,
|
||||||
.with_coupling(0, 6+3, 0, 1, CouplingMethod::Direct)
|
),
|
||||||
);
|
|
||||||
// run_sim(
|
// run_sim(
|
||||||
// &format!("38-{}:{}tx_shunt_cores-{}-8loop-n100rx-p100shunt-{}tx", 6, 4, scur, sinit),
|
// &format!("38-{}:{}tx_shunt_cores-{}-8loop-n100rx-p100shunt-{}tx", 6, 4, scur, sinit),
|
||||||
// drive_map_nstack_pos_minv::<6, 4>(finit, 1.00),
|
// drive_map_nstack_pos_minv::<6, 4>(finit, 1.00),
|
||||||
@@ -3576,18 +3603,19 @@ fn main() {
|
|||||||
// params
|
// params
|
||||||
// .with_coupling(0, 6+5, 0, 1, CouplingMethod::Direct)
|
// .with_coupling(0, 6+5, 0, 1, CouplingMethod::Direct)
|
||||||
// );
|
// );
|
||||||
run_sim(
|
(7, 2) => run_sim(
|
||||||
&format!("38-{}:{}tx_shunt_cores-{}-8loop-n100rx-p100shunt-{}tx", 7, 2, scur, sinit),
|
name,
|
||||||
drive_map_nstack_pos_minv::<7, 2>(finit, 1.00),
|
drive_map_nstack_pos_minv::<7, 2>(finit, 1.00),
|
||||||
params
|
params,
|
||||||
.with_coupling(0, 7+2, 0, 1, CouplingMethod::Direct)
|
),
|
||||||
);
|
(7, 3) => run_sim(
|
||||||
run_sim(
|
name,
|
||||||
&format!("38-{}:{}tx_shunt_cores-{}-8loop-n100rx-p100shunt-{}tx", 7, 3, scur, sinit),
|
|
||||||
drive_map_nstack_pos_minv::<7, 3>(finit, 1.00),
|
drive_map_nstack_pos_minv::<7, 3>(finit, 1.00),
|
||||||
params
|
params,
|
||||||
.with_coupling(0, 7+3, 0, 1, CouplingMethod::Direct)
|
),
|
||||||
);
|
other => panic!("unknown sim: {:?}", other),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,14 +9,48 @@ def fwd(offset: float, amp: float):
|
|||||||
def inv(offset: float, amp: float):
|
def inv(offset: float, amp: float):
|
||||||
return lambda x: max(0.0, 1.0 - offset - amp*x)
|
return lambda x: max(0.0, 1.0 - offset - amp*x)
|
||||||
|
|
||||||
|
def inv_from_fwd(inv):
|
||||||
|
return lambda x: max(0.0, 1 - inv(x))
|
||||||
|
|
||||||
def test_stability(fwd, inv):
|
def test_stability(fwd, inv):
|
||||||
low = 0.0
|
low = 0.0
|
||||||
high = 1.0
|
high = 1.0
|
||||||
mid = 0.5
|
mid = 0.5
|
||||||
for i in range(32):
|
for i in range(8):
|
||||||
low, high, mid = fwd(inv(high)), fwd(inv(low)), fwd(inv(mid))
|
low, high, mid = inv(fwd(high)), inv(fwd(low)), inv(fwd(mid))
|
||||||
print(f"low {low:.2f} high {high:.2f} bistable {mid:.2f}")
|
print(f"low {low:.2f} high {high:.2f} bistable {mid:.2f}")
|
||||||
|
|
||||||
|
def map_stability(inv):
|
||||||
|
s = []
|
||||||
|
for i in range(101):
|
||||||
|
v = i/100.0
|
||||||
|
for _ in range(32):
|
||||||
|
v = inv(v)
|
||||||
|
s.append(v)
|
||||||
|
logic_low = s[0]
|
||||||
|
logic_high = s[100]
|
||||||
|
logic_mean = 0.5*(logic_low + logic_high)
|
||||||
|
|
||||||
|
print(f"low: {logic_low:.2f}, high: {logic_high:.2f}")
|
||||||
|
for i, v in enumerate(s):
|
||||||
|
if v >= logic_mean:
|
||||||
|
print("logic cutoff: {:.2f}".format(i/100))
|
||||||
|
break
|
||||||
|
|
||||||
|
def print_to_stable(inv, f):
|
||||||
|
for _ in range(8):
|
||||||
|
next = inv(f)
|
||||||
|
print(f"{f} -> {next}")
|
||||||
|
f = next
|
||||||
|
|
||||||
|
def print_to_stable_noise(inv, f, noise=0.01):
|
||||||
|
for i in range(8):
|
||||||
|
if i%2: x = f - noise
|
||||||
|
else: x = f + noise
|
||||||
|
next = inv(x)
|
||||||
|
print(f"{f:.3} ({x:.3}) -> {next:.3}")
|
||||||
|
f = next
|
||||||
|
|
||||||
print("stability: 0.2 + 2.0*x")
|
print("stability: 0.2 + 2.0*x")
|
||||||
test_stability(fwd(0.2, 2.0), inv(0.2, 2.0))
|
test_stability(fwd(0.2, 2.0), inv(0.2, 2.0))
|
||||||
|
|
||||||
@@ -70,3 +104,139 @@ print("""\
|
|||||||
the same amp > 1.0 condition holds.
|
the same amp > 1.0 condition holds.
|
||||||
importantly, offset > 0.5 becomes *fine*
|
importantly, offset > 0.5 becomes *fine*
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
|
||||||
|
def piecewise(points: list, scale=20000.0):
|
||||||
|
"""
|
||||||
|
each element in points is a two-tuple (input, output), sorted by input value.
|
||||||
|
the return value is a function which:
|
||||||
|
- accepts f: [0..1]
|
||||||
|
- maps that to [-scale..scale]
|
||||||
|
- maps that through `points` with linear interpolation
|
||||||
|
- scales back to [0..1] and return that
|
||||||
|
"""
|
||||||
|
def apply(f):
|
||||||
|
x_in_scale = -scale + f * scale * 2.0
|
||||||
|
# locate the first point smaller than the input
|
||||||
|
for first_lower in points[:-1][::-1]:
|
||||||
|
if first_lower[0] < x_in_scale: break
|
||||||
|
for first_higher in points[1:]:
|
||||||
|
if first_higher[0] > x_in_scale: break
|
||||||
|
|
||||||
|
# print(x_in_scale, first_lower, first_higher)
|
||||||
|
|
||||||
|
tween = (x_in_scale - first_lower[0]) / (first_higher[0] - first_lower[0])
|
||||||
|
y_in_scale = tween * first_higher[1] + (1-tween) * first_lower[1]
|
||||||
|
|
||||||
|
r = (y_in_scale + scale) / (2.0 * scale)
|
||||||
|
return max(0.0, min(1.0, r))
|
||||||
|
return apply
|
||||||
|
|
||||||
|
fwd_26 = piecewise(
|
||||||
|
[
|
||||||
|
[ -14687, -7326 ],
|
||||||
|
[ -13049, -6503 ],
|
||||||
|
[ -11785, -5833 ],
|
||||||
|
[ -4649, -1447 ],
|
||||||
|
[ 4961, 7059 ],
|
||||||
|
[ 11283, 11147 ],
|
||||||
|
],
|
||||||
|
17000
|
||||||
|
)
|
||||||
|
print("stability 26 7:1 windings (SUITABLY DIFFERENTIATED)")
|
||||||
|
test_stability(fwd_26, lambda x: 1-x)
|
||||||
|
map_stability(inv_from_fwd(fwd_26))
|
||||||
|
|
||||||
|
fwd_36 = piecewise(
|
||||||
|
[
|
||||||
|
[ (-13430 + -14112 + -13935)/3, -8297],
|
||||||
|
[ (-12796 + -13454 + -13293)/3, -7684],
|
||||||
|
[ (-4872 + -5106 + -5091)/3, -282],
|
||||||
|
[ (2322 + 2343 + 3705)/3, 7411],
|
||||||
|
[ (4854 + 4840 + 7273)/3, 9318],
|
||||||
|
[ (7324 + 7138 + 10608)/3, 10151],
|
||||||
|
[ (10552 + 10509 + 14412)/3, 11398],
|
||||||
|
[ (13418 + 13482 + 14760)/3, 13081],
|
||||||
|
[ (14196 + 14528 + 14533)/3, 13580],
|
||||||
|
], 15000)
|
||||||
|
print("stability 36 (3:1) cores (not suitably differentiated)")
|
||||||
|
test_stability(fwd_36, lambda x: 1-x)
|
||||||
|
|
||||||
|
fwd_38_2_0 = piecewise(
|
||||||
|
[
|
||||||
|
[ (-13745 + -13012)/2, -6222 ],
|
||||||
|
[ (-4969 + -4744)/2, 2373 ],
|
||||||
|
[ (1772 + 2070)/2, 10467 ],
|
||||||
|
[ (4472 + 4114)/2, 12921 ],
|
||||||
|
[ (7221 + 6291)/2, 14530 ],
|
||||||
|
[ (11159 + 10397)/2, 15865 ],
|
||||||
|
[ (12430 + 15653)/2, 16202 ],
|
||||||
|
], 17000
|
||||||
|
)
|
||||||
|
print("stability 38 2:0 cores (SUITABLY DIFFERENTIATED)")
|
||||||
|
test_stability(fwd_38_2_0, lambda x: 1-x)
|
||||||
|
map_stability(inv_from_fwd(fwd_38_2_0))
|
||||||
|
# print_to_stable(inv_from_fwd(fwd_38_2_0), 0.0)
|
||||||
|
# print_to_stable_noise(inv_from_fwd(fwd_38_2_0), 0.32, 0.01)
|
||||||
|
|
||||||
|
fwd_38_3_0 = piecewise(
|
||||||
|
[
|
||||||
|
[ (-13956 + -13890 + -13077)/3, -5203],
|
||||||
|
[ (-4979 + -4885 + -4717)/3, 5051],
|
||||||
|
[ (1531 + 503 + 1006)/3, 12509],
|
||||||
|
[ (4180 + 1821 + 2239)/3, 14386],
|
||||||
|
[ (6986 + 3436 + 3701)/3, 15451],
|
||||||
|
[ (10482 + 6644 + 7735)/3, 16081],
|
||||||
|
[ (11436 + 13343 + 14411)/3, 16380],
|
||||||
|
], 17000
|
||||||
|
)
|
||||||
|
print("stability 38 3:0 cores (SUITABLY DIFFERENTIATED)")
|
||||||
|
test_stability(fwd_38_3_0, lambda x: 1-x)
|
||||||
|
map_stability(inv_from_fwd(fwd_38_3_0))
|
||||||
|
# print_to_stable(inv_from_fwd(fwd_38_3_0), 0.0)
|
||||||
|
# print_to_stable_noise(inv_from_fwd(fwd_38_3_0), 0.29, 0.01)
|
||||||
|
|
||||||
|
# fwd_38_2_0 minus 8000
|
||||||
|
# de-biasing like this makes for a WORSE inverter
|
||||||
|
# fwd_38_2_0_offset = piecewise(
|
||||||
|
# [
|
||||||
|
# [ (-13745 + -13012)/2, -14222 ],
|
||||||
|
# [ (-4969 + -4744)/2, -5627 ],
|
||||||
|
# [ (1772 + 2070)/2, 2467 ],
|
||||||
|
# [ (4472 + 4114)/2, 4921 ],
|
||||||
|
# [ (7221 + 6291)/2, 6530 ],
|
||||||
|
# [ (11159 + 10397)/2, 7865 ],
|
||||||
|
# [ (12430 + 15653)/2, 8202 ],
|
||||||
|
# ], 17000
|
||||||
|
# )
|
||||||
|
# print("stability 38 2:0 cores (offset -8000)")
|
||||||
|
# print("pw(0) = ", fwd_38_2_0_offset(0))
|
||||||
|
# test_stability(fwd_38_2_0_offset, lambda x: 1-x)
|
||||||
|
# map_stability(inv_from_fwd(fwd_38_2_0_offset))
|
||||||
|
# print_to_stable(inv_from_fwd(fwd_38_2_0_offset), 0.0)
|
||||||
|
|
||||||
|
fwd_38_4_2 = piecewise([
|
||||||
|
[ (-14049 + -14191 + -14218 + -14161)/4, -10675],
|
||||||
|
[ (-4993 + -4944 + -4985 + -5123)/4, -4640],
|
||||||
|
[ (1948 + 1854 + 2633 + 2602)/4, 73],
|
||||||
|
[ (4823 + 3914 + 5799 + 6177)/4, 1651],
|
||||||
|
[ (7933 + 6731 + 10058 + 9404)/4, 2625],
|
||||||
|
[ (11420 + 11947 + 15968 + 14039)/4, 6413],
|
||||||
|
[ (13786 + 16465 + 16667 + 15144)/4, 8180],
|
||||||
|
], 17000)
|
||||||
|
print("stability 38 4:2 cores (not suitably differentiated)")
|
||||||
|
test_stability(fwd_38_4_2, lambda x: 1-x)
|
||||||
|
|
||||||
|
fwd_38_5_2 = piecewise([
|
||||||
|
[ (-14056 + -14195 + -14234 + -14224 + -14162)/5, -8395],
|
||||||
|
[ (-4990 + -4931 + -4935 + -4968 + -5080)/5, -1468],
|
||||||
|
[ (1804 + 966 + 1564 + 1808 + 2237)/5, 3661],
|
||||||
|
[ (4632 + 2427 + 3521 + 4500 + 5563)/5, 5238],
|
||||||
|
[ (7629 + 4568 + 6648 + 8011 + 8527)/5, 6710],
|
||||||
|
[ (10758 + 9552 + 12404 + 13748 + 12927)/5, 10892],
|
||||||
|
[ (12335 + 15650 + 16603 + 16403 + 14635)/5, 13151],
|
||||||
|
], 17000)
|
||||||
|
print("stability 38 5:2 cores (not suitably differentiated)")
|
||||||
|
test_stability(fwd_38_5_2, lambda x: 1-x)
|
||||||
|
|
||||||
|
# TODO: code 24, 26, 27, 28, 30 (asymmetric windings)
|
||||||
|
Reference in New Issue
Block a user