Simbody
3.3
|
An Event is "something that happens" during a Study that is advancing through time. More...
#include <Event.h>
Classes | |
class | Cause |
These are all the possible causes for events. More... | |
Public Types | |
enum | Trigger { NoEventTrigger =0x0000, PositiveToNegative =0x0001, NegativeToPositive =0x0002, Falling =(PositiveToNegative), Rising =(NegativeToPositive), AnySignChange =(PositiveToNegative|NegativeToPositive) } |
Triggered Events respond to zero crossings of their associated trigger function. More... | |
Static Public Member Functions | |
static const char * | getCauseName (Cause) |
This is useful for debugging; it translates an Event::Cause into a readable string. More... | |
static std::string | eventTriggerString (Trigger) |
This is useful for debugging; it translates an Event::Trigger or a mask formed by a union of Event::Triggers, into a readable string. More... | |
static Trigger | classifyTransition (int before, int after) |
Classify a before/after sign transition. More... | |
static Trigger | maskTransition (Trigger transition, Trigger mask) |
Given an observed transition, weed out ignorable ones using the supplied mask. More... | |
An Event is "something that happens" during a Study that is advancing through time.
Its occurence interrupts the normal flow of computation, allowing an event Handler to adjust the State prior to resuming the Study.
Events are allocated by Subsystems, but require some System global resources. All Events are given a unique SystemEventId. Some Events require other State resources, such as slots for the values of trigger functions in the case of Triggered events.
Events can be allocated at Topology, Model, and Instance Stages. All Event resources are assigned when the Instance stage is realized. However, if an Event requires state variables, then it must be allocated by Model stage.
Triggered Events respond to zero crossings of their associated trigger function.
This enum defines constants for use in specifying which kind of zero crossing has been seen, or which kinds are considered interesting. For the latter purpose, these can be or'ed together to make a mask.
Enumerator | |
---|---|
NoEventTrigger | |
PositiveToNegative | |
NegativeToPositive | |
Falling | |
Rising | |
AnySignChange |
|
static |
This is useful for debugging; it translates an Event::Cause into a readable string.
|
static |
This is useful for debugging; it translates an Event::Trigger or a mask formed by a union of Event::Triggers, into a readable string.
|
inlinestatic |
Classify a before/after sign transition.
Before and after must both be -1,0, or 1 as returned by the SimTK::sign() function applied to the trigger function value at the beginning and end of a step.
Given an observed transition, weed out ignorable ones using the supplied mask.
That is, the return will indicate NoEventTrigger unless the original Trigger was present in the mask.