Opened 5 years ago

Closed 5 years ago

#5542 closed defect (fixed)

OMC generates simulation code out of systems with invalid connections

Reported by: Francesco Casella Owned by: Per Östlund
Priority: blocker Milestone: 1.14.0
Component: New Instantiation Version:
Keywords: Cc: massimo ceraolo

Description (last modified by Francesco Casella)

Consider the attached test case, where an electrical pin is connected to a thermal port. OMC generates simulation code out of it and runs a simulation.

Besides the obvious questions: what equations were actually put in the system and what does the corresponding simulation result mean, there is a more fundamental problem: this violates a basic rule in connections, see Sect. 9.1 of the specification, which reads

In a connect-equation the two connectors must have the same named component elements with the same dimensions; recursively down to the primitive components. The primitive components with the same name are matched and belong to the same connection set.

This behaviour is obtained both from the OF and from the NF. I guess we should just care to fix it in the NF.

@perost, is this an easy fix or a complex one? It would be nice to get it in 1.14.0, but if we can't, feel free to move it to 2.0.0

Attachments (1)

TestConnection.mo (614 bytes ) - added by Francesco Casella 5 years ago.

Download all attachments as: .zip

Change History (5)

by Francesco Casella, 5 years ago

Attachment: TestConnection.mo added

comment:1 by Francesco Casella, 5 years ago

Description: modified (diff)

in reply to:  description ; comment:2 by Per Östlund, 5 years ago

Replying to casella:

@perost, is this an easy fix or a complex one? It would be nice to get it in 1.14.0, but if we can't, feel free to move it to 2.0.0

It's a trivial fix, I've fixed it in PR #276.

The error message isn't very good though, since it just says that the types of the connectors are incompatible. But fixing that will have to wait until later, implementing good error handling in MetaModelica is unfortunately rather annoying since the language doesn't have proper exception handling.

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

Replying to perost:

It's a trivial fix, I've fixed it in PR #276.

Very good, thanks!

The error message isn't very good though, since it just says that the types of the connectors are incompatible. But fixing that will have to wait until later, implementing good error handling in MetaModelica is unfortunately rather annoying since the language doesn't have proper exception handling.

OK, I've opened #5545 on this topic. I guess it's not critical, particularly once we solve #5543, because then such incompatible connections will be very rare.

I'll check this with the nightly build on Monday and then close the ticket if it's ok.

comment:4 by Francesco Casella, 5 years ago

Resolution: fixed
Status: newclosed

I checked with the nighly build, looks good.

Note: See TracTickets for help on using tickets.