From cdcf3c04b1986925c0e94c6c16c2519200a00e74 Mon Sep 17 00:00:00 2001 From: Eneko Martin-Martinez Date: Tue, 9 Jan 2024 16:24:12 +0100 Subject: [PATCH] Add support for XMILE's DELAY function --- docs/tables/delay_functions.tab | 3 ++- docs/whats_new.rst | 24 +++++++++++++++++++ pysd/_version.py | 2 +- pysd/translators/xmile/xmile_structures.py | 4 ++++ .../pytest_integration_xmile_pathway.py | 4 ++++ tests/test-models | 2 +- 6 files changed, 36 insertions(+), 3 deletions(-) diff --git a/docs/tables/delay_functions.tab b/docs/tables/delay_functions.tab index cd209660..20766680 100644 --- a/docs/tables/delay_functions.tab +++ b/docs/tables/delay_functions.tab @@ -5,7 +5,8 @@ DELAY3I "DELAY3I(input, delay_time, initial_value)" delay3 "delay3(input, delay_ DELAY3 "DELAY3(input, delay_time)" delay3 "delay3(input, delay_time)" "DelayStructure(input, delay_time, input, 3)" pysd.statefuls.Delay(...) Not tested for Xmile! DELAY N "DELAY N(input, delay_time, initial_value, n)" delayn "delayn(input, delay_time, n, initial_value)" "DelayNStructure(input, delay_time, initial_value, n)" pysd.statefuls.DelayN(...) Not tested for Xmile! delayn "delayn(input, delay_time, n)" "DelayNStructure(input, delay_time, input, n)" pysd.statefuls.DelayN(...) Not tested for Xmile! -DELAY FIXED "DELAY FIXED(input, delay_time, initial_value)" "DelayFixed(input, delay_time, initial_value)" pysd.statefuls.DelayFixed(...) Not tested for Xmile! +DELAY FIXED "DELAY FIXED(input, delay_time, initial_value)" delay "delay(input, delay_time, initial_value)" "DelayFixed(input, delay_time, initial_value)" pysd.statefuls.DelayFixed(...) + delay "delay(input, delay_time)" "DelayFixed(input, delay_time, input)" pysd.statefuls.DelayFixed(...) SMOOTHI "SMOOTH1I(input, delay_time, initial_value)" smth1 "smth1(input, smth_time, initial_value)" "SmoothStructure(input, smth_time, initial_value, 1)" pysd.statefuls.Smooth(...) Not tested for Xmile! SMOOTH "SMOOTH1(input, delay_time)" smth1 "smth1(input, smth_time)" "SmoothStructure(input, smth_time, input, 1)" pysd.statefuls.Smooth(...) Not tested for Xmile! SMOOTH3I "SMOOTH3I(input, delay_time, initial_value)" smth3 "smth3(input, smth_time, initial_value)" "SmoothStructure(input, smth_time, initial_value, 3)" pysd.statefuls.Smooth(...) Not tested for Xmile! diff --git a/docs/whats_new.rst b/docs/whats_new.rst index afd78604..8cfab142 100644 --- a/docs/whats_new.rst +++ b/docs/whats_new.rst @@ -1,5 +1,29 @@ What's New ========== +v3.13.2 (2024/01/09) +-------------------- +New Features +~~~~~~~~~~~~ + +Breaking changes +~~~~~~~~~~~~~~~~ + +Deprecations +~~~~~~~~~~~~ + +Bug fixes +~~~~~~~~~ +- Add support for XMILE's DELAY function through `DelayFixed` (:issue:`433`). (`@enekomartinmartinez `_) + +Documentation +~~~~~~~~~~~~~ + +Performance +~~~~~~~~~~~ + +Internal Changes +~~~~~~~~~~~~~~~~ + v3.13.1 (2024/01/02) -------------------- New Features diff --git a/pysd/_version.py b/pysd/_version.py index 641cc783..d8c1804a 100644 --- a/pysd/_version.py +++ b/pysd/_version.py @@ -1 +1 @@ -__version__ = "3.13.1" +__version__ = "3.13.2" diff --git a/pysd/translators/xmile/xmile_structures.py b/pysd/translators/xmile/xmile_structures.py index 6d2e72de..b9eb05f4 100644 --- a/pysd/translators/xmile/xmile_structures.py +++ b/pysd/translators/xmile/xmile_structures.py @@ -12,6 +12,10 @@ "call": ae.CallStructure, "init": ae.InitialStructure, "stock": ae.IntegStructure, + "delay": { + 2: lambda x, y: ae.DelayFixedStructure(x, y, x), + 3: lambda x, y, z: ae.DelayFixedStructure(x, y, z) + }, "delay1": { 2: lambda x, y: ae.DelayStructure(x, y, x, 1), 3: lambda x, y, z: ae.DelayStructure(x, y, z, 1) diff --git a/tests/pytest_integration/pytest_integration_xmile_pathway.py b/tests/pytest_integration/pytest_integration_xmile_pathway.py index a422bb89..2266cce5 100644 --- a/tests/pytest_integration/pytest_integration_xmile_pathway.py +++ b/tests/pytest_integration/pytest_integration_xmile_pathway.py @@ -38,6 +38,10 @@ "folder": "constant_expressions", "file": "test_constant_expressions.xmile" }, + "delay_xmile": { + "folder": "delay_xmile", + "file": "test_delay_xmile.xmile" + }, "eval_order": { "folder": "eval_order", "file": "eval_order.xmile" diff --git a/tests/test-models b/tests/test-models index ac2edbcd..a752dac6 160000 --- a/tests/test-models +++ b/tests/test-models @@ -1 +1 @@ -Subproject commit ac2edbcde87aec2dfd8cc338d0574970c549a2d9 +Subproject commit a752dac620d1f84cb13b7aa8397ec55b5de623f8