ObstacleFMU.py 703 B

12345678910111213141516171819202122
  1. from units.CTSimulationUnit_Euler import CTSimulationUnit_Euler
  2. class ObstacleFMU(CTSimulationUnit_Euler):
  3. def __init__(self, name, num_rtol, num_atol, internal_step_size, c, fixed_x):
  4. self.x = "x"
  5. self.F = "F"
  6. input_vars = [self.x]
  7. def calc_F(x, u):
  8. return c*(u[self.x] - fixed_x) if u[self.x] > fixed_x else 0.0
  9. state_derivatives = {}
  10. algebraic_functions = {
  11. self.F : calc_F
  12. }
  13. CTSimulationUnit_Euler.__init__(self, name, num_rtol, num_atol, internal_step_size, state_derivatives, algebraic_functions, input_vars)