summaryrefslogtreecommitdiff
path: root/tests/source/DiffSystem.scade
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ansys.com>2014-07-03 17:52:37 +0200
committerAlex Auvolat <alex.auvolat@ansys.com>2014-07-03 17:52:37 +0200
commitf808eeaf3016f828d71b0f87afb89bb79a869035 (patch)
treea3baddb1e45087512318be680161c09f7949ced2 /tests/source/DiffSystem.scade
parent79bf56c809e727ed763e698386163706be2db0a7 (diff)
downloadscade-analyzer-f808eeaf3016f828d71b0f87afb89bb79a869035.tar.gz
scade-analyzer-f808eeaf3016f828d71b0f87afb89bb79a869035.zip
Changes to parser ; EDD optimisations ; test cases.
Diffstat (limited to 'tests/source/DiffSystem.scade')
-rw-r--r--tests/source/DiffSystem.scade34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/source/DiffSystem.scade b/tests/source/DiffSystem.scade
new file mode 100644
index 0000000..b1f3fb4
--- /dev/null
+++ b/tests/source/DiffSystem.scade
@@ -0,0 +1,34 @@
+
+node Body(Torq, Brake : real) returns (probe VehicleSpeed : real)
+var pre_VS, Cmd : real;
+let
+ --assume h1: Brake = 0.;
+ --assume h2: Torq >= 0. and Torq <= 1.;
+
+ pre_VS = 0.0 -> pre VehicleSpeed;
+
+ Cmd =
+ (if Torq <= 1.0 then 150.0 else 0.0)
+ + Brake * 200.0
+ + pre_VS * pre_VS * 0.3
+ + pre_VS * 2.5;
+
+ VehicleSpeed =
+ (Torq - (if pre_VS < - 0.1 then - Cmd else if pre_VS > 0.1 then Cmd else 0.0))
+ * 0.1 * 2.5 / 1450.0
+ + pre_VS;
+tel
+
+node test(i: int) returns(a, b, c: int; exit: bool)
+var torq, brake, vs: real;
+let
+ torq = 1000.; --if i mod 311 > 240 then 2.0 else if i mod 211 > 170 then 0.9 else 0.5;
+ brake = 0.; --if i mod 400 > 300 then 1.4 else 0.;
+ vs = Body(torq, brake);
+
+ a = int(torq);
+ b = int(brake);
+ c = int(vs * 10.);
+ exit = (i > 2000);
+tel
+