- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Question about expandable connectors
Question about expandable connectors
Question about expandable connectors
// I'm trying to understand how expandable connectors
// work. Hopefully the following simple model gets
// across the idea of what I'd like to do. The comments
// in 'block Obfuscate' show the errors I'm encountering.
// Corrections and suggestions would be appreciated.
package ExpandTest
expandable connector ExCon
input Real ins[:];
output Real outs[:];
//input Real ins; // OK
//output Real outs; // OK
end ExCon;
block Obfuscate
ExCon ex;
equation
// The four choices below will result in
// different error messages as indicated.
// Commands check model, instantiate, then
// simulate were applied in that order (i.e.
// simulate: means it passed checks and instantiated).
//for i in 1:size(ex.ins) loop // check model: fails to elaborate
//for i loop // check model: dimension of ex.outs and ex.ins differ
//for i in 1:size(ex.ins,1) loop // instantiate: range not constant or parameter
for i in 1:1 loop // simulate: internal error createSimCode failed
ex.outs[i] = ex.ins[i];
end for;
//ex.outs = ex.ins; // OK
end Obfuscate;
model Trivial
Real xin (start = 0.0);
Real xout (start = 0.0);
Real der_x (start = 1.0);
Obfuscate io;
equation
connect (xin, io.ex.ins[1]);
connect (xout, io.ex.outs[1]);
//connect (xin, io.ex.ins); // OK
//connect (xout, io.ex.outs); // OK
xin = sin(time);
der_x = der(xout);
end Trivial;
end ExpandTest;
- Vestal
- 7 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Question about expandable connectors