Skip to content

Display of models in latex-capable environements #2488

Open
@baggepinnen

Description

@baggepinnen

Currently, if a model is shown in an environment that supports Latex (such as Pluto and documentation), we have chosen to show only the equations of the system typeset as latex math. This only looks good for toy models, toy in the sense of small and uses exclusively mathematical notation/variable names. For more realistic models, this instead often looks rather terrible, and also fails to show other relevant information, such as variables and parameters etc.

As an example, here's how we display a PI controller
image

The terminal output is both looking nicer and at the same time more informative, I'd prefer if this was the default in all environments, and latex display can be opt in for those who are interested and have a suitable model where it makes sense.

Here's the terminal output for the same system for reference

julia> ModelingToolkitStandardLibrary.Blocks.LimPID(; name=:hrfd)
Model hrfd with 10 (18) equations
States (20):
  reference₊u(t) [defaults to 0.0]: Inner variable in RealInput reference
  measurement₊u(t) [defaults to 0.0]: Inner variable in RealInput measurement
  ctr_output₊u(t) [defaults to 0.0]: Inner variable in RealOutput ctr_output
  addP₊input1₊u(t) [defaults to 0.0]: Inner variable in RealInput input1
  addP₊input2₊u(t) [defaults to 0.0]: Inner variable in RealInput input2
  addP₊output₊u(t) [defaults to 0.0]: Inner variable in RealOutput output
  gainPID₊u(t) [defaults to gainPID₊u_start]: Input of SISO system
  gainPID₊y(t) [defaults to gainPID₊y_start]: Output of SISO system
  gainPID₊input₊u(t) [defaults to gainPID₊u_start]: Inner variable in RealInput input
  gainPID₊output₊u(t) [defaults to gainPID₊y_start]: Inner variable in RealOutput output

Parameters (14):
  addP₊k1 [defaults to 1]: Gain of Add input1
  addP₊k2 [defaults to -1]: Gain of Add input2
  gainPID₊u_start [defaults to 0.0]
  gainPID₊y_start [defaults to 0.0]
  gainPID₊k [defaults to 1]: Gain
  addPID₊k1 [defaults to 1]: Gain of Add input1
  addPID₊k2 [defaults to 1]: Gain of Add input2
  addPID₊k3 [defaults to 1]: Gain of Add input3
  limiter₊u_start [defaults to NaN]
  limiter₊y_start [defaults to NaN]

The latex output also has a very large number of corner cases where it just looks very poor and sometimes borderline incorrect, like here, so having it as default doesn't feel right
image

A related issue is

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions