/ToolboxR

Discrete Time C++ Modeling Library

Primary LanguageC++MIT LicenseMIT

ToolboxR Control Library

This library encompasses a broad range of basic time discrete blocks essential for discrete time modeling, as well as advanced components including Fuzzy Control blocks, Finite Impulse Response (FIR) filters, various Models, PID Controllers, and Trajectory Generation tools. These elements provide a comprehensive suite of features and functionalities for the development and implementation of sophisticated control systems based on fuzzy logic and other control strategies.

The Discrete Time part of ToolboxR Library in C++ provides the following features and functionalities:

  1. Abstraction of discrete time modeling: The library provides a set of classes and functions that allow users to define and work with discrete time models easily. It sabstracts away the low-level details of managing discrete time steps and state transitions.

  2. Model representation: The library offers offer a way to represent the state variables, inputs, outputs, and parameters of a discrete time model. This is achieved through classes or data structures that encapsulate these elements.

  3. Model initialization and configuration: The library provides mechanisms to initialize and configure a discrete time model. This includes setting the initial state values, specifying input values, and assigning parameter values.

  4. Step-wise simulation: The library offers functions or methods to simulate the behavior of the model over discrete time steps. Users are able to advance the model state from one time step to another, updating the state variables based on the defined model equations or rules.

  5. Support for different model types: The library accommodates various types of discrete time models, such as difference equations, discrete time integral, state-space models and some other relevant models. It is flexible enough to handle different modeling paradigms and approaches.

  6. Input and output handling: The library should provide mechanisms to handle inputs and outputs of the model. This involves reading input values from external sources, providing inputs to the model, and collecting and processing output values generated by the model.

  7. Flexibility and extensibility: The library has been designed to be flexible and extensible, allowing users to customize and extend its functionality according to their specific needs. It provides interfaces for users to incorporate their own model equations and algorithms.

  8. Documentation and examples: The library should be well-documented, with clear explanations and examples of how to use its features and functionalities. This will help users understand and leverage the library effectively.

By providing these features and functionalities, a Discrete Time Model Library in C++ can facilitate the development and simulation of discrete time models in a convenient and efficient manner.

A discrete time model is a mathematical representation of a system that evolves over time in discrete steps or intervals. In contrast to continuous time models, which describe systems that change continuously over time, discrete time models capture the behavior of a system at specific points or moments in time.

In a discrete time model, time is represented as a sequence of discrete time points or steps, typically denoted by integers such as 0, 1, 2, and so on. At each time step, the state of the system is updated based on the previous state and any external inputs or influences.

The dynamics of a discrete time model are often described by a set of equations or rules that govern how the system transitions from one state to another. These equations or rules define how the system variables change over time and can incorporate factors such as delays, feedback, and discrete events.

Discrete time models are widely used in various fields, including mathematics, physics, engineering, computer science, economics, and biology. They are particularly useful when the underlying system being modeled naturally exhibits discrete behaviors or when the measurements or observations of the system are made at discrete intervals. Discrete time models can be analyzed using mathematical techniques such as recurrence relations, difference equations, and discrete dynamical systems theory.

Overall, discrete time models provide a valuable framework for understanding and predicting the behavior of systems that evolve in discrete steps over time.

The main classes are:

Discrete Time Delay The Delay class holds and delays its input by the sample period you specify.

Difference The Difference class outputs the current input value minus the previous input value.

Discrete Time Derivative The Discrete Derivative pproximates the derivative of its input.

Discrete FIR Filter Discrete FIR Filter class implements a discrete-time finite impulse response (FIR) filter.

Discrete First-Order IIR Filter The IIR Filter class implements a discrete first-order infinite impulse response (IIR) filter on the specified input signal.

Discrete Second-Order IIR Filter The IIR Filter class implements a discrete second-order infinite impulse response (IIR) filter on the specified input signal.

Discrete IIR Filter The IIR Filter class implements a discrete-time infinite impulse response (IIR) filter on the specified input signal.

Discrete Second Order Butterworth Filters Includes Lowpass, Highpass, Bandpass, and Notch filters.

Discrete N'th Order IIR Filter Implements an Nth-order Infinite Impulse Response filter.

Discrete Integrator Discrete Integrator class performs discrete-time integration or accumulation of signal. It implements Trapezoidal, Forward Euler and Backward Euler integration methods.

