Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty printing list of parameters. #2481

Closed
Datseris opened this issue Feb 22, 2024 · 6 comments · Fixed by #2489
Closed

Pretty printing list of parameters. #2481

Datseris opened this issue Feb 22, 2024 · 6 comments · Fixed by #2489
Assignees

Comments

@Datseris
Copy link

In MTK, I would like to obtain a printable list of parameters along with all their "descriptions": default value, description field, and any other metdata field. Just parameters(prob/sys) does not do this, it only prints the parameters in latex notation but without any metadata. Is it straightforward to get the nice string with metadata that is printed when the whole system itself is printed?

@ChrisRackauckas
Copy link
Member

Instead of just parameters, we should make a whole unknowns, variables, etc. system on this. Needs a better naming scheme than unknowns_pretty(sys), parameters_pretty(sys), etc. Thoughts?

I think as an inter-exchange giving a NamedTuple dump might be good? That would allow for making data frames from it.

@Datseris
Copy link
Author

Yeah exactly, vector of NamedTuple with the first entry being name = Symbol would be great. The rest of the entries is a sequential push of all other metdata.

We could use dump in the name: parameters_dump or unknowns_dump.

@ChrisRackauckas
Copy link
Member

Might be good to do early since this is not hard to do and would be a good debugging tool for v9 updates.

@baggepinnen
Copy link
Contributor

I have this gist that creates a table like below, something from there could perhaps be used as a starting point
https://gist.github.com/baggepinnen/7dda5a13dc898cb06f8fdd5c1dc101a2

julia> describe(sys)
Model sys with
11 (19) equations
1 states
15 parameters
Inependent variable t: Time
┌─────────────────────┬───────────────┬────────────────────┬─────────────┬───────────────────────────────────────────┐
│ Variable name       │ Variable type │ Default value      │ Bounds      │ Description                               │
├─────────────────────┼───────────────┼────────────────────┼─────────────┼───────────────────────────────────────────┤
│ PI₊Dzero₊output₊u   │ variables     │ 0.0                │ (-Inf, Inf) │ Inner variable in RealOutput output       │
│ PI₊Izero₊output₊u   │ variables     │ 0.0                │ (-Inf, Inf) │ Inner variable in RealOutput output       │
│ PI₊addPID₊input1₊u  │ variables     │ 0.0                │ (-Inf, Inf) │ Inner variable in RealInput input1        │
│ PI₊addPID₊input2₊u  │ variables     │ 0.0                │ (-Inf, Inf) │ Inner variable in RealInput input2        │
│ PI₊addPID₊input3₊u  │ variables     │ 0.0                │ (-Inf, Inf) │ Inner variable in RealInput input3        │
│ PI₊addPID₊output₊u  │ variables     │ 0.0                │ (-Inf, Inf) │ Inner variable in RealOutput output       │
│ PI₊addP₊input1₊u    │ variables     │ 0.0                │ (-Inf, Inf) │ Inner variable in RealInput input1        │
│ PI₊addP₊input2₊u    │ variables     │ 0.0                │ (-Inf, Inf) │ Inner variable in RealInput input2        │
│ PI₊addP₊output₊u    │ variables     │ 0.0                │ (-Inf, Inf) │ Inner variable in RealOutput output       │
│ PI₊ctr_output₊u     │ variables     │ 0.0                │ (-Inf, Inf) │ Inner variable in RealOutput ctr_output   │
│ PI₊gainPID₊input₊u  │ variables     │ PI₊gainPID₊u_start │ (-Inf, Inf) │ Inner variable in RealInput input         │
│ PI₊gainPID₊output₊u │ variables     │ PI₊gainPID₊y_start │ (-Inf, Inf) │ Inner variable in RealOutput output       │
│ PI₊gainPID₊u        │ variables     │ PI₊gainPID₊u_start │ (-Inf, Inf) │ Input of SISO system                      │
│ PI₊gainPID₊y        │ variables     │ PI₊gainPID₊y_start │ (-Inf, Inf) │ Output of SISO system                     │
│ PI₊limiter₊input₊u  │ variables     │ PI₊limiter₊u_start │ (-Inf, Inf) │ Inner variable in RealInput input         │
│ PI₊limiter₊output₊u │ variables     │ PI₊limiter₊y_start │ (-Inf, Inf) │ Inner variable in RealOutput output       │
│ PI₊limiter₊u        │ variables     │ PI₊limiter₊u_start │ (-Inf, Inf) │ Input of SISO system                      │
│ PI₊limiter₊y        │ variables     │ PI₊limiter₊y_start │ (-Inf, Inf) │ Output of SISO system                     │
│ PI₊measurement₊u    │ variables     │ 0.0                │ (-Inf, Inf) │ Inner variable in RealInput measurement   │
│ PI₊reference₊u      │ variables     │ 0.0                │ (-Inf, Inf) │ Inner variable in RealInput reference     │
│ u                   │ variables     │                    │ (-1, 1)     │ A short description of u                  │
│ PI₊Dzero₊k          │ variables     │ 0                  │ (-Inf, Inf) │ Constant output value of block            │
│ PI₊Izero₊k          │ variables     │ 0                  │ (-Inf, Inf) │ Constant output value of block            │
│ PI₊addPID₊k1        │ variables     │ 1                  │ (-Inf, Inf) │ Gain of Add input1                        │
│ PI₊addPID₊k2        │ variables     │ 1                  │ (-Inf, Inf) │ Gain of Add input2                        │
│ PI₊addPID₊k3        │ variables     │ 1                  │ (-Inf, Inf) │ Gain of Add input3                        │
│ PI₊addP₊k1          │ variables     │ 1                  │ (-Inf, Inf) │ Gain of Add input1                        │
│ PI₊addP₊k2          │ variables     │ -1                 │ (-Inf, Inf) │ Gain of Add input2                        │
│ PI₊gainPID₊k        │ variables     │ 1                  │ (-Inf, Inf) │ Gain                                      │
│ PI₊gainPID₊u_start  │ variables     │ 0.0                │ (-Inf, Inf) │                                           │
│ PI₊gainPID₊y_start  │ variables     │ 0.0                │ (-Inf, Inf) │                                           │
│ PI₊limiter₊u_start  │ variables     │ NaN                │ (-Inf, Inf) │                                           │
│ PI₊limiter₊y_max    │ parameters    │ Inf                │ (-Inf, Inf) │ Maximum allowed output of Limiter limiter │
│ PI₊limiter₊y_min    │ parameters    │ -Inf               │ (-Inf, Inf) │ Minimum allowed output of Limiter limiter │
│ PI₊limiter₊y_start  │ variables     │ NaN                │ (-Inf, Inf) │                                           │
│ p                   │ parameters    │                    │ (-Inf, Inf) │ A description of p                        │
└─────────────────────┴───────────────┴────────────────────┴─────────────┴───────────────────────────────────────────┘

@ChrisRackauckas
Copy link
Member

That looks like a good start to me.

@AayushSabharwal
Copy link
Member

I have an implementation in #2489

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants