Opened 11 years ago

Closed 10 years ago

#2470 closed enhancement (fixed)

Display values and descriptions for all variables

Reported by: sjoelund.se Owned by: adeas31
Priority: high Milestone: 1.9.1
Component: OMEdit Version: trunk
Keywords: Cc:

Description

Currently only tunable parameters display a box to change value and a description of the variable.

I propose that all variables show the description (and maybe the unit too?), and that any time-invariant names in the result-file are shown with a grey'ed out box in the values column (easier to see the value in a column than trying to read it from the graph).

Change History (15)

comment:1 Changed 11 years ago by adeas31

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in r18076.

Only thing which I don't like is that the column name should be "Start Value" instead of "Value" otherwise its confusing.

comment:2 Changed 11 years ago by sjoelund.se

  • Resolution fixed deleted
  • Status changed from closed to reopened

Oh, I didn't mean the start-value but rather reading from the result-file which are parameters (or time-invariant variables also stored in the same way in the mat-file). So the calculated value of dependent parameters (that you cannot modify), are shown. With r18076, the start-value (0.000) is shown instead of the actual value of the parameter (0.0010).

This value cannot be taken from the xml-file, but rather something like:

ModelicaMatVariable_t var = omc_matlab4_find_var(reader, varName);
if (var->isParam) {
  showValueInColumn(varName, reader->params[var->index]);
} else {
  // leave column blank; it's a continuous-time variable and the start-value won't match the initial value anyway
}
Last edited 11 years ago by sjoelund.se (previous) (diff)

comment:3 Changed 11 years ago by adeas31

OK But I am not going to implement this. The reason is it will make things very slow. Because either I have to use the var API or I have to the read the value from the result file. So models like enginev6 which has approx. variables more than 6000 will make things very very slow.

Implement a new API which returns all the values of variables in one call. Then I can use that list to display the values.

comment:4 Changed 11 years ago by sjoelund.se

You mean like:

for (i=0; i<reader->nall; i++) {
  ModelicaMatVariable_t *var = reader->allInfo + i;
}

Note that the file API is very fast for reading parameters since all the info is in the headers. Should be faster than reading the xml-file at any rate.

comment:5 Changed 11 years ago by adrpo

Not all variables are in the .mat file. Some might have been filtered out with the variable filter.

comment:6 Changed 11 years ago by sjoelund.se

Even better - why show filtered out variables in OMEdit anyway?

comment:7 Changed 11 years ago by adeas31

Its not only the .mat file. I have to support it for .plt and .csv as well.

comment:8 Changed 11 years ago by sjoelund.se

No, you don't. Just add a tooltip saying the text-based formats are slow and some features are disabled for them.

comment:9 follow-up: Changed 11 years ago by adeas31

Also, everything is scattered. So I have to do a lot of things to fetch the information e.g,

vars = readSimulationResultVars();
foreach (var, vars)
{
  for (i=0; i<reader->nall; i++) {
    ModelicaMatVariable_t *var1 = reader->allInfo + i;
    if (var.name == var1.name) {
      // use this variable value;
    }
  }
}

The above code is bogus but that is only way right now. I need information at one place so that I can built the data structures in one go. Either put all the information in the result file or put all the information in the xml file.

comment:10 in reply to: ↑ 9 Changed 11 years ago by adeas31

Sorry I forgot to add another loop in the code for reading the unit and description from the xml file.

Replying to adeas31:

Also, everything is scattered. So I have to do a lot of things to fetch the information e.g,

vars = readSimulationResultVars();
foreach (var, vars)
{
  for (i=0; i<reader->nall; i++) {
    ModelicaMatVariable_t *var1 = reader->allInfo + i;
    if (var.name == var1.name) {
      // use this variable value;
    }
  }
}

The above code is bogus but that is only way right now. I need information at one place so that I can built the data structures in one go. Either put all the information in the result file or put all the information in the xml file.

comment:11 Changed 11 years ago by sjoelund.se

Well... It for sure can not be in the XML-file, because you want the values calculated by the simulation.
And the result-file cannot contain information like units, because that's not in the .mat format (and we cannot change the format). So you have to update the information after a simulation run and do it in two steps.

comment:12 Changed 11 years ago by adeas31

Yes, so things will become slow in two steps :). Anyways I will try to add it and see how much it will change the GUI response time.

There is still one more issue. We should add a new column called "Final Value". In short two columns, one is "Start Value" which contains the changeable values, second is "Final Value" which contains the values of the variables from the result file.

comment:13 Changed 11 years ago by sjoelund.se

Why would it become slow? The plot tool already reads in the metadata for the whole file when you create a new mat4 reader. So all the information is already there... Update it in a thread for all I care :)

Oh, and if you add more columns, it would be nice to be able to select which ones should be visible.

Last edited 11 years ago by sjoelund.se (previous) (diff)

comment:14 Changed 11 years ago by adeas31

Done in r18081.

comment:15 Changed 10 years ago by sjoelund.se

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.