Browse Source

Fixed in and out rules to use dt and h

Casper Thule 6 years ago
parent
commit
b1b2678c15

+ 0 - 18
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation.cg.cpp/src/be/uantwerpen/ansymo/semanticadaptation/cg/cpp/generation/CppGenerator.xtend

@@ -724,21 +724,12 @@ class CppGenerator extends SemanticAdaptationGenerator {
 						val getValueCpp = '''getValue«Conversions.fmiTypeToGetValueString(type)»(«dependency.owner.name»,«define»)''';
 						ruleCpp = '''
 							«funcSigCon»{
-								double h = 0;
-								double dt = 0;
-								//FIXME
 								return true;
 							}
 							«funcSigBody»{
-								double h = 0;
-								double dt = 0;
-								//FIXME
 								this->internalState.stored_«dependency.owner.name»_«dependency.port.name» = «getValueCpp»;
 							}
 							«funcSigFlush»{
-								double h = 0;
-								double dt = 0;
-								//FIXME
 								this->internalState.«currentPort.name» = this->internalState.stored_«dependency.owner.name»_«dependency.port.name»;
 							}
 						'''
@@ -746,21 +737,12 @@ class CppGenerator extends SemanticAdaptationGenerator {
 						val setValueCpp = '''setValue(«dependency.owner.name»,«define»,this->internalState.stored_«dependency.owner.name»_«dependency.port.name»);''';
 						ruleCpp = '''
 							«funcSigCon»{
-								double h = 0;
-								double dt = 0;
-								//FIXME
 								return true;
 							}
 							«funcSigBody»{
-								double h = 0;
-								double dt = 0;
-								//FIXME
 								this->internalState.stored_«dependency.owner.name»_«dependency.port.name» = this->internalState.«currentPort.name»;
 							}
 							«funcSigFlush»{
-								double h = 0;
-								double dt = 0;
-								//FIXME
 								«setValueCpp»
 							}
 						'''

+ 1 - 10
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation.cg.cpp/src/be/uantwerpen/ansymo/semanticadaptation/cg/cpp/generation/RulesConditionSwitch.xtend

@@ -121,7 +121,7 @@ class RulesConditionSwitch extends BasicConditionSwitch {
 	 */
 	public def String createFunctionSignature(String functionName, String type, int count,
 		List<String> functionSignatures) {
-		val functionSignature = this.functionPrefix + functionName + count + "()";
+		val functionSignature = this.functionPrefix + functionName + count + "(double dt, double h)";
 		functionSignatures.add(type + " " + functionSignature);
 		return type + " " + this.adaptationClassName + "::" + functionSignature;
 	}
@@ -184,9 +184,6 @@ class RulesConditionSwitch extends BasicConditionSwitch {
 		val functionSignature = createFunctionSignature("condition", "bool", this.count, this.functionSignatures);
 		retVal.code = '''
 			«functionSignature»{
-				double h = 0;
-				double dt = 0;
-				//FIXME
 				return «doSwitch(object.condition).code»;
 			}
 		''';
@@ -200,9 +197,6 @@ class RulesConditionSwitch extends BasicConditionSwitch {
 		val functionSig = createFunctionSignature("body", "void", this.count, this.functionSignatures);
 		retVal.code = '''
 			«functionSig»{
-				double h = 0;
-				double dt = 0;
-				//FIXME
 				«IF object.expression !== null»
 					«val result = doSwitch(object.expression)»
 					«result.code»«if (!result.isExpression) ";"»
@@ -308,9 +302,6 @@ class RulesConditionSwitch extends BasicConditionSwitch {
 		val functionSig = createFunctionSignature("flush", "void", this.count, this.functionSignatures);
 		retVal.code = '''
 			«functionSig»{
-				double h = 0;
-				double dt = 0;
-				//FIXME
 				«FOR stm : object.statements»
 					«val result = doSwitch(stm)»
 					«result.code»«if(!result.isExpression) ";"»