Reputation: 43
I am using Dymola to design a small model of some DC motors and a power source. After I finished my work I saved everything and closed Dymola. When I opened it the next time some (not all) of the connections did not show up anymore. So I tried to draw them again, but Dymola tells me that the connections already exist. When I look at the connections in the Text section they are still there.
I am using Ubuntu 18.04 and Dymola Version 2019 FD01 (64-bit), 2018-10-10. I also tried to open the model in Openmodelica. But there also were the same connections missing.
and the text representation:
connect(controlSoftware.s1, switches.s1);
connect(controlSoftware.s12, switches.s12);
connect(controlSoftware.s2, switches.s2);
connect(controlSoftware.r1, switches.r1);
connect(controlSoftware.r2, switches.r2);
connect(switches.p, constantVoltage.p);
connect(switches.pin_n, motorWithCurrentSensor.n);
connect(switches.pin_n1, motorWithCurrentSensor1.n);
connect(controlSoftware.cur1, motorWithCurrentSensor.Currenctsensor);
connect(motorWithCurrentSensor.pin, constantVoltage.n);
connect(motorWithCurrentSensor1.pin, constantVoltage.n);
connect(motorWithCurrentSensor.Speedsensor, controlSoftware.speed1);
connect(controlSoftware.speed2, motorWithCurrentSensor1.Speedsensor);
connect(controlSoftware.cur2, motorWithCurrentSensor1.Currenctsensor);
connect(ground.p, constantVoltage.n);
What can I do to get the connections back? I have a really hard time fixing things without graphical representation.
Thank you for your help
Best regards Gerald
Upvotes: 1
Views: 175
Reputation: 927
I see that you are on Ubuntu and there is actually a bug in (at least) Dymola2019FD01 where it does mix up komma and decimal point when writing out annotation coordinates. So if you check you might see some graphical annotations having {10,5,10}
instead of {10.5,10}
rendering them invalid. I haven't tested if this has been resolved in Dymola2020 but until then you can use the workaround to start Dymola like this:
#!/bin/sh
export LC_ALL=C
exec /usr/local/bin/dymola-2019FD01-x86_64 $*
I.e., make sure the local is set to "C" so that Dymola does not get confused.
Upvotes: 2
Reputation: 7525
Some background Information: The graphical representation of the all components in Modelica is placed in the annotation after the class definition. This is also true for the connections.
One of the smaller electrical examples is Modelica.Electrical.Analog.Examples.ShowSaturatingInductor
in which you will find these connect statements:
connect(SineVoltage1.n, Ground1.p) annotation (Line(points={{-60,-16},{-60,
-16}}, color={0,0,255}));
connect(SineVoltage1.n, SaturatingInductance1.n) annotation (Line(points={{-60,-16},
{-20,-16},{-20,-10}}, color={0,0,255}));
connect(SaturatingInductance1.p, SineVoltage1.p) annotation (Line(points={{-20,10},
{-20,20},{-60,20},{-60,4}}, color={0,0,255}));
connect(Inductance1.p, SineVoltage1.p) annotation (Line(
points={{20,10},{20,20},{-60,20},{-60,4}}, color={0,0,255}));
connect(Inductance1.n, SineVoltage1.n) annotation (Line(
points={{20,-10},{20,-16},{-60,-16}}, color={0,0,255}));
The first part states which connectors are actually connected. From this part the respective equations are generated. The following annotation contains the graphical representation. The graphical part is not necessary for the model to work. It seems that somehow this part got lost in your model.
Regarding your question: The easiest way to restore the graphical representation should be to delete all connect
statements from your model and re-draw them. As an alternative you could add the annotation manually or by editing it in the graphical layer, but both options are pretty fiddly, which is why I would suggest to delete and re-draw.
Upvotes: 0
Reputation: 6655
You can either
or
annotation (Line(points={{0, 0}, {0, 0}}))
With the second option your connect statements will first look like this in the code:
connect(controlSoftware.s1, switches.s1) annotation (Line(points={{0, 0}, {0, 0}}));
You can then use the diagram layer to rearrange the points of the connections.
Upvotes: 0