在 State-Space 块中使用连续变量 OpenModelica

Use continuous variables in State-Space block OpenModelica

我在 OpenModelica 中创建了一个模型,该模型 assemble 使用插值 table 状态 space 矩阵。使用接受一个输入和 39 个输出(13 个特征值、13 个系统输入和 13 个系统输出)的 table 创建矩阵。我可以 assemble 矩阵就好了,但是当将它们分配给状态 Space 块时,我收到以下错误:

[ZapuniInterpolation: 53:52-53:57]: Component A of variability parameter has binding 'ssA' of higher variability continuous.

模型由以下代码给出:

block ZapuniInterpolation
// ----------------------------------------------------------------------------- //
  Modelica.Blocks.Tables.CombiTable1Ds modelDef(table = [180.0, 0.0, 0.125639618, 0.122496368, 0.152595123, 1.30134654, 7.03518772, 10.1638193, 11.777113, 12.5243101, 21.683424, 27.5360508, 34.4655838, 34.1353836, -0.000156808334, 0.000567958435, -6.16513252e-06, 5.07716331e-05, 0.000295116516, -0.00226303029, 1.72715359e-05, -2.76345825e-05, -0.000384722595, -1.60172176e-05, 2.38217144e-05, 8.43528748e-06, 2.26263523e-05, -0.0392020416, -0.0412239838, 0.000444312775, -0.00735736036, 0.083243988, 0.00416324186, 0.00528137589, -0.012360487, 1.24845228e-05, -0.196934738, 6.53376694e-05, -7.1772345e-07, -0.047993618; 182.5, 0.0, 0.12338031, 0.121614441, 0.152516403, 1.28446889, 7.03372765, 10.160368, 11.7592869, 12.5243101, 24.4601326, 27.5334625, 34.4655838, 32.8034935, -0.000155028641, 0.000569061768, -1.06752777e-05, 4.43576736e-05, 0.000292540131, -0.00226327395, 1.87270737e-05, -2.94425335e-05, -0.000384721771, -1.95333481e-05, 2.38186722e-05, 8.43502998e-06, 2.18605156e-05, -0.038757122, -0.0399122047, 0.000745555359, -0.00661621618, 0.080380722, 0.00384176278, 0.00474613094, -0.010696907, 1.03946018e-05, -0.187355469, 0.000304825897, -3.04758026e-07, -0.0856405334; 185.0, 0.0, 0.121165268, 0.120708992, 0.152441833, 1.26705885, 7.03220701, 10.1565781, 11.7394562, 12.5243101, 26.2911625, 27.5308762, 34.4655838, 33.3992195, -0.000153284882, 0.000568685425, -4.0209774e-05, 3.89236832e-05, 0.000290123566, -0.00226349735, 2.0346014e-05, -3.14919395e-05, -0.000384720856, -2.75364189e-05, 2.39696522e-05, 8.43503952e-06, 1.46955872e-05, -0.0383211823, -0.0385091896, 0.00271969485, -0.00597921848, 0.0775424423, 0.00357709074, 0.00436138248, -0.00955755329, 8.97015572e-06, -0.137678406, 0.000970456665, -8.64766174e-07, -0.156308731; 187.5, 0.0, 0.118988342, 0.119786552, 0.152369507, 1.24918771, 7.0306282, 10.1524391, 11.7177658, 12.5243092, 26.049839, 27.5282478, 34.4655838, 37.3313332, -0.000151576111, 0.000570432922, 2.22414017e-05, 3.42602654e-05, 0.000287870667, -0.00226369929, 2.21327553e-05, -3.37703247e-05, -0.000384719849, -3.28333435e-05, 2.40614624e-05, 8.43494415e-06, 6.49287128e-06, -0.0378939934, -0.0372608452, -0.00145591199, -0.00542455482, 0.074719574, 0.00335672474, 0.00408232164, -0.00875357533, 7.95372009e-06, -0.080245285, 0.000683899231, 4.3715094e-07, -0.196699677; 190.0, 0.0, 0.116858894, 0.118837822, 0.152297958, 1.23091626, 7.02899122, 10.1479139, 11.6941319, 12.5243092, 24.9532948, 27.5255089, 34.4655838, 43.7087631, -0.000149901413, 0.000571410095, 8.67566872e-06, 3.02129364e-05, 0.000285783508, -0.00226387715, 2.41047344e-05, -3.62895241e-05, -0.000384718781, -3.62359619e-05, 2.40104408e-05, 8.43495083e-06, 3.14631987e-06, -0.0374753189, -0.0359707489, -0.000549157532, -0.0049361062, 0.0719031982, 0.00317143512, 0.00388165021, -0.00817939949, 7.20596743e-06, -0.0537428932, 0.000341564392, 1.62058945e-07, -0.2088992; 195.0, 0.0, 0.112727142, 0.116876053, 0.152152176, 1.19337523, 7.02551937, 10.1374197, 11.639926, 12.5243092, 22.4547005, 27.5198441, 34.4655838, 63.5006485, -0.000146650772, 0.000572308289, 3.85471559e-06, 2.35291004e-05, 0.000282106537, -0.00226414824, 2.87340622e-05, -4.21810608e-05, -0.00038471637, -4.2829483e-05, 2.39550076e-05, 8.43493652e-06, 1.15650666e-06, -0.0366626587, -0.0333576317, -0.00022747081, -0.0041120615, 0.0662582474, 0.0028797617, 0.00365292263, -0.00749141979, 6.22078133e-06, -0.0335395622, 0.00014459668, 7.19030685e-08, -0.2181745; 200.0, 0.0, 0.10876281, 0.114828865, 0.151995438, 1.15478432, 7.02172279, 10.1242056, 11.5731678, 12.5243082, 20.1688595, 27.5138836, 34.4655838, 97.7778931, -0.000143526184, 0.000572750549, 2.4388926e-06, 1.82274666e-05, 0.000279082581, -0.00226427436, 3.46423569e-05, -4.95841827e-05, -0.000384713623, -5.03695107e-05, 2.39311123e-05, 8.4349184e-06, 1.23468935e-06, -0.0358815079, -0.030764555, -0.000133495087, -0.00343931985, 0.0605537033, 0.00266271996, 0.00360132694, -0.00721686459, 5.66029549e-06, -0.0255758495, 8.98340149e-05, 4.8260746e-08, -0.220523834]) annotation(
    Placement(visible = true, transformation(origin = { 0, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
// ----------------------------------------------------------------------------- //
  Real [13] omega2={modelDef.y[1], modelDef.y[2], modelDef.y[3], modelDef.y[4], modelDef.y[5], modelDef.y[6], modelDef.y[7], modelDef.y[8], modelDef.y[9], modelDef.y[10], modelDef.y[11], modelDef.y[12], modelDef.y[13]}; 
// ------
  Real [13] Ba={modelDef.y[14], modelDef.y[15], modelDef.y[16], modelDef.y[17], modelDef.y[18], modelDef.y[19], modelDef.y[20], modelDef.y[21], modelDef.y[22], modelDef.y[23], modelDef.y[24], modelDef.y[25], modelDef.y[26]}; 
// ------
  Real [13] Ca={modelDef.y[27], modelDef.y[28], modelDef.y[29], modelDef.y[30], modelDef.y[31], modelDef.y[32], modelDef.y[33], modelDef.y[34], modelDef.y[35], modelDef.y[36], modelDef.y[37], modelDef.y[38], modelDef.y[39]}; 
// ------
  Real [13] damping={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
// ----------------------------------------------------------------------------- //
  Real [26, 26] ssA = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; 
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; 
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; 
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0; 
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0; 
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0; 
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0; 
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0; 
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0; 
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0; 
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0; 
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0; 
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1; 
     - omega2[1], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[1], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; 
     0, - omega2[2], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[2], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; 
     0, 0, - omega2[3], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[3], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; 
     0, 0, 0, - omega2[4], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[4], 0, 0, 0, 0, 0, 0, 0, 0, 0; 
     0, 0, 0, 0, - omega2[5], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[5], 0, 0, 0, 0, 0, 0, 0, 0; 
     0, 0, 0, 0, 0, - omega2[6], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[6], 0, 0, 0, 0, 0, 0, 0; 
     0, 0, 0, 0, 0, 0, - omega2[7], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[7], 0, 0, 0, 0, 0, 0; 
     0, 0, 0, 0, 0, 0, 0, - omega2[8], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[8], 0, 0, 0, 0, 0; 
     0, 0, 0, 0, 0, 0, 0, 0, - omega2[9], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[9], 0, 0, 0, 0; 
     0, 0, 0, 0, 0, 0, 0, 0, 0, - omega2[10], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[10], 0, 0, 0; 
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - omega2[11], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[11], 0, 0; 
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - omega2[12], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[12], 0; 
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - omega2[13], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[13] ];
// ------
  Real [26, 1] ssB = [0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; Ba[1]; Ba[2]; Ba[3]; Ba[4]; Ba[5]; Ba[6]; Ba[7]; Ba[8]; Ba[9]; Ba[10]; Ba[11]; Ba[12]; Ba[13]]; 
// ------
  Real [3, 26] ssC = [Ca[1], Ca[2], Ca[3], Ca[4], Ca[5], Ca[6], Ca[7], Ca[8], Ca[9], Ca[10], Ca[11], Ca[12], Ca[13], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; 
     Ba[1], Ba[2], Ba[3], Ba[4], Ba[5], Ba[6], Ba[7], Ba[8], Ba[9], Ba[10], Ba[11], Ba[12], Ba[13], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; 
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Ba[1], Ba[2], Ba[3], Ba[4], Ba[5], Ba[6], Ba[7], Ba[8], Ba[9], Ba[10], Ba[11], Ba[12], Ba[13] ];
// ------
  Real [3, 1] ssD = [0; 
     0; 
     0];
// ----------------------------------------------------------------------------- //
    Modelica.Blocks.Interfaces.RealInput tableInput annotation(
    Placement(visible = true, transformation(origin = {-60, 40}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-60, 40}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
  Modelica.Blocks.Continuous.StateSpace stateSpace(A=ssA, B=ssB, C=ssC, D=ssD, initType = Modelica.Blocks.Types.Init.NoInit) annotation(
    Placement(visible = true, transformation(origin = {0, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Interfaces.RealOutput out1 annotation(
    Placement(visible = true, transformation(origin = {50, 20}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {50, 20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Interfaces.RealOutput out2 annotation(
    Placement(visible = true, transformation(origin = {50, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {50, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Interfaces.RealOutput out3 annotation(
    Placement(visible = true, transformation(origin = {50, -20}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {50, -20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Interfaces.RealInput ssInput annotation(
    Placement(visible = true, transformation(origin = {-60, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-60, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
equation
// ----------------------------------------------------------------------------- //
  connect(modelDef.u, tableInput) annotation(
    Line(points = {{-12, 40}, {-60, 40}}, color = {0, 0, 127}));
  connect(stateSpace.y[1], out1) annotation(
    Line(points = {{12, 0}, {20, 0}, {20, 20}, {50, 20}, {50, 20}}, color = {0, 0, 127}));
  connect(stateSpace.y[2], out2) annotation(
    Line(points = {{12, 0}, {42, 0}, {42, 0}, {50, 0}}, color = {0, 0, 127}));
  connect(stateSpace.y[3], out3) annotation(
    Line(points = {{12, 0}, {20, 0}, {20, -20}, {50, -20}, {50, -20}}, color = {0, 0, 127}));
  connect(stateSpace.u[1], ssInput) annotation(
    Line(points = {{-12, 0}, {-60, 0}}, color = {0, 0, 127}));
// ----------------------------------------------------------------------------- //
annotation(
    uses(Modelica(version = "3.2.3")));
end ZapuniInterpolation;

现在我显然可以将所有 Real 声明更改为 parameter Real,这解决了 State-Space 块。但是,我无法根据插值 table 定义数组 omega2、Ba、Ca:然后会发生以下错误

[ZapuniInterpolationTest: 6:3-6:229]: Component omega2 of variability parameter has binding '{modelDef.y[1], modelDef.y[2], modelDef.y[3], modelDef.y[4], modelDef.y[5], modelDef.y[6], modelDef.y[7], modelDef.y[8], modelDef.y[9], modelDef.y[10], modelDef.y[11], modelDef.y[12], modelDef.y[13]}' of higher variability continuous.

所以我的问题是,如何使用插值 table 定义矩阵并在 State-Space 块中使用它们?

如果我对您的示例的理解正确,您希望通过 table 使用输入来计算系统矩阵的系数以进行插值。这将导致 ssA 成为变量。

根本问题是 Modelica.Blocks.Continuous.StateSpace 的参数与变量相比具有较低的可变性。参数在模拟过程中是恒定的,而变量会随时间变化。在 Modelica 中,不可能将一个表达式分配给另一个具有较低可变性的表达式。有关这方面的更多信息,请参阅 Modelica Language Specification,第 3.8 节。

有两种解决方法

  1. 仅根据参数和常量计算状态-space 块的参数(其结果将随时间变化)。
  2. 重新实现state-space块,不限制ABCD为参数。我认为从技术上讲它不再是一个状态-space,但那是吹毛求疵...

选项1.似乎对你没有帮助,所以我会跳过它。

选项 2. 应该可以通过直接在模型中添加状态-space 方程来实现。这应该是

  der(x) = ssA*x + ssB*{ssInput};
  y = ssC*x + ssD*{ssInput};
  out1 = y[1];
  out2 = y[2];
  out3 = y[3];

适合你的情况。此外,您还需要使用

定义 xy
Real x[size(ssA,1)] "states";   
Real y[size(ssC,1)] "outputs";

并删除 state-space 块(及其连接)的原始定义。

这应该导致整体代码:

block ZapuniInterpolation
// ----------------------------------------------------------------------------- //
  Modelica.Blocks.Tables.CombiTable1Ds modelDef(table = [180.0, 0.0, 0.125639618, 0.122496368, 0.152595123, 1.30134654, 7.03518772, 10.1638193, 11.777113, 12.5243101, 21.683424, 27.5360508, 34.4655838, 34.1353836, -0.000156808334, 0.000567958435, -6.16513252e-06, 5.07716331e-05, 0.000295116516, -0.00226303029, 1.72715359e-05, -2.76345825e-05, -0.000384722595, -1.60172176e-05, 2.38217144e-05, 8.43528748e-06, 2.26263523e-05, -0.0392020416, -0.0412239838, 0.000444312775, -0.00735736036, 0.083243988, 0.00416324186, 0.00528137589, -0.012360487, 1.24845228e-05, -0.196934738, 6.53376694e-05, -7.1772345e-07, -0.047993618; 182.5, 0.0, 0.12338031, 0.121614441, 0.152516403, 1.28446889, 7.03372765, 10.160368, 11.7592869, 12.5243101, 24.4601326, 27.5334625, 34.4655838, 32.8034935, -0.000155028641, 0.000569061768, -1.06752777e-05, 4.43576736e-05, 0.000292540131, -0.00226327395, 1.87270737e-05, -2.94425335e-05, -0.000384721771, -1.95333481e-05, 2.38186722e-05, 8.43502998e-06, 2.18605156e-05, -0.038757122, -0.0399122047, 0.000745555359, -0.00661621618, 0.080380722, 0.00384176278, 0.00474613094, -0.010696907, 1.03946018e-05, -0.187355469, 0.000304825897, -3.04758026e-07, -0.0856405334; 185.0, 0.0, 0.121165268, 0.120708992, 0.152441833, 1.26705885, 7.03220701, 10.1565781, 11.7394562, 12.5243101, 26.2911625, 27.5308762, 34.4655838, 33.3992195, -0.000153284882, 0.000568685425, -4.0209774e-05, 3.89236832e-05, 0.000290123566, -0.00226349735, 2.0346014e-05, -3.14919395e-05, -0.000384720856, -2.75364189e-05, 2.39696522e-05, 8.43503952e-06, 1.46955872e-05, -0.0383211823, -0.0385091896, 0.00271969485, -0.00597921848, 0.0775424423, 0.00357709074, 0.00436138248, -0.00955755329, 8.97015572e-06, -0.137678406, 0.000970456665, -8.64766174e-07, -0.156308731; 187.5, 0.0, 0.118988342, 0.119786552, 0.152369507, 1.24918771, 7.0306282, 10.1524391, 11.7177658, 12.5243092, 26.049839, 27.5282478, 34.4655838, 37.3313332, -0.000151576111, 0.000570432922, 2.22414017e-05, 3.42602654e-05, 0.000287870667, -0.00226369929, 2.21327553e-05, -3.37703247e-05, -0.000384719849, -3.28333435e-05, 2.40614624e-05, 8.43494415e-06, 6.49287128e-06, -0.0378939934, -0.0372608452, -0.00145591199, -0.00542455482, 0.074719574, 0.00335672474, 0.00408232164, -0.00875357533, 7.95372009e-06, -0.080245285, 0.000683899231, 4.3715094e-07, -0.196699677; 190.0, 0.0, 0.116858894, 0.118837822, 0.152297958, 1.23091626, 7.02899122, 10.1479139, 11.6941319, 12.5243092, 24.9532948, 27.5255089, 34.4655838, 43.7087631, -0.000149901413, 0.000571410095, 8.67566872e-06, 3.02129364e-05, 0.000285783508, -0.00226387715, 2.41047344e-05, -3.62895241e-05, -0.000384718781, -3.62359619e-05, 2.40104408e-05, 8.43495083e-06, 3.14631987e-06, -0.0374753189, -0.0359707489, -0.000549157532, -0.0049361062, 0.0719031982, 0.00317143512, 0.00388165021, -0.00817939949, 7.20596743e-06, -0.0537428932, 0.000341564392, 1.62058945e-07, -0.2088992; 195.0, 0.0, 0.112727142, 0.116876053, 0.152152176, 1.19337523, 7.02551937, 10.1374197, 11.639926, 12.5243092, 22.4547005, 27.5198441, 34.4655838, 63.5006485, -0.000146650772, 0.000572308289, 3.85471559e-06, 2.35291004e-05, 0.000282106537, -0.00226414824, 2.87340622e-05, -4.21810608e-05, -0.00038471637, -4.2829483e-05, 2.39550076e-05, 8.43493652e-06, 1.15650666e-06,
  -0.0366626587, -0.0333576317, -0.00022747081, -0.0041120615, 0.0662582474, 0.0028797617, 0.00365292263, -0.00749141979, 6.22078133e-06, -0.0335395622, 0.00014459668, 7.19030685e-08, -0.2181745; 200.0, 0.0, 0.10876281, 0.114828865, 0.151995438, 1.15478432, 7.02172279, 10.1242056, 11.5731678, 12.5243082, 20.1688595, 27.5138836, 34.4655838, 97.7778931, -0.000143526184, 0.000572750549, 2.4388926e-06, 1.82274666e-05, 0.000279082581, -0.00226427436, 3.46423569e-05, -4.95841827e-05, -0.000384713623, -5.03695107e-05, 2.39311123e-05, 8.4349184e-06, 1.23468935e-06, -0.0358815079, -0.030764555, -0.000133495087, -0.00343931985, 0.0605537033, 0.00266271996, 0.00360132694, -0.00721686459, 5.66029549e-06, -0.0255758495, 8.98340149e-05, 4.8260746e-08, -0.220523834]) annotation (
    Placement(visible = true, transformation(origin = { 0, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
// ----------------------------------------------------------------------------- //
  Real [13] omega2={modelDef.y[1], modelDef.y[2], modelDef.y[3], modelDef.y[4], modelDef.y[5], modelDef.y[6], modelDef.y[7], modelDef.y[8], modelDef.y[9], modelDef.y[10], modelDef.y[11], modelDef.y[12], modelDef.y[13]};
// ------
  Real [13] Ba={modelDef.y[14], modelDef.y[15], modelDef.y[16], modelDef.y[17], modelDef.y[18], modelDef.y[19], modelDef.y[20], modelDef.y[21], modelDef.y[22], modelDef.y[23], modelDef.y[24], modelDef.y[25], modelDef.y[26]};
// ------
  Real [13] Ca={modelDef.y[27], modelDef.y[28], modelDef.y[29], modelDef.y[30], modelDef.y[31], modelDef.y[32], modelDef.y[33], modelDef.y[34], modelDef.y[35], modelDef.y[36], modelDef.y[37], modelDef.y[38], modelDef.y[39]};
// ------
  Real [13] damping={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
// ----------------------------------------------------------------------------- //
  Real [26, 26] ssA = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0;
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0;
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0;
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0;
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0;
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0;
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0;
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0;
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0;
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1;
     - omega2[1], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[1], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
     0, - omega2[2], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[2], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
     0, 0, - omega2[3], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[3], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
     0, 0, 0, - omega2[4], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[4], 0, 0, 0, 0, 0, 0, 0, 0, 0;
     0, 0, 0, 0, - omega2[5], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[5], 0, 0, 0, 0, 0, 0, 0, 0;
     0, 0, 0, 0, 0, - omega2[6], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[6], 0, 0, 0, 0, 0, 0, 0;
     0, 0, 0, 0, 0, 0, - omega2[7], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[7], 0, 0, 0, 0, 0, 0;
     0, 0, 0, 0, 0, 0, 0, - omega2[8], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[8], 0, 0, 0, 0, 0;
     0, 0, 0, 0, 0, 0, 0, 0, - omega2[9], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[9], 0, 0, 0, 0;
     0, 0, 0, 0, 0, 0, 0, 0, 0, - omega2[10], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[10], 0, 0, 0;
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - omega2[11], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[11], 0, 0;
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - omega2[12], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[12], 0;
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - omega2[13], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, damping[13]];
// ------
  Real [26, 1] ssB = [0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; Ba[1]; Ba[2]; Ba[3]; Ba[4]; Ba[5]; Ba[6]; Ba[7]; Ba[8]; Ba[9]; Ba[10]; Ba[11]; Ba[12]; Ba[13]];
// ------
  Real [3, 26] ssC = [Ca[1], Ca[2], Ca[3], Ca[4], Ca[5], Ca[6], Ca[7], Ca[8], Ca[9], Ca[10], Ca[11], Ca[12], Ca[13], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
     Ba[1], Ba[2], Ba[3], Ba[4], Ba[5], Ba[6], Ba[7], Ba[8], Ba[9], Ba[10], Ba[11], Ba[12], Ba[13], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Ba[1], Ba[2], Ba[3], Ba[4], Ba[5], Ba[6], Ba[7], Ba[8], Ba[9], Ba[10], Ba[11], Ba[12], Ba[13]];
// ------
  Real [3, 1] ssD = [0; 0; 0];
// ----------------------------------------------------------------------------- //
    Modelica.Blocks.Interfaces.RealInput tableInput annotation (
    Placement(visible = true, transformation(origin = {-60, 40}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-60, 40}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
  Modelica.Blocks.Interfaces.RealOutput out1 annotation (
    Placement(visible = true, transformation(origin = {50, 20}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {50, 20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Interfaces.RealOutput out2 annotation (
    Placement(visible = true, transformation(origin = {50, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {50, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Interfaces.RealOutput out3 annotation (
    Placement(visible = true, transformation(origin = {50, -20}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {50, -20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Interfaces.RealInput ssInput annotation (
    Placement(visible = true, transformation(origin = {-60, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-60, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));

  Real x[size(ssA,1)] "states";
  Real y[size(ssC,1)] "outputs";

equation 
  der(x) = ssA*x + ssB*{ssInput};
  y = ssC*x + ssD*{ssInput};
  out1 = y[1];
  out2 = y[2];
  out3 = y[3];

// ----------------------------------------------------------------------------- //
  connect(modelDef.u, tableInput) annotation (
    Line(points = {{-12, 40}, {-60, 40}}, color = {0, 0, 127}));
// ----------------------------------------------------------------------------- //
annotation (
    uses(Modelica(version = "3.2.3")));
end ZapuniInterpolation;

不确定是否一切都按预期工作,因为输入为零(而且我不了解实际模型)。但它至少应该能让你继续。

与 MSL 的 state-space 块相比,一个限制是,没有可能的初始条件。

除了马库斯的两个解决方案还有第三个解决方案:

omega2BaCa 声明为带有修饰符 fixed=false 的参数,并在 initial equation 部分中为它们赋值。

此致

雷内·贾斯特·尼尔森