XML

Simul8 supports the XML standard.

Quick Guide

Use the File menu, Save As option and select XML to save a Simul8 file as the XML format ready for editing in an XML editor or for import to another application.

Use the File Menu, Open, and select XML as the file type to import a file saved as XML.

Both the Open and Save as XML options are available under the File menu, Import and Export options.

Detailed Information

XML is a standard for creating markup languages that describe the structure of data. That is XML lets you describe a file in text using tags. The picture below shows an example of a Simul8 XML file.

If you know Simul8 you can easily interpret the file. A trial contains 5 runs, the results collection period is set to 2399.4999, antithetic random numbers are turned off and the random numbers don't automatically change on each reset.

Creating a Simul8 XML

  • Do File Save As and select the .xs8 or .xml option.
  • Use File Export.

You can then view it in several ways. The easiest way is to open the file using Notepad, but you can also view it using internet explorer.

To create a Simul8 XML from scratch is easy too. In Notepad you just need to type the lines <Simul8XML></Simul8XML> and save the file as a .xs8 or .xml file. This is enough to allow Simul8 to open the file, although the simulation will be blank.

XML Tags

A Simul8 XML file is constructed from a series of elements. An element is made up from a start tag, an end tag and content in between, like in the figure 1 below. The start tag is inside angled brackets and is given a name that describes the data inside the element, in our example <RUNS>. The end tag is also inside angled brackets and has the same text as the start tag but has a slash first, in our example </RUNS>. The content in between is text or can be another element. For example in figure 1 below the content is text, the number 5, but in figure 2 the content of the <TRIAL> element is the <RUN> element.

Figure 1

Figure 2

Key Sections

A Simul8 XML file has 4 key sections:

Simulation Parameters
The key settings of your simulation, for example results and shifts.

Environment
Your building environment settings. For example whether to display arrows or not and whether to display simulation assistant messages.

Simulation Objects
Describes all the simulation objects like Work Centers, Storage Bins etc.

File Parameters
Records information about your Simul8 version and information like the Simul8 version required to run your simulation.

There are hundreds of Simul8 XML tags you can use to populate these sections. The easiest way to find the tags you need is create a simulation that uses the property you want and save it as an XML file. Simul8 XML is so readable that you should be able to easily locate the tags you need. Alternatively see Simul8's XML Schema for a full list of all the tags available.

You don't need to populate all the sections to create a valid Simul8 XML file. As long as you add the tags <Simul8XML></Simul8XML> Simul8 will use default values to create all the other elements, so you can just add the elements that are key to your simulation and Simul8 will do the rest.

Results from a simulation don't get stored in the main .xs8 Simul8 XML file, they are stored in a separate .RS8, Results Simul8 XML file. You can generate a .RS8 file by selecting Results / Results Save as XML from the main toolbar.

How can you use XML with Simul8?

XML can be used in lots of different ways, but because you can parse it as a text file its an ideal way to share information between software packages. For example we use XML to automatically turn process maps built in Microsoft Visio into Simul8 simulations.

You create your process map in Visio Simul8 then opens and reads an XML version of the map. Simul8 goes through the file to identify key phrases in the XML. For example Shape denotes the start of a process map object. Simul8 then determines from the number of in and out links the shape has whether it should be a Work Center, Work Entry Point etc. in the simulation.

Lots of other BPM software packages link with Simul8 in a similar way. Except instead of Simul8 parsing of the XML file they parse their own file and then generate a Simul8 XML file that Simul8 automatically opens.

As a Simul8 user there are lots of ways you can make use of Simul8 XML. At a really simple level a Simul8 XML file is an excellent starting point to creating your own file documentation. At a more powerful level you can use it to generate simulations without having to use the Simul8 interface. For example we have a customer who never updates their simulations in the conventional way. They have an Excel spreadsheet where they enter the parameters for the simulation. A macro then generates the relevant Simul8 XML file. They then use COM to tell Simul8 to run the simulation and save the results to an XML file. Another macro then imports the result from the Simul8 XML file to the spreadsheet. Download an example to see this idea in action.

See Also