Opened 5 years ago
Closed 5 years ago
#5589 closed defect (invalid)
Protected top-level input connectors are not handled correctly by the backend
Reported by: | Francesco Casella | Owned by: | Lennart Ochel |
---|---|---|---|
Priority: | blocker | Milestone: | 1.14.0 |
Component: | Backend | Version: | |
Keywords: | Cc: | Karim Adbdelhak, Andreas Heuermann |
Description
Please run the following test case
model TestProtectedInput protected Modelica.Blocks.Interfaces.BooleanInput u; equation u = time > 1 and time < 2; annotation( experiment(StopTime = 10)); end TestProtectedInput;
OMEdit outputs two red error messages:
[1] 12:51:14 Symbolic Error Too many equations, over-determined system. The model has 1 equation(s) and 0 variable(s). [2] 12:51:14 Translation Error [TestProtectedRealInput: 5:3-5:47]: Internal error u = if time > 1.0 and time < 2.0 then 1.0 else 0.0 has size size 1 but 0 variables ()
I guess the problem here is that a defaul connection equation is added to the system because of the top-level connector. This shouldn't be the case, as the connector is protected.
Then, the model runs anyway and produces a wrong result, but that's another story, probably related to #5564.
Change History (5)
comment:1 by , 5 years ago
Summary: | Protected input connectors are not handled correctly by the backend → Protected top-level input connectors are not handled correctly by the backend |
---|
follow-up: 3 comment:2 by , 5 years ago
comment:3 by , 5 years ago
Replying to Karim.Abdelhak:
I don't know if i understand this correctly, isn't an input supposed to be known?
Yes, unless it is a protected connector :)
If you look at the definitions of balanced models in Section 4.7, only public connectors and inputs are considered for extra equations.
Why define it as an input in the first place, if it gets computed inside the block?
When you have conditional connectors, the classic use pattern is to have a protected connector with a connect statement between the conditional connector and the protected connector, which is automatically removed when the conditional connector is not instantiated. In that case, you have to give some value to the protected connector via a conditional equation.
The test case in this ticket contains what is left if the public connector is not instantiated. I could add all the conditionally removed stuff, but that's irrelevant, since the frontend gets rid of it anyway and the backend won't see it.
comment:4 by , 5 years ago
Ah i see, but this is a problem in the frontend or backend?
It does not seem to me that the connect equation is generated since the error message just states
Too many equations, over-determined system. The model has 1 equation(s) and 0 variable(s).
I seems to me that the input is just not added to the unknowns. It would be better if the frontend detected that the protected input is not connected to anything at all and adds it to the unknowns. In the backend it seems quite a mess to look for connect equations and check if the input is connected.
comment:5 by , 5 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
OK, most likely a frontend issue, see #5591.
I don't know if i understand this correctly, isn't an input supposed to be known? Why define it as an input in the first place, if it gets computed inside the block?