Skip to content

Commit

Permalink
Merge pull request #292 from enekomartinmartinez/add_forecast
Browse files Browse the repository at this point in the history
Add support for FORECAST, ELMCOUNT, :NA:
  • Loading branch information
enekomartinmartinez authored Oct 7, 2021
2 parents 7348c9d + 7f853f9 commit 5885d62
Show file tree
Hide file tree
Showing 17 changed files with 2,622 additions and 1,822 deletions.
4 changes: 2 additions & 2 deletions docs/advanced_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ In a Vensim model with three separate views (e.g. `view_1`, `view_2` and `view_3
.. note ::
Often, modelers wish to organise views further. To that end, a common practice is to include a particular character in the View name to indicate that what comes after it is the name of the subview. For instance, we could name one view as `ENERGY.Supply` and another one as `ENERGY.Demand`.
In that particular case, setting the `subview_sep` kwarg equal to `"."`, as in the code below, would name the translated views as `demand.py` and `supply.py` and place them inside the `ENERGY` folder::
In that particular case, setting the `subview_sep` kwarg equal to `["."]`, as in the code below, would name the translated views as `demand.py` and `supply.py` and place them inside the `ENERGY` folder::
read_vensim("many_views_model.mdl", split_views=True, subview_sep=".")
read_vensim("many_views_model.mdl", split_views=True, subview_sep=["."])
If macros are present, they will be self-contained in files named as the macro itself. The macro inner variables will be placed inside the module that corresponds with the view in which they were defined.

Expand Down
74 changes: 39 additions & 35 deletions docs/development/supported_vensim_functions.rst
Original file line number Diff line number Diff line change
@@ -1,63 +1,75 @@
+------------------------------+------------------------------+
| Vensim | Python Translation |
+==============================+==============================+
| COS | np.cos |
| ABS | abs |
+------------------------------+------------------------------+
| EXP | np.exp |
| INTEGER | int |
+------------------------------+------------------------------+
| MIN | min |
+------------------------------+------------------------------+
| <= | <= |
| MAX | max |
+------------------------------+------------------------------+
| STEP | functions.step |
| = | == |
+------------------------------+------------------------------+
| PULSE | functions.pulse |
| < | < |
+------------------------------+------------------------------+
| POISSON | np.random.poisson |
| > | > |
+------------------------------+------------------------------+
| EXPRND | np.random.exponential |
| >= | >= |
+------------------------------+------------------------------+
| SIN | np.sin |
| <= | <= |
+------------------------------+------------------------------+
| >= | >= |
| ^ | \** |
+------------------------------+------------------------------+
| IF THEN ELSE | functions.if_then_else |
| SQRT | np.sqrt |
+------------------------------+------------------------------+
| EXP | np.exp |
+------------------------------+------------------------------+
| LN | np.log |
+------------------------------+------------------------------+
| PULSE TRAIN | functions.pulse_train |
| PI | np.pi |
+------------------------------+------------------------------+
| RAMP | functions.ramp |
| SIN | np.sin |
+------------------------------+------------------------------+
| INTEGER | int |
| COS | np.cos |
+------------------------------+------------------------------+
| TAN | np.tan |
+------------------------------+------------------------------+
| PI | np.pi |
+------------------------------+------------------------------+
| = | == |
| ARCSIN | np.arcsin |
+------------------------------+------------------------------+
| < | < |
| ARCCOS | np.arccos |
+------------------------------+------------------------------+
| > | > |
| ARCTAN | np.arctan |
+------------------------------+------------------------------+
| MODULO | np.mod |
+------------------------------+------------------------------+
| ARCSIN | np.arcsin |
| ELMCOUNT | len |
+------------------------------+------------------------------+
| ABS | abs |
| IF THEN ELSE | functions.if_then_else |
+------------------------------+------------------------------+
| ^ | \** |
| PULSE TRAIN | functions.pulse_train |
+------------------------------+------------------------------+
| RAMP | functions.ramp |
+------------------------------+------------------------------+
| INVERT MATRIX | functions.invert_matrix |
+------------------------------+------------------------------+
| VMIN | functions.vmin |
+------------------------------+------------------------------+
| VMAX | functions.vmax |
+------------------------------+------------------------------+
| SUM | functions.sum |
+------------------------------+------------------------------+
| PROD | functions.prod |
+------------------------------+------------------------------+
| LOGNORMAL | np.random.lognormal |
+------------------------------+------------------------------+
| MAX | max |
| STEP | functions.step |
+------------------------------+------------------------------+
| SQRT | np.sqrt |
| PULSE | functions.pulse |
+------------------------------+------------------------------+
| ARCTAN | np.arctan |
| EXPRND | np.random.exponential |
+------------------------------+------------------------------+
| ARCCOS | np.arccos |
| POISSON | np.random.poisson |
+------------------------------+------------------------------+
| RANDOM NORMAL | functions.bounded_normal |
+------------------------------+------------------------------+
Expand All @@ -71,6 +83,8 @@
+------------------------------+------------------------------+
| DELAY FIXED | functions.DelayFixed |
+------------------------------+------------------------------+
| FORECAST | functions.Forecast |
+------------------------------+------------------------------+
| SAMPLE IF TRUE | functions.SampleIfTrue |
+------------------------------+------------------------------+
| SMOOTH3 | functions.Smooth |
Expand All @@ -85,16 +99,6 @@
+------------------------------+------------------------------+
| ZIDZ | functions.XIDZ |
+------------------------------+------------------------------+
| VMIN | functions.vmin |
+------------------------------+------------------------------+
| VMAX | functions.vmax |
+------------------------------+------------------------------+
| SUM | functions.sum |
+------------------------------+------------------------------+
| PROD | functions.prod |
+------------------------------+------------------------------+
| INVERT MATRIX | functions.invert_matrix |
+------------------------------+------------------------------+
| GET XLS DATA | external.ExtData |
+------------------------------+------------------------------+
| GET DIRECT DATA | external.ExtData |
Expand Down
2 changes: 1 addition & 1 deletion pysd/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.10.0"
__version__ = "1.11.0"
Loading

0 comments on commit 5885d62

Please sign in to comment.