FORCESPRO 6.3
  • Chapter
      • 1. Introduction
      • 2. License Variants
      • 3. Installation
      • 4. Backward Compatibility
      • 5. Y2F Interface
      • 6. MathWorks Linear MPC Plugin
      • 7. MathWorks Nonlinear MPC Plugin
      • 8. Low-level interface
      • 9. High-level Interface
      • 10. Simulating your custom controller in Simulink®
      • 11. Examples
      • 12. Parametric problems
      • 13. Code Deployment
      • 14. Multicore parallelization
      • 15. Licensing
      • 16. Autotuner
      • 17. Solver Options
      • 18. Exitflags
      • 19. Modelling Utilities
      • 20. Dumping Problem Formulation and Data
      • 21. Webcompilers
      • 22. Frequently asked questions

10.4.2. Real-time control with the Simulink® block¶

  • Input and Output Ports in the Compact Interface

When a user generates a new solver, a Simulink® block becomes available in the interfaces folder. Such block is useful to interface the solver with other Simulink® models for simulation, or for deployment to embedded prototyping hardware using tools such as dSPACE MicroAutobox or Simulink® Coder.

10.4.2.1. Input and Output Ports in the Compact Interface¶

For every solver, there are two Simulink® variants generated: a standard variant; and a compact variant, which groups parameters and outputs. For problems with many parameters and outputs, the compact variant is more suitable because it reduces the number of ports and connections that need to be wired up to the rest of the Simulink® model.

The criteria for grouping parameters is the following: parameters of the same type that have the same number of rows are grouped together into a single stacked parameter. These parameters are stacked horizontally, e.g. if there are two parameters mapping to eq.c, both of size 3x1, they will be grouped into a new parameter of size 3x2. The new parameter will get the name c.

To illustrate the conversion, consider a problem with the following parameters and with the corresponding standard (non-compact) Simulink® block:

Name

maps2data

Dimensions

Amat1

eq.D

2x4

Amat2

eq.D

3x4

Amat3

eq.D

3x4

Amat4

eq.D

3x4

linterm1

cost.f

4x1

linterm2

cost.f

4x1

linterm3

cost.f

4x1

linterm4

cost.f

4x1

../../_images/standard.png

For the compact Simulink® block, parameters linterm1, linterm2, linterm3 and linterm4 are stacked together into a new parameter f (because the problem data they map to is cost.f). For the parameters mapping to eq.D, Amat2, Amat3 and Amat4 can be stacked into the new parameter D. Amat1 is not included into the new parameter because it has two rows and the concatenation is not possible with the other parameters, which all have three rows. Parameters are always stacked horizontally according to the stage number they map to.

Name

maps2data

Dimensions

D

eq.D

3x12

f

cost.f

4x4

Amat1

eq.D

2x4

../../_images/compact.png

The port dimensions of any FORCESPRO Simulink® block can be checked by double-clicking the block and clicking the ‘Help’ button.

Back to top

© Copyright 2023, embotech AG.
Created using Sphinx 5.2.0.