This library contains basic tools to work with dynamical systems. In particular, it contains dynamic controllers such as the PID Controller.
Fundamental concepts are:
- Signal (
ISignal
): Provides a long real valueoutput
- Dynamic (
IDynamic
): Takes a long real valuevalue
and provides a long real valueoutput
- Dynamic controller (
IDynamicController
): Takes two long real valuesinput
andvalue
and provides a long real valueoutput
To get a PID controller, take a DynamicController
and assign an instance of PID_Dynamic
to the public field openDynamic
. You also have to assign the public field elapsedTimeProvider
of the PID_Dynamic
. The easiest way would be to use a MeasuredTimeProvider
. However if you know you will call the method Next
cyclically, for better resource efficiency use a ConstantTimeProvider
instead and set the public field seconds
to the cycle time in seconds.
Enter:
apax add @simatic-ax/dynamics
Simatic.Ax.Dynamics;
USING Simatic.Ax.Dynamics;
[...]
VAR_GLOBAL
elapsedTimeProvider : MeasuredTimeProvider;
dynamic : PID_Dynamic := (elapsedTimeProvider := elapsedTimeProvider);
controller : DynamicController := (openDynamic := dynamic);
END_VAR
[...]
// Initialisation
dynamic.SetK(0.1);
dynamic.SetTISeconds(2.3);
dynamic.SetTDSeconds(4.5);
[...]
// Use
output := controller.Next(value, input);
Thanks for your interest in contributing. Anybody is free to report bugs, unclear documentation, and other problems regarding this repository in the Issues section or, even better, is free to propose any changes to this repository using Merge Requests.
Please read the Legal information