Importing FMU in Dymola using importFMU function - modelica

I'm trying to Import FMU in Dymola using the following syntax:
importFMU(fileName="xyz", includeAllVariables=false, integrate=true, promptReplacement=true, packageName="abc");
It gives me this error:
Error: declaration window line 3 column 10, syntax error at "("
missing { identifier "[" }
What am I missing?

Related

run a matlab function from Julia

I am trying to use a custom matlab function in julia but I am getting an error.
I tried to do the following (https://github.com/JuliaInterop/MATLAB.jl)
mat"""
function [result] = run(x_pos, y_pos)
result = x_pos + y_pos;
end
"""
but I am getting this error:
Error: Function definition not supported in this context. Create functions in code file.
Unrecognized function or variable 'x_pos'.
end;
|
Error: Illegal use of reserved keyword "end".
How can I use a custom matlab function in julia?

Scala code returning error with avg an abs functions

While running code in Scala I'm getting the following errors with functions abs, and avg.
command-3092209798892765:2: error: not found: value abs
.filter(abs(t2("engine_size") - t1("engine_size")) <= BigDecimal("0.1"))
^
command-3092209798892765:4: error: not found: value avg
.agg(avg("sale_price").as("average_price")).collect()
^
The Scala code is
t1.join(t2, Seq("make", "model"))
.filter(abs(t2("engine_size") - t1("engine_size")) <= BigDecimal("0.1"))
.groupBy("registration")
.agg(avg("sale_price").as("average_price")).collect()
Can you let me know if I need to import functions? Or how to fix the errors
Use import org.apache.spark.sql.functions._ to use these functions.

How do I export result of visdiff of two models programmatically (Matlab versions <= R2016b)?

I am comparing two models using visdiff. I can see the results as a comparison tab. I see options on the GUI to export results in different format.
How do I export these results programmatically?
I am able to export it for non-model files.
But for model files it throws following error:
Subscript indices must either be real positive integers or logicals.
Error in linediff>tokenize (line 153)
cls = tok_class(double(s));
Error in linediff (line 18)
tok1 = tokenize(line1,ignore_whitespace);
Error in textdiff>i_CreateHTML/writeModifiedLine (line 158)
[newline1,newline2] = linediff(line1,line2,showchars,ignore_whitespace);
Error in textdiff>i_CreateHTML (line 464)
writeModifiedLine(line1,a1(n),line2,a2(n));
Error in textdiff (line 42)
htmlOut=i_CreateHTML(source1,text1,readable1, ...
Error in comparisons_private (line 9)
out = textdiff(varargin{:});
Error in visdiff (line 52)
htmlOut = comparisons_private('textdiff',filename1,filename2,showchars);

Indexing matrices in matlab

So I have a script that I run j times. The following line produces an error:
[evec(:,:,j), eval(:,:,j)] = eig(T(:,:,j));
Error using mupadmex
Error in MuPAD command: Cannot compute the explicit
representation of the eigenvalues; use
'numeric::eigenvectors'. [linalg::eigenvectors]
Error in sym/mupadmexnout (line 2080)
out = mupadmex(fcn,args{:});
Error in sym/eig (line 68)
[V,D,p] = mupadmexnout('symobj::eigenvectors',A);
Error in SingleLayer (line 86)
[evec(:,:,j), eval(:,:,j)] = eig(T(:,:,j));
That is the error message I get. Am I correct creating 3 "sheets" (not sure how to describe it) like this. I

error in using M block (in Xilinx system generator)?

I wrote this code inside the M Blcok (one of Xilinx blockstes in Simulink):
function z= discorr(x,y)
t=zeros(12288,1);
i=zeros(12288,1);
k=zeros(12288,1);
i(4096:8191,1)=x(1:4096,2); %output of the image filter
t(4096:8191,1)=y(1:4096,2); %output of the tamplate filter
i=i';
z=A(1:4096,1);
for n=1:8191
k=zeros(12288,1);
k(n:n+4095,1)=t(4096:8191,1);
z(n,2)=i*k;
end
end
Its telling me:
Error("discreatcorr.m"): Syntax error: Lexical error at line 15, column 0. Encountered: after : "\';\r\nz=A(1:4096,1);\r\nfor n=1:8191\r\n k=zeros(12288,1);\r\n k(n:n+4095,1)=t(4096:8191,1);\r\n z(n,2)=i*k;\r\n end\r\nend\r\n"
Error("discreatcorr.m"): Syntax error: Lexical error at line 15, column 0. Encountered: after : "\';\r\nz=A(1:4096,1);\r\nfor n=1:8191\r\n k=zeros(12288,1);\r\n k(n:n+4095,1)=t(4096:8191,1);\r\n z(n,2)=i*k;\r\n end\r\nend\r\n"
Error occurred during "Block Configuration".
althogh there is nothing in line 15 in the code
it is giving an error at the end of the code
Any Ideas??
The problem is that your system misinterprets the ' symbol as string symbol. Replacing the line i=i'; by i=transp(i); should solve the problem.