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?

 

Thanks,

Minoru Yubuchi

2019-02-22_13-24-44.jpg

Samples_Modelica.scm

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

Share this post


Link to post
Share on other sites

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×