No items found.
August 8, 2024

The Value Proposition for Collimator

The Value Proposition for Collimator

At Collimator, we are building the future of advanced modeling and simulation, and we believe that future has Python—with its growing versatility and popularity—at its center. This might be an unexpected conclusion, so we thought we would take a few minutes to explain why we chose Python, what has been missing from the Python ecosystem, and what we’ve added to not only fill the gaps, but take modeling and simulation to the next level.

The dominance of MathWorks

MathWorks was founded in 1984, with their first product, PC-MATLAB, a reworked version of a free, open source numerical computing language originally designed for academia. As the company grew, so did their platform, adding more and more language features, as well as visual modeling tools, analysis modules, graphical interface builders, and so on. Currently, the company’s MATLAB and Simulink products are indisputably the dominant players in the market for scientific computing and engineering applications.

With that said, let’s look at what key features a modeling and simulation environment has historically needed to provide to be useful:

  1. General scientific computing and scripting: This includes general numerical computation libraries in a scripted environment, where workflows can be automated. This functionality is provided by the MATLAB product of the MathWorks suite.
  2. Block-diagram environment: This provides an easy and intuitive way to separate components and functionality into individual graphical blocks, which can be arranged and interconnected in a graphical canvas to represent larger and more complex systems, in much the same way that engineering block diagrams do. Hierarchy and composability in this environment enhance understanding and teamwork by allowing complex systems to be broken down into manageable sub-systems. This is handled by Simulink in the MathWorks suite.
  3. Support for state machines: State machines are a relatively simple way to represent event-driven transitions within a complex system, and they correspond directly to certain classes of controls software. For this, Mathworks has StateFlow.
  4. Support for acausal modeling: In this framework, as opposed to deriving a mathematical model for a system first and then simulating the derived model, the system is directly represented as interconnected physical components. Derivation of the equations for the physical system is left to the simulation tool. Mathworks has Simscape for acausal modeling.
  5. Code generation: For the transfer of model based designs to components and controllers in embedded hardware, an ideal tool should provide automatic code generation for the target embedded hardware. Simulink, Simscape, and Stateflow support code generation, albeit with some limitations.

So, Mathworks provides a single unified platform offering all the traditionally necessary features in a modeling and simulation tool. Unsurprisingly, it is a preferred one-stop shop for many engineers. Alternative ecosystems either lack necessary functionality under a single umbrella, or fail to provide a tight integration between components.

The case for Python

Since about 2012, Python has been a rising star in industry and academia, driven primarily by major improvements to it’s support for numerical computing (NumPy and SciPy), data processing (Pandas), and of course, AI / ML (TensorFlow and PyTorch). As data science continued to grow as a field, Python became even more popular due its general purpose nature, leading it to be useful throughout the data acquisition, pre-processing, computation (e.g., for ML), and then post-processing workflow. Add in strong community support and relatively easy-to-use language features, and it makes sense why Python has become so popular.

Credit: https://www.tiobe.com/tiobe-index/

Likely due to its increasing popularity, its ease of use, and widespread adoption, engineers and students started asking when there would be a tool based on Python that could match the workflow of Simulink:

For many years, there was not a clear answer to that question. Despite its popularity and capabilities, Python was still lacking key functionality, keeping it from seeing mass adoption for modeling and simulation. Collimator was founded to create the solution many were asking for, but in order to move forward with Python, we would have to identify and overcome its weaknesses.

What is holding Python back?

