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

Publish the base code for Python user-models #14

Closed
5 of 9 tasks
PMeira opened this issue Sep 8, 2018 · 7 comments
Closed
5 of 9 tasks

Publish the base code for Python user-models #14

PMeira opened this issue Sep 8, 2018 · 7 comments

Comments

@PMeira
Copy link
Member

PMeira commented Sep 8, 2018

The Python user-models wrap a C DLL (built with CFFI currently) and provide a Pythonic and more approachable way of creating user-models for the following components, with no need to write a DLL in Pascal/Delphi or C:

  • Capacitor controls
  • Generator (basic version released in 0.10)
  • Storage
  • PVSystem

So far we tested it mostly with generators.

These models can be used with either a COM instance (with limitations due to a bug) or DSS Python's instance.

Other tasks:

  • Test with COM (v8 only and Edit limitation still present)
  • Test with DSS C-API (DSS Python base)
  • Test on Linux
  • Test on MacOS
  • Provide working examples in version 0.11
@PMeira PMeira added this to the 0.10 milestone Sep 8, 2018
@PMeira PMeira modified the milestones: 0.10, 0.11 Nov 17, 2018
@PMeira
Copy link
Member Author

PMeira commented Nov 17, 2018

Pushing this to 0.11.

@f-rosato
Copy link

Can you please provide a minimal example of usermodel definition for a generator and the following circuit solution?

@PMeira
Copy link
Member Author

PMeira commented Jun 4, 2019

Hi @f-rosato, I started working on a full example for the generator, I'll try to finish tomorrow.

PMeira added a commit that referenced this issue Jun 13, 2019
@PMeira
Copy link
Member Author

PMeira commented Jun 13, 2019

@f-rosato Please check this notebook and the files in that folder:

https://github.com/dss-extensions/dss_python/blob/master/docs/examples/UserModels/PyIndMach012/README.ipynb

It's not a step-by-step manual but I tried to comment most of code to illustrate how to use it.

I found some issues with recent versions of OpenDSS 8 to handle later. I left some comments about them.

Funnily enough, I also found an issue with IndMach012 class in DSS C-API to investigate later, dss-extensions/dss_capi#62. For now, if you're running on Linux/macOS, just comment the bad plots (plt.plot(time, outputs_pas[ch_pas], label='IndMach012', lw=3). Actually it was an issue with the Monitors, missing a copy in the Channel function. Fixed in master, will be available on the next release.

@PMeira
Copy link
Member Author

PMeira commented Jan 11, 2021

It's been a couple of years. Since the official OpenDSS still has bugs/incomplete support for user-models (including still v7 vs v8+ issues), we'll abandon the idea of supporting the same models as EPRI's official OpenDSS, releasing an alternative approach in the coming months.

@utamrakar
Copy link

@PMeira I am trying to adapt this to write a Storage User-Model. Since, you mentioned there are some issues and this idea has been abandon are there any updates in future directions you are taking? I was wondering if you have tested this for other components apart from the Gen models.

@PMeira
Copy link
Member Author

PMeira commented Apr 12, 2022

@utamrakar Sorry about the extended delay on this topic. I was supposed to have at least one student to help on this, but my local team has been short-staffed for a while (mostly due to the pandemic).

I personally only used the Generator and CapControl user-models. I've seen some brief mentions of inverters (e.g. see slide 12 in https://documents.pserc.wisc.edu/documents/general_information/presentations/pserc_seminars/webinars_2021/Webinar_Slides_Ayyanar_Yang_Chongfuangprinya_8_31_21.pdf ), but it's unclear which kind of base model was used.

For the next release (0.12.0), only the Generator user-model will be left enabled on DSS Python. The low-level headers in DSS C-API are still there and are updated in the current beta releases, but you need conditional compilation (i.e. define DSS_CAPI_DLL when targeting DSS C-API) for some models due some internal changes in DSS C-API -- the generator model doesn't need that, so we can leave it enabled in DSS Python without extra work.

In 2021, we decided to move the base library (DSS C-API) from Pascal to C++. The results of that should be out still in this semester (we already have some results in a private branch). I shouldn't say too much since it's still in flux, but the new approach for user-models will be based on that, and the new/rewritten property system coming in v0.12.

For a general overview of the current development, please see also the main v0.12 PR at dss-extensions/dss_capi#109

@PMeira PMeira removed this from the 0.12 milestone Mar 12, 2023
@PMeira PMeira closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2023
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

3 participants