Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#5680 closed defect (fixed)

Dots replaced by __ in text view when creating a model in graph view

Reported by: Oliver Lenord Owned by: Adrian Pop
Priority: blocker Milestone: 1.14.0
Component: OMEdit Version: v1.14.0-dev-nightly
Keywords: corrupt modeling Cc:

Description

In the attached model is corrupt by using drag and drop in the graphics view. In the text view all "." are shown as "".

Attachments (5)

test.mo (653 bytes ) - added by Oliver Lenord 5 years ago.
test2.mo (456 bytes ) - added by anonymous 5 years ago.
omeditcommunication.log (3.2 MB ) - added by Oliver Lenord 5 years ago.
test3.mo (456 bytes ) - added by Oliver Lenord 5 years ago.
script.mos (346 bytes ) - added by Adeel Asghar 5 years ago.

Change History (24)

by Oliver Lenord, 5 years ago

Attachment: test.mo added

comment:1 by Francesco Casella, 5 years ago

@olivleno, it is not clear to me how did you obtain this model. Do you mean you dragged and dropped from the MSL and got double underscores instead of dots in the class names?

by anonymous, 5 years ago

Attachment: test2.mo added

comment:2 by anonymous, 5 years ago

It sounds rediculous, but in fact it is. I'm very surprised that this kind of fundamental disfunctionality has been put out as "stable" version.

This is what I do:

  1. open OMEdit
  2. create new model named test2
  3. drag an integrator and a first order block in the graphics window
  4. switch to text view
