You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Copy SMIB_Tutorial repo contents to Resources folder
Files from the external repository https://github.com/ALSETLab/SMIB_Tutorial
have been copied to the Resources folder. This will allow us to manage the
scripts to create power flow records directly within the OpenIPSL repository.
* Update names inside create_pf_records module
The following changes have been applied to create_pf_records.py:
- Modelica object names have been updated to be upperCamelCase.
- Replace variable 'V' with variable 'v' in Bus records.
* Update regex expression in generate_component_list
A new more explicit way of finding generators in the Modelica Network model
has been introduced. A for loop is now used to iterate over several regex
patterns to detect generator objects.
* Update names inside gridcal2rec module
The following changes have been applied to gridcal2rec.py:
- Modelica object names have been updated to be upperCamelCase.
- Variable 'V' has been replaced with variable 'v' in Bus records.
* Update link inside main Instructions documentation
Link to python scripts to create and populate records with PF results has
been updated. The scripts are now available within the OpenIPSL repository.
* Update steps defined in PFRecordCreation documentation
* Update steps defined in InstallingGridCal doc
Steps have been updated to ensure a working installation of GridCal 4.5.1
under a conda environment.
* Fix HTML issue with li tags
* Update steps defined in PopulatingRecords doc
* Revert changes to tutorial 4 images
* Update GridCal installation instructions
- Instructions have been updated to install the latest version of GridCal.
- Miniconda is no longer used.
- GridCal installation is recommended on a python 3.12.7 virtual env.
* Fix HTML issue with li tags
* Clean up pf record generation utils
- All python files are now located in the pf2rec folder below Resources/pf2rec.
- Modelica, csv and PSS/E files have been removed from Resources.
* Update python pf record creation scripts
- Logic associated to OpenIPSL old versions has been removed to keep code simpler.
- A list of regex patterns is used to identify generating units in OpenIPSL network models.
* Update python pf record population scripts
- Code has been updated to reflect changes in GridCal API and data model (reference version = GridCal v5.1.52).
- Support for old versions of OpenIPSL has been removed to make the code simpler.
* Fix invalid escape sequence issue in regex
* Fix issue in transformer pf record generation
Tail of the pf record was missing, leading to syntax errors.
* Update PFRecordCreation doc - python scripts
The instructions have been updated to properly use the pf record
generation scripts.
* Correct the unit
* Update PopulatingRecords doc - PSSE Files
PSS/E Files folder is no longer kept within the Resources folder. The
instruction have been modified to guide the user in the process of creating
the raw file that is used as an input to populate the pf records with
GridCal.
* Escape \ chars inside paths in documentation
* Whitespace fix.
* Fix case of Python
---------
Co-authored-by: Dietmar Winkler <dietmar.winkler@dwe.no>
<h5>Creating and Integrating the Power Flow Structure</h5>
6
+
<p>After completing the instructions in <a href=\"modelica://OpenIPSL.Examples.Tutorial.Example_4.Instructions.SMIBSystemAssembly\">Assembling a SMIB System</a>, you should have a <font color=\"blue\"><code>SMIB</code></font> folder inside your working directory. </p>
6
7
<ol>
7
-
<li>Create a directory called <font color=\"blue\"><code>models</code></font> above your model current folder. </li>
8
-
<li>Move your model folder to the directory created in <strong>step 2</strong>. For example, let's assume you are using the new version of OpenIPSL, then if your model is saved in a folder called <font color=\"blue\"><code>SMIB</code></font>, the new path of your folder should be <font color=\"blue\"><code>models/SMIB</code></font>. </li>
9
-
<li>Make sure the directory <font color=\"blue\"><code>pf2rec</code></font> downloaded from the <font color=\"blue\"><code>SMIB_Tutorial</code></font> repository is in the same directory. The tree below shows how your folder structure should look like:
8
+
<li>Create a directory called <font color=\"blue\"><code>SMIB_Example</code></font> at the same level where the <font color=\"blue\"><code>SMIB</code></font> folder is located. </li>
9
+
<li>Create a directory called <font color=\"blue\"><code>models</code></font> below your new <font color=\"blue\"><code>SMIB_Example</code></font> folder. </li>
10
+
<li>Move the <font color=\"blue\"><code>SMIB</code></font> folder below the previously added <font color=\"blue\"><code>models</code></font> folder. </li>
11
+
<li>Copy the <font color=\"blue\"><code>pf2rec</code></font> folder from <a href=\"modelica://OpenIPSL/Resources/utils\">Resources</a> to the <font color=\"blue\"><code>SMIB_Example</code></font> folder. </li>
12
+
<li>Move the <font color=\"blue\"><code>create_records.py</code></font> and <font color=\"blue\"><code>run_pf.py</code></font> Python files one level up (i.e., to the <font color=\"blue\"><code>SMIB_Example</code></font> folder). The tree below shows how your folder structure should look like:
10
13
<blockquote><pre>
11
-
C:\\Users\\...>tree /f /a SMIB
14
+
C:\\Users\\...>tree /f /a SMIB_Example
12
15
Folder PATH listing
13
16
Volume serial number is ...
14
-
C:\\USERS\\...\\SMIB
17
+
C:\\USERS\\...\\SMIB_Example
15
18
| create_records.py
16
19
| run_pf.py
17
-
|
18
20
+---models
19
21
| \\---SMIB
20
22
| | ...
21
23
|
22
24
\\---pf2rec
25
+
| create_pf_records.py
26
+
| generate_component_list.py
27
+
| gridcal2rec.py
28
+
| __init__.py
23
29
| ...
24
-
</pre></blockquote>
25
-
</li>
26
-
<li>In the same location where you have your <font color=\"blue\"><code>models</code></font> and <font color=\"blue\"><code>pf2rec</code></font> folders, create a new python file called <font color=\"blue\"><code>create_records.py</code></font>. Copy and paste the following code in the file. <em>Be careful with indentation!</em>
<strong>for</strong> l <strong>in</strong> new_lines:
72
-
mo_file.write(<em>\"{}\"</em>.format(l))
73
-
74
-
create_pf_records(_model,
75
-
path_mo_file,
76
-
data_path,
77
-
openipsl_version = _version)
78
-
79
30
</pre></blockquote>
80
31
</li>
81
32
<li>Reload your model or run Dymola, depending on what you did at the end of the previous section. Create a package inside the root package <font color=\"blue\"><code>SMIB</code></font> and name it <font color=\"blue\"><code>Utilities</code></font>. </li>
82
33
<li>Add a new function inside <font color=\"blue\"><code>Utilities</code></font> called <font color=\"blue\"><code>saveTotalSMIBModel</code></font>. Remember that the procedure for creating functions is the same as for other kinds of classes such as <font color=\"blue\"><code>Package</code></font>, <font color=\"blue\"><code>Model</code></font> or <font color=\"blue\"><code>Record</code></font>. </li>
83
34
<li>Go to the Modelica text of the function and type the following code:
84
35
<blockquote><pre>
85
36
<strong>function</strong> saveTotalSMIBModel \"Save the SMIB package as a total model\"
86
-
<strong>output</strong> <em>Boolean</em> ok \"True if succesful\";
ok := <em>saveTotalModel</em>(\"SMIBTotal.mo\", \"SMIB\", <strong>true</strong>);
42
+
ok := <em>saveTotalModel</em>(targetDir + \"/\" + \"SMIBTotal.mo\", \"SMIB\", <strong>true</strong>);
89
43
<strong>end</strong> saveTotalSMIBModel;
90
44
</pre></blockquote>
91
45
<hr>
46
+
<p>🔨 <strong>Update</strong> the <em>targetDir</em> variable value with the appropriate path to reach the <font color=\"blue\"><code>SMIB</code></font> folder. </p>
92
47
<p>📌 This function has no inputs and only one boolean output. The modelica standard function <em><font color=\"blue\"><code>saveTotalModel</code></font></em> is called inside the algorithm section with predefined arguments. You can check the information view of <em><font color=\"blue\"><code>saveTotalModel</code></font></em> to get to know the proper use of each of its parameters. To do that, make sure the <font color=\"blue\"><code>DymolaCommands</code></font> library is loaded within the Package Browser. Then navigate as shown in the picture below </p>
<li>Right-click the <font color=\"blue\"><code>saveTotalSMIBModel</code></font> function from the Package Browser. Select the " <em>Call Function...</em>" option and then click the <font color=\"blue\"><code>OK</code></font> button. As a result, you should be able to see a new file called <em><font color=\"blue\"><code>SMIBTotal.mo</code></font></em> in the same folder where your model files are being stored. </li>
99
-
<li>Go to the system terminal, change the current directory to the location where the <font color=\"blue\"><code>create_records</code></font> python script is placed and execute it as indicated below.
54
+
<li>Go to the system terminal, change the current directory to the location where the <font color=\"blue\"><code>create_records</code></font> Python script is placed and execute it as indicated below.
100
55
<blockquote><pre>
101
56
<strong>python</strong> create_records.py
102
57
</pre></blockquote>
103
58
</li>
104
59
<li>Go back to Dymola and refresh ( <img src=\"modelica://OpenIPSL/Resources/images/example_4/PFRecordCreation/RefreshButton.png\" alt=\"RefreshButton\" />) the SMIB package.
105
60
<hr>
106
61
<p>
107
-
📌 The python script <font color=\"blue\"><code>create_records</code></font> should have created a new package inside your model that looks like this
62
+
📌 The Python script <font color=\"blue\"><code>create_records</code></font> should have created a new package inside your model that looks like this
Copy file name to clipboardExpand all lines: OpenIPSL/Examples/Tutorial/Example_4/Instructions/PopulatingRecords.mo
+71-66Lines changed: 71 additions & 66 deletions
Original file line number
Diff line number
Diff line change
@@ -5,80 +5,74 @@ model PopulatingRecords "Populating PF Records"
5
5
<h5>Populating Power Flows with GridCal</h5>
6
6
<p>The next step is to populate our model with power flow results generated from GridCal. For simplicity, we will create a power flow model from an accompanying PSS/E <font color=\"blue\"><code>.raw</code></font>. However, it is possible to run the power flows from a native GridCal model. </p>
7
7
<ol>
8
-
<li><a href=\"https://github.com/ALSETLab/SMIB_Tutorial/tree/master/models/_old/SMIB/PSSE_Files\">Download</a> the accompanying PSS/E <font color=\"blue\"><code>.raw</code></font> file (<font color=\"blue\"><code>SMIB_Base_Case.raw</code></font>) and save it in your model directory under <font color=\"blue\"><code>PSSE_Files</code></font>. The <font color=\"blue\"><code>.dyr</code></font> file is not required for power flow computations.
8
+
<li>Create a new <a href=\"modelica://OpenIPSL/Resources/utils/pfRecordCreator/models/_new/SMIB\">PSSE_Files</a> folder within <font color=\"blue\"><code>SMIB_Example/models/SMIB</code></font> folder.
<li>Create a new Python script called <font color=\"blue\"><code>run_pf.py</code></font>. Copy and paste the following code inside it.
13
+
<li>Create a new PSS/E raw file called <font color=\"blue\"><code>SMIB_Base_Case.raw</code></font> within the <font color=\"blue\"><code>PSSE_Files</code></font> folder. Copy and paste the following text inside the file and save it:
<p>📌 A new power flow record called <font color=\"blue\"><code>PF00000</code></font> should be generated inside the <font color=\"blue\"><code>PFData</code></font> subfolder. </p>
<li>In the diagram layer of your SMIB model, double click the power flow component <font color=\"blue\"><code>pf</code></font>. Select the newly created power flow <font color=\"blue\"><code>PF00000</code></font> as the value for the <font color=\"blue\"><code>PowerFlow</code></font> field. By doing so, we are specifying that the model will initialize using the power flow results in that specific container.
87
+
<p>📌 You can alternatively modify the <strong>Modelica Text</strong> of the <font color=\"blue\"><code>SMIB</code></font> Experiment model as follows: </p>
88
+
<blockquote><pre>
89
+
model SMIB
90
+
extends Modelica.Icons.Example;
91
+
<strong>extends BaseModels.BaseNetwork.SMIBPartial(pf(redeclare record PowerFlow = PFData.PF00000));</strong>
0 commit comments