Like many engineers, I use Mathcad as a scratchpad to jot down equations, model physical systems and explore technical ideas. My specialty is fluid dynamics and heat transfer, but I also dabble in electromechanical modelling.
But deriving equations for dynamic engineering systems demands time and skill. I’ll be the first to admit that I often lack both.
I recently discovered I already had the tools to translate an initial schematic of an engineering system to a Mathcad function (but my own lack of foresight prevented me from connecting the dots earlier). The technology lets me
- model multidomain engineering systems by connecting physical components on a virtual workspace,
- and convert these block-diagram models to Mathcad functions.
The technology is a software tool called MapleSim. It has blocks for modelling electrical, mechanical, multibody, hydraulic, thermal and magnetic systems, as well as signal-flow functionality. The equations are already programmed in, so I don’t need to derive them.
MapleSim also generates C code from your model (simply point-and-click). The code can be parameterised with any set of properties (for example, resistances, inertias etc) and includes a solver.
This code can also be compiled to a Mathcad-compatible DLL.
This, for example, is a MapleSim model of a DC motor with backlash and a PI controller. The model was created by dragging physical components on a workspace, then connecting them together.
And this is the compiled function (after code generation) implemented in Mathcad.
I’ve parameterised the Mathcad function with respect to the set point and controller gains, but I could have picked any other combination of properties.
Compiling MapleSim code to a Mathcad-compatible DLL sounds tricky. You need some awareness of C coding, but you don’t need to be an expert or even consider yourself a competent programmer. Once you know the steps to follow, it’s simple and is mostly copy and paste. For anyone who wants to try, I’ve prepared a Visual Studio example project to make this easier (email me for the link).
Converting block-diagram physical models to Mathcad functions is novel and has the potential to save countless hours. Given that the volume of coffee I drink is positively correlated with the amount of algebra I do, this approach could lower my blood pressure as well.