Part-DB-server icon indicating copy to clipboard operation
Part-DB-server copied to clipboard

Support of SI unit prefixes for parameters

Open Bluezetv opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe.
Currently, there are two ways of dealing with unit prefixes while using parameters, but both are not ideal:

  1. Not using unit prefixes:
    When dealing with very big or small values (e.g., pF), the Numbers get long and hard to read.
  2. Adding a prefix to the Unit-field in the parameter editor:
    The filtering function can not deal with this (e.g., when filtering for I < 2 A, a part with the parameter I = 500 mA is not being considered).

Describe the solution you'd like

  • The Value-fields of the parameter editor (and the Parameters-tab of the filter) could allow entries like 1.8k or 1k8 and automatically convert them to (or interpret them as) 1800 when clicking on Save changes (or Update).
    (Image 1)
  • Additionally, the table of the parameter editor could have an additional column that contains one checkbox per parameter to control whether the values of this parameter should be displayed with unit prefixes or not. (Image 2)

Describe alternatives you've considered
A different approach would be to use the second mentioned way of dealing with prefixes and only modify the filter:
When filtering for Value: Typ. Value < 100, Unit: nF, it could internally also be searched for Value: Typ. Value < 0.1, Unit: µF, Value: Typ. Value < 100000, Unit: pF and so on. This might be easier to implement than the former approach (fewer modified code parts, no additional data to be stored in the database), but I expect it to have a higher potential for unintended behavior (like misinterpretations of m as the prefix "milli" or the unit "meter").

Additional context
Example of how the effect of the first bullet point could look like inside the filter menu: 1 Example of how the effect of the second bullet point could look like: 2

Bluezetv avatar Oct 01 '23 00:10 Bluezetv

I think this feature is absolutely necessary to support parametric search properly. I think the easiest way would be to store a sortable version of the entered parameters (e.g. 5kΩ -> 5000), but this has the downside of needing a few more DB columns (e.g. value_min_sort, value_typical_sort, value_max_sort) in the parameters table.

Are there any plans to implement this in the near future? I would be willing to take a stab at it, but I would need some pointers on where to start...

NikoDelarich avatar Apr 21 '24 12:04 NikoDelarich