Let’s revisit our list of traditional modeling and simulation capabilities from above, and see how Python stacks up:

  1. General scientific computing and scripting: This is perhaps the area where Python presents as the strongest contender to MATLAB. The scripting capabilities of Python are superior to MATLAB, and scientific computing libraries in the Python ecosystem—particularly NumPy and SciPy—offer a viable alternative. Indeed, this aspect is playing out as both industry and academia have started to adopt Python in favor of MATLAB for general scientific computing. Specialized libraries for AI (PyTorch, Tensorflow), control systems (python-control), and wrappers for advanced optimization (NLopt, IPOPT) further strengthen the case for Python over MATLAB.
  2. Block-diagram environment: The Python ecosystem lacks a polished graphical block-diagram environment for modeling and simulation. There are some frameworks that adopt the conceptual approach of block-diagram based modeling, for example bdsim, pysimcoder, and Drake, however only bdsim and pysimcoder offer a graphical interface for drawing these diagrams. bdsim does not have advanced blocks, and pysimcoder is largely meant for code generation, not simulation. Drake, which is written in C++ but comes with Python bindings, has many advanced features, but its approach of constructing diagrams in code (i.e., without a graphical interface) is relatively tedious and difficult to maintain over time. In other words, there is nothing in the Python ecosystem that quite matches the workflow of Simulink.
  3. Support for state machines: While support for state machines is available in a variety of libraries (Python state-machine, pytransitions), a major shortcoming, again, is the lack of a graphical editor. Thus, a strong alternative to Stateflow doesn’t exist in the Python ecosystem.
  4. Support for acausal modeling: Acausal modeling paradigms are supported by some libraries such as CASADI, however a graphical editor to build and process acausal diagrams remains absent. Simscape should not feel threatened by the Python ecosystem.
  5. Code generation: This has very limited support in Python land. Some AI libraries such as Tensorflow provide a mechanism to compile the Python models and then call them from a C program, but this is far from a complete solution.

So it’s clear that vanilla Python support for most of our list of traditional modeling and simulation requirements is spotty at best. There are a few other issues worth mentioning as well.

First is fragmentation. There are library repositories such as PyPI, and the Anaconda folks have done some amazing integration work, but when you get down to the brass tacks of creating a solid, performant, easily upgradable Python environment for modeling and simulation, it’s still not simple. Getting disparate libraries to work together, sorting out dependencies and version conflicts, not to mention data storage and management—suffice it to say that it can be a lot.

Second is the issue of performance. Python is an interpreted language that supports dynamic typing and high-level abstractions. While these features make it user-friendly and versatile, they also introduce overhead that can slow down execution speed compared to lower-level, statically-typed languages like C or C++. Julia was designed to address the “two-language problem” by providing high-level syntax with the performance of low-level languages. However, recent advancements in Python, such as the introduction of frameworks like JAX and performance optimizations in recent versions, are enhancing performance through just-in-time compilation, efficient parallelization techniques, and various under-the-hood improvements.

So Python on its own does not offer a clear alternative to the MathWorks suite of products. The lack of a modern graphical user interface, the somewhat fragmented ecosystem from the perspective of a one-stop platform for modeling and simulation, and the performance pitfalls mean that if you want to use Python for serious modeling and simulation, you’ll have your work cut out for you.

How Collimator is taking Python to the next level

Collimator is a Python and cloud-native modeling and simulation platform. For the details of our simulation engine, and how we leverage the popularity and flexibility of Python along with high performance with just-in-time compilation, see this article. For our purposes here, it is sufficient to understand that we aim to leverage the strengths of Python and the strengths of the Mathworks paradigms in order to create a whole that is greater than the sum of its parts. In short, a platform for the problems of today and the future. Let’s take a look:

A modern graphical block-diagram

Collimator provides a web and cloud native block-diagram based environment where blocks can be a combination of causal systems, state machines, code, and acausal blocks. The user can combine and interconnect these blocks freely in the intuitive interface.

A Collimator model of the propellant tank of a rocket engine

Support for state machines

Collimator provides a framework for modeling state machines on the graphical canvas and integrating them seamlessly with other blocks.

A state machine modeling the behavior of a cardiac pacemaker

Support for acausal modeling

Collimator provides a framework for acausal modeling with a continuously improving and growing acausal systems library.

An acausal model of a motor with control circuit

Code generation

Code generation for deployment to hardware is a challenge. The poor performance and unreliable timing of interpreted code, along with the considerable requirements of Python relative to typical microcontrollers means that it is almost never used for industrial control applications. Collimator settles on two solutions: for small, low-power MCUs, it produces MISRA-compliant C code for controllers built as low-level discrete logic blocks; for more robust, OS-based systems such as those using GPUs, it compiles the code with tools from major machine learning libraries and then integrates the compiled code into a C program. For instance, JAX allows this path via the XLA compiler and the TensorFlow C API.

Tight integration of advanced Python libraries under one umbrella

Being Python native allows Collimator to tightly integrate all the libraries in the Python ecosystem—and those outside but providing Python bindings—under a single umbrella. This cohesive integration enables further development on top of the combined power of the existing state-of-the-art. Some key integrations are highlighted below.

Advanced AI libraries