Discrete PID Controller The Discrete PID Controller class implements a PID controller (PID, PI, PD only or I only). It includes Output saturation limits and anti-windup mechanism.

Discrete State-Space The Discrete State-Space class represents the discrete-time dynamic system in state-space form. A, B, C, and D matrices and intial conditions can be specified. It uses Eigen Library.

Wave Form Tracer This utility classs can be used to trace selected signals in gnuplot format file.

Sine Wave Generator Generates sine waves with specified frequency and amplitude.

FFT Utility Derived from "Numerical Recipes in C" by Cambridge University Press, for Fast Fourier Transform operations.

Frequency Response Manager Manages and analyzes the frequency response of systems.

Math Functions Includes Hyperbolic Secant Squared, Quintic Polynomial, Heptic Polynomial, Hexic Polynomial, Linear Exponential Decay, Quintic Bezier Curve.

Models Covers examples like DC Motor, Friction Model, Permanent Magnet Synchronous Motor (PMSM), PMSM PI Current Controller, PMSM Position Controller.

Trajectory Generation Tools

ToolboxR is equipped with a sophisticated suite of Trajectory Generation Tools, offering advanced capabilities for precise and efficient motion planning. These tools are designed to cater to a wide range of applications, enabling users to create and manage complex trajectories with ease. Whether it's for robotics, simulation, or any system requiring detailed motion control, ToolboxR's trajectory generation features stand ready to deliver exceptional performance and flexibility.

  1. Jerk Limited Trajectory The "Jerk Limited Trajectory" tool in ToolboxR is an innovative feature based on a novel algorithm that utilizes Bézier functions. This advanced approach allows users to set initial parameters such as position, velocity, and acceleration, and also define corresponding final values. The precision afforded by Bézier functions ensures that the trajectory is smooth and adheres closely to the specified parameters from start to finish. In addition to this refined control, the tool offers the ability to limit the maximum jerk (rate of change of acceleration), acceleration, and velocity. This is particularly beneficial in scenarios requiring meticulous motion control, as it ensures smooth transitions, enhances system stability, and maintains operational safety. By integrating Bézier functions in its algorithm, the "Jerk Limited Trajectory" tool in ToolboxR stands out for its precision and efficiency in trajectory planning. It is an indispensable tool for any application demanding high-level control over motion dynamics.

  2. Quintic Polynomial Trajectory Generates trajectories based on quintic polynomials with options to limit acceleration and velocity.

  3. Simple Heptic Polynomial Trajectory Utilizes heptic polynomials for trajectory generation with similar constraints.

Here are some key aspects of the ToolboxR Fuzzy Control Blocks:

  1. Fuzzy set representation: The library provides classes or data structures to define and represent fuzzy sets and their associated membership functions. It supports the following types of membership functions: Singleton, Gaussian,Bell Shaped, Sigmoidal, Triangular, Trapezoidal, PI-shaped, S-shaped, Z-Shaped, Trapezoidal, Fuzzy-Small function, Fuzzy Large function and Linear Sugeno membership function.

  2. Fuzzy rule-based systems: The library supports the construction and execution of fuzzy rule-based systems. It should provide a way to define linguistic variables, fuzzy rules, and the corresponding fuzzy inference mechanism for mapping inputs to outputs.

  3. Membership function operations: The library should offer a range of operations on fuzzy sets and membership functions, such as fuzzy set intersection, union, complement, scaling, and aggregation. These operations are essential for fuzzy logic computations and reasoning.

  4. Fuzzy inference methods: The library should support various fuzzy inference methods, including Mamdani and Sugeno. It should provides functions and classes to perform fuzzy inference and compute the output values based on the input variables and fuzzy rule base.

  5. Defuzzification methods: The library should include a variety of defuzzification methods to convert the fuzzy output into a crisp value or action. Common defuzzification methods include centroid, weighted average, and maximum membership.

  6. Fuzzy logic operators: The library supports a range of fuzzy logic operators, such as fuzzy AND, fuzzy OR, fuzzy NOT, and some fuzzy implication operators. These operators are fundamental for fuzzy rule evaluation and inference.

  7. Import/Export utilities: This library provides basic Import/Export utility classes which enable Import of MATLAB/Simulink Fuzzy Models (FIS File Format)

By providing these features and functionalities, a ToolboxR could empower developers to easily implement and deploy fuzzy logic-based control systems for various applications, such as robotics, automation, process control, and decision support systems.

Project Status

  • Work in progress...