Skip to content

Commit

Permalink
Add XMILE delay test
Browse files Browse the repository at this point in the history
  • Loading branch information
enekomartinmartinez committed Jan 9, 2024
1 parent ac2edbc commit a752dac
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/delay_xmile/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Test delay xmile
================

Test model for XMILE's DELAY, which is supposed to work as Vensim's DELAY FIXED. Adapted from https://github.com/SDXorg/pysd/issues/433#issuecomment-1882992617

Contributions
-------------

| Component | Author | Contact | Date | Software Version |
|:------------------------------ |:--------------- |:------------------------------- |:-------- |:----------------------------------- |
| `test_delay_xmile.xmile` | Eneko Martin | [email protected] | 09/01/24 | |
| `output.tab ` | Eneko Martin | [email protected] | 09/01/24 | |
14 changes: 14 additions & 0 deletions tests/delay_xmile/output.tab
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Time INITIAL TIME FINAL TIME TIME STEP SAVEPER Converter 1 Converter 2 Delay Stock 1 Delay Stock 1 0 Delay Flow 2 Delay Flow 2 20 Flow 2 Stock 1
1 1 13 1 1 0.02 0.0 100.0 0.0 2.0 -20.0 2.0 100.0
2 1 13 1 1 0.02 2.0000000000000018 100.0 100.0 2.0 -20.0 2.04 102.0
3 1 13 1 1 0.02 2.0000000000000018 102.0 102.0 2.0 -20.0 2.0808 104.04
4 1 13 1 1 0.02 2.0000000000000018 104.04 104.04 2.0 -20.0 2.1224160000000003 106.1208
5 1 13 1 1 0.02 2.0000000000000018 106.1208 106.1208 2.0 -20.0 2.16486432 108.243216
6 1 13 1 1 0.02 2.0000000000000018 108.243216 108.243216 2.0 2.0 2.2081616064000005 110.40808032000001
7 1 13 1 1 0.02 2.0000000000000018 110.40808032000001 110.40808032000001 2.04 2.04 2.252324838528 112.61624192640001
8 1 13 1 1 0.02 2.0000000000000018 112.61624192640001 112.61624192640001 2.0808 2.0808 2.29737133529856 114.868566764928
9 1 13 1 1 0.02 2.0000000000000018 114.868566764928 114.868566764928 2.1224160000000003 2.1224160000000003 2.3433187620045315 117.16593810022657
10 1 13 1 1 0.02 2.0000000000000018 117.16593810022657 117.16593810022657 2.16486432 2.16486432 2.390185137244622 119.5092568622311
11 1 13 1 1 0.02 2.0000000000000018 119.5092568622311 119.5092568622311 2.2081616064000005 2.2081616064000005 2.4379888399895147 121.89944199947573
12 1 13 1 1 0.02 2.0000000000000018 121.89944199947573 121.89944199947573 2.252324838528 2.252324838528 2.486748616789305 124.33743083946524
13 1 13 1 1 0.02 2.0000000000000018 124.33743083946524 124.33743083946524 2.29737133529856 2.29737133529856 2.536483589125091 126.82417945625454
54 changes: 54 additions & 0 deletions tests/delay_xmile/test_delay_xmile.xmile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<xmile version="1.0" xmlns="http://docs.oasis-open.org/xmile/ns/XMILE/v1.0" xmlns:isee="http://iseesystems.com/XMILE">
<header>
<smile version="1.0" namespace="std, isee"/>
<name>New Model</name>
<uuid>f2a71d66-9f40-4ebf-8fe9-235110e3905f</uuid>
<vendor>isee systems, inc.</vendor>
<product version="1.8.3" isee:build_number="1772" isee:saved_by_v1="true" lang="en">Stella Architect</product>
</header>
<sim_specs isee:simulation_delay="0.115385" isee:restore_on_start="false" method="Euler" time_units="Months" isee:instantaneous_flows="false">
<start>1</start>
<stop>13</stop>
<dt>1</dt>
</sim_specs>
<isee:prefs show_module_prefix="true" live_update_on_drag="true" show_restore_buttons="false" layer="model" interface_scale_ui="true" interface_max_page_width="10000" interface_max_page_height="10000" interface_min_page_width="0" interface_min_page_height="0" saved_runs="5" keep="false" rifp="true"/>
<isee:multiplayer_settings include_chat="true" allow_observers="false" advance_time_increment="1" observer_start_page="home_page" enabled="false"/>
<isee:time_formats default_format="Builtin">
<isee:time_format name="Builtin" type="adaptive"/>
</isee:time_formats>
<default_format/>
<model_units/>
<model>
<variables>
<stock name="Stock 1">
<eqn>100</eqn>
<inflow>Flow_2</inflow>
<non_negative/>
</stock>
<aux name="Converter 1">
<eqn>0.02</eqn>
</aux>
<flow name="Flow 2">
<eqn>Converter_1*Stock_1</eqn>
<non_negative/>
</flow>
<aux name="Converter 2">
<eqn>(((Stock_1/DELAY(Stock_1, 1))-1)*100)</eqn>
</aux>
<aux name="Delay Stock 1">
<eqn>DELAY(Stock_1, 1)</eqn>
</aux>
<aux name="Delay Stock 1 0">
<eqn>DELAY(Stock_1, 1, 0)</eqn>
</aux>
<aux name="Delay Flow 2">
<eqn>DELAY(Flow_2, 5)</eqn>
</aux>
<aux name="Delay Flow 2 20">
<eqn>DELAY(Flow_2, 5, -20)</eqn>
</aux>
</variables>
</model>
</xmile>

0 comments on commit a752dac

Please sign in to comment.