e2nIEE / pandapower
Showing 1 of 3 files from the diff.

@@ -17,8 +17,11 @@
Loading
17 17
18 18
class ConstControl(Controller):
19 19
    """
20 -
    Class representing a generic time series controller for a specified element and variable
21 -
    Control strategy: "No Control" -> just updates timeseries
20 +
    Class representing a generic time series controller for a specified element and variable.
21 +
    Control strategy: "No Control" -> updates values of specified elements according to timeseries input data.
22 +
    If ConstControl is used without timeseries input data, it will reset the controlled values to the initial values,
23 +
    preserving the initial net state.
24 +
    The timeseries values are written to net during time_step before the initial powerflow run and before other controllers' control_step.
22 25
    It is possible to set attributes of objects that are contained in a net table, e.g. attributes of other controllers. This can be helpful
23 26
    e.g. if a voltage setpoint of a transformer tap changer depends on the time step.
24 27
    An attribute of an object in the "object" column of a table (e.g. net.controller["object"] -> net.controller.object.at[0, "vm_set_pu"]
@@ -141,20 +144,19 @@
Loading
141 144
    def time_step(self, net, time):
142 145
        """
143 146
        Get the values of the element from data source
147 +
        Write to pandapower net by calling write_to_net()
148 +
        If ConstControl is used without a data_source, it will reset the controlled values to the initial values,
149 +
        preserving the initial net state.
144 150
        """
145 -
        self.values = self.data_source.get_time_step_value(time_step=time,
146 -
                                                           profile_name=self.profile_name,
147 -
                                                           scale_factor=self.scale_factor)
148 -
        # self.write_to_net()
149 -
150 -
    def initialize_control(self, net):
151 -
        """
152 -
        At the beginning of each run_control call reset applied-flag
153 -
        """
154 -
        #
151 +
        self.applied = False
155 152
        if self.data_source is None:
156 153
            self.values = net[self.element][self.variable].loc[self.element_index]
157 -
        self.applied = False
154 +
        else:
155 +
            self.values = self.data_source.get_time_step_value(time_step=time,
156 +
                                                               profile_name=self.profile_name,
157 +
                                                               scale_factor=self.scale_factor)
158 +
        if self.values is not None:
159 +
            self.write_to_net(net)
158 160
159 161
    def is_converged(self, net):
160 162
        """
@@ -164,10 +166,8 @@
Loading
164 166
165 167
    def control_step(self, net):
166 168
        """
167 -
        Write to pandapower net by calling write_to_net()
169 +
        Set applied to True, which means that the values set in time_step have been included in the load flow calculation.
168 170
        """
169 -
        if self.values is not None:
170 -
            self.write_to_net(net)
171 171
        self.applied = True
172 172
173 173
    def _write_to_single_index(self, net):
Files Coverage
pandapower 87.60%
setup.py 0.00%
Project Totals (168 files) 87.52%

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading