Commit 2a589d9c authored by David Huss's avatar David Huss 💬
Browse files

Calculate for both w/ env and w/o

parent 5609986c
%% Cell type:code id: tags:
``` python
# Change these values to calculate the needed values
requirements = {"inputs": 8, "outputs":8}
envelopes = True
# Do not edit below this Point unless you know what you are doing
data = {
"mami-input": {
"input-channels": 2,
"parts": [
{"MPN": "PJ301M-12", "n": 2},
{"MPN": "Subminiature On-Off-(On) Toggle switch", "n": 2},
]
},
"mami-output": {
"output-channels": 2,
"parts": [
{"MPN": "LME49720", "n": 2},
{"MPN": "100nF 0603 25V", "n": 4},
{"MPN": "100k 0805", "n": 6},
{"MPN": "100R 0805", "n": 2},
{"MPN": "PJ301M-12", "n": 2}
]
},
"mami-quad": {
"input-channels":2, "output-channels":2,
"parts": [
{"MPN": "P0915N-FC15BR100K", "n": 4},
{"MPN": "Knob", "n": 4},
{"MPN": "100k 0805", "n": 4}
]
},
"mami-env": {
"output-channels":2,
"parts": [
{"MPN": "100nF 0603 25V", "n": 4},
{"MPN": "PJ301M-12", "n": 2},
{"MPN": "TL074CD", "n": 2},
{"MPN": "100k 0805", "n": 8},
{"MPN": "200k 0805", "n": 6},
{"MPN": "20k 0805", "n": 2},
{"MPN": "1k 0805", "n": 2},
{"MPN": "470R 0805", "n": 2},
{"MPN": "1M 0805", "n": 2},
{"MPN": "1nF 0603", "n": 2},
{"MPN": "1uF 5mm lead spacing (e.g. MKS2C041001F00J)", "n": 2},
{"MPN": "LED 3mm", "n": 2},
{"MPN": "BAV199", "n": 4}
]
}
}
# Calculate how many PCBs are needed
n_input_modules = int(requirements["inputs"] / data["mami-input"]["input-channels"])
n_output_modules = int(requirements["outputs"] / data["mami-output"]["output-channels"])
n_env_modules = n_output_modules
n_quad_modules = int((requirements["inputs"] * requirements["outputs"]) / (data["mami-output"]["output-channels"] * data["mami-input"]["input-channels"]))
envelopes = False
# Print the PCB
print("Needed for a {}x{} Matrix Mixer without envelopes".format(requirements["inputs"], requirements["outputs"]))
print("{}".format("="*50))
print("{0:>5}x MAMI-INPUT-Module".format(n_input_modules))
print("{0:>5}x MAMI-OUTPUT-Module".format(n_output_modules))
print("{0:>5}x MAMI-QUAD-Module".format(n_quad_modules))
if envelopes:
print("{0:>5}x MAMI-ENV-Module".format(n_env_modules))
print()
# Collect all the parts
bom = {}
def get_parts(data, n_input_modules, n_quad_modules, n_output_modules, n_env_modules):
parts = []
for part in data["mami-input"]["parts"]*n_input_modules:
parts.append(part)
for part in data["mami-quad"]["parts"]*n_quad_modules:
parts.append(part)
for part in data["mami-output"]["parts"]*n_output_modules:
parts.append(part)
if envelopes:
for part in data["mami-env"]["parts"]*n_env_modules:
parts.append(part)
return parts
for part in get_parts(data, n_input_modules, n_quad_modules, n_output_modules, n_env_modules):
if part["MPN"] in bom:
bom[part["MPN"]] += part["n"]
else:
bom[part["MPN"]] = part["n"]
# Print the BOM
print("Parts\n{}".format("="*50))
for key, value in bom.items():
print("{:>5}x {}".format(value, key))
# Print second variant
print()
print("="*80)
print()
envelopes = True
# Print the PCB
print("Needed for a {}x{} Matrix Mixer".format(requirements["inputs"], requirements["outputs"]))
print("Needed for a {}x{} Matrix Mixer with envelopes".format(requirements["inputs"], requirements["outputs"]))
print("{}".format("="*50))
print("{0:>5}x MAMI-INPUT-Module".format(n_input_modules))
print("{0:>5}x MAMI-OUTPUT-Module".format(n_output_modules))
print("{0:>5}x MAMI-QUAD-Module".format(n_quad_modules))
if envelopes:
print("{0:>5}x MAMI-ENV-Module".format(n_env_modules))
print()
# Collect all the parts
bom = {}
def get_parts(data, n_input_modules, n_quad_modules, n_output_modules, n_env_modules):
parts = []
for part in data["mami-input"]["parts"]*n_input_modules:
parts.append(part)
for part in data["mami-quad"]["parts"]*n_quad_modules:
parts.append(part)
for part in data["mami-output"]["parts"]*n_output_modules:
parts.append(part)
if envelopes:
for part in data["mami-env"]["parts"]*n_env_modules:
parts.append(part)
return parts
for part in get_parts(data, n_input_modules, n_quad_modules, n_output_modules, n_env_modules):
if part["MPN"] in bom:
bom[part["MPN"]] += part["n"]
else:
bom[part["MPN"]] = part["n"]
# Print the BOM
print("Parts\n{}".format("="*50))
for key, value in bom.items():
print("{:>5}x {}".format(value, key))
```
%% Output
Needed for a 8x8 Matrix Mixer
Needed for a 8x8 Matrix Mixer with envelopes
==================================================
4x MAMI-INPUT-Module
4x MAMI-OUTPUT-Module
16x MAMI-QUAD-Module
4x MAMI-ENV-Module
Parts
==================================================
24x PJ301M-12
8x Subminiature On-Off-(On) Toggle switch
64x P0915N-FC15BR100K
64x Knob
120x 100k 0805
8x LME49720
32x 100nF 0603 25V
8x 100R 0805
8x TL074CD
24x 200k 0805
8x 20k 0805
8x 1k 0805
8x 470R 0805
8x 1M 0805
8x 1nF 0603
8x 1uF 5mm lead spacing (e.g. MKS2C041001F00J)
8x LED 3mm
16x BAV199
================================================================================
Needed for a 8x8 Matrix Mixer without envelopes
==================================================
4x MAMI-INPUT-Module
4x MAMI-OUTPUT-Module
16x MAMI-QUAD-Module
Parts
==================================================
16x PJ301M-12
8x Subminiature On-Off-(On) Toggle switch
64x P0915N-FC15BR100K
64x Knob
88x 100k 0805
8x LME49720
16x 100nF 0603 25V
8x 100R 0805
%% Cell type:code id: tags:
``` python
```
%% Cell type:code id: tags:
``` python
```
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment