compat

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2015 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

compat provides the ability to read and write XMILE files that correspond to the implementation in isee systems STELLA and iThink version 10 products.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalName

func CanonicalName(in string) string

CanonicalName takes the string in and converts literal newlines into underscores, and collapes multiple underscores into a single underscore.

func ConvertFromIsee

func ConvertFromIsee(in Node, stripVendorTags bool) (out xmile.Node, err error)

TODO(bp) f is an interface{} so that any tag can be passed, and the corresponding TC xmile tag returned. Currently, only the root File tag is supported.

TODO(bp) implement stripVendorTags

ConvertFromIsee takes an isee tag and converts it to the current TC draft XMILE spec. If stripVendorTags is true, isee-namespaced tags and attributes that would otherwise have been passed through will be removed.

Types

type File

type File struct {
	XMLName    xml.Name           `xml:"http://www.systemdynamics.org/XMILE xmile"`
	Version    string             `xml:"version,attr"`
	Level      int                `xml:"level,attr"`
	IseeHack   string             `xml:"xmlns:isee,attr"` // FIXME(bp) workaround for, I think go issue w.r.t. namespaces
	Header     xmile.Header       `xml:"header"`
	SimSpec    xmile.SimSpec      `xml:"sim_specs"`
	Dimensions []*xmile.Dimension `xml:"dimensions>dim,omitempty"`
	ModelUnits xmile.ModelUnits   `xml:"model_units"`
	IseePrefs  IseePrefs          `xml:"prefs"`
	Behavior   xmile.Behavior     `xml:"behavior"`
	Models     []*Model           `xml:"model,omitempty"`
}

File represents the entire contents of a XMILE document as implemented by STELLA & iThink version ~10.0.3

func ConvertToIsee

func ConvertToIsee(f *xmile.File) (*File, error)

func NewFile

func NewFile(level int, name string) *File

NewFile returns a new File object of the given XMILE compliance level and name, along with a new UUID. If you have a file on disk you are looking to process, please see ReadFile.

func ReadFile

func ReadFile(contents []byte) (*File, error)

ReadFile takes a block of xml content that represents a XMILE file, as implemented by iThink/STELLA v10.0.3, and returns a File structure, or an error. The hope is that iThink files rountripped through this function will remain readable by iThink. If not, please report it.

type IseePrefs

type IseePrefs struct {
	XMLName                xml.Name
	Layer                  string         `xml:"layer,attr"`
	GridWidth              string         `xml:"grid_width,attr"`
	GridHeight             string         `xml:"grid_height,attr"`
	DivByZeroAlert         bool           `xml:"divide_by_zero_alert,attr"`
	ShowModPrefix          bool           `xml:"show_module_prefix,attr"`
	HideTransparentButtons bool           `xml:"hide_transparent_buttons,attr"`
	Window                 xmile.Window   `xml:"window"`
	Security               xmile.Security `xml:"security"`
	PrintSetup             xmile.Window   `xml:"print_setup"`
}

IseePrefs contains preferences used by STELLA and iThink

type Model

type Model struct {
	XMLName   xml.Name    `xml:"model"`
	Name      string      `xml:"name,attr,omitempty"`
	Variables []*Variable `xml:",any,omitempty"`
	Display   xmile.View  `xml:"display"`
	Interface xmile.View  `xml:"interface"`
}

Model represents a container for both the computational definition of a system dynamics model, as well as the visual representations of that model.

type Node

type Node interface {
	// contains filtered or unexported methods
}

An XML node

type Variable

type Variable struct {
	XMLName xml.Name
	xmile.Variable
	Display *xmile.Display `xml:"display"`
}

Variable is the definition of a model entity. Some fields, such as Inflows and Outflows are only applicable for certain variable types. The type is determined by the tag name and is stored in XMLName.Name.

Notes

Bugs

  • when we read in a tag with a variable tag name, the XMILE namespace gets propagated to that tag.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL