Opened 11 years ago
Closed 11 years ago
#2462 closed defect (fixed)
filterOutput isn't working
Reported by: | Owned by: | somebody | |
---|---|---|---|
Priority: | normal | Milestone: | 1.9.1 |
Component: | Run-time | Version: | trunk |
Keywords: | filterOutput | Cc: |
Description
Steps to reproduce in OMEdit:
- Open Modelica.Electrical.Analog.Examples.Rectifier.
- Ctrl-B (simulation tab).
- Under the Output tab, enter "iAC.*" in the Variable Filter tab.
- Hit simulate.
The simulation runs successfully, but all variables are returned. None are filtered.
In simulation_runtime.cpp, I got filtering to work (I think) with the following changes.
/* new imple */ for(long i=0; i<modelData->nVariablesReal; i++) { if(!modelData->realVarsData[i].filterOutput) { modelData->realVarsData[i].filterOutput = regexec(&myregex, modelData->realVarsData[i].info.name, 0, NULL, 0); }} for(long i=0; i<modelData->nAliasReal; i++) { if(modelData->realAlias[i].aliasType == 0) /* variable */ { if(!modelData->realAlias[i].filterOutput // && !modelData->realVarsData[modelData->realAlias[i].nameID].filterOutput ) { modelData->realAlias[i].filterOutput = regexec(&myregex, modelData->realAlias[i].info.name, 0, NULL, 0); } // else // { // modelData->realAlias[i].filterOutput = 1; // modelData->realVarsData[modelData->realAlias[i].nameID].filterOutput = 1; // } } else if(modelData->realAlias[i].aliasType == 1) /* parameter */ { if(!modelData->realAlias[i].filterOutput // && !modelData->realParameterData[modelData->realAlias[i].nameID].filterOutput ){ modelData->realAlias[i].filterOutput = regexec(&myregex, modelData->realAlias[i].info.name, 0, NULL, 0); } // else // { // modelData->realAlias[i].filterOutput = 1; // modelData->realParameterData[modelData->realAlias[i].nameID].filterOutput = 1; // } } }
Change History (4)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Here are changes in svn diff format. I tried cleaning it up a bit because I had some debugging stuff in there. As you're looking at this, note that I'm bad at C/C++. I only changed the Real variables part.
-
SimulationRuntime/c/simulation/simulation_runtime.cpp
363 363 364 364 /* new imple */ 365 365 for(long i=0; i<modelData->nVariablesReal; i++) if(!modelData->realVarsData[i].filterOutput) 366 modelData->realVarsData[i].filterOutput = regexec(&myregex, modelData->realVarsData[i].info.name, 0, NULL, 0) != 0;366 modelData->realVarsData[i].filterOutput = regexec(&myregex, modelData->realVarsData[i].info.name, 0, NULL, 0); 367 367 for(long i=0; i<modelData->nAliasReal; i++) 368 368 { 369 // The following two cases look like they can be collapsed. 369 370 if(modelData->realAlias[i].aliasType == 0) /* variable */ 370 371 { 371 if(!modelData->realAlias[i].filterOutput && !modelData->realVarsData[modelData->realAlias[i].nameID].filterOutput) 372 modelData->realAlias[i].filterOutput = regexec(&myregex, modelData->realAlias[i].info.name, 0, NULL, 0) != 0; 373 else 374 { 375 modelData->realAlias[i].filterOutput = 0; 376 modelData->realVarsData[modelData->realAlias[i].nameID].filterOutput = 0; 377 } 372 if(!modelData->realAlias[i].filterOutput) 373 modelData->realAlias[i].filterOutput = regexec(&myregex, modelData->realAlias[i].info.name, 0, NULL, 0); 378 374 } 379 375 else if(modelData->realAlias[i].aliasType == 1) /* parameter */ 380 376 { 381 if(!modelData->realAlias[i].filterOutput && !modelData->realParameterData[modelData->realAlias[i].nameID].filterOutput) 382 modelData->realAlias[i].filterOutput = regexec(&myregex, modelData->realAlias[i].info.name, 0, NULL, 0) != 0; 383 else 384 { 385 modelData->realAlias[i].filterOutput = 0; 386 modelData->realParameterData[modelData->realAlias[i].nameID].filterOutput = 0; 387 } 377 if(!modelData->realAlias[i].filterOutput) 378 modelData->realAlias[i].filterOutput = regexec(&myregex, modelData->realAlias[i].info.name, 0, NULL, 0); 388 379 } 389 380 }
comment:3 by , 11 years ago
comment:4 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
What are the changes? Post any changes in diff format