Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to handle odd units #14

Closed
karlp opened this issue Feb 4, 2014 · 6 comments
Closed

how to handle odd units #14

karlp opened this issue Feb 4, 2014 · 6 comments

Comments

@karlp
Copy link
Contributor

karlp commented Feb 4, 2014

I know that I can provide my own entire array of units, but do you have ideas on how best to handle things like "Vrms" and Vpp, while still keeping all the existing SI unit prefixes? so I can have mVrms and uVrms without having to to duplicate all the units for all the combinations?

I'm probably just going to ignore supporting this in the direct SOURce#:APPLy:SIN [freq], [ampl], [offset] type functions, and only allow changing it via the explicit SOURce#:VOLTage:UNIT command, but was wondering if you had any ideas on how best to handle this

@j123b567
Copy link
Owner

j123b567 commented Feb 5, 2014

Because of collisions in units and their prefixes, you must specify all combinations you want. Units prefixes are case insensitive.

Consider these examples:

  • What is MHZ? - mega Hertz or milli Hertz
  • What is MV? - mega Volt or milli Volt
  • What is MOHM? - mega Ohm or milli Ohm

It all depends on your application and it is not possible to generate prefixes automaticly.

@karlp
Copy link
Contributor Author

karlp commented Feb 5, 2014

I more meant suffixes. I understand the M problem above, and SCPI even just says it's banned to use milli hertz, milli ohms and megavolts.

I was more meaning things like 400uVrms, 400mVrms and 400Vrms and 400uVpp, 400mVpp, 400Vpp, without specifying Vrms and Vpp as separate units, so the prefix would still do the x1000, /1000 type multipliers, but the suffix could have some other factor after the prefix was applied. Just idle thoughts really.

@j123b567
Copy link
Owner

j123b567 commented Feb 5, 2014

I now understand what you want. There could be one array of units and each unit connected to array with possible prefixes for that unit.

V -> U,M,,K
Vrms -> U,M,,K
OHM -> ,K,M
HZ -> ,K,M,G

But now, it is not possible and it is hard to implement. The best way now is to expand all possible prefixes with all possible suffixes.

@karlp
Copy link
Contributor Author

karlp commented Feb 5, 2014

Indeed, I know it's not really possible in the current library, just something to think about .)

@j123b567
Copy link
Owner

j123b567 commented Feb 5, 2014

Feel free to implement it ;)

@j123b567
Copy link
Owner

Just make two separate issues from this #26 and #25 so closing this.

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

No branches or pull requests

2 participants