model test2
  Modelica__Blocks__Continuous__Integrator integrator annotation(
    Placement(visible = true, transformation(origin = {-32, 50}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica__Blocks__Continuous__FirstOrder firstOrder annotation(
    Placement(visible = true, transformation(origin = {10, 50}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation

annotation(
    uses(Modelica(version = "3.2.3")));
end test2;

in reply to:  2 comment:3 by Francesco Casella, 5 years ago

Replying to anonymous:

It sounds ridiculous, but in fact it is. I'm very surprised that this kind of fundamental disfunctionality has been put out as "stable" version.

Well, beta versions are supposed to be stable, unless they aren't, and we fix them asap before the official release. That's what betas are for.

This is what I do:

  1. open OMEdit
  2. create new model named test2
  3. drag an integrator and a first order block in the graphics window
  4. switch to text view
model test2
  Modelica__Blocks__Continuous__Integrator integrator annotation(
    Placement(visible = true, transformation(origin = {-32, 50}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica__Blocks__Continuous__FirstOrder firstOrder annotation(
    Placement(visible = true, transformation(origin = {10, 50}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation

annotation(
    uses(Modelica(version = "3.2.3")));
end test2;

I can't reproduce this behaviour with the latest 1.15.0 nightly under Windows. I'll check with the beta and report.

comment:4 by Francesco Casella, 5 years ago

Milestone: Future1.14.0

I'm now using OpenModelica v1.14.0-dev.beta1 (64-bit) on a Windows 10 pro laptop. I went through your four steps and the result is:

model test2
  Modelica.Blocks.Continuous.Integrator integrator annotation(
    Placement(visible = true, transformation(origin = {-34, 14}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Continuous.FirstOrder firstOrder annotation(
    Placement(visible = true, transformation(origin = {44, 12}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation

annotation(
    uses(Modelica(version = "3.2.3")));
end test2;

which looks good to me.

@olivleno, can you please report exactly which version you are using (Help | About OMEdit) on which operating system?

Last edited 5 years ago by Francesco Casella (previous) (diff)

comment:5 by Francesco Casella, 5 years ago

@adeas31, any idea why this could happen?

comment:6 by Adeel Asghar, 5 years ago

I also can't reproduce the issue.
@olivleno can you upload omeditcommunication.log file so we can see what went wrong and when.

comment:7 by anonymous, 5 years ago

Connected to OpenModelica v1.14.0-dev.beta1 (64-bit)
Connected to OMSimulator v2.1.0-dev-147-g36ec2c7-mingw
on a Windows 10 laptop.

How do I find or create the communication.log file?

comment:8 by Adeel Asghar, 5 years ago

It is located in %TEMP%/OpenModelica/OMEdit.

in reply to:  8 comment:9 by Francesco Casella, 5 years ago

Replying to adeas31:

It is located in %TEMP%/OpenModelica/OMEdit.

You should be able to get there with Tools | Open Working directory

comment:10 by Oliver Lenord, 5 years ago

Thanks for the hint.
It's uploaded now.

comment:11 by Adeel Asghar, 5 years ago

This is not the relevant log file. It doesn't show the steps you mentioned in comment:2 instead it just shows that you opened test2.mo. Please the do the following,

  • Stop any running instance of OMEdit.
  • Delete the log file.
  • Start OMEdit.
  • Follow the steps mentioned in comment:2.
  • Close OMEdit.
  • Send the log file again.

by Oliver Lenord, 5 years ago

Attachment: omeditcommunication.log added

by Oliver Lenord, 5 years ago

Attachment: test3.mo added

comment:12 by Francesco Casella, 5 years ago

From line 29870 I read

addComponent(integrator, Modelica.Blocks.Continuous.Integrator,test3,annotate=Placement(visible=true, transformation=transformation(origin={-40,12}, extent={{-10,-10},{10,10}}, rotation=0))) 11:45:05:315
true 11:45:05:315
#s#; 0.000000; 9.187000; 'addComponent(integrator, Modelica.Blocks.Continuous.Integrator,test3,annotate=Placement(visible=true, transformation=transformation(origin={-40,12}, extent={{-10,-10},{10,10}}, rotation=0)))'

getUses(test3) 11:45:05:315
{} 11:45:05:315
#s#; 0.000000; 9.187000; 'getUses(test3)'

errors:=getMessagesStringInternal() 11:45:05:316
{} 11:45:05:393
#s#; 0.077000; 9.264000; 'errors:=getMessagesStringInternal()'

size(errors,1) 11:45:05:393
0 11:45:05:394
#s#; 0.001000; 9.265000; 'size(errors,1)'

addClassAnnotation(test3, annotate=$annotation(uses(Modelica(version="3.2.3")))) 11:45:05:394
true 11:45:05:396
#s#; 0.002000; 9.267000; 'addClassAnnotation(test3, annotate=$annotation(uses(Modelica(version="3.2.3"))))'

listFile(test3,true) 11:45:05:396
"model test3
  Modelica__Blocks__Continuous__Integrator integrator annotation(
    Placement(visible = true, transformation(origin = {-40, 12}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation

  annotation(
    uses(Modelica(version = "3.2.3")));
end test3;" 11:45:05:396
#s#; 0.000000; 9.267000; 'listFile(test3,true)'

That's weird indeed.

comment:13 by Adeel Asghar, 5 years ago

Yes I saw that already. I am debugging what could be the reason for that. Maybe inside the Compiler some sort of locale aware dot(.) is used OR maybe @olivleno has some specific settings. I can't say what is wrong yet.

@olivleno can you run the attached script from command line and post the output.

by Adeel Asghar, 5 years ago

Attachment: script.mos added

comment:14 by Adrian Pop, 5 years ago

Found the problem.

When omc is ran with:

  -m, --modelicaOutput       Enables valid modelica output for flat modelica.

It will show paths with __ instead of ..
In your log file you have:

setCommandLineOptions("--matchingAlgorithm=PFPlusExt --indexReductionMethod=dynamicStateSelection -d=initialization,NLSanalyticJacobian,newInst -d=initialization -m") 11:44:33:275

The last one, -m is what generates this issue. If you remove -m all will be well.

We should fix this, it should be activated only when dumping flat Modelica (DAE), not normal Modelica code.

From AbsynDumpTpl.tpl:

template dumpPath(Absyn.Path path)
::=
match path
  case FULLYQUALIFIED(__) then
    '.<%dumpPath(path)%>'
  case QUALIFIED(__) then
    if (Flags.getConfigBool(Flags.MODELICA_OUTPUT)) then
    '<%name%>__<%dumpPath(path)%>'
    else
    '<%name%>.<%dumpPath(path)%>'
  case IDENT(__) then
    '<%name%>'
  else
    errorMsg("SCodeDump.dumpPath: Unknown path.")
end dumpPath;

comment:15 by Adrian Pop, 5 years ago

Owner: changed from Adeel Asghar to Adrian Pop
Status: newaccepted

comment:16 by Adeel Asghar, 5 years ago

@olivleno you should remove the -m option. Remove it in OMEdit from Tools->Options->Simulation->Additional Translation Flags:, save and then restart OMEdit.

comment:17 by Adrian Pop, 5 years ago

Resolution: fixed
Status: acceptedclosed

comment:18 by Francesco Casella, 5 years ago

Thank you @adrpo!

comment:19 by Oliver Lenord, 5 years ago

Yes, I can confirm that removing the "-m" option solves the issue.
Thanks for going after this and applying the fix instantly.

Note: See TracTickets for help on using tickets.