Skip to content

Commit

Permalink
Functions were missing when printing the xml representation of the mo…
Browse files Browse the repository at this point in the history
…del with the dumpXMLDAE method. Fixed.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@4011 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Filippo Donida committed Apr 28, 2009
1 parent b66d08b commit e493223
Show file tree
Hide file tree
Showing 3 changed files with 230 additions and 18 deletions.
14 changes: 11 additions & 3 deletions Compiler/Ceval.mo
Expand Up @@ -7092,7 +7092,6 @@ algorithm
Boolean cdToTemp,asInSimulationCode;
Real starttime_r,stoptime_r,interval_r,tolerance_r;
String file_dir,cname_str,init_filename,method_str,filenameprefix,makefilename,oldDir,tempDir;
list<String> libs;
list<SCode.Class> sp;
list<Interactive.InstantiatedClass> ic;
list<Interactive.InteractiveVariable> iv;
Expand Down Expand Up @@ -7120,6 +7119,8 @@ algorithm
list<Interactive.InstantiatedClass> ic_1,ic;
list<SCode.Class> p_1,sp;
list<list<Integer>> comps;
list<Absyn.Path> funcpaths;
list<DAE.Element> funcelems;
equation
//asInSimulationCode==true => it's necessary to do all the translation's steps before dumping with xml
_ = Error.getMessagesStr() "Clear messages";
Expand All @@ -7140,8 +7141,10 @@ algorithm
indexed_dlow = DAELow.translateDae(dlow_1);
indexed_dlow_1 = DAELow.calculateValues(indexed_dlow);
xml_filename = Util.stringAppendList({filenameprefix,".xml"});
funcpaths = SimCodegen.getCalledFunctions(dae, indexed_dlow_1);
funcelems = SimCodegen.generateFunctions2(p_1, funcpaths);
Print.clearBuf();
XMLDump.dumpDAELow(indexed_dlow_1,addOriginalIncidenceMatrix,addSolvingInfo,addMathMLCode,dumpResiduals);
XMLDump.dumpDAELow(indexed_dlow_1,funcpaths,funcelems,addOriginalIncidenceMatrix,addSolvingInfo,addMathMLCode,dumpResiduals);
xml_contents = Print.getString();
Print.clearBuf();
System.writeFile(xml_filename,xml_contents);
Expand All @@ -7158,6 +7161,8 @@ algorithm
list<DAE.Element> dael;
list<Interactive.InstantiatedClass> ic_1,ic;
list<SCode.Class> p_1,sp;
list<Absyn.Path> funcpaths;
list<DAE.Element> funcelems;
equation
//asInSimulationCode==false => it's NOT necessary to do all the translation's steps before dumping with xml
_ = Error.getMessagesStr() "Clear messages";
Expand All @@ -7175,8 +7180,10 @@ algorithm
mT = DAELow.transposeMatrix(m);
(_,_,dlow_1,m,mT) = DAELow.matchingAlgorithm(dlow, m, mT, (DAELow.INDEX_REDUCTION(),DAELow.EXACT(), DAELow.REMOVE_SIMPLE_EQN()));
xml_filename = Util.stringAppendList({filenameprefix,".xml"});
funcpaths = SimCodegen.getCalledFunctions(dae, dlow_1);
funcelems = SimCodegen.generateFunctions2(p_1, funcpaths);
Print.clearBuf();
XMLDump.dumpDAELow(dlow_1,addOriginalIncidenceMatrix,addSolvingInfo,addMathMLCode,dumpResiduals);
XMLDump.dumpDAELow(dlow_1,funcpaths,funcelems,addOriginalIncidenceMatrix,addSolvingInfo,addMathMLCode,dumpResiduals);
xml_contents = Print.getString();
Print.clearBuf();
System.writeFile(xml_filename,xml_contents);
Expand All @@ -7188,6 +7195,7 @@ algorithm
end matchcontinue;
end dumpXMLDAE;


protected function getClassnamesInClassList
input Absyn.Path inPath;
input Absyn.Program inProgram;
Expand Down
14 changes: 7 additions & 7 deletions Compiler/SimCodegen.mo
@@ -1,9 +1,9 @@
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-2008, Linköpings University,
* Copyright (c) 1998-2008, Linköpings University,
* Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
* SE-58183 Linköping, Sweden.
*
* All rights reserved.
*
Expand All @@ -14,7 +14,7 @@
*
* The OpenModelica software and the Open Source Modelica
* Consortium (OSMC) Public License (OSMC-PL) are obtained
* from Linköpings University, either from the above address,
* from Linköpings University, either from the above address,
* from the URL: http://www.ida.liu.se/projects/OpenModelica
* and in the OpenModelica distribution.
*
Expand Down Expand Up @@ -6127,7 +6127,7 @@ algorithm
end matchcontinue;
end generateFunctions;

protected function generateExternalObjectIncludes
public function generateExternalObjectIncludes
"Generates the library paths for external objects"
input DAELow.DAELow daelow;
output list<String> includes;
Expand Down Expand Up @@ -6165,7 +6165,7 @@ algorithm
end matchcontinue;
end generateExternalObjectInclude;

protected function generateFunctions2
public function generateFunctions2
"function: generateFunctions2
author: PA
Helper function to generateFunctions."
Expand Down Expand Up @@ -6290,7 +6290,7 @@ algorithm
DAELow.DAELow dlow;
Absyn.Path class_;

case (dlow,class_,exe,filename,start,stop,intervals,tolerance,method) /* classname executable file name filename start time stop time íntervals */
case (dlow,class_,exe,filename,start,stop,intervals,tolerance,method) /* classname executable file name filename start time stop time intervals */
equation
delta_time = stop -. start;
step = delta_time/.intervals;
Expand Down Expand Up @@ -8771,7 +8771,7 @@ algorithm
end matchcontinue;
end crefModelicaStr;

protected function getCalledFunctions
public function getCalledFunctions
"function: getCalledFunctions
Goes through the DAELow structure, finds all function
calls and returns them in a list. Removes duplicates."
Expand Down

0 comments on commit e493223

Please sign in to comment.