matth
matth

Reputation: 2696

Modelica style guide

For many programming languages there are style guides available, e.g. PEP8 for Python, this Matlab style guide or the style guides by Google. For Modelica I found the conventions described in the Users Guide, but is there something more comprehensive available? And, ideally, a tool that helps with the re-formatting, indentation etc.?

Upvotes: 10

Views: 761

Answers (2)

marco
marco

Reputation: 6665

Meanwhile there are two command line tools which format Modelica code quite well:

  • mofmt: a python rust package installable with pip or pipx cargo.

  • modelica-fmt: a tool written in go. Binaries are available in the tags section. Apparently development has stopped in 2021 with v0.2.

Upvotes: 2

Michael Tiller
Michael Tiller

Reputation: 9421

The guidelines in the Modelica User's Guide are the only ones I am aware of. The topic has been discussed several times at the design meetings and I've written one paper that discussed the topic but didn't really propose concrete guidelines.

Part of the issue is that while the Modelica Association might have their guidelines (as your've seen), they don't represent any particular business or industries guidelines which might be different. In other words, I could envision having many different guidelines floating around that are tailored to specific types of models or specific industry conventions. But the Modelica ones are the only ones I am specifically aware of (although it would not surprise me if large organizations using did have their own formal style guidelines).

Upvotes: 10

Related Questions