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 (revision 17647) +++ SimulationRuntime/c/simulation/simulation_runtime.cpp (working copy) @@ -363,38 +363,29 @@ /* 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) != 0; + modelData->realVarsData[i].filterOutput = regexec(&myregex, modelData->realVarsData[i].info.name, 0, NULL, 0); for(long i=0; i<modelData->nAliasReal; i++) { + // The following two cases look like they can be collapsed. 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) != 0; - else - { - modelData->realAlias[i].filterOutput = 0; - modelData->realVarsData[modelData->realAlias[i].nameID].filterOutput = 0; - } + if(!modelData->realAlias[i].filterOutput) + modelData->realAlias[i].filterOutput = regexec(&myregex, modelData->realAlias[i].info.name, 0, NULL, 0); } 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) != 0; - else - { - modelData->realAlias[i].filterOutput = 0; - modelData->realParameterData[modelData->realAlias[i].nameID].filterOutput = 0; - } + if(!modelData->realAlias[i].filterOutput) + modelData->realAlias[i].filterOutput = regexec(&myregex, modelData->realAlias[i].info.name, 0, NULL, 0); } }
Version 0, edited 11 years ago by (next)
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