Browse Source

updated window_sa test to conform to newest syntax

Cláudio Gomes 7 years ago
parent
commit
2bb8061a6a

+ 3 - 3
DSL_SemanticAdaptation/README.txt

@@ -1,12 +1,12 @@
 Installation Instructions:
 - Download Eclipse NEON (64 bits) installer.
 - Run it, and select "Eclipse DSL Tools" environment.
-or if you allready have Eclipse NEON then just install the xText plugins
+or if you already have Eclipse NEON then just install the xText plugins
 - repo http://download.eclipse.org/modeling/tmf/xtext/updates/composite/releases/
 -  plugins `Xtend IDE` and `Xtend Complete SDK`
 
 BEFORE MAVEN
-Generationa and Compilation
+Generation and Compilation
 - Import all projects in this folder.
 - Right click in be.uantwerpen.ansymo.semanticadaptation/src/be/uantwerpen/ansymo/semanticadaptation/SemanticAdaptation.xtext   and select "run as -> generate xtext artifacts"
 - Check that the console log is similar to the one in File "first_generation_sucessful_log.txt".
@@ -23,4 +23,4 @@ mvn clean
 Other tasks:
 	Run the tests: right-click be.uantwerpen.ansymo.semanticadaptation.tests/src/be/uantwerpen/ansymo/semanticadaptation/tests/SemanticAdaptationParsingTest.xtend -> run as -> J-Unit test
 	
-	Run the plugin: right-click /be.uantwerpen.ansymo.semanticadaptation -> run as -> eclipse application
+	Run the plugin: After building everything, right-click /be.uantwerpen.ansymo.semanticadaptation -> run as -> eclipse application

+ 77 - 5
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation.tests/input/window_sa_BASE.sa

@@ -1,7 +1,79 @@
-// outdated
+module Window_SA
+
+semantic adaptation reactive mealy WindowSA windowSA
+at "./path/to/WindowSA.fmu"
+
+/*
+Reactive means that the unit expects the following treatment:
+Supose the external master is at time t, and that there is an FMU f providing inputs to windowsa.
+Then,
+f.doStep(t, H) // f goes from t->t+H 
+u := f.getValues(...)
+windowsa.setValues(u) // Input provided from the future (t+H)
+windowsa.doStep(t, H) // windowsa goes from t->t+H
+v := windowsa.getValues(...)
+
+Delayed unit means that the unit expects the following treatment:
+Supose the external master is at time t, and that there is an FMU f providing inputs to windowsa.
+Then,
+pu := f.getValues(...)
+f.doStep(t, H) // f goes from t->t+H 
+windowsa.setValues(pu) // Input provided at the time t
+windowsa.doStep(t, H) // windowsa goes from t->t+H and does not need input at time (t+H)
+v := windowsa.getValues(...)
+
+
+Mealy unit means the following:
+windowsa.setValues(v1)  // values set at time t
+o1 = windowsa.getValues() // values set at time t
+assert v2 <> v1 // Assumption
+windowsa.setValues(v2)  // values set at time t
+o2 = windowsa.getValues() // values set at time t
+It is probably the case that o1 <> o2
+
+Moore unit means the following:
+windowsa.setValues(v1)  // values set at time t
+o1 = windowsa.getValues() // values set at time t
+assert v2 <> v1 // Assumption
+windowsa.setValues(v2)  // values set at time t
+o2 = windowsa.getValues() // values set at time t
+It must be the case that o1 == o2
+In other words, the output at time t, only depends on the state at time t.
+*/
+
+	
+	/*
+	The definition for the wrappen FMU is now done here.
+	This is because, for adaptations that wrap multiple FMUs as well as other adaptations, the connection information cannot be fully completed in the senario description (see the window_obstacle.sa example).
+	*/
+	for inner fmu Window window
+		at "./path/to/WindowSA.fmu"
+		with input ports displacement (rad), speed (rad/s), reaction_force (N)
+		with output ports height (m), reaction_torque (N.m)
+
+/*
+No need to have input ports declared for this model.
+Every input port of the original FMU will be automatically assumed to be an input port of the adapted FMU.
+
+If there is an input port window.p which is dangling, but is not declared here, then an input port windowsa.p will be created in the adapted FMU, and we will have that window.p -> windowsa.p.
+*/
+
+/*
+Declares two output ports, and specified how height is mapped to disp.
+Here, the units need to be specified, so that the conversion can take place.
+The units of disp can be either obtained from the scenario, or specified explicitly here.
+*/
+output ports disp (cm)  <- height, tau
+/*
+There are alternative ways that this can be interpreted:
+disp  := arbitrary_function(height) * 100 or arbitrary_function(height * 100) (they are not necessarily equal)
+We pick the first one, so what we have is this:
+aux_var := arbitrary_function(height);
+disp := aux_var*100; // This part never has to be coded.
+*/
 
-semantic adaptation window_sa
-for fmu window
 out rules {
-	true -> { } --> { reaction_torque := -reaction_torque; };
-}
+	true -> {} --> {
+		tau := -reaction_force;
+	};
+}

+ 1 - 1
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation/examples/window_sa.BASE.sa

@@ -60,7 +60,7 @@ Declares two output ports, and specified how height is mapped to disp.
 Here, the units need to be specified, so that the conversion can take place.
 The units of disp can be either obtained from the scenario, or specified explicitly here.
 */
-output ports disp(cm) <- height(m), tau; 
+output ports disp(cm) <- height, tau; 
 /*
 There are alternative ways that this can be interpreted:
 disp  := arbitrary_function(height) * 100 or arbitrary_function(height * 100) (they are not necessarily equal)