Repository navigation
Add support for continuous delay systems #1148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MythasNauveili
wants to merge
19
commits into
python-control:main
Choose a base branch
from
MythasNauveili:dev-delay
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
de5a61f
implement delayLTI and PartionedStateSpace classes and first algorith…
MythasNauveili 848d763
Merge branch 'python-control:main' into dev-delay
MythasNauveili 2c74ca1
ongoing tests with julia notebooks, feedback bug solved
MythasNauveili b6c0cde
mimo building of delay systems
MythasNauveili 8dcab54
implementation of working frequency response for delayed siso system
MythasNauveili 9b7b062
__call__ implementation to use lti frequency response function
MythasNauveili e8a197b
delay systems handle freq plots (julia comparison ok). Time to work o…
MythasNauveili 29081b5
add dde.py file to improve readibility in timeresp.py
MythasNauveili 8f43ab9
add tests and docstrings, tests are all passing. ToDo: refine tests, …
MythasNauveili 30c05b9
improve tests by scripting julia code to mimic python tests, and seri…
MythasNauveili 53641f4
methods of steps implemented, 1E-5 accuracy against julia for first t…
MythasNauveili b0f2cd3
Merge branch 'python-control:main' into dev-delay
MythasNauveili 4172ce8
cleaning old dde methods
MythasNauveili a460513
mimo forced response passed. TODO: clean
MythasNauveili f56e5de
docstrings, ruff check and format
MythasNauveili 36ad284
improve formatting, underscore internal functions, add file description
MythasNauveili 4870463
implement delay case in input_output_response, move and test issiso f…
MythasNauveili 1150646
remove forgotten debug print in timeresp, and unused imports in delay…
MythasNauveili e9cf123
Merge branch 'python-control:main' into dev-delay
MythasNauveili File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
improve tests by scripting julia code to mimic python tests, and seri…
…alize with json file. Fix scalar multiplication
- Loading branch information
commit 30c05b93e957442ac85f3a26a9207bf12bfe7690
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import numpy as np | ||
| import json | ||
|
|
||
| from pathlib import Path | ||
|
|
||
| def _recursive_reshape(node): | ||
| if isinstance(node, dict) and ("data" in node) and ("dim" in node): | ||
| data = node["data"] | ||
| dim = tuple(node["dim"]) | ||
|
|
||
| array_data = np.array(data) | ||
|
|
||
| if len(dim) == 1: | ||
| return array_data | ||
|
|
||
| elif len(dim) > 1 and (np.shape(array_data) == dim) and (dim[0] != dim[1]): | ||
| return array_data | ||
| else: | ||
| return np.transpose(array_data) | ||
|
|
||
| elif isinstance(node, dict): | ||
| new_node = {} | ||
| for key, value in node.items(): | ||
| new_node[key] = _recursive_reshape(value) | ||
| return new_node | ||
|
|
||
| elif isinstance(node, list) and any(isinstance(item, dict) for item in node): | ||
| new_node = [] | ||
| for i, item in enumerate(node): | ||
| new_node[i] = _recursive_reshape(item) | ||
| return new_node | ||
|
|
||
| else: | ||
| return node | ||
|
|
||
|
|
||
| def load_julia_results(json_path): | ||
| with open(json_path, "r") as f: | ||
| json_content = json.load(f) | ||
|
|
||
| reshaped_julia = _recursive_reshape(json_content) | ||
| return reshaped_julia | ||
|
|
||
|
|
||
| def assert_delayLTI(dlti, julia_results): | ||
| assert np.allclose(dlti.P.A, julia_results["A"]) | ||
| assert np.allclose(dlti.P.B, julia_results["B"]) | ||
| assert np.allclose(dlti.P.C, julia_results["C"]) | ||
| assert np.allclose(dlti.P.D, julia_results["D"]) | ||
| assert np.allclose(dlti.tau, julia_results["tau"]) | ||
|
|
||
|
|
||
| # Load julia results file | ||
| script_dir = Path(__file__).parent | ||
| julia_json = load_julia_results(f"{script_dir}/tests/julia_results.json") |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible to MIMO → It is possible to create
Also missing a period at the end.