Filippo Cianetti
Wed, 25 Nov 2009 06:37:19 -0800
Dear Martin thanks a lot for the highlighting help ! Filippo _________________________________________________________________ Filippo Cianetti Associate Professor Department of Industrial Engineering University of Perugia Via G. Duranti 1/A-4 - 06125 Perugia (Italy) Tel. +39 75 585 3728 Fax +39 75 585 3703 E-mail: cia...@unipg.it Internet address: http://www.caedii.unipg.it _________________________________________________________________----- Original Message ----- From: "Martin Sjölund" <mar...@sjoelund.se>
To: <openmodelicainterest@ida.liu.se> Sent: Wednesday, November 25, 2009 1:45 PM Subject: Re: Array manipulation
Hi Filippo,I'm currently working on a solution to make the identity function work for parameter inputs. Before this is working, try making modes into a constant.As far as I can tell, the power operator only works for square matrices. Also, I had to transpose the matrix before using the diagonal operation. parameter Real OMq[modes,modes] = diagonal(transpose(omq)[1]); -- Martin Sjölund Filippo wrote: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 ??__________ Informazioni da ESET NOD32 Antivirus, versione del database delle firme digitali 4635 (20091125) __________Il messaggio è stato controllato da ESET NOD32 Antivirus. www.nod32.it