crashmetrics.bncap_channels and crashmetrics.bncap_report¶
bncap_channels
¶
Bharat NCAP occupant inputs from dummy channels (AIS-197 2023).
Turns dummy time histories, from a test (for example ISO-MME) or from a simulation, into the inputs of the Bharat NCAP scoring in one call:
frontal_occupant_from_channels: Hybrid III 50th in the ODB frontal test ->crashmetrics.bncap.FrontalOccupant.side_occupant_from_channels: ES-2 in the MDB side test ->crashmetrics.bncap.SideOccupant, with the backplate and T12 modifiers when those channels are given.pole_test_from_channels: ES-2 in the pole test -> pass / fail.channels_from_isomme: the named channels of one dummy from an ISO-MME test (HYBRID3_ISOMMEcodes from Euro NCAP CP 005; give your own patterns for other dummies), converted to the units below and filtered with the protocol CFC if they are not filtered yet.
Channels are given by name as {name: (time_s, values)} in the units
and with the filter classes of FRONTAL_CHANNELS and SIDE_CHANNELS.
With filtered=False (the default) each channel is filtered here with
its CFC, which needs uniform sampling (crashmetrics.signals.
resample_uniform first if needed). Channels used together (the three
head axes, the neck, the tibia loads of one location, the three ribs)
must share a time base.
Sign conventions are those of the rest of the package (see the units and
signs page): femur and tibia Fz compression negative, neck Fz tension
positive, Hybrid III chest deflection compression positive (set
chest_compression_negative=True otherwise), knee slider negative in
compression, ES-2 rib deflections and abdominal forces positive in
loading.
Edition: AIS-197 of September 2023, for ratings from 1 October 2023 to
30 September 2027 (crashmetrics.bncap.PROTOCOL); every function takes
edition=2023.
HEAD_CONTACT_PEAK
module-attribute
¶
Peak resultant head acceleration (g) above which a frontal head
contact is assumed when head_contact is not given (AIS-197 2023: no
hard contact if the peak is at most 80 g and there is no other
evidence).
FRONTAL_CHANNELS
module-attribute
¶
FRONTAL_CHANNELS: dict[str, tuple[str, int]] = {
"head_ax": ("g", 1000),
"head_ay": ("g", 1000),
"head_az": ("g", 1000),
"neck_fx": ("N", 1000),
"neck_fz": ("N", 1000),
"neck_my": ("N m", 600),
"chest_deflection": ("mm", 180),
"femur_fz_left": ("N", 600),
"femur_fz_right": ("N", 600),
"knee_left": ("mm", 180),
"knee_right": ("mm", 180),
**{
name: ("N" if name.endswith("fz") else "N m", 600)
for name in _TIBIA
},
}
Hybrid III 50th channels: name -> (unit, CFC). Tibia loads are needed at the upper or the lower location (or both: the worse is used).
SIDE_CHANNELS
module-attribute
¶
SIDE_CHANNELS: dict[str, tuple[str, int]] = {
"head_ax": ("g", 1000),
"head_ay": ("g", 1000),
"head_az": ("g", 1000),
"rib_upper": ("mm", 180),
"rib_middle": ("mm", 180),
"rib_lower": ("mm", 180),
"abdomen_front": ("N", 600),
"abdomen_middle": ("N", 600),
"abdomen_rear": ("N", 600),
"pubic_fy": ("N", 600),
"backplate_fy": ("N", 600),
"t12_fy": ("N", 600),
"t12_mx": ("N m", 600),
}
ES-2 channels: name -> (unit, CFC). backplate_fy, t12_fy and
t12_mx are optional (they give the chest modifiers).
HYBRID3_ISOMME
module-attribute
¶
HYBRID3_ISOMME: dict[str, str] = {
"head_ax": "HEAD0000H3ACX",
"head_ay": "HEAD0000H3ACY",
"head_az": "HEAD0000H3ACZ",
"neck_fx": "NECKUP00H3FOX",
"neck_fz": "NECKUP00H3FOZ",
"neck_my": "NECKUP00H3MOY",
"chest_deflection": "CHST????H3DSX",
"femur_fz_left": "FEMRLE00H3FOZ",
"femur_fz_right": "FEMRRI00H3FOZ",
"knee_left": "KNSLLE00H3DSX",
"knee_right": "KNSLRI00H3DSX",
**{
f"tibia_{leg}_{loc}_{c}": f"TIBI{leg[:2].upper()}{loc[:2].upper()}H3{'FO' if c == 'fz' else 'MO'}{c[1].upper()}"
for leg in ("left", "right")
for loc in ("upper", "lower")
for c in ("mx", "my", "fz")
},
}
ISO-MME channel codes of the Hybrid III 50th (Euro NCAP CP 005),
characters 3 to 15: the test object, the seating position and the filter
class are added by channels_from_isomme. ? matches any character
(chest deflection fine locations differ between labs).
frontal_occupant_from_channels
¶
frontal_occupant_from_channels(
channels: Mapping[str, Series],
*,
driver: bool = True,
filtered: bool = False,
head_contact: bool | None = None,
pedal_rearward: float | None = None,
modifiers: Mapping[str, float] | None = None,
chest_compression_negative: bool = False,
edition: int = EDITION,
) -> FrontalOccupant
FrontalOccupant of a Hybrid III 50th from its channels.
Calculates HIC15 and the 3 ms clip of the resultant head acceleration, the neck shear and tension histories and the extension moment at the occipital condyle, chest compression and VC, femur histories, knee slider displacements, and per leg the worst Tibia Index and tibia compression of the given locations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channels
|
Mapping[str, Series]
|
|
required |
driver
|
bool
|
False for the passenger (no pedal assessment). |
True
|
filtered
|
bool
|
True if the channels are already filtered with their CFC. |
False
|
head_contact
|
bool | None
|
Hard head contact. None: assumed if the peak resultant head
acceleration exceeds |
None
|
pedal_rearward
|
float | None
|
Worst rearward pedal displacement, mm (driver). |
None
|
modifiers
|
Mapping[str, float] | None
|
Points per region, for example from
|
None
|
chest_compression_negative
|
bool
|
True if chest deflection is negative in compression. |
False
|
edition
|
int
|
Bharat NCAP edition (2023). |
EDITION
|
Returns:
| Type | Description |
|---|---|
FrontalOccupant
|
Ready for |
side_occupant_from_channels
¶
side_occupant_from_channels(
channels: Mapping[str, Series],
*,
filtered: bool = False,
modifiers: Mapping[str, float] | None = None,
edition: int = EDITION,
) -> SideOccupant
SideOccupant of an ES-2 in the MDB side test from its channels.
Calculates HIC15 and the 3 ms clip of the resultant head
acceleration, the worst rib deflection and rib VC, the peak total
abdominal force and the peak pubic symphysis force. If
backplate_fy or t12_fy and t12_mx are given, their
chest modifiers (crashmetrics.bncap.side_modifiers) are added to
modifiers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channels
|
Mapping[str, Series]
|
|
required |
filtered
|
bool
|
True if the channels are already filtered with their CFC. |
False
|
modifiers
|
Mapping[str, float] | None
|
Further points to subtract per region. |
None
|
edition
|
int
|
Bharat NCAP edition (2023). |
EDITION
|
pole_test_from_channels
¶
pole_test_from_channels(
channels: Mapping[str, Series],
*,
head_contact: bool,
filtered: bool = False,
edition: int = EDITION,
) -> bool
Pole side test result (29 km/h, ES-2) from its channels, with
crashmetrics.bncap.pole_test_passed: HIC15 < 700, peak head
acceleration < 80 g, no head contact with the pole (head_contact,
from the film), and rib, abdomen and pubic values below the side
lower performance limits.
channels_from_isomme
¶
channels_from_isomme(
test: IsoMmeTest,
*,
position: str = "1",
test_object: str = "1",
patterns: Mapping[str, str] = HYBRID3_ISOMME,
table: Mapping[str, tuple[str, int]] = FRONTAL_CHANNELS,
optional: Sequence[str] = (*_TIBIA, *_SIDE_OPTIONAL),
filter: bool = True,
) -> dict[str, Series]
Named channels of one dummy from an ISO-MME test.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
test
|
IsoMmeTest
|
From |
required |
position
|
str
|
Seating position, the 2nd code character: |
'1'
|
test_object
|
str
|
1st code character ( |
'1'
|
patterns
|
Mapping[str, str]
|
Name -> code characters 3 to 15, |
HYBRID3_ISOMME
|
table
|
Mapping[str, tuple[str, int]]
|
Name -> (unit, CFC): |
FRONTAL_CHANNELS
|
optional
|
Sequence[str]
|
Names that may be missing (tibia locations, side modifier loads). |
(*_TIBIA, *_SIDE_OPTIONAL)
|
filter
|
bool
|
Filter channels whose filter class says unfiltered with the CFC
of |
True
|
Returns:
| Type | Description |
|---|---|
dict
|
|
bncap_report
¶
Bharat NCAP adult occupant scorecard (AIS-197 2023).
scorecard lays out a scored frontal and side test like a rating
sheet: every body region with its points, colour, governing criterion
and modifiers, every criterion with its value against the higher and
lower performance limits, where the points are lost, and how many
points the next star needs.
Scorecard.markdown: report for a design review or a pull request.Scorecard.rows: one row per criterion, forcrashmetrics.features.write_csvor a dataframe.Scorecard.losses: point losses per body region group, largest first.
Edition: AIS-197 of September 2023, for ratings from 1 October 2023 to
30 September 2027 (crashmetrics.bncap.PROTOCOL).
UNITS
module-attribute
¶
UNITS: dict[str, str] = {
"hic15": "",
"head_a3ms": "g",
"neck_shear": "N",
"neck_tension": "N",
"neck_extension": "N m",
"chest_compression": "mm",
"viscous_criterion": "m/s",
"femur_force": "N",
"knee_displacement": "mm",
"tibia_index": "",
"tibia_force": "N",
"pedal_rearward": "mm",
"rib_deflection": "mm",
"rib_vc": "m/s",
"abdominal_force": "N",
"pubic_force": "N",
}
Unit of each criterion value.
RegionRow
dataclass
¶
RegionRow(
test: str,
occupant: str,
region: str,
points: float,
raw_points: float,
modifiers: float,
colour: str,
governing: str,
capped: bool,
)
One body region of one occupant.
CriterionRow
dataclass
¶
Loss
dataclass
¶
Scorecard
dataclass
¶
Scorecard(
protocol: str,
frontal: float,
side: float,
total: float,
stars: int,
reasons: tuple[str, ...],
next_star: int | None,
points_to_next_star: float | None,
regions: tuple[RegionRow, ...],
criteria: tuple[CriterionRow, ...],
losses: tuple[Loss, ...],
test_modifiers: dict[str, float],
)
scorecard
¶
scorecard(
frontal: TestResult,
side: TestResult,
rating: AopRating | None = None,
edition: int = EDITION,
) -> Scorecard
Scorecard of the adult occupant tests.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frontal
|
TestResult
|
From |
required |
side
|
TestResult
|
From |
required |
rating
|
AopRating | None
|
The AOP rating (for example |
None
|
edition
|
int
|
Bharat NCAP edition (2023). |
EDITION
|