Files

72 lines
3.4 KiB
Python
Raw Permalink Normal View History

2026-11-09 11:51:56 -06:00
"""TEMPLATE — Technical Note (TN). Copy this folder to <PROJECT>/source/ and fill it in.
A TN answers ONE engineering question (does it fit, how much power, is a cut needed)
and puts the answer first. 1–3 pages. See MPM_Document_Standard.md §9.3.
Order (do not reorder):
masthead (automatic) → KPI tiles → Result → evidence sections (tables, calc, figures)
→ Assumptions and open items → Revision history (automatic)
"""
import sys, pathlib
HERE = pathlib.Path(__file__).resolve().parent
sys.path.insert(0, str(next(p / "_STANDARDS" for p in HERE.parents if (p / "_STANDARDS").is_dir())))
from mpmdoc import Doc, KeyRow, up, dn
from figs import FIGS, MEASURED, LIMIT # keep every number in ONE place (figs.py) and derive the rest
F = {k: f() for k, f in FIGS.items()}
MARGIN = LIMIT - MEASURED
doc = Doc(
number="TN-MPM-SUBJ-01", # TYPE-CUST-SUBJ-NN · register CUST + number in registry.md
rev="0.1", # 0.x = Draft · 1.0 = first release
date="2026-11-05", # ISO in source; displayed as "Nov 5, 2026"
customer=None, # None = name from the CUST code; override for a fuller name
subject="Subject", # short: the thing studied ("Bay 17", "Pingo P2.5 LED module")
title="Question-Shaped Title: The Thing Being Checked",
lede=("Two to three sentences: the situation, and what this note works out. "
"Write it so someone who reads only this paragraph knows why the note exists."),
meta=[("Site", "Where / what"), ("Requirement", "The criterion · e.g. ≤ 60 W")], # exactly two cells
slug="Customer_Short-Title", # → TN-MPM-SUBJ-01_Customer_Short-Title_Rev0.1.pdf
history=[("0.1", "2026-11-05", "Initial draft.")],
)
doc.add(
# 3–4 tiles: the input(s), THE ANSWER (tone="key"), and the verdict (tone="ok"/"bad")
doc.kpis([
("Measured", f"{MEASURED:.1f} W", "How it was measured"),
("Limit", f"{LIMIT:.1f} W", "Where the limit comes from", "strong"),
("Margin", f"{MARGIN:+.1f} W", "Limit − measured", "ok" if MARGIN >= 0 else "bad"),
]),
# 2–4 bullets. First bullet = the answer, with the number in bold. Then conditions / what to do.
doc.result([
f"The answer in one sentence, with the key value in <b>bold ({MEASURED:.1f} W)</b>.",
"The condition the answer depends on, and what changes if it doesn't hold.",
]),
doc.section("Comparison"),
doc.table(
[("Item", ""), ("Value", "m r"), ("Change", "d r"), ("Notes", "")],
[
["Row", "1.0", up("+1.0"), "Source of the number"],
KeyRow(["<b>The row that matters</b>", "2.0", dn("−0.5"), "Highlight max. one row"]),
],
caption="What the table shows, units, and the datum.", ref="cmp"),
doc.section("Calculation"),
doc.calc([
"# One comment line per step, saying why",
("Margin", "limit − measured = {:.1f} − {:.1f}".format(LIMIT, MEASURED), f"{MARGIN:+.1f} W",
"PASS" if MARGIN >= 0 else "FAIL"),
]),
doc.section("Figure"),
doc.figure(F["bars"], "Caption says what to look at, not just what it is. Refer to it in text as [[fig:bars]].", ref="bars"),
doc.assumptions(
["Every assumption the answer rests on, one per bullet."],
["Everything still to confirm, phrased as an action (Confirm …, Add …)."],
),
)
doc.build()