GithubHelp home page GithubHelp logo

how to handle odd units about scpi-parser HOT 6 CLOSED

karlp avatar karlp commented on May 29, 2024
how to handle odd units

from scpi-parser.

Comments (6)

j123b567 avatar j123b567 commented on May 29, 2024

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.

from scpi-parser.

karlp avatar karlp commented on May 29, 2024

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.

from scpi-parser.

j123b567 avatar j123b567 commented on May 29, 2024

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.

from scpi-parser.

karlp avatar karlp commented on May 29, 2024

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

from scpi-parser.

j123b567 avatar j123b567 commented on May 29, 2024

Feel free to implement it ;)

from scpi-parser.

j123b567 avatar j123b567 commented on May 29, 2024

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

from scpi-parser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.