modelica / modelica-compliance Goto Github PK
View Code? Open in Web Editor NEWA semantics compliance suite for the Modelica language
License: Other
A semantics compliance suite for the Modelica language
License: Other
Reported by frenkel on 26 Nov 2013 13:50 UTC
The break-statement breaks the execution of the innermost while or for-loop enclosing the break-statement and continues execution after the while- or for-loop. It can only be used in a while- or for-loop in an algorithm section.
but:
function f
input Real x;
output Real r;
algorithm
r := 2.0 * x;
if r>20 then
break;
end if;
r := r * x;
end f;
hence the test should have shouldPass = false.
Migrated-From: https://trac.modelica.org/Modelica/ticket/1364
Reported by eldjillali.talbi on 19 Dec 2013 16:51 UTC
This test example checks that missing "inner" is added automatically during translation, if an annotation for it is specified. But the specification says "the tool may also temporarily automatically add the corresponding inner component during translation" (3.3 section 18.7). So the tool is not forced to add this inner prefix during translation, and this test should not be present in the compliance test suite.
Migrated-From: https://trac.modelica.org/Modelica/ticket/1385
Reported by hansolsson on 30 Sep 2013 14:01 UTC
The models ModelicaCompliance.Redeclare.ClassExtends.{ClassExtendsChain,ClassExtendsClassTypes} have shouldPass=false but seem correct as far as I can tell.
The texts of the models even state:
Checks that it's possible to have a chain of class extends
Tests that class extends can be used with the different types of specialized classes
Migrated-From: https://trac.modelica.org/Modelica/ticket/1298
The test ModelicaCompliance.Equations.For.VariableRange is incorrect, as the supposedly false behavior seems in agreement with the spec.
Integer x[3];
Integer y[3]={1, 2, 3};
equation
for i in y loop
x[i] = y[i];
end for;
As ModelicaSpec 8.3.2. states explicitely in example 3 this is legal. Similar to the test ModelicaCompliance.Algorithms.For.VariableRange
Is it meant, that the array y
should change its size, which is indeed invalid?
Reported by hansolsson on 26 Sep 2013 13:23 UTC
Since some people complained about too long ticket.
Still issue with: ModelicaCompliance.Functions.ExternalObjects.ExternalObjectTable -
The ExtObj.c is included twice without a guard which is not nice; so should either change the C-file (preferred) to have guards (as is normal in headers) or put this into the Include-part (less nice):
Include="#ifndef ExtObjC
#define ExtObjC
#include "ExtObj.c"
#endif"
And there is no magic for finding URIs in the c-code, so the solution would be:
MyTable myTable = MyTable(ModelicaServices.ExternalReferences.loadResource("modelica://ModelicaCompliance/Resources/Data/Tables/testTables.txt"), "table1", {1, 2, 3});
(but then the test-suite becomes dependent on ModelicaServices).
Migrated-From: https://trac.modelica.org/Modelica/ticket/1290
Currently the repo only contains the default LICENSE template from the MA, in order to use it one needs to at least fill out <name of Licensor>
Reported by hansolsson on 3 Oct 2013 15:54 UTC
This was previously reported, and after analyzing it further I can only conclude the the model is not correct:
(PresentInExp also has the slight issue that there is no instance of M, i.e. we are simulating an empty model.)
The model and has an output connector (ro) connected to the bus. The expandable connector should thus be the source of the signal (i.e. variable in connector should declared with input-prefix).
According to: 9.1.3:
"If the variable on the other side of the connect-equation is input or output the new component will be either input or output to satisfy the restrictions in Section 9.3."
The idea is that this should uniquely define whether it is input or output; and it is clear that having it as "input" in the expandable connector is ok. Unfortunately it is a bit messy for "output" - will open a ticket.
But the source is missing (instead ro has an equation):
9.1.3:
"If a variable appears as an input in one expandable connector, it should appear as a non-input in at least one other expandable connector instance in the same augmentation set."
--
Proposed change:
Base them on ModelicaCompliance.Connections.Expandable.AugmentScalar and just add an unused variable in the expandable connector for AugmentNonEmpty, and add 'x' in expandable connector and add another variable Real y=ec.x;
for PresentInExp.
Migrated-From: https://trac.modelica.org/Modelica/ticket/1304
Reported by hansolsson on 13 Dec 2013 14:05 UTC
In import A.B.C; the A.B must be a package.
import ModelicaCompliance.Classes.Specialized.OperatorRecordShortExtends.OR;
(and similarly in other model) does not seem to satisfy that (assuming it was not changed recently).
Migrated-From: https://trac.modelica.org/Modelica/ticket/1380
I'd like to see some test case that the following model should fail with a dimension error.
model A
Real x[:,1]=[2,3];
end A;
Where should such a model go?
Calling exit()
in initMyTable
and interpolateMyTable
is not a good idea since this entirely closes the simulation environment. The solution is to replace printf
/exit
by ModelicaError
from the ModelicaUtilities.
Reported by choeger on 13 Aug 2014 09:07 UTC
Consider the following small model:
model Test2
model C
constant Real k = 1;
constant Real p = 0;
end C;
model D
constant Real k = 2;
constant Real p = 2;
end D;
model E
replaceable model C2 = C;
replaceable model C3 = C2(k = C2.p + 10);
Real x;
equation
x = C3.k;
end E;
model F = E(redeclare model C3 = D, redeclare model C2 = D);
F e;
end Test2;
I wonder whether this is actually legal? C2 is certainly not transitively non-replacable, so can I have a "redeclaration chain" like that? Dymola accepts this. OpenModelica complains about a field not found.
Assuming it is legal, how about the modifications?
Basically, there are 3 ways to deal with the modification of C2:
AFAIK, modifications are "merged" according to the spec, i.e. the modification inside E is never lost. When we also assume that redeclarations are always applied before modifications, the only legal answer should be 3.
However we decide, I propose to add this as a test case to the compliance suite.
Migrated-From: https://trac.modelica.org/Modelica/ticket/1552
Reported by hansolsson on 30 Sep 2013 10:52 UTC
The reference value 0 for y1 is just wrong, since it is
y1 = sin(0-3).
The when-statement will be triggered initially since sample() has start-value of false in 8.3.5.1.
Migrated-From: https://trac.modelica.org/Modelica/ticket/1296
Tests with empty arrays (10.7) are only found in ModelicaCompliance.Arrays.Declarations, but numeric tests on element-wise addition, subtraction, multiplication and matrix/vector multiplication with empty arrays are completely missing.
ModelicaCompliance.Operators.Arithmetic.AddLargeStrings leads to a fatal compiler error C1091 for string constants exceeding the maximum length of 65k Bytes. Is this really the desired scenario to be tested?
GCC (also for MinGW) does not have this problem.
Reported by jfrenkel on 2 Apr 2015 07:53 UTC
The Model ModelicaCompliance.Classes.Predefined.AttributeStateSelect
test that all defined values of StateSelect can be used. But there is a mistake vor Real v(stateSelect = StateSelect.always) = 5.0;
. This variable have to be always "Do use it as a state."
. But this is not possible because it is bind to be 5.0
.
The tool should reject it with a massage like:
Error In ModelicaCompliance.Classes.Predefined.AttributeStateSelect
The equation:
v=5.;
constrains the continuous time variables:
v
requiring them to be continuous time state variables. It is necessary to modify the stateSelect attributes or the model.
Migrated-From: https://trac.modelica.org/Modelica/ticket/1692
Many tests check for things like type A = constant B
, but only input/output are allowed in the grammar now.
This line:
contains an import that is not found, but this is probably not the intended source of the error.
Reported by perost on 15 May 2013 08:45 UTC
This is a ticket for feedback on the Modelica language compliance test suit under development by the OSMC.
Migrated-From: https://trac.modelica.org/Modelica/ticket/1101
Reported by hansolsson on 30 Sep 2013 10:56 UTC
ModelicaCompliance.Classes.Balancing.CorrectBalance3 has external inputs p and h, and nothing is specified for them. Using zero will not work for simulations.
ModelicaCompliance.Classes.Balancing.CorrectBalance4 has fixed=true for p and T, without any specified start-value (the default is thus zero). Using zero will not work for simulations.
Migrated-From: https://trac.modelica.org/Modelica/ticket/1297
Reported by hansolsson on 30 Sep 2013 10:47 UTC
The updated ModelicaCompliance.Algorithms.When.WhenPriority and ModelicaCompliance.Equations.When.WhenPriority have a when-statement that never should be triggered.
See mapping of when to if in 8.3.5.1; i.e. the mapping implies that a when that starts true does not trigger an event initially.
Migrated-From: https://trac.modelica.org/Modelica/ticket/1295
Reported by hansolsson on 13 Dec 2013 16:40 UTC
There is an inconsistency in the test-suite influencing the design of many test-cases:
I assume the intent is that no model used in a correct test-case should have any relevant issues.
Here is a partial list of the models with issues (mostly balancing):
ModelicaCompliance.Classes.Specialized.BlockInputOutput.B
ModelicaCompliance.Components.Conditional.CompRemovalBalanced.A
ModelicaCompliance.Components.Conditional.CompRemovalBalancedParam.A
ModelicaCompliance.Components.Prefixes.DiscreteValidClassType.M
ModelicaCompliance.Components.Prefixes.FlowValidClassType.M
ModelicaCompliance.Connections.Declarations.ArrayEquations.M
ModelicaCompliance.Connections.Declarations.ConnectArrays.M
ModelicaCompliance.Connections.Declarations.ConnectParamSubscript.M
ModelicaCompliance.Connections.Declarations.ConnectWholeDim.M
ModelicaCompliance.Connections.Declarations.OperatorRecordEquations.M
ModelicaCompliance.Connections.Declarations.SimpleEquations.M
ModelicaCompliance.Connections.Expandable.AugmentComplex.M
ModelicaCompliance.Connections.Expandable.FlowInConnectorInExpandable.M
ModelicaCompliance.Connections.Restrictions.ConnectConstants.M
ModelicaCompliance.Connections.Restrictions.ConnectParameters.M
ModelicaCompliance.Connections.Stream.InStreamTwoInside.A
ModelicaCompliance.Operators.Special.Cardinality.M
ModelicaCompliance.Scoping.MemberAccess.AccessAlgorithm.A
(and similarly for all cases in MemberAccess).
ModelicaCompliance.Scoping.InnerOuter.DifferentPrefixes.A has a constant bound to a parameter!
---
Also found the following:
Isn't ModelicaCompliance.Components.Prefixes.DiscreteValidClassType incorrect due to using when into a model?
ModelicaCompliance.Connections.Expandable.ConnectDisjointExpandables lacks content!
Migrated-From: https://trac.modelica.org/Modelica/ticket/1383
If I clone this repo and immediately switch to a new branch I see a bunch of modified files. Why?
$ git checkout -b test
M ModelicaCompliance/Scoping/InnerOuter/Array1.mo
M ModelicaCompliance/Scoping/InnerOuter/Array2.mo
M ModelicaCompliance/Scoping/InnerOuter/Array3.mo
M ModelicaCompliance/Scoping/InnerOuter/Array4.mo
M ModelicaCompliance/Scoping/InnerOuter/Array5.mo
M ModelicaCompliance/Scoping/InnerOuter/Array6.mo
M ModelicaCompliance/Scoping/InnerOuter/ComplicatedNameLookup.mo
M ModelicaCompliance/Scoping/InnerOuter/DifferentPrefixes.mo
M ModelicaCompliance/Scoping/InnerOuter/Enumeration.mo
M ModelicaCompliance/Scoping/InnerOuter/EnumerationWrong.mo
M ModelicaCompliance/Scoping/InnerOuter/FunctionSelection.mo
M ModelicaCompliance/Scoping/InnerOuter/MissingInner.mo
M ModelicaCompliance/Scoping/InnerOuter/MissingInnerAdded.mo
M ModelicaCompliance/Scoping/InnerOuter/ModificationOnOuter1.mo
M ModelicaCompliance/Scoping/InnerOuter/ModificationOnOuter2.mo
M ModelicaCompliance/Scoping/InnerOuter/ModificationOnOuter3.mo
M ModelicaCompliance/Scoping/InnerOuter/Nested.mo
M ModelicaCompliance/Scoping/InnerOuter/OuterInPackage.mo
M ModelicaCompliance/Scoping/InnerOuter/PartialInner.mo
M ModelicaCompliance/Scoping/InnerOuter/PartialOuter.mo
M ModelicaCompliance/Scoping/InnerOuter/PartialOuterWrong.mo
M ModelicaCompliance/Scoping/InnerOuter/Record.mo
M ModelicaCompliance/Scoping/InnerOuter/RecordWrong.mo
M ModelicaCompliance/Scoping/InnerOuter/SimpleNameLookup.mo
M ModelicaCompliance/Scoping/InnerOuter/SimultaneousDeclarations.mo
M ModelicaCompliance/Scoping/InnerOuter/WrongSubType.mo
Switched to a new branch 'test'
There is no test testing that when f(initial()) then
is disallowed in 3.2r1. There is even one test using when not initial() then
(WhenPriority.mo).
Reported by hansolsson on 13 Dec 2013 14:07 UTC
"Checks that it's not legal to extend from an operator record as a long class definition." - I agree with that.
But then it should not have shouldPass=true.
Migrated-From: https://trac.modelica.org/Modelica/ticket/1381
In the example ModelicaCompliance.Operators.Overloading.ConstructorAmbiguous in the definition of record Complex the keyword operator is missing.
Reported by hansolsson on 30 Sep 2013 10:41 UTC
The ModelicaCompliance.Algorithms.When.ElseWhenStatement has state events and relies on r integrating exactly to the boundaries 0.2 and -1.8 - without any integration error.
Migrated-From: https://trac.modelica.org/Modelica/ticket/1294
The Annotations tests on chapter 18 are missing. The respective package.order file is a zero-bytes file.
In model ModelicaCompliance.Connections.Restrictions.SizeOverconstrainedInvalid
the modifier to r
does not have the correct dimension value. The model, however, seem to be testing whether the number of flow variables is equal to the number of "other" variables for overdetermined connectors.
I suggest we change the modifier to r
from {1, 2, 3}
to {1, 2}
to resolve the ambiguity.
Reported by hansolsson on 11 Oct 2013 09:58 UTC
The testing for operator records in connections is a bit counter-intuitive.
The functionality is tested - but not in the way one would assume.
The details are: Assume that the part about operator records in 9.2 is ignored. One would assume that OperatorRecordEquations test-case would fail, since it is intended to test that this functionality is implemented.
However, if one ignores operator record part of 9.2 the operator record will be split into primitive elements for OperatorRecordEquations; and since Complex use cartesian coordinates this will generate the correct flow-equations!
Thus the test-case OperatorRecordEquations does in fact not test that operator records generate operator-record-equations.
However, it tests that if operator-record-equations are generated they are the correct ones.
Instead the test-cases OperatorRecordMissing... will instead detect this issue (at least it is highly likely).
It might be ok to keep this as it is.
Changing the Complex functions to detect it will result a non-additive group, which would make the model incorrect (and not something that a tool is likely to detect).
The only alternative I could see would be to switch to Polar coordinates, but addition in Polar coordinates is a bit messy.
Migrated-From: https://trac.modelica.org/Modelica/ticket/1321
As of the resolution of https://trac.modelica.org/Modelica/ticket/1551, ModelicaCompliance.Scoping.InnerOuter.MissingInner should no longer fail.
(And additionally, MissingInnerAdded was invalid from the beginning, since the spec previously said that a tool was allowed to automatically add the declaration.)
The models in ModelicaCompliance.Functions.ExternalObjects assume that ExtObj.c is found in the default InludeDirectory. There also should be a test (either there or in ModelicaCompliance.Functions.External) that utilizes the IncludeDirectoty annotation according to MLS 3.2r2 section 12.9.4.
There is no single test that utilizes the Library and LibraryDirectory annotations for custom libraries (except ModelicaCompliance.Functions.External.FortranLapack for tool vendor provided Lapack library).
The test
ModelicaCompliance.Arrays.Functions.Size.ArrayDimSizeIncorrectArgument3
appears to be incorrect. In section "10.3.1 Array Dimension and Size Functions" Table 10-3 it is stated, that
ndims(A) Returns the number of dimensions k of array expression A, with k >= 0.
size(A) Returns a vector of length ndims(A) containing the dimension sizes of A.
Therefore, size(A)
of an scalar should return an empty vector (with length ndims(A)==0), but would still be a valid statement.
Reported by hansolsson on 13 Dec 2013 14:20 UTC
The BaseProperties model lack equations and should thus be declared as partial (even if in a partial package; similarly as there is a difference between an abstract class and a pure virtual function).
Migrated-From: https://trac.modelica.org/Modelica/ticket/1382
Reported by hansolsson on 2 Dec 2013 14:49 UTC
The function
ModelicaCompliance.Functions.External.CMapping2.M.enumIncrement
seem to take Integer input/output instead of enumeration E; that should not be correct.
The actual C-code is correct since the enumeration will be mapped to int.
Migrated-From: https://trac.modelica.org/Modelica/ticket/1371
I believe this should say shouldPass = false
, as is also indicated by the name of the class:
The following test models do not test that the Modelica tool does not allow declaring classes that use reserved names because some Modelica tools (OpenModelica in particular) assume that any use of a reserved identifier points to the built-in class (which is sort of true since there cannot be any elements with the reserved names):
Perhaps the test name needs to be ModelicaCompliance.Classes.Predefined.Boolean in order to force instantiation of this class (perhaps add it in addition to the existing ones). Anyone have any other ideas?
This test verifies that the overloaded constructor shadows the automatically generated constructor.
The call to the constructor uses a single positional argument. This makes the potential call to the default constructor invalid. Therefore, the ambiguity is lifted by there being a single valid constructor.
I suggest we move the default binding from re
to im
:
Integer re;
Integer im = 1;
instead of:
Integer re = 1;
Integer im;
In this case, both calls are valid, and we test that the overloaded constructor properly shadows the automatically generated one.
There are these two test cases:
https://github.com/modelica/Modelica-Compliance/blob/master/ModelicaCompliance/Classes/Predefined/ReservedStateSelectClass.mo
https://github.com/modelica/Modelica-Compliance/blob/master/ModelicaCompliance/Classes/Predefined/ReservedStateSelectComp.mo
but the way I read 4.8 in the specification, it doesn't actually prohibit these?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.