Multiple instances of the same model on a single page

More or less from the outset, it has been possible to have widgets for multiple models on the same Systo page.    For example, to have the model diagram, sliders and plots for the Miniworld model and for a predator-prey model on the same page.

For some time, I have been thinking that it would be great if you could have more than one instance of the same model on a page.  You could then work with each one independently – changing the model diagram of one copy without affecting the other, changing the parameter values (via sliders) for one independently of the other, or making more radical changes to one of the copies.    This could be really useful for comparing alternative model-diagram layouts, alternative parameter settings, or alternative model structures and equations.

I’ve now got a very basic implementation of this idea.  The following figure shows two instances of the Miniworld model on a single page.

multiple_instances

The top row has widgets for the first instance, while the second row has widgets for the second.  (Of course, it doesn’t have to be like this – they can be arranged anyway the designer of the page wants.)   You can see that the diagrams, the parameter settings, and thus the plots, are different for the two instances, although they started off the same – they can be changed independently.

The potential offered by this enhancement to Systo is considerable.   Being able to compare alternative similar-but-different models for addressing the same problem is a fundamental part of the modeller’s craft, and current tools do little to support this activity.

One example of this could be for displaying some aspect of two or more instances of the same model within the same panel.   For example, a single widget could show the “diff” of two instances – i.e.  where the two instances are identical and where they differ, perhaps using colour-coding of the model symbols.    A previous posting on the compare_models_text widget gives an example of what this might look like.

Internals

Models in Systo are stored as a single “map” – a collection of similar objects – in SYSTO.models.    All I have done is to provide a simple utility to copy an existing model and add that to the collection of models.   Widgets are then set up with one of these copies, rather than the original model.   This is crude, but it does the job.

Because the original (master) copy and the copies themselves are stored in the same “map”, it is very easy to switch between viewing the master and a copy.    The master copy and the copies are tagged with this information, so that a web page developer can, for instance, prevent editing of the master.   Each copy is tagged with the ID of the model it came from, so that relevant metadata about the master is available to the copy.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s