| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Experimenting with XMILE

Page history last edited by robertm 10 years, 11 months ago

As a way of getting to grips with XMILE, I've experimented a bit with using it.  This is not an endorsement of it in its present form - just that there's enough there to start working with.  

Robert Muetzelfeldt, 1st April 2008

 

 

Generating XMILE documents from Simile

Simile has two text formats for saved models: Prolog and XML.   To experiment with generating XMILE from Simile models, I've taken the latter as my starting point, and written an XSLT stylesheet for transforming SimileXML into XMILE.  

 

I've converted 5 'flat' System Dynamics models (i.e. SD models with no disaggregation, since that's all that XMILE can represent) using this stylesheet.   Please contact me if you'd like to know more about how this was done.

 

 

Changes to XMILE

The XMILE generated from the Simile models differs in two ways from 'standard' XMILE.

 

First, in standard, XMILE, the inflows and outflows child elements of the stock element have a simple text content - a comma-separated list of flows.   I have changed this to a separate inflow or outflow element for each inflow or outflow.   The principle here is that one should not mix different ways of representing the symbolic structure of a model.    The standard XMILE syntax would require a separate string-processing procedure to split apart the inflows or outflows string, which is quite unnecessary.

 

(One could make the same case for the comma-separated x,y coordinates used in several places, but I have not bothered to inject this change.)

 

Second, standard XMILE uses a rather quirky way representing a sketched (tabulated) relationship between two variables.   The independent variable is listed as the sole content of the equation (making it look like the dependt variable is simply equal to the dependent variable), while the information defining the tabulated relationship is held in a separate gf element.  I agree with Magne's comment, that this should be just another type of function (which is the way it is represented in SimileXML), and I have retained that syntax in the generated XMILE.   See the LINTUL model for an example.

 

 

Issues concerned with the representation of equations

The XMILE documentation makes it clear that equations are to be represented as a text string.   One problem with this is that there is no one universal syntax for representing equations - especially when it comes to representing (for example) IF...THEN...ELSE structures.   In the present exercise, I have used Javascript syntax (rather than Simile's native syntax), to allow running models in the browser.  For example, a sin(x) function is represented as Math.sin(x).

 

In my opinion, the proper solution is to used MathML for representing equations - this is the approach used in Simile's markup language.  However, it is probably not wise to use it in an exercise such as this, given that participants will probably want to scan the XMILE documents, and most will be unfamiliar with MathML syntax.

 

 

Publishing the XMILE documents on the web

(May 2013: PLEASE NOTE: due to the demise of Connotea, referred to here, the links given here no longer work. Instead, please go to the page"XMILE files")

There are links to the resulting XMILE documents at http://www.connotea.org/user/robertm/tag/xmile_document, along with the two sample XMILE files included in the supporting material for Karim Chichakly's presentation at the 2007 System Dynamics Society conference (http://www.systemdynamics.org/conferences/2007/proceed/supp/385.zip).

 

 

XSLT stylesheets for displaying XMILE

(May 2013: PLEASE NOTE: due to the demise of Connotea, referred to here, the links given here no longer work. Instead, please go to the page "XMILE files")

I've started writing XSLT stylesheets for displaying the published XMILE.   Note that these are highly experimental, and not every stylesheet will work with every model.    Links to the stylesheets can be found in Nature's Connotea bookmarking service, at  http://www.connotea.org/user/robertm/tag/xmile_stylesheet.    The following stylesheets are currently available:

  • XMILE equation listing: Displays model stocks, flows and auxilliaries with their equations in HTML;
  • XMILE Javascript generator: Demonstrates code generation from an XMILE-represented model;
  • XMILE simple simulator: Allows you to actually run the model inside your browser.   Note that this stylesheet is based on the Javascript generator used in the previous stylesheet.

If you are familiar working with XSLT, then you should be able to use an XSLT processor (such as Saxon) to transform an XMILE model using one of the above XMILE stylesheets.

 

 

Using the XMILE package in MultiGuise (Currently - May 2013 - unavailable)

MultiGuise (http://www.multiguise.com)  is a general-purpose web application for allowing one of several XSLT stylesheets to be applied to one of several compatible XML documents, with the result (usually HTML) displayed in the browser.   It's arranged so that the user can quickly move between different stylesheets for the same document; or between different documents for the same stylesheet.     A collection of documents and compatible stylesheets are grouped together in a MultiGuise package.

 

The XMILE documents and stylesheet referred to above are in the XMILE package.  

 

Sorry, currently MultiGuise only works reliably with Internet Explorer.   If you experience problems, it's likely to be the server timing out, so please try again.

 

 

Contributing XMILE documents and stylesheets

MultiGuise actually knows which documents and stylesheets are in a certain package by going to Connotea, and finding all bookmarked files tagged with a certain tag.  In the case of XMILE, the tags are xmile_document and xmile_stylesheet respectively.

 

Therefore, anyone can add to the list of XMILE documents and stylesheets that MultiGuise presents, simply by placing your XMILE document or stylesheet anywhere on the web, bookmarking it in Connotea, and tagging it with xmile_document or xmile_stylesheet respectively.

 

 

 

 

 

 

 

Comments (0)

You don't have permission to comment on this page.