Richardsim
New Member
Offline
Posts: 7
|
Can anyone help me with a matrix vector multiplication in Verilog-ams, where the matrices and vectors contain a combination of kinematic and translational signals?
An example:
A static 3 degrees-of-freedom beam without the use of vectors and matrices:
//Verilog-AMS HDL for "Libaryname", "Beam3dof" "verilogams"
`include "constants.vams" `include "disciplines.vams"
module Beam3dof (tx1, tx2, ty1, ty2, tphi1, tphi2); inout tx1, tx2, ty1, ty2, tphi1, tphi2; kinematic tx1, tx2, ty1, ty2,gnd; rotational tphi1, tphi2, rotgnd;
ground gnd, rotgnd;
// mechanical properties parameter real k1=1; parameter real k2=1; parameter real k3=1; parameter real k4= 1; parameter real k5= 1; parameter real k6= 1; // N/m real x1, x2, y1, y2, phi1, phi2;
analog begin x1 = Pos(tx1); x2 = Pos(tx2); y1 = Pos(ty1); y2 = Pos(ty2); phi1 = Theta(tphi1); phi2 = Theta(tphi2); F(tx1,gnd) <+ k1*cd_x1 - k1*x2; F(tx2,gnd) <+ -k1*x1 + k1*x2; F(ty1,gnd) <+ k2*y1 + k3*phi1 - k2*y2 + k3*phi2; F(ty2,gnd) <+ -k2*y1 - k3*phi1 + k2*y2 - k3*phi2; Tau(tphi1,rotgnd) <+ k4*y1 + k5*phi1 - k4*y2 + k6*phi2; Tau(tphi2,rotgnd) <+ k4*y1 + k6*phi1 - k4*y2 + k5*phi2; end
endmodule
To use vectors I guess something like this is required:
inout [0:5] dispvector kinematic ...... inout[0], inout[1], inout[3], inout[4] rotational ...... inout[2], inout[5]
so effectively this would be obtained:
dispvector = [x1 y1 phi1 x2 y2 phi2] forcevector = [fx1 fy1 Tau1 fx2 fy2 Tau2]
Declaring:
k11=k1 k14=-k1 k22=k2 k23=k3 k25=-k2 k12=k13=k21=k24=0 ... ...
would give the coefficients of the k (stiffness) matrix. Then the matrix vector multiplication would be required.
Any suggestions are welcome.
|