Skip to content

Commit

Permalink
minor fix in reward calculation and some minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Heid committed Oct 23, 2020
1 parent 85dec29 commit 214a16d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions net/net_single-inv-curr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ components:
out:
v: [lc1.capacitor1.v, lc1.capacitor2.v, lc1.capacitor3.v]
i: [lc1.inductor1.i, lc1.inductor2.i, lc1.inductor3.i]
# iref: [0,0,0]
# vref: [1,0,0]
i_ref: [15,0,0]
# v_ref: [1,0,0]

2 changes: 1 addition & 1 deletion openmodelica_microgrid_gym/aux_ctl/pi_controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def step(self, error: float) -> float:
PI_Parameters provided during initialisation, clipped due to the defined limits
"""

self.integralSum = self.integralSum + (self._params.kI * error + self.windup_compensation) * self._ts
self.integralSum += (self._params.kI * error + self.windup_compensation) * self._ts
output = self._params.kP * error + self.integralSum
clipped = np.clip(output, *self._params.limits)
self.windup_compensation = (output - clipped) * self._params.kB
Expand Down
2 changes: 1 addition & 1 deletion openmodelica_microgrid_gym/env/modelica.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def step(self, action: Sequence) -> Tuple[np.ndarray, float, bool, Mapping]:
else:
logger.debug("Experiment step done, experiment done.")

reward = self.reward(self.history.cols, obs)
reward = self.reward(self.history.cols, outputs)
self._failed = np.isnan(reward) or np.isinf(reward) and reward < 0 or reward is None

# only return the state, the agent does not need the measurement
Expand Down

0 comments on commit 214a16d

Please sign in to comment.