Skip to content

Commit

Permalink
Do not remove local min or max points
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@17898 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Oct 27, 2013
1 parent bd03591 commit 032163c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions Compiler/runtime/SimulationResultsCmpTubes.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,9 @@ static addTargetEventTimesRes removeUneventfulPoints(addTargetEventTimesRes in,
double y = in.values[i];
double x1 = in.time[i+1];
double y1 = in.values[i+1];
if (almostEqualRelativeAndAbs(y,linearInterpolation(x,x0,x1,y0,y1,xabstol),reltol,0) && !isEvent && removeNonEvents) {
/* The point can be reconstructed using linear interpolation */
int isLocalMinOrMax = (x > x1 && x > x0) || (x < x1 && x < x0);
if (!isLocalMinOrMax && almostEqualRelativeAndAbs(y,linearInterpolation(x,x0,x1,y0,y1,xabstol),reltol,0) && !isEvent && removeNonEvents) {
/* The point can be reconstructed using linear interpolation and is not a local minimum or maximum */
res.time[res.size] = x1;
res.values[res.size] = y1;
res.size++;
Expand Down Expand Up @@ -708,16 +709,16 @@ static unsigned int cmpDataTubes(int isResultCmp, char* varname, DataField *time
}
fprintf(fout, "%.15g,%.15g,%.15g,%.15g",calibrated_values[i],high[i],low[i],error);
}
if (ref.time[i] == actual.time[j] && j < actual.size) {
fprintf(fout, ",%.15g%s\n",actual.values[j++],rbracket);
if (ref.time[i] == actualoriginal.time[j] && j < actualoriginal.size) {
fprintf(fout, ",%.15g%s\n",actualoriginal.values[j++],rbracket);
} else {
fprintf(fout, ",%s%s\n",empty,rbracket);
}
} else {
fputs(isHtml ? "null,null,null,null,null],\n" : ",,,,\n", fout);
}
while (ref.time[i] > actual.time[j] && j < actual.size) {
fprintf(fout, "%s%.15g,%s,%s,%s,%s,%s,%.15g%s\n",lbracket,actual.time[j],empty,empty,empty,empty,empty,actual.values[j],rbracket);
while (ref.time[i] > actualoriginal.time[j] && j < actualoriginal.size) {
fprintf(fout, "%s%.15g,%s,%s,%s,%s,%s,%.15g%s\n",lbracket,actualoriginal.time[j],empty,empty,empty,empty,empty,actualoriginal.values[j],rbracket);
j++;
}
lastStepError = thisStepError;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/runtime/SimulationResults_omc.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void* SimulationResults_diffSimulationResults(int runningTestsuite, const char *

const char* SimulationResults_diffSimulationResultsHtml(int runningTestsuite, const char *var, const char *filename,const char *reffilename, double refTol, double reltolDiffMaxMin, double rangeDelta)
{
char *res;
char *res = "";
SimulationResultsCmp_compareResults(0,runningTestsuite,filename,reffilename,"",0,refTol,reltolDiffMaxMin,rangeDelta,mmc_mk_cons(mmc_mk_scon(var),mmc_mk_nil()),0,NULL,1,&res);
return res;
}
Expand Down
2 changes: 1 addition & 1 deletion Compiler/runtime/SimulationResults_rml.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ RML_END_LABEL

RML_BEGIN_LABEL(SimulationResults__diffSimulationResultsHtml)
{
char *res;
char *res = "";
SimulationResultsCmp_compareResults(0,RML_UNTAGFIXNUM(rmlA0),RML_STRINGDATA(rmlA1),RML_STRINGDATA(rmlA2),"",rml_prim_get_real(rmlA3),0.0/*abstol*/,rml_prim_get_real(rmlA4),rml_prim_get_real(rmlA5),mk_cons(rmlA6,mk_nil()),0,NULL,1,&res);
rmlA0 = mk_scon(res);
RML_TAILCALLK(rmlSC);
Expand Down

0 comments on commit 032163c

Please sign in to comment.