Opened 7 years ago
Closed 6 years ago
#4632 closed defect (fixed)
Moving a model creates wrong code
Reported by: | massimo ceraolo | Owned by: | sjolund |
---|---|---|---|
Priority: | blocker | Milestone: | 2.0.0 |
Component: | Interactive Environment | Version: | |
Keywords: | Cc: | Adeel Asghar |
Description
This ticket is related to, but different from #4624
1) load TestP
2) open IdOnePwm
3) check IdOnePwm => OK
4) move a little pwmPulser
5) check again: ERROR.
In step 4 you can use mouse or keyboard. Only when using keyboard the weird message reported in #4624 is displayed.
Tested with v1.13.0-dev-215-g2a409cd (64-bit)
Attachments (1)
Change History (8)
by , 7 years ago
comment:1 by , 7 years ago
Cc: | added |
---|
follow-up: 4 comment:2 by , 7 years ago
comment:3 by , 7 years ago
comment:4 by , 7 years ago
Cc: | added; removed |
---|---|
Owner: | changed from | to
Status: | new → assigned |
Replying to ceraolo:
I've had a closer look at the issue. In this case when moving the object the moved object is returned with the package name at the beginning, with turns out to be invalid.
The reason why it is invalid is that you declared the package as encapsulated, so lookup stops at the boundary of TestP and does not continue one level up to the global namespace, where you need to go in order to see TestP.PwPulser
.
I don't really see the reason of using an encapsulated package in this case, so I'd suggest you to remove the encapsulated
keyword from the package declaration. This makes sure that the model is still valid after moving the block.
That said, OMEdit should not change a model instantiation using a relative path into one with an absolute path just because its icon has been moved in the enclosing diagram. This should be fixed.
I checked the omcommunication.log file. When moving pwPulser, OMEdit calls updateConnection()
four times (one for each connection), then it calls
updateComponent(pwmPulser,TestP.PwmPulser,TestP.IdOnePwm, annotate= Placement(visible=true, transformation=transformation(origin={-15,44}, extent={{-13,13},{13,-13}}, rotation=180)))
When the file listing is obtained afterwards, the four connect statements have been moved at the beginning of the equation section, with the Line annotation updated. This of course should not happen, and I guess that we should fix updateConnection
not to move connection statements around.
Then, most importantly, the instantiation PwmPulser pwmPulser
is changed into TestP.PwmPulser pwmPulser
and the Placement annotation is updated. I am not sure whether this happens because OMEdit puts TestP.PwmPulser
instead of PwmPulser
as second argument of updateComponent, or because of how updateComponent
works internally.
In the first case, OMEdit needs to be fixed, otherwise updateComponent
needs to be fixed.
comment:5 by , 7 years ago
Encapsulated lookup is probably going to stay broken until the new version of the interactive API is released.
comment:6 by , 7 years ago
If I remove the keyword "encapsulated" now the model checks but a huge message is displayed, similar to the closed ticket #4624.
Now the problem of huge, uncontrolled message has remained orphan of tickets.
I will open a new ticket with the message in its name, just to leave open a trace of this huge messages.
comment:7 by , 6 years ago
Milestone: | 1.13.0 → 2.0.0 |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
This will be fixed in 2.0.0 when the new front-end becomes default
I've had a closer look at the issue. In this case when moving the object the moved object is returned with the package name at the beginning, with turns out to be invalid.
I'm not sure if it is an Interactive Environment issue or an OMEdit one.
@adeas31 can you, please, have a look?