AGXDynamics
2.35.0.3
ControllerHandler.h
Go to the documentation of this file.
1
/*
2
Copyright 2007-2022. Algoryx Simulation AB.
3
4
All AGX source code, intellectual property, documentation, sample code,
5
tutorials, scene files and technical white papers, are copyrighted, proprietary
6
and confidential material of Algoryx Simulation AB. You may not download, read,
7
store, distribute, publish, copy or otherwise disseminate, use or expose this
8
material unless having a written signed agreement with Algoryx Simulation AB, or having been
9
advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10
valid commercial license from Algoryx Simulation AB.
11
12
Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13
from using this software, unless otherwise stated in written agreements with
14
Algoryx Simulation AB.
15
*/
16
17
#pragma once
18
19
#include <
agxSDK/StepEventListener.h
>
20
#include <
agxModel/Controller1D.h
>
21
#include <
agxModel/export.h
>
22
23
24
namespace
agxModel
{
25
26
AGX_DECLARE_POINTER_TYPES
(
ControllerHandler
);
27
32
class
AGXMODEL_EXPORT
ControllerHandler
:
public
agxSDK::StepEventListener
33
{
34
public
:
35
AGX_DECLARE_POINTER_TYPES
(
Plant
);
44
class
AGXMODEL_EXPORT
Plant
:
public
virtual
agx::Referenced
45
{
46
public
:
47
Plant
() =
default
;
48
50
Plant
(std::function<
agx::Real
(
const
agx::TimeStamp
&)> getProcessVariable, std::function<
void
(
agx::Real
)>setManipulatedVariable)
51
{
52
m_getProcessVariable = getProcessVariable;
53
m_setManipulatedVariable = setManipulatedVariable;
54
};
55
57
virtual
agx::Real
getProcessVariable
(
const
agx::TimeStamp
& time) {
return
m_getProcessVariable ? m_getProcessVariable(time) : 0; };
58
63
virtual
void
setManipulatedVariable
(
agx::Real
manipulatedVariable) {
if
(m_setManipulatedVariable) m_setManipulatedVariable(manipulatedVariable); };
64
65
private
:
66
std::function<
agx::Real
(
const
agx::TimeStamp
&)> m_getProcessVariable;
67
std::function<void(
agx::Real
)> m_setManipulatedVariable;
68
};
69
70
public
:
71
72
ControllerHandler
(
Controller1D
* controller, Plant* plant);
73
74
Controller1DRef
getController()
const
;
75
76
PlantRef getPlant()
const
;
77
83
virtual
void
post(
const
agx::TimeStamp
& time)
override
;
84
85
private
:
86
Controller1DRef
m_controller;
87
PlantRef m_plant;
88
89
};
90
91
}
92
agxModel::ControllerHandler::Plant
The Plant (aka the Physical System) is added to the ControllHandler in the Control System.
Definition:
ControllerHandler.h:44
agx::Real
double Real
Definition:
Real.h:42
agxModel
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition:
FlowUnit.h:36
agxSDK::StepEventListener
Derive from this class to implement a listener for simulation step events.
Definition:
StepEventListener.h:37
agxModel::ControllerHandler::Plant::Plant
Plant(std::function< agx::Real(const agx::TimeStamp &)> getProcessVariable, std::function< void(agx::Real)>setManipulatedVariable)
Create a plant.
Definition:
ControllerHandler.h:50
export.h
agxModel::Controller1D
A simple base class for a controller with a set point and an out signal.
Definition:
Controller1D.h:35
StepEventListener.h
agx::ref_ptr< Controller1D >
agxModel::ControllerHandler::Plant::getProcessVariable
virtual agx::Real getProcessVariable(const agx::TimeStamp &time)
Definition:
ControllerHandler.h:57
Controller1D.h
agx::Referenced
Base class providing referencing counted objects.
Definition:
Referenced.h:113
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition:
Referenced.h:248
agx::TimeStamp
agx::Real TimeStamp
Definition:
TimeStamp.h:26
AGXMODEL_EXPORT
#define AGXMODEL_EXPORT
Definition:
agxModel/export.h:42
agxModel::ControllerHandler
This is a PID handler that collects the Plant measured Process Variable (PV) and execute PID update()...
Definition:
ControllerHandler.h:32
agxModel::ControllerHandler::Plant::setManipulatedVariable
virtual void setManipulatedVariable(agx::Real manipulatedVariable)
Set the Manipulated Variable(MV) controlling the Plant, also known as Control Variable.
Definition:
ControllerHandler.h:63
include
agxModel
ControllerHandler.h
Generated on Fri Feb 10 2023 14:06:09 for AGXDynamics by
1.8.17