Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add check for when-condition variability
- Check that when-conditions are discrete-time expressions.
- Loading branch information
Showing
7 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// name: WhenCondition1 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
model WhenCondition1 | ||
Boolean b; | ||
Real x; | ||
equation | ||
when b then | ||
x = 1.0; | ||
end when; | ||
end WhenCondition1; | ||
|
||
// Result: | ||
// class WhenCondition1 | ||
// Boolean b; | ||
// Real x; | ||
// equation | ||
// when b then | ||
// x = 1.0; | ||
// end when; | ||
// end WhenCondition1; | ||
// endResult |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// name: WhenCondition2 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
model WhenCondition2 | ||
Boolean b; | ||
Real x; | ||
equation | ||
when {b, initial()} then | ||
x = 1.0; | ||
end when; | ||
end WhenCondition2; | ||
|
||
// Result: | ||
// class WhenCondition2 | ||
// Boolean b; | ||
// Real x; | ||
// equation | ||
// when {b, initial()} then | ||
// x = 1.0; | ||
// end when; | ||
// end WhenCondition2; | ||
// endResult |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// name: WhenCondition3 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
model WhenCondition3 | ||
Real x; | ||
equation | ||
when time > 0 then | ||
x = 1.0; | ||
end when; | ||
end WhenCondition3; | ||
|
||
// Result: | ||
// class WhenCondition3 | ||
// Real x; | ||
// equation | ||
// when time > 0.0 then | ||
// x = 1.0; | ||
// end when; | ||
// end WhenCondition3; | ||
// endResult |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// name: WhenCondition4 | ||
// keywords: | ||
// status: incorrect | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
model WhenCondition4 | ||
Real x; | ||
equation | ||
when noEvent(time > 0) then | ||
x = 1.0; | ||
end when; | ||
end WhenCondition4; | ||
|
||
// Result: | ||
// Error processing file: WhenCondition4.mo | ||
// [flattening/modelica/scodeinst/WhenCondition4.mo:11:3-13:11:writable] Error: When-condition ‘noEvent(time > 0.0)‘ is not a discrete-time expression. | ||
// | ||
// # Error encountered! Exiting... | ||
// # Please check the error message and the flags. | ||
// | ||
// Execution failed! | ||
// endResult |