Browse Source

fmus array now stores the path, and corrected a bug related to loading the fmu from the path.

Claudio Gomes 2 years ago
parent
commit
c08b82bbf0

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

@@ -93,7 +93,7 @@ class CppGenerator {
 				val fmuFile = getFMUFile(fmu.path, adaptationFolderURI)
 				this.resourcePaths.add(fmuFile);
 				md = new ModelDescription(fmu.name, fmu.type.name, fmuFile);
-				fmus.add(fmu.name -> fmu.type.name);
+				fmus.add(fmu.name -> fmu.path);
 				val LinkedHashMap<String, MappedScalarVariable> mSV = newLinkedHashMap();
 				
 				Log.push("Loading fmu variables")
@@ -388,7 +388,7 @@ class CppGenerator {
 	/*
 	 * Compiles the source file constructor, destructor and the initialize function
 	 */
-	def String compileDeAndConstructorAndInitialize(String adapClassName, String fmuName, String fmuTypeName,
+	def String compileDeAndConstructorAndInitialize(String adapClassName, String fmuName, String fmuPath,
 		String guid, String paramsCons, String inCons, String outCons, String crtlCons) {
 		return '''
 			«adapClassName»::«adapClassName»(shared_ptr<std::string> fmiInstanceName,shared_ptr<string> resourceLocation, const fmi2CallbackFunctions* functions) : 
@@ -404,7 +404,7 @@ class CppGenerator {
 			void «adapClassName»::initialize(bool loggingOn)
 			{				
 				auto path = make_shared<string>(*resourceLocation);
-				path->append(string("«fmuTypeName».fmu"));
+				path->append(string(«fmuPath»));
 				auto «fmuName»Fmu = make_shared<fmi2::Fmu>(*path);
 				«fmuName»Fmu->initialize();
 				this->«fmuName» = «fmuName»Fmu->instantiate("«fmuName»",fmi2CoSimulation, "«guid»", true, loggingOn, shared_from_this());