Message Boards Message Boards

0
|
4464 Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Extract information from transfer function matrix using parameter names?

Posted 6 years ago

Dear all,

As shown in the picture below I have a transfer function matrix with one input (DisplacementGround) and two outputs (DisplacementMass and VelocityMass). I can access either one of the two elements of the matrix using SystemModelExtract and referring to the elements as {1}, {1} and {1},{2}.

However, it would be very useful to be able to extract the individual transfer functions using the actual names of the input and output quantities (e.g. DisplscementGround in this example). These names come from a Modelica model imported into Mathematica.

Is there a way to achieve it?

Thank you very much in advance.

Fabian

Description

POSTED BY: Fabián Peña
4 Replies
Posted 6 years ago

Dear Neil,

Thank you very much indeed for your explanation.

After seeing the FullForm of the transfer function I understood what you did.

Regards,

Fabian

POSTED BY: Fabián Peña

Fabian,

To understand what I did, it is best to look at the FullForm of a TransferFunctionModel:

It has the Form of TransferFunctionModel[{...},s, SystemsModelLabels->{{inputs..., outputs...}}]

So I used pattern matching to extract the argument to SystemModelLabels-> xxx_. I had to use Rule[] because I am pattern matching the argument to a rule.

Regards,

Neil

POSTED BY: Neil Singer
Posted 6 years ago

Dear Neil,

Thank you very much for your answer. It does work very well. I still have a question.

I don't understand how the values of SystemsModelLabels become accessible through the command Rule[SystemsModelLabels, lst_], which seems to be a replacement rule. Is this a way to go around a ReadProtected attribute?

Would you mind explaining, please?

Thank you in advance again.

Fabian

POSTED BY: Fabián Peña

Fabian,

I do not know of a way to do this with the built in commands, However, you can easily write your own.

You can get the labels with this command:

labels = Cases[model , Rule[SystemsModelLabels, lst_] -> lst][[1]]

From this you can create your own mySystemsModelExtract that finds the labels in the list of labels above (by Position) and feeds that to the SystemsModelExtract function. You need to decide on a syntax for your command but it should work well.

Regards,

Neil

POSTED BY: Neil Singer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract