# Path: deluca/lung/core.py
# ROOT = os.path.dirname(os.path.realpath(os.path.join(__file__, "../..")))
# DEFAULT_XP = [0.0, 1.0, 1.5, 3.0 - 1e-8, 3.0]
# DEFAULT_DT = 0.03
# class BreathWaveform(deluca.Obj):
# class LungEnv(deluca.Env):
# class LungEnvState(deluca.Obj):
# class ControllerState(deluca.Obj):
# class Controller(deluca.Agent):
#   def setup(self):
#   def at(self, t):
#     def static_interp(t, xp, fp, period):
#   def elapsed(self, t):
#   def is_in(self, t):
#   def is_ex(self, t):
#   def time(self, state):
#   def dt(self):
#   def physical(self):
#   def should_abort(self):
#   def wait(self, duration):
#   def cleanup(self):
# def proper_time(t):
#   def init(self, waveform=None):
#   def max(self):
#   def min(self):
#   def decay(self, waveform, t):
#     def false_func():


import deluca.core
import jax
import jax.numpy as jnp
from deluca.lung import core
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Residual controller."""


class CompositeState(deluca.Obj):
  """Combined state of two controller states."""
  base_state: deluca.Obj
  resid_state: deluca.Obj

  @property
  def time(self):
    return self.base_state.time

  @property
  def steps(self):
    return self.base_state.steps

  @property
  def dt(self):
    return self.base_state.dt


class CompositeController(core.Controller):
  """Controller comprised of a base controller along with a residual controller.

  Only the residual controller is trainable.
  """

# Path: deluca/lung/core.py
# ROOT = os.path.dirname(os.path.realpath(os.path.join(__file__, "../..")))
# DEFAULT_XP = [0.0, 1.0, 1.5, 3.0 - 1e-8, 3.0]
# DEFAULT_DT = 0.03
# class BreathWaveform(deluca.Obj):
# class LungEnv(deluca.Env):
# class LungEnvState(deluca.Obj):
# class ControllerState(deluca.Obj):
# class Controller(deluca.Agent):
#   def setup(self):
#   def at(self, t):
#     def static_interp(t, xp, fp, period):
#   def elapsed(self, t):
#   def is_in(self, t):
#   def is_ex(self, t):
#   def time(self, state):
#   def dt(self):
#   def physical(self):
#   def should_abort(self):
#   def wait(self, duration):
#   def cleanup(self):
# def proper_time(t):
#   def init(self, waveform=None):
#   def max(self):
#   def min(self):
#   def decay(self, waveform, t):
#     def false_func():


# Path: deluca/lung/controllers/_residual.py
import deluca.core
import jax
import jax.numpy as jnp
from deluca.lung import core

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Residual controller."""


class CompositeState(deluca.Obj):
  """Combined state of two controller states."""
  base_state: deluca.Obj
  resid_state: deluca.Obj

  @property
  def time(self):
    return self.base_state.time

  @property
  def steps(self):
    return self.base_state.steps

  @property
  def dt(self):
    return self.base_state.dt


class CompositeController(core.Controller):
  """Controller comprised of a base controller along with a residual controller.

  Only the residual controller is trainable.
  """

  base_controller: core.Controller = deluca.field(jaxed=False)