openmodelicainterest  

Array manipulation

Filippo
Wed, 25 Nov 2009 04:12:19 -0800

This is what I wolud do with open Modelica: A simple state space model of a 
simple flexible beam driven by a base motion.

model StateSpaceFlexMG "Flexible body driven with base motion"
////
  import Modelica.Constants;
  constant Real PI = Modelica.Constants.pi;
////
  parameter Integer modes = 5;
  parameter Real PF[modes,1] = {{10.3}, {-5.7}, {20.3}, {1.1}, {0.2}};
  parameter Real freq[modes,1] = {{5.5}, {12.1}, {14}, {25}, {73.6}};
////
  parameter Real om[modes,1] = 2*PI*freq;
  parameter Real omq[modes,1] = om^2;
  parameter Real OMq[modes,modes] = diagonal(omq);
////
  parameter Real fiinp[1,modes] = transpose(PF);
  parameter Integer fiout[modes,modes] = identity(modes);
  parameter Real fi[modes+1,modes] = [fiout;fiinp];
////
  Real a, b, c;
////
equation
////
  a = omq[1,1];
  b = omq[2,1];
  c = omq[3,1];
////
end StateSpaceFlexMG;

But this model don't run !

In particular there is an evident problem in the square operation:
  parameter Real omq[modes,1] = om^2;
in the use of the "diagonal" and "identity" functions:
  parameter Real OMq[modes,modes] = diagonal(omq);
  parameter Integer fiout[modes,modes] = identity(modes);


Could have an help ??