NREL / ditto

DiTTo is a Distribution Transformation Tool that aims at providing an open source framework to convert various distribution systems modeling formats.
https://nrel.github.io/ditto/
BSD 3-Clause "New" or "Revised" License
68 stars 35 forks source link

CYME -> OpenDSS -- Issues with Regulator, detecting [S.I] or [Imperial], and Not Understanding Node Name Outcomes #370

Open thomas-baskin opened 3 years ago

thomas-baskin commented 3 years ago

My process from beginning to end: I downloaded DiTTo using this command -> pip install git+https://github.com/NREL/ditto.git@v0.1.0#egg=ditto[all] straight from the GitHub. I quickly realized that wasn't the most up-to-date version of DiTTo so I redownloaded with -> pip install git+https://github.com/NREL/ditto.git@v0.2.1#egg=ditto[all]

Now when I run pip list in my Anaconda prompt I see:

ditto               0.1.0
ditto.py            0.2.1

I'm not entirely sure why both appear. I worry that my problems are caused by the old DiTTo version but I believe the new ditto.py was working.

Regardless, I thought it could be helpful. Here is the header for the CYME load.txt file:

[GENERAL]
DATE=April 15, 2020 at 12:36:48
CYME_VERSION=8.10
CYME_REVISION=7
COMMENTS=

[IMPERIAL]
TemperatureInSI=0

An error I received was the following:

>>> Writing to OpenDSS...
Could not extract XHL from regulator Reg_regname
Could not extract XLT from regulator Reg_regname
Could not extract XHT from regulator Reg_regname
Traceback (most recent call last):
  File "test_cyme_to_opendss.py", line 59, in <module>
    main()
  File "test_cyme_to_opendss.py ", line 54, in main
    w.write(model)
  File "C:\Users\Username\Anaconda3\lib\site-packages\ditto\writers\opendss\write.py", line 247, in write
    s = self.write_master_file(model)
  File "C:\Users\ Username \Anaconda3\lib\site-packages\ditto\writers\opendss\write.py", line 3900, in write_master_file
    feeder_name == "" and i.nominal_voltage < 30000
TypeError: '<' not supported between instances of 'NoneType' and 'int'

In this case, i.nominal_voltage was NoneType.

Here are the Regulator Settings for CYME:


[REGULATOR SETTING]
FORMAT_REGULATORSETTING=SectionID,Location,EqID,DeviceNumber,DeviceStage,Flags,InitFromEquipFlags,CoordX,CoordY,PhaseON,MaxBuck,MaxBoost,CT,PT,SettingOption,AtSectionID,VsetA,VsetB,VsetC,RsetA,RsetB,RsetC,XsetA,XsetB,XsetC,BandWidthA,BandWidthB,BandWidthC,TapA,TapB,TapC,Conn,Lagging,FromNodeID,RevMode,RevTreshold,RevVsetA,RevVsetB,RevVsetC,RevRsetA,RevRsetB,RevRsetC,RevXsetA,RevXsetB,RevXsetC,RevBandWidthA,RevBandWidthB,RevBandWidthC,FirstHouseLow,FirstHouseHigh,FaultIndicator,ConnectionStatus,ByPassOnRestoration,PythonDeviceScriptID,Reversible
org_name999,L,7.2KV_UNKAMP(3),org_name999,,0,0,,,A,10.000000,10.000000,50.000000,60.000000,T,org_name999,124.000000,124.000000,124.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,2.000000,2.000000,2.000000,0.000000,0.000000,0.000000,0,1,org_name999,5,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,2.000000,2.000000,2.000000,0.000000,0.000000,0,0,0,,1

I don't know CYME files all that well but I got past the issue by doing this in C:\Users\Username\Anaconda3\lib\site-packages\ditto\writers\opendss\write.py: feeder_name == "" and i.nominal_voltage is not None and i.nominal_voltage < 30000 Rather than include line numbers here I just searched through the code for the statement which happened to be unique.

I don't know if that left my Regulator not doing what it was supposed to but it shows up in my dss files and I can still run it in OpenDSS:


New Transformer.trans_Reg_org_name999_A phases=1 windings=2 buses=(org_name999.1,org_name999.1) conns=(Wye, Wye) kvs=(7.2, 7.2) kvas=(108.0, 108.0)

New RegControl.Reg_org_name999_A transformer=trans_Reg_org_name999_A winding=2 CTprim=50.0 ptratio=60.0 band=2.4 vreg=124.0 Ptphase=1

