MoCustomComponent block

Minoru Yubuchi_21420
Minoru Yubuchi_21420 New Altair Community Member
edited October 2020 in Community Q&A

Dear Experts,

 

I built a simple model that contains a MoCustomComponent block that represent a mass (see attached Activate model). The script in the block is just copied from Mass modelica block.

 

The model issued the error (see the picture attched). What should I modify?

 

Thanks,

Minoru Yubuchi

<?xml version="1.0" encoding="UTF-8"?>2019-02-22_13-24-44.jpg

Unable to find an attachment - read this blog

Answers

  • Fady Nassif_21652
    Fady Nassif_21652
    Altair Employee
    edited February 2019

    Hello Minoru,

     

    Your modelica Code should be something like that:

     

    model C_Mass 'Sliding mass with inertia'
        parameter Modelica.SIunits.Mass m(min = 0, start = 1) 'Mass of the sliding mass';

        extends Modelica.Mechanics.Translational.Interfaces.PartialRigid(L = 0, s(start = 0));

        Modelica.SIunits.Velocity v(start = 0) 'Absolute velocity of component';
        Modelica.SIunits.Acceleration a(start = 0) 'Absolute acceleration of component';
    equation
        m * a = flange_a.f + flange_b.f;
        a = der(v);
        v = der(s);
    end C_Mass;

     

    Note that I've removed the stateselect since it is not a block parameter, you can put it back if needed.

     

    Thanks

     

    Fady

  • Minoru Yubuchi_21420
    Minoru Yubuchi_21420 New Altair Community Member
    edited February 2019

    Fady,

     

    Thank you so much!

     

    Let me ask you one question. The original script of Modelica Mass block in Activate has a line 'parameter SI.Mass m(....', not 'parameter Modelica.SIunits.Mass m(....' as you mentioned.

     

    Why does the original script not issue any errors?

     

    Regards,

    Minoru Yubuchi

  • RoKet
    RoKet
    Altair Employee
    edited February 2019

    At the top of package Translational SI is defined as placeholder for Modelica.SIunits.

     import SI = Modelica.SIunits;

    Everywhere else in this file you can use SI instead of Modelica.SIunits.