﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4877	Optionally prune all the equations in a model that are not needed to compute the outputs	Francesco Casella	Willi Braun	"In 2011, together with PhD student Vincenzo Manzoni, I proposed a method to prune the dependency graph of the equations in a Modelica model to only keep those equations that are strictly necessary to compute the top-level outputs of a model, see paper [https://www.modelica.org/events/modelica2011/Proceedings/pages/papers/32_poster_ID_130_a_fv.pdf Minimal Equation Sets for Output Computation in Object-Oriented Models].

This could be very useful in a number of cases:

- to speed up the computation of models in FMUs, by eliminating the computation of equations that may be included in the model for monitoring purposes, but that are not required to compute the output
- to get simplified models very cheap, e.g., if you build a planar MultiBody system models, only put the motion on the plane as output, and evaluate the parameters, it could automatically remove all the equations for decoupled out-of-plane dynamics without the need of explicitly using different models for that purpose. This is particularly useful for systems that have ''some'' planar parts, and some full 3D motion mixed up.
- to automatically remove the computation of unneded thermodynamical properties in thermofluid models with equation-based fluid models

Unfortunately, as far as I understand, nobody has ever tried to implement this in a Modelica tool - at the time, we only tried it out manually on toy models. For me, it would be particularly interesting to see how much this method can help in real-life cases. In fact, it could turn out that in some cases of industrial relevance, you can get a significant speed-up, at practically zero cost for the modeller, as it would only be necessary to declare the top-level interesting outputs.


From what I understand of the development in [https://github.com/OpenModelica/OMCompiler/pull/2349#issuecomment-380069675 PR #2349], implementing this additional feature should be rather straightforward, because all the required data structures and graph-analysis algorithms are already there. In a nutshell, it is only necessary to build the dependency graph from the outputs, adding the implicit dependency between each state variable and its corresponding derivative to the explicit dependencies in equations.

Are you interested in this development?"	enhancement	new	high	Future	Backend				
