Message Boards Message Boards

Get a model from a transfer function that is obtained from statespacemodel?

Posted 4 years ago

I'm trying to get Modelica SystemModel from a TransferFuntionModel as follow:

  1. I create a StateSpaceModel from a set of equations
  2. I get the transfer function by using TransferFunctionModel on the StateSpaceModel
  3. Everytime I plug the transfer function into CreateSystemModel, I always get Part::partd message

I don't know where I was wrong. Any help is appreciated.

POSTED BY: Gifari Hasyim
2 Replies

Hi Gifari, Indeed, we have fixed this issue in 12.1. In our latest build, we produce something like the following model:

block W19313de0af6f4e04bfa142762ca7b635
  extends Modelica.Blocks.Icons.Block;

  block TransferFunctionWithAssert
    extends Modelica.Blocks.Continuous.TransferFunction;
  equation
    assert(a[1] <> 0, "Highest order coeffient of transfer function denominator must not be 0.");
  end TransferFunctionWithAssert;

  parameter Real C0;
  parameter Real D0;
  parameter Real ED;
  parameter Real g;
  parameter Real I0;
  parameter Real L0;
  parameter Real r;
  parameter Real R0;
  parameter Real V0;
  final constant Integer nin = 2 annotation(Dialog(group = "Dimensions"));
  final constant Integer nout = 2 annotation(Dialog(group = "Dimensions"));
  Modelica.Blocks.Interfaces.RealInput u[nin] annotation(Placement(transformation(extent = {{-140, -20}, {-100, 20}})));
  Modelica.Blocks.Interfaces.RealOutput y[nout] annotation(Placement(transformation(extent = {{100, -10}, {120, 10}})));
  TransferFunctionWithAssert tf11(b = {C0 * ED * R0 + (-1) * C0 * R0 * V0, ED + ED * g * R0 + I0 * R0 + (-1) * D0 * I0 * R0 + (-1) * V0 + (-1) * g * R0 * V0}, a = {C0 * L0 * R0, L0 + g * L0 * R0 + C0 * r * R0, r + R0 + (-2) * D0 * R0 + D0 ^ 2 * R0 + g * r * R0});
  TransferFunctionWithAssert tf12(b = {C0 * D0 * R0, D0 + D0 * g * R0}, a = {C0 * L0 * R0, L0 + g * L0 * R0 + C0 * r * R0, r + R0 + (-2) * D0 * R0 + D0 ^ 2 * R0 + g * r * R0});
  TransferFunctionWithAssert tf21(b = {I0 * L0 * R0, (-1) * ED * R0 + D0 * ED * R0 + I0 * r * R0 + R0 * V0 + (-1) * D0 * R0 * V0}, a = {C0 * L0 * R0, L0 + g * L0 * R0 + C0 * r * R0, r + R0 + (-2) * D0 * R0 + D0 ^ 2 * R0 + g * r * R0});
  TransferFunctionWithAssert tf22(b = {((-1) * D0 + D0 ^ 2) * R0}, a = {C0 * L0 * R0, L0 + g * L0 * R0 + C0 * r * R0, r + R0 + (-2) * D0 * R0 + D0 ^ 2 * R0 + g * r * R0});
equation
  {tf11.u, tf12.u} = u;
  {tf21.u, tf22.u} = u;
  y = {tf11.y + tf12.y, tf21.y + tf22.y};
  annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-80, 0}, {80, 0}}, color = {64, 64, 64}), Text(textColor = {64, 64, 64}, extent = {{-90, 25}, {90, 75}}, textString = "b(s)"), Text(textColor = {64, 64, 64}, extent = {{-90, -75}, {90, -25}}, textString = "a(s)")}), Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{40, 0}, {-40, 0}}, color = {64, 64, 64}), Text(textColor = {64, 64, 64}, extent = {{-55, 5}, {55, 55}}, textString = "b(s)"), Text(textColor = {64, 64, 64}, extent = {{-55, -55}, {55, -5}}, textString = "a(s)"), Rectangle(lineColor = {0, 36, 164}, extent = {{-60, -60}, {60, 60}}), Line(points = {{-100, 0}, {-60, 0}}, color = {0, 36, 164}), Line(points = {{60, 0}, {100, 0}}, color = {0, 36, 164})}));
end W19313de0af6f4e04bfa142762ca7b635;

A general workaround for 12.0 may be possible if you decompose every component of your MIMO transfer function model into a SISO transfer function, which, at its core, is the output we are providing in 12.1.

Sergio

Edit: I am attaching a notebook tested in 12.0 that does a workaround with the functionality available.

Attachments:
POSTED BY: Sergio Vargas
Posted 4 years ago

Gifari,

I tried it on my computer and it works as you entered it. Try clearing your Kernel. If it still does not work, email support -- you likely have a version problem/mismatch between MMA and WSM.

I am using a prerelease version so I do not know what Version 12 does.

Regards

Neil

POSTED BY: Updating Name
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