Collimator provides pre-built blocks to easily import models trained in PyTorch, Tensorflow, and Equinox. It also allows users to train their own models in Equinox within Collimator.

Equinox MLP (left), PyTorch (center), and TensorFlow (right) blocks in Collimator canvas

Data-driven modeling with system identification libraries

Collimator integrates with system identification libraries—that allow learning of a mathematical model for dynamics of a system from experimentally obtained data—such as pysindy.

The SINDy block in Collimator, which can be trained from the UI through provision of experimental data

Third-party 3D modeling libraries

Driven by the popularity of Python, increasingly many simulation tools offer a Python API. For example, Ansys provides the capability to export reduced order models as digital twins through their PyTwin library. Such models can be imported into Collimator and used seamlessly with other blocks. Similarly, tools that use the Modelica modeling language can export Functional Mockup Units (FMUs) which can then be imported into Collimator and used in simulations.

An Ansys PyTwin model of coupled clutches being controlled by PID controllers

Robotics libraries such as MuJoCo

Collimator integrates with advanced Robotics libraries such as MuJoCo, to model and control Robots.

A MuJoCo model of the Panda robot imported in Collimator and controlled with inverse kinematics
An animation of the Panda robot using an algorithm developed in Collimator

Import any Python library in the custom PythonScript block

Where dedicated integrations are not made available, Collimator allows users to import any Python library in a PythonScript block and use the capabilities of the library in the block through Python code.

The roboticstoolbox library is being imported in a PythonScript block, so that its functionality can be used within the block to create a robot controller.

Lastly, Collimator also integrates with virtual hardware in the loop testing platforms such as Quanser, and the Robot Operating System (ROS).

Collimator provides a one-stop platform for a seamless integration of the advanced capabilities of existing libraries. Developing on top of these combinations with our state-of-the-art simulation and scientific-computing engine unlocks countless possibilities.

Beyond just an alternative to MathWorks

Collimator’s goal is not to be a mere alternative to MathWorks, but to go far beyond in providing new and advanced capabilities as the modeling and simulation platform of the future. This goal has influenced the design of Collimator’s simulation engine, detailed here. There are three points to highlight in this respect:

Automatic differentiation in end-to-end simulation

One of the key principles in the design of Collimator is automatic differentiation of any simulation output, objective, or constraint, with respect to any model parameters (which could be neural network weights) and initial conditions. As such, most native Collimator blocks are fully differentiable. Where possible, integration with other libraries is also ensured to be compatible with automatic differentiation. This unlocks opportunities for optimization, neural network training, and creating models that combine classical physics-based modeling, data-driven approaches, and AI methods. This greatly enhances productivity by automating a time-consuming process traditionally based on manual trial-and-error.

Cloud native platform and high-performance computing

Being cloud-native, Collimator provides instant scale-up of computing power. Whether you need to run parameter sweeps, Monte Carlo simulations, uncertainty quantification workflows, or single compute-heavy simulations, the required computing power is always available instantly.

Additionally, our architecture enables seamless collaboration. From central storage of shared files to real-time co-editing of models, the cloud allows teams to work together more efficiently.

Generative AI

Collimator is the first to explore how Generative AI can help engineers in their day-to-day tasks, boosting their productivity. See early examples of this approach published in this video. Since Collimator’s model representation is in Python, a language very well understood by large language models (LLMs), it is relatively easy for off-the-shelf LLMs to navigate and understand Collimator’s modeling paradigm, resulting in efficient processing of user requests. Our goal is to make model creation, iteration, visualization, and results interpretation  faster and more natural, using multi-modal inputs and outputs.


In conclusion, Collimator offers a robust platform for the modeling and simulation needs of today, and looking into the future. By addressing the limitations of the Python ecosystem and offering seamless integration of advanced Python libraries within a modern graphical block-diagram environment, Collimator delivers on both functionality and ease of use. Its cloud-native platform, support for state machines and acausal modeling, and capabilities in automatic differentiation and high-performance computing highlight its potential to meet diverse needs. Beyond being an alternative, Collimator redefines simulation by integrating classical physics-based approaches with the latest in AI technology.

Want to learn more? Check out the documentation and tutorials for our open-source simulation engine and libraries at py.collimator.ai, and get started with the browser-based modeling environment at app.collimator.ai.

Frequently Asked Questions