diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 930686c3..4bff59d8 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -10,23 +10,10 @@
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
@@ -195,7 +182,7 @@
-
+
@@ -211,7 +198,7 @@
-
+
@@ -236,8 +223,8 @@
-
-
+
+
@@ -245,20 +232,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
+
+
+
+
+
@@ -270,8 +268,8 @@
-
-
+
+
@@ -321,10 +319,10 @@
-
+
-
+
@@ -387,10 +385,10 @@
-
+
-
+
@@ -419,7 +417,7 @@
-
+
@@ -565,46 +563,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1135,7 +1093,7 @@
-
+
@@ -1144,7 +1102,7 @@
-
+
@@ -1166,17 +1124,17 @@
-
-
-
-
+
+
+
+
-
+
-
+
@@ -1249,13 +1207,6 @@
-
-
-
-
-
-
-
@@ -1504,28 +1455,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1539,8 +1468,8 @@
-
-
+
+
@@ -1614,23 +1543,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1672,14 +1584,6 @@
-
-
-
-
-
-
-
-
@@ -1699,5 +1603,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pysd/__init__.py b/pysd/__init__.py
index d955775b..4a0e7772 100644
--- a/pysd/__init__.py
+++ b/pysd/__init__.py
@@ -1,5 +1,4 @@
-from .pysd import read_xmile, read_vensim, load, PySD
+from .pysd import read_vensim, load, PySD
from . import functions
-from . import builder
from . import utils
diff --git a/pysd/pysd.py b/pysd/pysd.py
index 06ebc9e7..c493d9e0 100644
--- a/pysd/pysd.py
+++ b/pysd/pysd.py
@@ -29,27 +29,8 @@
# Todo: add a logical way to run two or more models together, using the same integrator.
# Todo: add the state dictionary to the model file, to give some functionality to it even
# without the pysd class
-# Todo: seems to be some issue with multiple imports - need to create a new instance...
# Todo: work out an RK4 adaptive integrator
-def read_xmile(xmile_file):
- """ Construct a model object from `.xmile` file.
-
- Parameters
- ----------
- xmile_file :
- The relative path filename for a raw xmile file
-
- Examples
- --------
- >>> model = read_vensim('Teacup.xmile')
- """
- #from translators import translate_xmile
- #py_model_file = translate_xmile(xmile_file)
- #model = load(py_model_file)
- #model.__str__ = 'Import of ' + xmile_file
- #return model
-
def read_vensim(mdl_file):
""" Construct a model from Vensim `.mdl` file.
@@ -418,7 +399,7 @@ def _integrate(self, derivative_functions, timesteps, capture_elements, return_t
# Todo: consider adding the timestamp to the return elements, and using that as the index
outputs = []
- for i, t2 in enumerate(timesteps[1:]):
+ for t2 in timesteps[1:]:
if self.components._t in return_timestamps:
outputs.append({key: self.components._funcs[key]() for key in capture_elements})
self.components._state = self._euler_step(derivative_functions,
diff --git a/pysd/vensim2py.py b/pysd/vensim2py.py
index 8269eeb0..1dd2fb7b 100644
--- a/pysd/vensim2py.py
+++ b/pysd/vensim2py.py
@@ -166,17 +166,17 @@ def __init__(self, ast):
self.entries = []
self.visit(ast)
- def visit_entry(self, n, (eqn, _1, unit, _2, doc, _3, annotation)):
- self.entries.append({'eqn': eqn.strip(),
- 'unit': unit.strip(),
- 'doc': doc.strip(),
+ def visit_entry(self, n, vc):
+ self.entries.append({'eqn': vc[0].strip(),
+ 'unit': vc[2].strip(),
+ 'doc': vc[4].strip(),
'kind': 'entry'})
- def visit_section(self, n, (sect_marker, _1, text, _3)):
- if text.strip() != "Simulation Control Parameters":
+ def visit_section(self, n, vc):
+ if vc[2].strip() != "Simulation Control Parameters":
self.entries.append({'eqn': '',
'unit': '',
- 'doc': text.strip(),
+ 'doc': vc[2].strip(),
'kind': 'section'})
def generic_visit(self, n, vc):
@@ -570,7 +570,9 @@ def visit_subscript_list(self, n, (lb, _1, refs, rb)):
else:
return ' '
- def visit_build_call(self, n, (call, _1, lp, _2, args, rp)):
+ def visit_build_call(self, n, vc):
+ call = vc[0]
+ args = vc[4]
self.kind = 'component'
arglist = [x.strip() for x in args.split(',')]
name, structure = builders[call.strip().lower()](*arglist)