enum of numbers

sjabirsjabir Posts: 7
edited March 2017 in Saber Modeling Languages
I have a Parameter which may have one of three numbers (32,64,128) , How can I
define an enum of numbers?

Comments

  • Hello Saad,

    Thanks for your query on forum. It is not possible to have enum for numbers but you can assign the values corresponding to three enums in parameters section as shown below.. 

    template resistor_enum p1 m1 = res_value

    electrical p1, m1

    enum {_32,_64,_128} res_value = _32

    {
    number res = 32

    parameters {
    if (res_value == _32) {
    res = 32
    }
    if (res_value == _64) {
    res = 64
    }
    if (res_value == _128) {
    res = 128
    }

    }
    r.res p1 m1 = rnom = res
    }

    Attached the resistor file and the corresponding symbol for your reference. 

    I hope this helps. 

    Regards,
    Balaji
  • sjabirsjabir Posts: 7
    thank you !
    I know this work around but it seemed to me impossible not tot have a direct way.

    saad
  • Is there any way to display list of numbers in properties of a Saber -Matlab created symbol?

    Example:

    I have created a Saber - Matlab symbol, where Vehicle Speed is one of the parameter (property).

    Can I have a list of values say 0,50,100 (enum) for Vehicle speed parameter?


    Regards,

    Naveenkumar J
  • VishwaVishwa Posts: 86
    Hi Naveen,

    Please contact Volvo-IT for support.
    Refer to my comment in the other discussion.

    Thanks,
    Vishwa

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file