Jump to content
Minoru Yubuchi

Switching Modelica Blocks

Recommended Posts

Dear Experts,

 

I would like to know how to switch two Modelica blocks based on a situation of the simulation.

 

For example, please assume two SpringDamper blocks, A and B are contained in an Actibvate model which are applied at the same location. SpringDamper block (A or B)used in the simulation is decided based on situation of simulation and might be changed during the simulation.

 

I created a model (attached) where MoCustomComponent based on Spring is used. In the model, spring constant of the Spring block can be switched during simulation but Spring block cannot be switched in this way?

 

Are there any ways to switch Modelica blocks?

 

Regards,

Minoru Yubuchi

Model5.scm

Share this post


Link to post
Share on other sites

Dear Yubuchi-san,

 

as far as I understood, it is not possible to switch between two different Modelica components during a running simulation, because that would require a new compilation to create a new set of equations (before the simulation you could use the include diagram block, but that is not your question, right?).

 

One option (maybe, not the smartest implementation;) could be to use both Modelica components in parallel and switch between their outputs depending on a specific condition.

I attached a very simple example for that.

 

Does that help?

 

Best regards

Christian

SwitchSignals.scm

Share this post


Link to post
Share on other sites

Hi Christian,

 

I fully agree to your explanations.

 

An additional question: You mentioned the include diagram block (a very interesting and powerful element!). Can I use it with Modelica ports or is it limited to Activate signals? Many of my models have super models with Modelica content and Modelica ports, It would be very helpful if I could exchange a super models by another one by changing a configuration parameter.

 

Thanks,
Ronald

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.

Guest
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...