Integrator Class
(CDPSim::Integrator)This simulator model describes a (limited) Integrator function. Inherits DynamicSimComponent. More...
Header: | #include <Integrator> |
Inherits: | CDPSim::DynamicSimComponent |
Public Functions
Integrator() | |
~Integrator() override |
Reimplemented Public Functions
virtual void | Configure(const char *componentXML) override |
virtual void | Create(const char *fullName) override |
virtual void | CreateModel() override |
virtual void | ProcessNull() override |
- 16 public functions inherited from CDPSim::DynamicSimComponent
- 90 public functions inherited from CDPComponent
- 37 public functions inherited from CDPObject
- 46 public functions inherited from CDPBaseObject
- 26 public functions inherited from CDP::StudioAPI::CDPNode
- 22 public functions inherited from CDP::StudioAPI::ICDPNode
Reimplemented Protected Functions
virtual void | EvaluateDiffEquations(double t) override |
virtual void | PostIntegrate() override |
virtual void | PreIntegrate() override |
- 4 protected functions inherited from CDPSim::DynamicSimComponent
- 12 protected functions inherited from CDPComponent
- 13 protected functions inherited from CDPObject
- 1 protected function inherited from CDP::StudioAPI::CDPNode
Additional Inherited Members
- 2 static public members inherited from CDPComponent
- 6 static public members inherited from CDPObject
- 1 static public member inherited from CDPBaseObject
- 4 protected functions inherited from CDPSim::DynamicSimComponent
- 12 protected functions inherited from CDPComponent
- 13 protected functions inherited from CDPObject
- 1 protected function inherited from CDP::StudioAPI::CDPNode
- 42 protected variables inherited from CDPComponent
- 9 protected variables inherited from CDPObject
- 11 protected variables inherited from CDPBaseObject
Detailed Description
Description
This simulator model describes a (limited) Integrator function. Inherits DynamicSimComponent.
`Out=int_"LowerLimit"^"UpperLimit" Ki*"In" dt`
Integral, Wikipedia (© CC BY-SA 3.0)
This Integrator simulator-component has an input CDPSim::SimSignal called In, where you may set the Routing to wanted input-signal. The CDPSim::StateVariable called Out is the calculated output (integrated signal). The Out value is limited by the two CDPParameters called UpperLimit and LowerLimit, which you may set to wanted values. There is also a CDPParameter Ki, which is the integral gain (it is multiplied with he derivative of the StateVariable Out).
Simple Example
- Add a simulator application to your system, e.g. "SimApp". A SimulatorManager will then automatically have been added to the simulator application.
- Click on the SimulatorManager in the Project tree, then expand CDPSim in the Resource tree, and add one of the Integration methods, e.g. RungeKutta4.
- Click on "SimApp", add Integrator from CDPSim to your application, and name it e.g. "MyIntegrator".
- Click on "SimApp" and add Sine from CDPCore to your application. Sine is not a simulator-component, it is just a component providing a Sine output signal.
- Click on MyIntegrator component, and set Routing for the SimSignal In to SimApp.Sine.Output.
Your configuration should look something like this:
Run your system, go to Analyze mode and graph the signal SimApp.Sine.Output and the StateVariable SimApp.MyIntegrator.Out.
As you can see, Out (integrated value) increases as long as Sine is positive, and decreases when Sine becomes negative.
Stop your system, go to Configure mode and click at MyIntegrator in the Project tree. Find the CDPParameter UpperLimit and set the value to 1, and set LowerLimit to -1. Run your system again and go to Analyze mode.
Now the StateVariable SimApp.MyIntegrator.Out is limited, so the values always stays within [-1..1].
References
- Wikipedia
Member Function Documentation
Integrator::Integrator()
Integrator constructor.
Integrator::~Integrator()
Integrator destructor.
[override virtual]
void Integrator::Configure(const char *componentXML)
Reimplemented from CDPObject::Configure().
Configures the component by reading the configuration.
[override virtual]
void Integrator::Create(const char *fullName)
Reimplemented from CDPComponent::Create().
Creates the component instance and members
[override virtual]
void Integrator::CreateModel()
Reimplemented from CDPBaseObject::CreateModel().
Creates a model instance for this class and fills model data. Registers messages, states and state transitions.
[override virtual protected]
void Integrator::EvaluateDiffEquations(double t)
Reimplemented from DynamicSimComponent::EvaluateDiffEquations().
Implements 'dydt = f(y,t)'. The derivative of Out is updated to Ki*In
[override virtual protected]
void Integrator::PostIntegrate()
Reimplemented from DynamicSimComponent::PostIntegrate().
Called just after EvaluateDiffEquations(), currently does nothing.
[override virtual protected]
void Integrator::PreIntegrate()
Reimplemented from DynamicSimComponent::PreIntegrate().
If Out is larger than UpperLimit, Out is set to UpperLimit and the derivative of Out is set to 0. If Out is less than LowerLimit, Out is set to LowerLimit and the derivative of Out is set to 0.
[override virtual]
void Integrator::ProcessNull()
Reimplemented from CDPComponent::ProcessNull().
Component Null state processing function (currently does nothing)
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.