# StateComponent

The StateComponent is used to define components that contain differential equations.

The user must define a function that returns the initial condition (GetInitialConditions) and the calculation of the state derivative (CalcStateDerivatives). In case of hybrid systems (discrete), then one must define the event polling (CheckForEvent and TriggeredOnSign) and event handle functions (EventHandler), while also notify that the component contains discrete events (HasDescreteEvent).

### Public Attributes

Parameter | Type | Description |
---|---|---|

name | String | Name of the state component (required). |

### Public Functions

Function | Description |
---|---|

std::vector< Real > GetInitialConditions() const | Interface. |

std::vector< Real > CalcStateDerivatives(Real t, std::vector< Real > x0) const | Calculates the state derivative xdot = f(t, x). |

bool HasDiscreteEvent() const | If this component models a hybrid system (discrete events) then one should make this function true. |

int TriggeredOnSign() const | If +1, then triggered on rising sign transition. |

Real CheckForEvent(Real t, std::vector< Real > x) const | Implements a zero crossing function that signifies an event. |

std::vector< Real > EventHandler(Real t, std::vector< Real > x) const | A function that is called when an event is detected and returns a the new state. |

_{Converted from doxygen using dokugen}