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

Display of models in latex-capable environements #2488

Open
baggepinnen opened this issue Feb 23, 2024 · 1 comment
Open

Display of models in latex-capable environements #2488

baggepinnen opened this issue Feb 23, 2024 · 1 comment
Labels
bug Something isn't working usability

Comments

@baggepinnen
Copy link
Contributor

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

@baggepinnen baggepinnen added the bug Something isn't working label Feb 23, 2024
@ChrisRackauckas
Copy link
Member

It may be a Pluto restriction as we have to output something for the show on the special MIME type. I don't know if we can show multiple things, part of it being TeX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working usability
Projects
None yet
Development

No branches or pull requests

2 participants