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 file name to clipboardExpand all lines: doc/Demonstrations_and_Examples.rst
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,8 @@ TESP Capability Demonstrations
30
30
./demonstrations/houses.rst
31
31
./demonstrations/gld_player_recorder.rst
32
32
./demonstrations/gld_modifier.rst
33
+
./demonstrations/datastore.rst
34
+
33
35
34
36
TESP uses TCP/IP port 5570 for communication and requires Python 3. Simulations can start many processes, and take minutes or hours to complete. At this time, instructions are given only for the Linux package or Docker version of TESP, which is installable. See below for advice on running TESP in native Mac OS X or Windows.
Copy file name to clipboardExpand all lines: doc/demonstrations/gld_modifier.rst
+18-15Lines changed: 18 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -41,29 +41,32 @@ With the modifier, we can read the GridLAB-D model into the GLMModifier data str
41
41
GridLAB-D split their functionality into various modules and for this example, we're going to be adding houses to the model which means we need to make sure the "residential" module gets added to the model file.::
42
42
43
43
glmMod.add_module('residential', [])
44
+
45
+
The GLMModifier has an attribute that holds the entire GridLAB-D model, "glm". Purely to make our live a few characters easier when using the GLMModifier, we can assign this to another variable of our choice and strip out the need constantly pre-pend many of our commands with "GLMModifier".::
44
46
45
-
GLMModifier makes it easy to get the names of all of the objects of a given class and in this case, to add houses, we need to look for GridLAB-D's "triplex_meters" to attach the houses to.::
If we wanted the objects themselves we would instead call::
49
+
GLMModifier makes it easy to get the names of all of the objects of a given class and in this case, to add houses, we need to look for GridLAB-D's "triplex_meters" to attach the houses to.::
``tp_meter_objs`` is then a Python dictionary with the keys being the object names and the value being an Python dictionary of the object parameters and values.
54
+
``tp_meter_objs`` is a Python dictionary with the keys being the object names and the value being an Python dictionary of the object parameters and values. To make a list of the names of the meters, we just need to ask for the keys of the dictionary as a list.
54
55
55
56
Adding Objects
56
57
--------------
57
58
58
59
``tp_meter_names`` is a list of the names of the GridLAB-D ``triplex_meter`` objects as strings. Using those names we can build up a Python dictionary that defines the parameters of another ``triplex_meter`` object we're going to add to the model. The dictionary is called "meter_params" and has three members all defined by the data from an existing specific ``triplex_meter`` in the model.::
The ``phases`` and ``nominal_voltage`` show a common practice with the GLMModifier: ask GLMModifier for all objects of a certain type in the model and then ask for a specific one from that list by name. This shows up as a ``.get_objects("name of GridLAB-D class").instance("object name")``. ``.instance()`` returns a Python dictionary with all the GridLAB-D parameters as members. Alternatively, there is a specific API that does the same thing: ``glmMod.get_object_named_instance("name of GridLAB-D class", "object name")``
69
+
The ``phases`` and ``nominal_voltage`` are easily defined using GLMModifier as they are just members of a dictionary that defines a specific triplex meter.
67
70
68
71
Once the Python dictionary with the GridLAB-D object parameters are defined, it can simply be added to the model.::
69
72
@@ -73,23 +76,23 @@ Once the Python dictionary with the GridLAB-D object parameters are defined, it
73
76
74
77
Adding and Modifying Existing Object Parameter Values
Further down in the example, there's an example of how to modify an existing object. In this case, the ``.add_object()`` method returns the the GridLAB-D object (effectively a Python dictionary). Its also possible to get the same object using the ``.get_objects().instance()``. Using either method, once you have the GridLAB-D object, its easy to modify any of its properties such as::
79
+
Further down in the example, there's a portion of code showing of how to modify an existing object. In this case, we use the fact that ``.add_object()`` method returns the the GridLAB-D object (effectively a Python dictionary) once it is added to the model. Once you have the GridLAB-D object, its easy to modify any of its properties such as::
77
80
78
81
house_obj['floor_area'] = 2469
79
82
80
83
This exact syntax is also valid for adding a parameter that is undefined to an existing GridLAB-D object.
81
84
82
85
Deleting Existing Object Parameter Values
83
86
-----------------------------------------
84
-
To delete a GridLAB-D object parameter value there is a dedicated API call::
87
+
To delete a GridLAB-D object parameter value, you can just set to to `None`::
Note that GridLAB-D requires some parameters to be defined to run its simulations. Removing the parameter will remove it from the GridLAB-D model file that gets created (.glm) but may effectively force GridLAB-D to use its internal default value.
91
+
Note that GridLAB-D requires some parameters to be defined to run its simulations. Removing the parameter will remove it from the GridLAB-D model file that gets created (.glm) but may effectively force GridLAB-D to use its internal default value. That is, clearing the parameter value in this way is not the same as setting it to an undefined value.
89
92
90
93
Deleting Existing Objects
91
94
-------------------------
92
-
Its possible to delete an object and all its parameter values::
95
+
Its possible to delete an object and all its parameter values from the GridLAB-D model::
0 commit comments