Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
vruge
committed
Jul 31, 2016
1 parent
c49987f
commit 793899e
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |