Skip to content
Snippets Groups Projects
Commit 83240cfc authored by MARSOLLIER Felix's avatar MARSOLLIER Felix
Browse files

Addition of a ".mos" script to automate the test of models

parent 7cd344ff
No related branches found
No related tags found
No related merge requests found
// loading of the necessary libraries
loadModel(Modelica); getErrorString();
loadFile("C:/Users/fm4b8dfn/Documents/Modelica/TAeZoSysPro/package.mo"); getErrorString();
loadFile("C:/Users/fm4b8dfn/Documents/Modelica/TAeZoSysPro_testsuite/package.mo"); getErrorString();
// Creation of log file
path_log := "C:/Users/fm4b8dfn/Documents/Modelica/TAeZoSysPro_testsuite/Scripts/log.txt";
writeFile(path_log,"");
//
package_list := getPackages(TAeZoSysPro_testsuite);
package_list_str := {typeNameString(package_list[i]) for i in 1:size(package_list,1)};
for package_name in package_list_str loop
subClasses_list := getClassNames( stringTypeName("TAeZoSysPro_testsuite"+"."+package_name), recursive=true );
writeFile(path_log, package_name+"\n", append=true );
for class_TypeName in subClasses_list[2:end] loop
writeFile(path_log, typeNameString(class_TypeName)+"\n", append=true );
if isModel(class_TypeName) == true then
// les fonctions "stringSplit" et "strtok" ne fonctionnent pas avec la version 1.16. Les points de separation de classes sont convertis en slash
model_name := typeNameString(class_TypeName);
model_name := stringReplace(model_name,".","/");
model_name := basename( model_name );
// *** CHECK OF INSTANTIATION ***
instantiateModel(class_TypeName);
errors := getErrorString();
if errors == "" then
writeFile(path_log,"No errors during instantiation of " + model_name + "\n", append=true );
else
writeFile(path_log,"Following errors during instantiation of " + model_name + "\n", append=true );
writeFile(path_log, errors + "\n", append=true);
end if;
// *** CHECK OF MODEL CHECINKG ***
checkModel(class_TypeName);
errors := getErrorString();
if errors == "" then
writeFile(path_log,"No errors during check of " + model_name + "\n", append=true );
else
writeFile(path_log,"Following errors during check of " + model_name + "\n", append=true );
writeFile(path_log, errors + "\n", append=true);
end if;
// *** CHECK OF SIMULATION ***
simulate(class_TypeName);
errors := getErrorString();
if errors == "" then
writeFile(path_log,"No errors during simulation of " + model_name + "\n", append=true );
else
writeFile(path_log,"Following errors during simulation of " + model_name + "\n", append=true );
writeFile(path_log, errors + "\n", append=true);
end if;
echo(true);
end if;
end for;
end for;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment