← Back to team overview

kicad-developers team mailing list archive

Re: Odp: Re: SPICE_VALUE behavior

 

Hi Sylwester,

Got it. I would avoid rejecting all extra characters after the multiplier suffix and parse SI units (if they are defined).  If the SI units are not valid, then the value should be rejected as invalid.

Wayne

On 5/19/21 12:45 PM, Sylwester Kocjan wrote:
Hi Wayne,

Dnia 19 maja 2021 00:32 Wayne Stambaugh <stambaughw@xxxxxxxxx <mailto:stambaughw@xxxxxxxxx>> napisał(a):

    The test cases look correct so I don't see any issues here.


Could you please check again with better formatting below? Hertz is a valid SI unit, so strings: "10m" and "10mHz" are valid, but
values ending with "Hzz" are invalid:





*Scenario:*
	*Input:*
	*Actual behavior:*
	*Expected behavior:*
	*Result:*
Positive
	10m
	Value parsed correctly
	Value parsed correctly
	PASS
Positive
	10mHz
	Value parsed correctly
	Value parsed correctly
	PASS
Negative
	10mHzz
	Value parsed correctly
	Exception thrown
	FAIL
Positive
	10Hz
	Exception thrown
	Value parsed correctly
	FAIL
Negative
	10Hzz
	Exception thrown
	Exception thrown
	PASS

Parsing strings in V7 wouldn't hurt, that's no problem, but the easiest solution is to reject all extra characters:




*Input:*
	*Actual behavior:*
10m
	Value parsed correctly
10mHz
	Exception thrown
10mHzz
	Exception thrown
10Hz
	Exception thrown
10Hzz
	Exception thrown


Best regards,
Sylwester

Dnia 19 maja 2021 00:32 Wayne Stambaugh <stambaughw@xxxxxxxxx <mailto:stambaughw@xxxxxxxxx>> napisał(a):

    Hi Sylwester,

    I don't know that we need to support SI units in spice strings but I
suppose it wouldn't hurt.  That would have to wait until V7 as
it is a
    new feature.  The test cases look correct so I don't see any
    issues here.

    - Wayne

    On 5/18/21 2:06 PM, Sylwester Kocjan wrote:

        Hello!

        I've noticed a minor bug in SPICE_VALUE class. Could you
        please let me
        know if we should parse SI units in SPICE strings or ignore
        them, so I
        can fix it? I think ngspice accepts units like, V, I, Ohm, but
        this may
        be an overkill. The easiest solution is to ignore everything after
        number and prefix.

        See below the testcases I made on AC tab of Simulation
        Settings dialog:

        Input:      Actual behavior:        Expected behavior:
        10m         Value parsed correctly  Value parsed correctly
        10mHz       Value parsed correctly  Value parsed correctly
10mHzz      Value parsed correctly 
Exception thrown
        10Hz        Exception thrown        Value parsed correctly
        10Hzz       Exception thrown        Exception thrown

        Best regards,
        Sylwester

        _______________________________________________
        Mailing list: https://launchpad.net/~kicad-developers
        <https://launchpad.net/~kicad-developers>
        Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
        <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
        Unsubscribe : https://launchpad.net/~kicad-developers
        <https://launchpad.net/~kicad-developers>
        More help   : https://help.launchpad.net/ListHelp
        <https://help.launchpad.net/ListHelp>


    _______________________________________________
    Mailing list: https://launchpad.net/~kicad-developers
    <https://launchpad.net/~kicad-developers>
    Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
    <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
    Unsubscribe : https://launchpad.net/~kicad-developers
    <https://launchpad.net/~kicad-developers>
    More help   : https://help.launchpad.net/ListHelp
    <https://help.launchpad.net/ListHelp>



_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


References