Hi Xiaofu,
Comments inline...
Xiaofu Du wrote:
Hi all,
last days i try my testbench for a lossles transmission line model in
high-frequency with delay. the line model i used is especially based on
the Modelica.Electrical.Analog.Lines, it is a Twoport transmission line
with a Voltage source and two resistors(see enclosed). because the
delay-function is not yet supported as Built-in Function in OpenModelica,
i quote the implemented delay function from Adrian(heartfelt thanks to
Adrian :) . the source text is:
....
the simulation result in Openmodelica was shown in enclosed pics. we can
see that it does not match with expected which we can just easily think
out.
I will have a look at this problem. It looks like a bug.
even in Dymola i got no simulation started because of the syntax error:
Error: declaration window line 16 column 1, syntax error at "model"
missing EndOfFile
ERROR: 1 error was found
Dymola is very sensitive on what you can put in a file.
In general you can have only ONE package, model, class, etc per file.
You should enclose all the code into a package to be able to save it
in Dymola:
--------------
package Bench
model Lossless "lossless transmission line with delay"
extends Modelica.Electrical.Analog.Interfaces.TwoPort;
parameter Modelica.SIunits.Resistance Z0=1 "Characteristic impedance";
parameter Modelica.SIunits.Time TAU=1 "Transmission delay";
Modelica.SIunits.Voltage er;
Modelica.SIunits.Voltage es;
Modelica.SIunits.Voltage d1;
Modelica.SIunits.Voltage d2;
Modelica.SIunits.Voltage d3;
Modelica.SIunits.Voltage d4;
equation
assert(Z0 > 0, "Z0 has to be positive");
assert(TAU > 0, "TAU has to be positive");
v1 = Z0*i1 + es;
//i1 = (v1-es)/Z0;
v2 = Z0*i2 + er;
//i2 = (v2-er)/Z0;
d1 = delay(v2, TAU);
d2 = delay(er, TAU);
d3 = delay(v1, TAU);
d4 = delay(es, TAU);
es = 2*d1 - d2;
er = 2*d3 - d4;
end Lossless;
/////////////////////////
model Bench
Modelica.Electrical.Analog.Sources.PulseVoltage CV(
V=5,
width=20,
period=10e-9);
Modelica.Electrical.Analog.Basic.Resistor R1(R=90);
Modelica.Electrical.Analog.Basic.Resistor Ri(R=50);
Modelica.Electrical.Analog.Basic.Ground G;
Lossless Line1(Z0=90, TAU=5e-9);
equation
connect(CV.p, Ri.p);
connect(Ri.n, Line1.p1);
connect(Line1.p2, R1.p);
connect(Line1.n2, R1.n);
connect(Line1.n1, CV.n);
connect(Line1.n1, G.p);
connect(Line1.n2, G.p);
end Bench;
end Bench;
--------------
I simulated the Bench.Bench model in Dymola and it seems to go
into an infinite loop. It might be that the values you have for
period in the PulseVoltage is too small (width is % of the period).
You could try to scale it up.
Regards,
Adrian Pop/