Jump to content
Minoru Yubuchi

MoCustomComponent block

Recommended Posts

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?



Minoru Yubuchi



Share this post

Link to post
Share on other sites

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";
    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.





Share this post

Link to post
Share on other sites



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?



Minoru Yubuchi

Share this post

Link to post
Share on other sites

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.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...