Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

OMEdit does not visualize a circuit. What is rong?

OMEdit does not visualize a circuit. What is rong?

I often switch between Dymola and OM, and thus I often incur in compatibility issues.
I've the following code: a model "RL" that uses "myResistor" (both created using Dymola)
the circuit RL is not displayed well (with R20071).
Is there some error in the Modelica code?

Thanks.

Code:


model MyResistor "Ideal linear electrical resistor"
  parameter Modelica.SIunits.Resistance R(start=1) ;
  extends Modelica.Electrical.Analog.Interfaces.OnePort;
equation
  v = R*i;
  annotation (uses(Modelica(version="3.2.1")), Icon(graphics={
        Rectangle(
          extent={{-70,32},{70,-28}},
          lineColor={0,0,255},
          fillColor={255,255,255},
          fillPattern=FillPattern.Solid),
        Line(points={{-90,0},{-70,0}}),
        Line(points={{70,0},{90,0}}),
        Text(
          extent={{-142,-48},{146,-88}},
          lineColor={0,0,0},
          textString="R=%R"),
        Text(
          extent={{-142,56},{142,100}},
          textString="%name",
          lineColor={0,0,255})}));
end MyResistor;

model RL
  Modelica.Electrical.Analog.Basic.Ground ground annotation (extent=[-10, -34; 10,
        -14], Placement(transformation(extent={{-10,-52},{10,-32}})));
  Modelica.Electrical.Analog.Basic.Inductor inductor(L=0.01)
    annotation (extent=[30, -10; 50, 10], rotation=-90);
  Modelica.Electrical.Analog.Sources.ConstantVoltage Vsource(V=10)
    annotation (extent=[-50, -10; -30, 10], rotation=-90);
  MyResistor Resistor(R=1) annotation (extent=[-10, 14; 10, 34], Placement(
        transformation(extent={{-10,10},{10,30}})));
equation
  connect(inductor.n, Vsource.n) annotation (Line(
      points={{40,-10},{40,-20},{-40,-20},{-40,-10}},
      color={0,0,255},
      smooth=Smooth.None));
  connect(ground.p, Vsource.n) annotation (Line(
      points={{0,-32},{0,-20},{-40,-20},{-40,-10}},
      color={0,0,255},
      smooth=Smooth.None));
  connect(Resistor.n, inductor.p) annotation (Line(
      points={{10,20},{40,20},{40,10}},
      color={0,0,255},
      smooth=Smooth.None));
  connect(Resistor.p, Vsource.p) annotation (Line(
      points={{-10,20},{-40,20},{-40,10}},
      color={0,0,255},
      smooth=Smooth.None));
  annotation (
    uses(Modelica(version="3.2.1")),
    Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,
            100}}), graphics),
    experiment(StopTime=0.1),
    __Dymola_experimentSetupOutput);
end RL;

Re: OMEdit does not visualize a circuit. What is rong?

Have you noticed,

Code:

extent=[-10, -34; 10, -14]

in the RL model?

This is old Modelica syntax. OMEdit only supports 3.x annotation syntax.
Btw, Dymola does show the model fine but you can't really use it e.g try moving the inductor component.

Adeel.

Re: OMEdit does not visualize a circuit. What is rong?

ah,
I really don't know how I could create this, given the programs (all very new) I use.
Now I've also checked Dymola in pedantic mode and it correctly complains about 'extent'.
Thanks.

MC

There are 0 guests and 0 other users also viewing this topic
You are here: