A Transparent Data Persistence Architecture for the SimJulia Framework

SimJulia is an open source discrete event simulation framework written in the Julia programming language. The framework transforms processes expressed as functions into resumable functions using the Resumable Functions library. The current SimJulia implementation lacks functionality to persist any variables, characterising the state of such a transformed process during the simulation in a transparent way. To mitigate this shortcoming, we extended both the SimJulia framework and the Resumable Functions library by implementing a transparent probing and persistence architecture, employing language-specific metaprogramming features. Our implementation is based on the Object-Relational Mapping concept (ORM) using the PostgresORM library, supported by the PostgreSQL Relational Database Management Systems (RDBMS), and Julia's macro expansion.

A simulation model expressed by means of functions is transformed into resumable functions ready to be run by SimJulia. Our solution uses the code analysis occurring at this stage to store a monitored function’s state variables configuration in the database. The user controls which processes are monitored through a flag set on each process. After the code analysis phase, macro expansion takes place, creating the object definitions based upon the configuration saved earlier, before the simulation runs. During the simulation, successive events invoke an array of callback functions being executed. The last function in such an array is the probing function. Monitored processes are probed using the object definitions created just in time. Instantiated objects materialising the state of the concerned process are then persisted in the table specific to the concerned process. The data is subsequently available in the RDMBS, and can be visualised using the technology of choice. Our implementation visualises the data using the VueJS library.

Our contribution consists of a transparent probing and persistence mechanism. Using Julia's metaprogramming capabilities, we were able to divert from a static ORM configuration as often seen in web applications, to a transparent and dynamic configuration. The end user has the evolution of the state variables available throughout the simulation, without having to provide any configuration.
Publication Reference
Van Der Paelt, P., Lauwens, B. and Signer, B.: "A Transparent Data Persistence Architecture for the SimJulia Framework", ORBEL 2022, 36th Annual Conference of the Belgian Operational Research Society, Gent, Belgium, September 2022