def event_variable_equation(self, event_variable_equation):
assert event_variable_equation.atoms(sp.Symbol) <= set(
self.constants_values.keys()) | set([dynamicsymbols._t])
self._event_variable_equation = event_variable_equation
if self.dim_state:
assert find_dynamicsymbols(event_variable_equation) <= \
set(self.state)
self.event_variable_equation_function = self.code_generator(
[dynamicsymbols._t] + sp.flatten(self.state),
self._event_variable_equation.subs(self.constants_values),
**self.code_generator_args
)
else:
assert find_dynamicsymbols(event_variable_equation) <= \
set(self.input)
self.event_variable_equation_function = self.code_generator(
[dynamicsymbols._t] + sp.flatten(self.input),
self._event_variable_equation.subs(self.constants_values),
**self.code_generator_args
)
评论列表
文章目录