Skip to content

Commit 2b51288

Browse files
committed
- fixed the problem that two or more plot commands end up plotting the same plot file by
generating a unique tmpPlot_NN.plt file name for each plot[X], plotParametric[X] command. git-svn-id: https://openmodelica.org/svn/OpenModelica/branches/OpenModelica1.5.0@4328 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent e7272b4 commit 2b51288

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

Compiler/CevalScript.mo

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,7 @@ algorithm
765765
local
766766
Integer res;
767767
list<Exp.Exp> vars;
768+
String uniqueStr;
768769
equation
769770
vars = Util.listMap(vars,Exp.CodeVarToCref);
770771
vars_1 = Util.listMap(vars, Exp.printExpStr) "plot2" ;
@@ -781,7 +782,8 @@ algorithm
781782
omhome_1 = System.trim(omhome, "\"");
782783
pd = System.pathDelimiter();
783784
plotCmd = Util.stringAppendList({cit,omhome_1,pd,"bin",pd,"doPlot",cit});
784-
tmpPlotFile = Util.stringAppendList({pwd,pd,"tmpPlot.plt"});
785+
uniqueStr = intString(tick());
786+
tmpPlotFile = Util.stringAppendList({pwd,pd,"tmpPlot_",uniqueStr,".plt"});
785787
res = Values.writePtolemyplotDataset(tmpPlotFile, value, vars_2, "Plot by OpenModelica");
786788
call = Util.stringAppendList({cit,plotCmd," \"",tmpPlotFile,"\"",cit});
787789

@@ -1511,6 +1513,7 @@ algorithm
15111513
local
15121514
Integer res;
15131515
list<Exp.Exp> vars;
1516+
String uniqueStr;
15141517
equation
15151518
vars = Util.listMap(vars,Exp.CodeVarToCref);
15161519
vars_1 = Util.listMap(vars, Exp.printExpStr);
@@ -1525,7 +1528,8 @@ algorithm
15251528
omhome_1 = System.trim(omhome, "\"");
15261529
pd = System.pathDelimiter();
15271530
plotCmd = Util.stringAppendList({cit,omhome_1,pd,"bin",pd,"doPlot",cit});
1528-
tmpPlotFile = Util.stringAppendList({pwd,pd,"tmpPlot.plt"});
1531+
uniqueStr = intString(tick());
1532+
tmpPlotFile = Util.stringAppendList({pwd,pd,"tmpPlot_",uniqueStr,".plt"});
15291533
res = Values.writePtolemyplotDataset(tmpPlotFile, value, vars_1, "Plot by OpenModelica");
15301534
call = Util.stringAppendList({cit,plotCmd," \"",tmpPlotFile,"\"",cit});
15311535
_ = System.systemCall(call);
@@ -1606,8 +1610,8 @@ algorithm
16061610
Integer res;
16071611
Exp.Exp xRange, yRange;
16081612
list<Exp.Exp> vars;
1609-
String interpolation, title, xLabel, yLabel;
1610-
Boolean legend, grid, logX, logY, points;
1613+
String interpolation, title, xLabel, yLabel, uniqueStr;
1614+
Boolean legend, grid, logX, logY, points;
16111615
equation
16121616
vars = Util.listMap(vars,Exp.CodeVarToCref);
16131617
vars_1 = Util.listMap(vars, Exp.printExpStr);
@@ -1623,8 +1627,9 @@ algorithm
16231627
omhome_1 = System.trim(omhome, "\"");
16241628
pd = System.pathDelimiter();
16251629
plotCmd = Util.stringAppendList({cit,omhome_1,pd,"bin",pd,"doPlot",cit});
1626-
tmpPlotFile = Util.stringAppendList({pwd,pd,"tmpPlot.plt"});
1627-
res = Values.sendPtolemyplotDataset(value, vars_1, "Plot by OpenModelica", interpolation, title, legend, grid, logX, logY, xLabel, yLabel, points, Exp.printExpStr(xRange), Exp.printExpStr(yRange));
1630+
uniqueStr = intString(tick());
1631+
tmpPlotFile = Util.stringAppendList({pwd,pd,"tmpPlot_",uniqueStr,".plt"});
1632+
res = Values.sendPtolemyplotDataset(value, vars_1, "Plot by OpenModelica", interpolation, title, legend, grid, logX, logY, xLabel, yLabel, points, Exp.printExpStr(xRange), Exp.printExpStr(yRange));
16281633
then
16291634
(cache,Values.BOOL(true),st);
16301635

0 commit comments

Comments
 (0)