Skip to content
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

Add an option to keep changed parameters #579

Closed
jinningwang opened this issue Nov 13, 2024 · 9 comments
Closed

Add an option to keep changed parameters #579

jinningwang opened this issue Nov 13, 2024 · 9 comments
Assignees

Comments

@jinningwang
Copy link
Member

Is your feature request related to a problem? Please describe.
N/A

Describe the solution you'd like
For easier usage, we can add an option in the IO module to allow "overwrite original values". Thus, users can save all the changes they have made through "Mode.set". into the exported case file.

Proposed development:

Add a parameter save_changes=False to func "write()"
If true, overwrite the Param.vin by per unit conversion of Param.v

Describe alternatives you've considered
N/A

Additional context
N/A

@cuihantao
Copy link
Collaborator

cuihantao commented Nov 13, 2024 via email

@cuihantao
Copy link
Collaborator

Add a parameter save_changes=False to func "write()" If true, overwrite the Param.vin by per unit conversion of Param.v

This is going to fail. If a field, say, generator's M is overwritten by the per-unit converted values, the next time the data is loaded, M's value will again be treated as in the machine base and then converted to system per unit, which will be wrong. There is no way to specify whether input data has been converted to per unit or not - we can but don't want to do it, because it creates more confusion.

@jinningwang
Copy link
Member Author

The proposed change to my mind looks like this:

https://github.com/jinningwang/andes/blob/70c9cb57d0a6cadec65086d1f9011a02b99a3fa0/andes/core/model/model.py#L555C1-L565C1

A quick demo is attached: dev_alter.pdf

Let me know if this makes sense to you.

@cuihantao
Copy link
Collaborator

Thanks. Can you respond to my replies, please?

@cuihantao
Copy link
Collaborator

Which one is better, the proposed API or the same API as "set", which takes an "attr"?

@jinningwang
Copy link
Member Author

This is going to fail. If a field, say, generator's M is overwritten by the per-unit converted values, the next time the data is loaded, M's value will again be treated as in the machine base and then converted to system per unit, which will be wrong.

Yes, I also saw this in my local test.

There is no way to specify whether input data has been converted to per unit or not - we can but don't want to do it, because it creates more confusion.

Yes, so I made changes to method alter.

Which one is better, the proposed API or the same API as "set", which takes an "attr"?

Let me think about this. If second one is better, I can make a notebook demo as a clarification.

@jinningwang
Copy link
Member Author

jinningwang commented Nov 18, 2024

The purpose of my proposed change is to eliminate the need for users to handle per-unit conversions themselves when adjusting parameters. At the same time, they can maintain all changes in a dumped file.

This change is motivated by my own confusion when manipulating parameters, as I feel this approach is less confusing.

Welcome any further comments or suggestions if I have overlooked anything.

@cuihantao
Copy link
Collaborator

cuihantao commented Nov 18, 2024 via email

@jinningwang
Copy link
Member Author

Thanks for this informative comment, I'll make a quick development in short.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants