#include <ActuatorPerturbation.h>
Public Types | |
enum | PertType { SCALE, DELTA, CONSTANT } |
Perturbation types. More... | |
Public Member Functions | |
ActuatorPerturbation (Model *aModel) | |
Construct an instance for perturbing actuator forces during an integration. | |
ActuatorPerturbation (const ActuatorPerturbation &aActuatorPerturbation) | |
Copy constructor. | |
ActuatorPerturbation (const std::string &aFileName, bool aUpdateFromXMLNode=true) | |
Construct an object from file. | |
virtual | ~ActuatorPerturbation () |
Destructor. | |
virtual Object * | copy () const |
Virtual copy constructor. | |
ActuatorPerturbation & | operator= (const ActuatorPerturbation &aActuatorPerturbation) |
Assignment operator. | |
void | setActuator (Actuator *aActuator) |
Set for which actuator a force perturbation should be made. | |
Actuator * | getActuator () const |
Get for which actuator a force perturbation should be made. | |
void | setAllowNegForce (bool aTrueFalse) |
Set whether it is permissable that a perturbation produces a negative force. | |
bool | getAllowNegForce () const |
Get whether negative force is allowed. | |
void | setPerturbation (const SimTK::State &s, PertType aPerturbationType, double aPerturbation) |
Set the perturbation type and the perturbation size. | |
virtual void | setModel (Model &) |
Set a pointer to the model for which this perturbation has been set. | |
Model * | getModel () const |
Get a pointer to the model for which this perturbation has been set. | |
void | setOn (bool aTrueFalse) |
Turn this perturbation on or off. | |
bool | getOn () const |
Get whether or not this analysis is on. | |
void | setStartTime (double aStartTime) |
Set the time at which to begin executing the perturbation. | |
double | getStartTime () const |
Get the time at which to begin executing the perturbation, expressed in normalized time units, not real time units. | |
void | setEndTime (double aEndTime) |
Set the time at which to end executing the perturbation. | |
double | getEndTime () const |
Get the time at which to end executing the perturbation, expressed in normalized time units, not real time units. | |
double | getPerturbation () const |
Get the size of the force perturbation that is made to the action forces. | |
PertType | getPerturbationType () const |
Get the type of the force perturbation that is made to the action forces. | |
Storage * | getForceStorage () |
Get a pointer to the Storage containing the nominal and perturbed forces. | |
virtual void | reset (const SimTK::State &s) |
Reset the perturbation. | |
virtual void | computeActuation (const SimTK::State &s) |
ActuatorPerturbation called right after actuation has been computed by the model. | |
virtual void | applyActuation (const SimTK::State &s) |
ActuatorPerturbation called right after actuation has been applied by the model. | |
Protected Attributes | |
Actuator * | _actuator |
Which actuator. | |
bool | _allowNegForce |
Negative force flag. | |
double | _perturbation |
Force perturbation. | |
PertType | _perturbationType |
Type of perturbation. | |
double | _force |
Nominal actuator force. | |
Storage * | _forceStore |
Storage for holding nominal and perturbed force. | |
Model * | _model |
Model. |
ActuatorPerturbation::ActuatorPerturbation | ( | Model * | aModel | ) |
Construct an instance for perturbing actuator forces during an integration.
aModel | Model for which actuator forces are to be perturbed. |
ActuatorPerturbation::ActuatorPerturbation | ( | const ActuatorPerturbation & | aActuatorPerturbation | ) |
Copy constructor.
aActuatorPerturbation | ActuatorPerturbation to copy. |
ActuatorPerturbation::ActuatorPerturbation | ( | const std::string & | aFileName, | |
bool | aUpdateFromXMLNode = true | |||
) |
Construct an object from file.
The object is constructed from the root element of the XML document. The type of object is the tag name of the XML root element.
aFileName | File name of the document. |
ActuatorPerturbation::~ActuatorPerturbation | ( | ) | [virtual] |
Destructor.
void ActuatorPerturbation::applyActuation | ( | const SimTK::State & | s | ) | [virtual] |
ActuatorPerturbation called right after actuation has been applied by the model.
The nominal atuator force is restored.
Reimplemented in OpenSim::ActuatorPerturbationIndependent.
void ActuatorPerturbation::computeActuation | ( | const SimTK::State & | s | ) | [virtual] |
ActuatorPerturbation called right after actuation has been computed by the model.
The nominal atuator force is recorded so that it can be restored, and the actuator force is replaced by its perturbed value.
s | System state |
Reimplemented in OpenSim::ActuatorPerturbationIndependent.
Object * ActuatorPerturbation::copy | ( | ) | const [virtual] |
Virtual copy constructor.
Reimplemented from OpenSim::Object.
Actuator * ActuatorPerturbation::getActuator | ( | ) | const |
Get for which actuator a force perturbation should be made.
bool ActuatorPerturbation::getAllowNegForce | ( | ) | const |
double ActuatorPerturbation::getEndTime | ( | ) | const |
Get the time at which to end executing the perturbation, expressed in normalized time units, not real time units.
Storage * ActuatorPerturbation::getForceStorage | ( | ) |
Get a pointer to the Storage containing the nominal and perturbed forces.
Model * ActuatorPerturbation::getModel | ( | ) | const |
Get a pointer to the model for which this perturbation has been set.
bool ActuatorPerturbation::getOn | ( | ) | const |
Get whether or not this analysis is on.
double ActuatorPerturbation::getPerturbation | ( | ) | const |
Get the size of the force perturbation that is made to the action forces.
ActuatorPerturbation::PertType ActuatorPerturbation::getPerturbationType | ( | ) | const |
Get the type of the force perturbation that is made to the action forces.
double ActuatorPerturbation::getStartTime | ( | ) | const |
Get the time at which to begin executing the perturbation, expressed in normalized time units, not real time units.
ActuatorPerturbation & ActuatorPerturbation::operator= | ( | const ActuatorPerturbation & | aActuatorPerturbation | ) |
void ActuatorPerturbation::reset | ( | const SimTK::State & | s | ) | [virtual] |
Reset the perturbation.
This method resets any internal objects so that a new perturbation series can be run cleanly.
Specifically, for this class, the force storage object is reset (or emptied) so that any new force perturbations are stored at the beginning of the force storage object.
Reimplemented in OpenSim::ActuatorPerturbationIndependent.
void ActuatorPerturbation::setActuator | ( | Actuator * | aAct | ) |
Set for which actuator a force perturbation should be made.
aAct | Pointer to the actuator. |
void ActuatorPerturbation::setAllowNegForce | ( | bool | aTrueFalse | ) |
Set whether it is permissable that a perturbation produces a negative force.
allowNegForce | Flag indicates whether a negative force is permitted |
void ActuatorPerturbation::setEndTime | ( | double | aEndTime | ) |
Set the time at which to end executing the perturbation.
Note that the end time should be specified in normalized time units, not in real time units.
aEndTime | Time at which the perturbation should end execution in NORMALIZED time units. |
void ActuatorPerturbation::setModel | ( | Model & | aModel | ) | [virtual] |
Set a pointer to the model for which this perturbation has been set.
void ActuatorPerturbation::setOn | ( | bool | aTrueFalse | ) |
Turn this perturbation on or off.
aTureFalse | Turns analysis on if "true" and off if "false". |
void ActuatorPerturbation::setPerturbation | ( | const SimTK::State & | s, | |
PertType | aPerturbationType, | |||
double | aPerturbation | |||
) |
Set the perturbation type and the perturbation size.
Three different types of perturbation are allowed, as listed in the enum PertType.
PertType SCALE
The force perturbation (df) that is made is computed by multiplying the action force (f) by the perturbation:
df = perturbation * f
The perturbation factor may be any value; however, a value between 0.0 and 1.0 what is typically used.
PertType DELTA
The force perturbation (df) that is made is computed by adding the perturbation to the the action force (f) by the perturbation:
df = f + perturbation
PertType CONSTANT
The force perturbation (df) that is made is computed by seting the action force (f) equal to the perturbation:
df = perturbation
aPerturbationType | Perturbation type. | |
aPerturbation | Perturbation value. |
void ActuatorPerturbation::setStartTime | ( | double | aStartTime | ) |
Set the time at which to begin executing the perturbation.
Note that the start time should be specified in normalized time units, not in real time units.
aStartTime | Start time expressed in NORMALIZED time units. |
Actuator* OpenSim::ActuatorPerturbation::_actuator [protected] |
Which actuator.
bool OpenSim::ActuatorPerturbation::_allowNegForce [protected] |
Negative force flag.
double OpenSim::ActuatorPerturbation::_force [protected] |
Nominal actuator force.
Storage* OpenSim::ActuatorPerturbation::_forceStore [protected] |
Storage for holding nominal and perturbed force.
Model* OpenSim::ActuatorPerturbation::_model [protected] |
double OpenSim::ActuatorPerturbation::_perturbation [protected] |
Force perturbation.
Type of perturbation.