- Index
- » Users
- » Salman
- » Profile
Posts
Posts
the link to bug tracker is not working
What is this tuple assignment error?
function SVDRLS
annotation(Diagram(coordinateSystem(extent={{-148.5,-105.0},{148.5,105.0}}, preserveAspectRatio=true, initialScale=0.1, grid={5,5})));
import Modelica.Math.Matrices;
input Real A[3,2];
output Real sigmasvd[3,2];
output Real Usvd[3,3];
output Real VTsvd[2,2];
algorithm
(sigmasvd,Usvd,VTsvd):=Matrices.singularValues(A);
end SVDRLS;
[<interactive>:10:1-10:50:writable] Error: Type mismatch in assignment in (sigmasvd,Usvd,VTsvd) := Modelica.Math.Matrices.singularValues({{A[1,1],A[1,2]},{A[2,1],A[2,2]},{A[3,1],A[3,2]}}) of (Real[3, 2], Real[3, 3], Real[2, 2]) := (Real[:], Real[:, :], Real[:, :])
[<interactive>:10:1-10:50:writable] Error: Tuple assignment only allowed when rhs is function call (in Modelica.Math.Matrices.singularValues({{A[1,1],A[1,2]},{A[2,1],A[2,2]},{A[3,1],A[3,2]}}))
i will ask wolfram guys but can you tell me what to ask in terms of compiler/building terms...how to ask the correct technical question
thanks
Thank you very much but problem persists
Hi,
i am trying to use the QR decomposition from the LAPACK library. Its ok syntax wise but when i try to build/compile it the following error(s) pop up. please help
THE CODE:
Modelica.Blocks.Interfaces.RealInput errorsample ;
Modelica.Blocks.Interfaces.RealInput errorsample2 ;
Modelica.Blocks.Interfaces.RealOutput pcon ;
import Modelica.Math.Matrices;
Real A[3,2]; Real b[3];
Real Q [3,2]; Real QT [2,3]; Real R [2,2];
Real gammalyp[2](start=1.0, start=1.0);
Integer i(start=0);
Real pcon1,pcon2,pcon3,pcon4;
Real errsamp0,errsamp1,errsamp2,errsamp3;
parameter Real gamma=10;
parameter Real stime=0.1;
algorithm
when sample(0, stime) then
i:=i + 1;
if noEvent(i >= 4) then
A:=[pcon1,1;pcon2,1;pcon3,1];
b:={errsamp1,errsamp2,errsamp3};
(Q,R):=Matrices.QR(A);
QT:=transpose(Q);
gammalyp:=Matrices.solve(R, QT*b);
Error: Error building simulator. Buildlog: command mingw-g++ not found.
Error: Error building simulator. Buildlog: command "C:\Program Files (x86)\Wolfram Research\SystemModeler 3.0.2\bin\../bin/Compile" not found.
g++ -m32 -mthreads -o sme_1395034709_6334.exe sme_1395034709_6334.cpp -I"." -I"C:\Program Files (x86)\Wolfram Research\SystemModeler 3.0.2\bin\../include/" -I"E:/Modelica/Paper 3" -L"." -L"C:\Program Files (x86)\Wolfram Research\SystemModeler 3.0.2\bin\../lib/" -L"E:/Modelica/Paper 3" -lLapack -lsim -lsuperlu_3.0 -lc_runtime -lmmcom -lf2c -lc_common -lexpat -lsundials_cvodes -lsundials_kinsol -lsundials_nvecserial -lwinmm -lwsock32
In file included from sme_1395034709_6334.cpp:12:
sme_1395034709_6334_functions.cpp: In function `int in_Modelica_Math_Matrices_LAPACK_dorgqr(type_description*, type_description*)':
sme_1395034709_6334_functions.cpp:128: error: expected initializer before '.' token
sme_1395034709_6334_functions.cpp:148: error: 'struct Modelica_Math_Matrices_LAPACK_dorgqr_rettype' has no member named 'targ1_size_10'
sme_1395034709_6334_functions.cpp:151: error: 'struct Modelica_Math_Matrices_LAPACK_dorgqr_rettype' has no member named 'targ1_size_10'
sme_1395034709_6334_functions.cpp: In function `Modelica_Math_Matrices_LAPACK_dorgqr_rettype _Modelica_Math_Matrices_LAPACK_dorgqr(real_array, real_array)':
sme_1395034709_6334_functions.cpp:175: error: expected initializer before '.' token
sme_1395034709_6334_functions.cpp:193: error: 'struct Modelica_Math_Matrices_LAPACK_dorgqr_rettype' has no member named 'targ1_size_12'
sme_1395034709_6334_functions.cpp:196: error: 'struct Modelica_Math_Matrices_LAPACK_dorgqr_rettype' has no member named 'targ1_size_12'
mingw32-make: *** [noclean] Error 1
error: No executable generated.C:/Users/Dell/AppData/Local/Temp/sme_1395034709_6334.exe
Hi!
I am a new user of modelica. I am trying to run a hybrid simulation of recursive least square (discrete) and a sine wave (continuous). In a nutshell, i sample the sine wave and try to do the least square estimation of the curve of sine wave (meaning fitting the curve with a line). just like moving average filter, i perform estimation using three sample values; forgetting(ignoring) previous ones and recieving the new ones.
so when i run the code i get the following error.
a->dim_size[0] != b->dim_size[0], 1 != 2
Assertion failed: base_array_shape_eq(source, dest), file real_array.c, line 177
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
my code is
block RLS
annotation(Icon(coordinateSystem(extent={{-100.0,-100.0},{100.0,100.0}}, preserveAspectRatio=true, initialScale=0.1, grid={10,10}), graphics={Rectangle(visible=true, fillColor={255,255,255}, extent={{-100.0,-100.0},{100.0,100.0}}),Text(visible=true, origin={-7.8354,3.7854}, fillPattern=FillPattern.Solid, extent={{-67.8354,-33.7854},{67.8354,33.7854}}, textString="RLS", fontName="Arial")}), Diagram(coordinateSystem(extent={{-148.5,-105.0},{148.5,105.0}}, preserveAspectRatio=true, initialScale=0.1, grid={5,5})));
Modelica.Blocks.Interfaces.RealInput errorsample annotation(Placement(visible=true, transformation(origin={-95.0,36.9418}, extent={{-20.0,-20.0},{20.0,20.0}}, rotation=0), iconTransformation(origin={-120.0,0.0}, extent={{-20.0,-20.0},{20.0,20.0}}, rotation=0)));
Modelica.Blocks.Interfaces.RealOutput predictedcontrol annotation(Placement(visible=true, transformation(origin={60.0,35.0}, extent={{-10.0,-10.0},{10.0,10.0}}, rotation=0), iconTransformation(origin={110.0,-0.0}, extent={{-10.0,-10.0},{10.0,10.0}}, rotation=0)));
import Modelica.Math.Matrices.*;
Real A[3,2];
Real b[3,1];
Real gammalyp[2,1];
Real ATA[2,2];
Real ATb[2,1];
Real errorsample0,errorsample1,errorsample2,errorsample3;
Real predictedcontrol1,predictedcontrol2,predictedcontrol3;
parameter Real gamma=1; parameter Real lyp=1;
Boolean fastsample; Integer i(start=0);
equation
fastsample=sample(0, .01);
algorithm
when fastsample then
i:=i + 1;
end when;
algorithm
if noEvent(i == 1) then
errorsample0:=errorsample;
predictedcontrol1:=errorsample0/gamma - sqrt(2*lyp)/gamma;
predictedcontrol:=predictedcontrol1;
elseif noEvent(i == 2) then
errorsample1:=errorsample;
predictedcontrol2:=errorsample1/gamma - sqrt(2*lyp)/gamma;
predictedcontrol:=predictedcontrol2;
elseif noEvent(i == 3) then
errorsample2:=errorsample;
predictedcontrol3:=errorsample2/gamma - sqrt(2*lyp)/gamma;
predictedcontrol:=predictedcontrol3;
else
errorsample3:=errorsample;
A:={{predictedcontrol1,1},{predictedcontrol2,1},{predictedcontrol3,1}};
b:={{errorsample1},{errorsample2},{errorsample3}};
ATA:=transpose(A)*A;
ATb:=transpose(A)*b;
gammalyp:=solve(ATA, ATb);
predictedcontrol:=errorsample3/gammalyp[1,1] - gammalyp[2,1]/gammalyp[1,1];
predictedcontrol1:=predictedcontrol2;
predictedcontrol2:=predictedcontrol3;
predictedcontrol3:=errorsample3/gammalyp[1,1] - gammalyp[2,1]/gammalyp[1,1];
errorsample1:=errorsample2;
errorsample2:=errorsample3;
end if;
end RLS;
anxiously waiting for a help
- Index
- » Users
- » Salman
- » Profile