Skip to content

Commit

Permalink
added test for ticket:3997
Browse files Browse the repository at this point in the history
  • Loading branch information
vruge committed Jul 31, 2016
1 parent c49987f commit 793899e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions simulation/modelica/inlineFunction/Makefile
Expand Up @@ -21,6 +21,7 @@ forceComplexEq2.mos \
forceComplexEq3.mos \
forceComplexEq4.mos \
testBug3687.mos \
testBug3997.mos \
testComplexMath.mos \


Expand Down
43 changes: 43 additions & 0 deletions simulation/modelica/inlineFunction/testBug3997.mos
@@ -0,0 +1,43 @@
// name: ticket3687
// status: correct

// use new inline method
loadString("

model InlineMatrixFunction
function jj \"Vectorized version of j\"
input Real[:,:] xx \"array of voltage or current vectors\";
output Real[size(xx,1),size(xx,2)] yy \"array of rotated vectors\";
algorithm
yy := cat(1, {-xx[2,:], xx[1,:]}, zeros(size(xx,1)-2, size(xx,2)));
annotation(Inline=true);
end jj;

Real[3, 1] v = {{1}, {2}, {3}};
Real[3, 1] jv = jj(v);
end InlineMatrixFunction;

");
getErrorString();
simulate(InlineMatrixFunction);

getErrorString();
val(jv[1,1],{0.0,1.0});
val(jv[2,1],{0.0,1.0});
val(jv[3,1],{0.0,1.0});

getErrorString();
// Result:
// true
// ""
// record SimulationResult
// resultFile = "InlineMatrixFunction_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'InlineMatrixFunction', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// ""
// {-2.0,-2.0}
// {1.0,1.0}
// {0.0,0.0}
// ""
// endResult

0 comments on commit 793899e

Please sign in to comment.