automata4cps.cps.CPSComponent¶
- class automata4cps.cps.CPSComponent(id, t=0, initial_q=(), initial_xt: list = (), initial_xk: list = (), dt=-1.0, p=None, cont_state_names=None, discr_state_names=None, discr_output_names=None, cont_output_names=None, unknown_state='Unknown')¶
General hybrid system class based on scipy and simpy.
- __init__(id, t=0, initial_q=(), initial_xt: list = (), initial_xk: list = (), dt=-1.0, p=None, cont_state_names=None, discr_state_names=None, discr_output_names=None, cont_output_names=None, unknown_state='Unknown')¶
Methods
__init__
(id[, t, initial_q, initial_xt, ...])apply_sim_event
(e)The event e is applied in this component's simpy execution, this means that the process must wait for an event.
context
(q, past_t, past_p, t)finish
(t, **kwargs)finish_condition
()get_alternatives
(state, system_state)get_decision_state
(state, overall_state)get_execution_data
()get_sim_state
()input
(q, clock)invariants
(q, clock, xc, xd, y)is_decision
(state, overall_state)load_context
(context)Loads artifacts from the specified
PythonModelContext
that can be used bypredict()
when evaluating inputs.on_entry
(q, context)output
(q, e, clock, xt, xk, u, p)predict
(context, model_input)Evaluates a pyfunc-compatible input and produces a pyfunc-compatible output.
predict_stream
(context, model_input[, params])Evaluates a pyfunc-compatible input and produces an iterator of output.
read_event
(t, e[, clear_p, keep_p])reinitialize
(t[, state])set_sim_state
(q, e, p, y, block_event)simulate
(finish_time)simulation_process_simpy
(env, max_time[, ...])The function simulates single concurrent thread of one component (CPSComponent).
stop_condition
(t)Simulation stop condition which can be overridden by the subclasses.
time_continuous_dynamics
(t, xt, xk, q, u, p, y)time_discrete_dynamics
(t, xt, xk, q, u, p, y)timed_event
(q, xc, xd)Calculates if and when the next time event will happen and the new state values.
update_input
(u)wait
(q)Attributes
full_id
overall_system
state
System state is a vector of all state variables.