Another issue I ran into has been shared on the GitHub and I used that solution to solve my problem. I'll share a link to that change here. This link is good as of 5/21/21 at 12:00 pm: https://github.com/NREL/ditto/commit/c0813ceed8df9ca7faf4dd7b7eb837e7f219c210

I was getting the following error because it couldn't parse out whether my CYME was using IMPERIAL or SI. I hard-coded Imperial to solve the problem: raise ValueError("Could not find [SI] or [IMPERIAL] unit system information. Unable to parse.")

Once I had DiTTo running, I converted my files but I saw patterns like this:

New Load.Load_org_name999_A_B_C_A_B_C_A_B_C_A_B_C_A_B_C_A_B_C_A_B_C_A_B_C bus1=org_name899.1.2.3.1.2.3.1.2.3.1.2.3.1.2.3.1.2.3.1.2.3.1.2.3 kV=12.47 model=1 kW=330.99999699999984 kvar=0.0 Phases=24

Why is this happening?

I ended up having to change each of these lines using a script so .1.2.3.1.2.3... became .1.2.3 and the Phases became 3. Is this because we have CYME Customer Loads as follows? Is it turning each of these loads into an extra Phase?


org_name1123,org_name1123,SPOT,org_name1123-3,Residential,0,0,2020,2,0,0,0,C,0.000000,0.000000,5.5556,20.297,1.000000,,,,,,
org_name1123,org_name1123,SPOT,org_name1123-3,Residential,0,0,2020,4,0,0,0,C,0.000000,0.000000,5.5556,20.132,1.000000,,,,,,
org_name1123,org_name1123,SPOT,org_name1123-3,Residential,0,0,2020,5,0,0,0,C,0.000000,0.000000,5.5556,20.003,1.000000,,,,,,
org_name1123,org_name1123,SPOT,org_name1123-3,Residential,0,0,2020,3,0,0,0,C,0.000000,0.000000,5.5556,27.339,1.000000,,,,,,
org_name1123,org_name1123,SPOT,org_name1123,Residential,0,0,2020,4,0,0,0,C,0.000000,0.000000,5.5556,36.903,1.000000,,,,,,
org_name1123,org_name1123,SPOT,org_name1123,Residential,0,0,2020,5,0,0,0,C,0.000000,0.000000,5.5556,36.212,1.000000,,,,,,
org_name1123,org_name1123,SPOT,org_name1123,Residential,0,0,2020,2,0,0,0,C,0.000000,0.000000,5.5556,47.064,1.000000,,,,,,
org_name1123,org_name1123,SPOT,org_name1123,Residential,0,0,2020,3,0,0,0,C,0.000000,0.000000,5.5556,53.424,1.000000,,,,,,
org_name1123,org_name1123,SPOT,org_name1123-2,Residential,0,0,2020,5,0,0,0,C,0.000000,0.000000,5.5556,25.994,1.000000,,,,,,
org_name1123,org_name1123,SPOT,org_name1123-2,Residential,0,0,2020,2,0,0,0,C,0.000000,0.000000,5.5556,55.661,1.000000,,,,,,
org_name1123,org_name1123,SPOT,org_name1123-2,Residential,0,0,2020,3,0,0,0,C,0.000000,0.000000,5.5556,47.445,1.000000,,,,,,
org_name1123,org_name1123,SPOT,org_name1123-2,Residential,0,0,2020,4,0,0,0,C,0.000000,0.000000,5.5556,22.206,1.000000,,,,,,
org_name1123,org_name1123,SPOT,org_name1123-8,Residential,0,0,2020,2,0,0,0,C,0.000000,0.000000,5.5556,41.852,1.000000,,,,,,
org_name1123,org_name1123,SPOT,org_name1123-8,Residential,0,0,2020,4,0,0,0,C,0.000000,0.000000,5.5556,47.587,1.000000,,,,,,
org_name1123,org_name1123,SPOT,org_name1123-8,Residential,0,0,2020,3,0,0,0,C,0.000000,0.000000,5.5556,48.991,1.000000,,,,,,
org_name1123,org_name1123,SPOT,org_name1123-8,Residential,0,0,2020,5,0,0,0,C,0.000000,0.000000,5.5556,49.667,1.000000,,,,,,
org_name1123,org_name1123,SPOT,org_name1123-5,Residential,0,0,2020,3,0,0,0,C,0.000000,0.000000,5.5556,24.885,1.000000,,,,,,

A note:

[LOAD MODEL INFORMATION]
FORMAT_LOADMODELINFORMATION=ID,Name
2,SUMMER 2019
3,SUMMER 2018
4,WINTER 2018-19
5,WINTER 2017-18

Other questions I had are as follows:

Any insight into how CYME files work would be appreciated.