Opened 14 years ago
Closed 12 years ago
#1355 closed defect (invalid)
Check model gives incorrect error message about variable not being constant
Reported by: | dhedberg | Owned by: | dhedberg |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Backend | Version: | |
Keywords: | Cc: | dhedberg |
Description
Checking myUMLModel.Class_0 gives the following result where for some reason the model Class_0 is considered to be a package(?).
[12] 11:45:16 Validation of class myUMLModel.Class_0 Error: Variable _results in package myUMLModel.Class_0 is not constant Check of myUMLModel.Class_0 failed. Error Class myUMLModel.Class_0 has 5 equation(s) and 5 variable(s). 2 of these are trivial equation(s).
The definition of the example model:
package myUMLModel model Class_1 Boolean violated; Boolean evaluated; algorithm if time > 1 and time < 2 then violated:=true; evaluated:=true; else violated:=false; end if; end Class_1; model Class_0 model Results input Boolean all_req_evaluated; input Boolean some_req_violated; Boolean test_passed; algorithm test_passed:=all_req_evaluated and not some_req_violated; end Results; myUMLModel.Class_1 req1; Results _results(all_req_evaluated=if req1.evaluated then true else false, some_req_violated=if req1.violated then true else false); end Class_0; end myUMLModel;
Change History (3)
comment:1 by , 14 years ago
comment:2 by , 14 years ago
As far as I can tell, this is not a bug.
You cannot access *variables* in myUMLModel.Class_1
via the DOT notation
in the declaration section of the model. You can only use variables in algorithm
or equation sections. So this declaration is wrong:
Results _results(all_req_evaluated=if req1.evaluated then true else false, some_req_violated=if req1.violated then true else false);
because req1.evaluated
is a *variable* not parameter or constant!
comment:3 by , 12 years ago
Cc: | dhedberg, → dhedberg |
---|---|
Component: | → Backend |
Resolution: | → invalid |
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
MathCore ticket: http://intranet/trac/mathmodelica/ticket/2995