Skip to content

Conversation

@ducky64
Copy link
Collaborator

@ducky64 ducky64 commented Oct 19, 2025

Improves how gate charge is handled in JLC FET parsing. Adds supplemental gate charge data into the JlcFet class for an arbitrary selection of FETs. Renames manual_gate_charge to fallback_gate_charge, which is now only used when a parsed gate charge is not available and uses a pessimistic max. Expands footprint names map for JlcParts.

Changes parts table behavior to crash (assertion out) when there is no match, to better distinguish it from a typical electrical model failure.

Eliminates manual_gate_charge from refinements, which is no longer relevant.

Also refactors a bunch of library to delete ideal modeling, delegating it to the ideal defaults. This was the cause some failures from gate_charge, which was being set as 0 -> inf instead of Range.all()

NOTES:

  • When the fallback gate charge is used, it may generate unreasonably high gate drive currents. TBD how to deal with this.

@ducky64 ducky64 changed the title Improved FET parsing Improved FET parsing + clean out unspecified params Oct 19, 2025
@ducky64 ducky64 changed the title Improved FET parsing + clean out unspecified params Improved FET parsing + clean out unspecified/ideal params Oct 19, 2025
@ducky64 ducky64 marked this pull request as ready for review October 19, 2025 23:09
@ducky64 ducky64 requested a review from Copilot October 19, 2025 23:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves FET parsing and cleans up unspecified/ideal parameters across the codebase. It enhances gate charge handling in JLC FET parsing by adding supplemental data for specific FETs and introduces a fallback mechanism, while removing manual gate charge specifications from refinements that are no longer needed.

  • Improved FET gate charge parsing with supplemental data and fallback mechanisms
  • Removed ideal modeling parameters (like (0, 0) current draws) in favor of default values
  • Expanded footprint name mappings for better JLC parts support

Reviewed Changes

Copilot reviewed 35 out of 35 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
examples/test_usb_source_measure.py Removed manual gate charge parameters from FET instantiations
examples/test_iot_iron.py Removed manual gate charge refinements
examples/test_iot_display.py Removed ideal gate charge and power parameters
examples/Fcml/Fcml.net Updated FET part numbers and specifications
edg/parts/JlcFet.py Added fallback gate charge mechanism and supplemental data
edg/jlcparts/JlcPartsFet.py Updated to use Range.all() for unspecified gate charge
Multiple part files Removed explicit (0, 0) current draw parameters

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

class FetFallbackGateCharge(PartsTableSelector, BaseTableFet):
"""A TableFet that allows a fallback gate charge if not specified in the table.
Unspecified entries must be Range.all(), which will be substituted with the fallback
value in per-Block post-processing."""
Copy link

Copilot AI Oct 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation mentions 'per-Block post-processing' but the actual implementation happens in _table_postprocess method during table generation, not per-Block. This could be misleading.

Suggested change
value in per-Block post-processing."""
value during table post-processing (in the _table_postprocess method)."""

Copilot uses AI. Check for mistakes.

DESCRIPTION_PARSERS: List[DescriptionParser] = [
(re.compile("(\S+V) (\S+A) (\S+W) (\S+Ω)@(\S+V),\S+A (\S+V)@\S+A ([PN]) Channel .* MOSFETs.*"),
(re.compile("(\S+V) (\S+A) (\S+W) (\S+Ω)@(\S+V),\S+A (\S+V)@\S+A.* ([PN]) Channel.* MOSFETs.*"),
Copy link

Copilot AI Oct 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The regex pattern is very complex and hard to maintain. Consider breaking it into named groups or adding comments explaining each capture group.

Copilot uses AI. Check for mistakes.
self._row_generate(selected_row)
else: # if no matching part, generate a parameter error instead of crashing
self.require(False, "no matching part")
assert len(postprocessed_table) > 0, "no matching part" # crash to make generator failures more obvious
Copy link

Copilot AI Oct 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message 'no matching part' is too generic. It should include context about which component type or requirements failed to match to aid debugging.

Suggested change
assert len(postprocessed_table) > 0, "no matching part" # crash to make generator failures more obvious
assert len(postprocessed_table) > 0, (
f"no matching part for {self.__class__.__name__} with part='{self.get(self.part)}'"
) # crash to make generator failures more obvious

Copilot uses AI. Check for mistakes.
@ducky64 ducky64 merged commit 3dad7fd into master Oct 19, 2025
21 checks passed
@ducky64 ducky64 deleted the fets-improvement branch October 19, 2025 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants