from typing import ClassVar
from jitx.feature import Soldermask
from jitx.stackup import Conductor, Dielectric
# Source of truth for every number in this module is JLCPCB's controlled
# impedance page, https://jlcpcb.com/impedance, last confirmed 2026-09-16,
# except the Rogers section, which names its own sources.
# JLCPCB's pages disagree with each other: the cart-side impedance page quotes
# 7628 at 4.6, 3313 at 4.05 and 2116 at 4.25. Those are a different page's
# figures, not corrections to these - do not merge the two sets.
# ----- Prepreg -----
# From Impedance Control Specifications from JLC-PCB
Er_7628 = 4.4
Er_3313 = 4.1
Er_1080 = 3.91
Er_2116 = 4.16
# Based on data provided here:
# https://github.com/JITx-Inc/jlc-pcb/issues/8
# I'm using an average value for each of the materials
Df_7628 = 0.0168
Df_3313 = 0.0168
Df_1080 = 0.0178
Df_2116 = 0.0168
# Deprecated aliases. JLCPCB has no 3314 prepreg on any of its pages; the
# glass style in the original name was a typo for 3313, whose dielectric
# constant 4.1 is the one that was always carried here. The names are public
# API (they appear on docs.jitx.com), so they stay for at least one release.
Er_3314 = Er_3313
Df_3314 = Df_3313
[docs]
class FR4_7628(Dielectric):
"FR4 Prepreg 7628 - JLC PCB Specified"
dielectric_coefficient = Er_7628 # @ 1GHz
loss_tangent = Df_7628 # @ 1GHz
[docs]
class FR4_3313(Dielectric):
"FR4 Prepreg 3313 - JLC PCB Specified"
dielectric_coefficient = Er_3313 # @ 1GHz
loss_tangent = Df_3313 # @ 1GHz
#: Deprecated alias of :py:class:`FR4_3313`, see the note above.
FR4_3314 = FR4_3313
[docs]
class FR4_1080(Dielectric):
"FR4 Prepreg 1080 - JLC PCB Specified"
dielectric_coefficient = Er_1080 # @ 1GHz
loss_tangent = Df_1080 # @ 1GHz
[docs]
class FR4_2116(Dielectric):
"FR4 Prepreg 2116 - JLC PCB Specified"
dielectric_coefficient = Er_2116 # @ 1GHz
loss_tangent = Df_2116 # @ 1GHz
# ----- Core -----
# The core dielectric constant is per buildup, and the two JLCPCB sources
# disagree about it. The impedance page publishes a single 4.6 for all cores.
# The impedance calculator's template database, which is what JLCPCB actually
# solves impedance with, carries a value per core; those are the values below,
# read 2026-09-17 and unanimous across every template using each of these
# cores. They are not a function of thickness in general - 0.2 mm cores appear
# as both 4.36 and 4.42 - so a new core takes its value from its own template
# rather than from the nearest one here.
Er_core_400 = 4.36
Er_core_550 = 4.41
Er_core_1065 = 4.38
Er_core_1265 = 4.42
Er_core = 4.6
"""The single figure jlcpcb.com/impedance publishes for all cores. Kept
because it is public API; the per-core values above are what the buildups in
this package use."""
# No Specification - This is a guess
Df_core = 0.0168
[docs]
class FR4_Core(Dielectric):
"""FR4 Core - JLC PCB Specified.
Base for the cores below, and the generic core for a buildup that has no
entry here. Carries the impedance page's single 4.6.
"""
dielectric_coefficient = Er_core # @ 1GHz
loss_tangent = Df_core # @ 1GHz
# Named for their thickness in micrometres, since a JLCPCB core is a stocked
# laminate rather than a material that can be cut to any depth.
[docs]
class FR4_Core400(FR4_Core):
"FR4 Core, 0.4 mm - JLC PCB Specified"
thickness = 0.4
dielectric_coefficient = Er_core_400
[docs]
class FR4_Core550(FR4_Core):
"FR4 Core, 0.55 mm - JLC PCB Specified"
thickness = 0.55
dielectric_coefficient = Er_core_550
[docs]
class FR4_Core1065(FR4_Core):
"FR4 Core, 1.065 mm - JLC PCB Specified"
thickness = 1.065
dielectric_coefficient = Er_core_1065
[docs]
class FR4_Core1265(FR4_Core):
"FR4 Core, 1.265 mm - JLC PCB Specified"
thickness = 1.265
dielectric_coefficient = Er_core_1265
# ----- Rogers -----
# JLCPCB builds Rogers boards on one laminate, RO4350B, 2-layer only, with
# 1 oz copper (https://jlcpcb.com/pcb-fabrication/high-frequency-pcb, read
# 2026-11-08). The impedance page above does not cover it; the sources for
# this section are that page, the order form, and the Rogers datasheet the
# order form links (https://static.jlcpcb.com/pdf/ROGERS_Datasheet.pdf,
# Rogers publication 92-134, revised 2019, read 2026-11-08).
#
# The dielectric constant is the one exception in this module to "JLCPCB is
# the source of truth". JLCPCB lists RO4350B at Dk 3.48, which is Rogers'
# process specification: a clamped-stripline measurement at 10 GHz that the
# datasheet itself says "can potentially lower the actual dielectric constant
# due to the presence of air gap". Rogers publishes 3.66 as the design
# specification, the value to solve impedance with, so that is what the
# routing structures here are computed from. Both are kept.
Er_RO4350B = 3.66
"""Rogers' design Dk for RO4350B, used for impedance."""
Er_RO4350B_process = 3.48
"""Rogers' process Dk for RO4350B (10 GHz, clamped stripline), the figure
JLCPCB lists. Not used for impedance; see above."""
Df_RO4350B = 0.0037
"""At 10 GHz. JLCPCB and the Rogers datasheet agree."""
[docs]
class RO4350B(Dielectric):
"""Rogers RO4350B laminate - JLC PCB Specified.
Base for the stocked thicknesses below. The order sheet names Rogers and
RO4350B for any stackup with a layer of this class.
"""
dielectric_coefficient = Er_RO4350B
loss_tangent = Df_RO4350B # @ 10GHz
# Named for their thickness in micrometres like the FR4 cores. The order form
# offers PCB thickness 0.51, 0.76 or 1.52 mm for Rogers. Those are Rogers'
# standard RO4350B laminate thicknesses of 0.020", 0.030" and 0.060" (the
# datasheet's 0.508, 0.762 and 1.524 mm), not the finished board: JLCPCB's
# high-frequency page gives the finished boards as 0.65, 0.9 and 1.65 mm, and
# their 2023 announcement of the service lists the same 0.51/0.76/1.52
# options beside "the thickness of the finished product is 0.6/0.9/1.65mm"
# (https://jlcpcb.com/news/rogers-ptfe-high-frequency-pcb-available).
[docs]
class RO4350B_Core508(RO4350B):
"RO4350B laminate, 0.508 mm (0.020 in) - JLC PCB Specified"
thickness = 0.508
[docs]
class RO4350B_Core762(RO4350B):
"RO4350B laminate, 0.762 mm (0.030 in) - JLC PCB Specified"
thickness = 0.762
[docs]
class RO4350B_Core1524(RO4350B):
"RO4350B laminate, 1.524 mm (0.060 in) - JLC PCB Specified"
thickness = 1.524
# ----- Copper -----
# Declared here rather than per substrate so that one weight cannot mean two
# thicknesses in one package. Both figures are JLCPCB's stackup tables, which
# every buildup in the catalogue agrees on. Note that JLCPCB's impedance
# *calculator* user guide uses different numbers for its own solve (1.6 mil /
# 0.0406 mm for 1 oz external, 0.6 mil for 0.5 oz internal); the stackup
# figures are the ones that describe the board.
#
# `weight_oz` is carried explicitly because it cannot be recovered from the
# thickness: JLCPCB's half-ounce inner copper is 0.0152 mm, not half of the
# 0.035 mm they give for one ounce. Anything reporting a copper weight should
# read this rather than divide.
[docs]
class JLCPCBCopper(Conductor):
"""Base for the copper weights JLCPCB ships, carrying the weight the
stackup was ordered with alongside its thickness."""
weight_oz: ClassVar[float | None] = None
"""Copper weight in ounces per square foot."""
[docs]
class Copper1oz(JLCPCBCopper):
"1oz Copper - JLC PCB Specified"
material_name = "Copper 1oz"
weight_oz = 1.0
thickness = 0.035
[docs]
class CopperHalfOz(JLCPCBCopper):
"Half-ounce Copper - JLC PCB Specified"
material_name = "Copper 0.5oz"
weight_oz = 0.5
thickness = 0.0152
# ----- Soldermask -----
[docs]
class SoldermaskMaterial(Dielectric):
"Soldermask - JLC PCB Specified"
dielectric_coefficient = 3.8
loss_tangent = 0.02 # This is a guess
representing = Soldermask
# JLCPCB publishes three soldermask coating thicknesses: 1.2 mil above
# substrate, 0.6 mil above trace, 1.2 mil between traces. The substrates in
# this package use 0.01524 mm, which is the 0.6 mil above-trace figure, since
# a stackup layer sits on top of the copper. Do not "correct" it to 1.2 mil.
# ----- Surface finish -----
#
# A surface finish would be declared here, as a material: HASL (leaded),
# HASL (lead-free), ENIG and OSP are confirmed on JLCPCB's capabilities page
# as of 2026-09-16. Immersion silver, immersion tin, hard gold and ENEPIG are
# order-form-only as far as we can confirm and are deliberately not listed.
#
# There is nothing to declare them as. A finish plates exposed copper only, so
# it is not a layer spanning the board and it must not enter a thickness sum;
# `Material` demands a thickness regardless; and there is no `Feature` for a
# `representing` tag to point at. JITX cannot describe a surface treatment in
# a stackup today, so this package does not invent a JLCPCB-shaped side
# channel for one - see `plans/stackup-revision-plan.md` §4. The exporter
# prints a hardcoded PRELIMINARY value until the model catches up.