Skip to content

Commit

Permalink
Merge pull request #90 from sot/step-function
Browse files Browse the repository at this point in the history
Enhance StepFunctionPower component to allow multiple instances
  • Loading branch information
taldcroft authored Jul 21, 2020
2 parents c3be177 + 1bf6e69 commit f32a1d6
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions xija/component/heat.py
Original file line number Diff line number Diff line change
Expand Up @@ -1013,18 +1013,26 @@ def plot_data__time(self, fig, ax):

class StepFunctionPower(PrecomputedHeatPower):
"""
A class that applies a constant temperature shift only
after a certain point in time.
A class that applies a constant heat power shift only
after a certain point in time. The shift is 0.0 before
``time`` and ``P`` after ``time``.
:param model: parent model object
:param node: node name or object for which to apply shift
:param time: time of step function shift
:param P: size of shift in heat power (default=0.0)
:param id: str, identifier to allow multiple steps (default='')
"""
def __init__(self, model, node, time, P=0.0):
def __init__(self, model, node, time, P=0.0, id=''):
super(StepFunctionPower, self).__init__(model)
self.time = DateTime(time).secs
self.node = self.model.get_comp(node)
self.add_par('P', P, min=-10.0, max=10.0)
self.n_mvals = 1
self.id = id
self.add_par('P', P, min=-10.0, max=10.0)

def __str__(self):
return 'step_power__{0}'.format(self.node)
return f'step_power{self.id}__{self.node}'

def get_dvals_tlm(self):
"""Return an array of zeros => no activation of the heater.
Expand Down

0 comments on commit f32a1d6

Please sign in to comment.