- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » how to use Openmodelica Scripting to...
how to use Openmodelica Scripting to delete multiple files
how to use Openmodelica Scripting to delete multiple files
Hallo, every one,
now I use openmodelica Scripting in oder to simulate a Model with different Parameters. It worked. but during the simulation OM creats a lot of Intermediate Files, which is very in convienient. In OM Connection editor, in Tools->Option->Simulation there is a Option "delete intermediate Compilation files". When it is choosed, OMC will automatically delete the Intermediate files. However in Openmodelica Scripting I only find a function "deleteFiles", that can only delelte a file at once.
Is there a way to solve this?
best regards
Re: how to use Openmodelica Scripting to delete multiple files
Call /bin/rm to remove some files?
- sjoelund.se
- 1700 Posts
Re: how to use Openmodelica Scripting to delete multiple files
I add /bin/rm to my code, but it does not word. Here is my Code
-----------------------------------------------------------------------------------------
cd("C:\Users\USERNAME\Desktop\Modelica_Uebung\ParameterSweep\TestModels");
//loadFile("package.mo");
//loadFile("Model.mo");
getErrorString();
str_model := "RefrigerationCycle_Demo.Simple_Cycle_SL.Tests.Test_Cycle";
simulate(RefrigerationCycle_Demo.Simple_Cycle_SL.Tests.Test_Cycle);
//stringTypeName(str_model);
//simulate(stringTypeName(str_model));
getErrorString();
for p in {926901, 956901, 986901, 1036901, 1066901} loop
str_p := String(p);
getErrorString();
//str_cmd := str_model + ".exe -override a=" + str_a;
//print(str_cmd + "\n");
//getErrorString();
//system(str_cmd, "output.txt");
//system("RefrigerationCycle_Demo.Simple_Cycle_2.Tests.test_Cycle.exe -override RefrigerationCycle_Demo.Simple_Cycle_2.Tests.test_Cycle.simpleHeatExchanger_m_dot.p_ex=" + String(p) + " -r=Model_" + String(p) + "_res.mat");
system(str_model + ".exe -override Kondensator.p_ex=" + String(p) + " -r=Model_" + String(p) + "_res.mat");
getErrorString();
//res := readSimulationResult("Model_res.mat", x); getErrorString();
//results := results + str_a + "," + String(res[size(res, 1), size(res, 2)]) + ",\n";
//closeSimulationResultFile();
end for;
#!/bin/bash
rm *.o;
rm *.c;
rm *.h;
Re: how to use Openmodelica Scripting to delete multiple files
Instead of this:
Code:
#!/bin/bash
rm *.o;
rm *.c;
rm *.h;
do:
Code:
system("rm -f *.o *.c *.h");
- adrpo
- 885 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » how to use Openmodelica Scripting to...