Monthly Archives: June 2015

LiveCode speed of execution

Reactor Lab was built using LiveCode. Get the free Community version at  LiveCode.org. LiveCode is great because it is cross-platform: write once and deploy on many platforms. Another advantage is that the stack model and scripting language are very stable in the sense of supporting past versions: some of the script dates from 1993 and HyperCard.

In most cases in Reactor Lab, the speed of LiveCode is sufficiently fast. The most demanding lab using math computations in LiveCode script is Division 7 Biological Reactions, Lab 3 Immobilized Enzyme Profiles. In that lab, as the user moves a slider to change an input parameter, LiveCode solves a second-order, ordinary differential equation using the iterative shooting method, and then updates the graphics.

Calculations in the dynamic Catalyst Pellet are too demanding to run in LiveCode script. That lab has a detailed, elementary-step simulation of carbon monoxide oxidation over a porous solid catalyst. A function was written in C++ to do finite-difference integration of a set of partial differential equations. The external is then compiled separately on Mac and Windows to make an “external” (.bundle on Mac, .dll on Windows). The LiveCode stack calls this external to do the calculations. The advantage of an external is that it is fast. The disadvantage is that you must compile a separate executable for each platform.

When the Catalyst Pellet external was written in 2008, we used Revolution 4, where Revolution was the earlier name for LiveCode. The Catalyst Pellet and its external ran great when we finished it but it is not compatible with later versions of LiveCode. Therefore we pulled the dynamic Catalyst Pellet out into its own standalone app. The problem presumably is that the interface specification between externals and LiveCode changed. The stack and its external initially appear to run in LiveCode 7, but there appears to be a memory leak and a crash ensues. We haven’t had the time to keep the external up to date. The original version posted in the Download section works well.

The speed at which LiveCode 7 updates the card graphics appears to have slowed from previous versions. This may be related to the addition of resolution independence and higher resolution target displays. To speed things up, we lock the screen before changing many separate elements in the display, then unlock the screen when everything on the card has been updated.

SimzLab added to Download page

An archival copy of SimzLab was added to the Download page. Reactor Lab was removed and the “on line” functions do not work in this copy of SimzLab. This copy does contain working copies of PureWaterLab, the Control Lab, and a heat exchanger simulation.

Looking for SimzLab?

We closed the SimzLab project in order to concentrate our efforts here with Reactor Lab. An archival copy of SimzLab is posted at the Download page here at the Reactor Lab site. As we get time, we will incorporate some of the PureWaterLab and Control Lab modules from SimzLab into Reactor Lab.