AM261x Motor Control SDK  10.02.00
dcl_zpk3.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023-2025 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 #ifndef _DCL_ZPK3_H_
33 #define _DCL_ZPK3_H_
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
48 #include <complex.h>
49 
50 //--- ZPK3 structure ---------------------------------------------------------
51 
59 typedef struct dcl_zpk3
60 {
61  float complex z1;
62  float complex z2;
63  float complex z3;
64  float complex p1;
65  float complex p2;
66  float complex p3;
68 } DCL_ZPK3;
69 
72 #define ZPK3_DEFAULTS { 0.0f + 0.0f*I, 0.0f + 0.0f*I, 0.0f + 0.0f*I, \
73  0.0f + 0.0f*I, 0.0f + 0.0f*I, 0.0f + 0.0f*I, \
74  1.0f }
75 
78 typedef struct dcl_zpk3f64
79 {
80  double complex z1;
81  double complex z2;
82  double complex z3;
83  double complex p1;
84  double complex p2;
85  double complex p3;
87 } DCL_ZPK3F64;
88 
91 #define ZPK3F64_DEFAULTS { 0.0L + 0.0L*I, 0.0L + 0.0L*I, 0.0L + 0.0L*I, \
92  0.0L + 0.0L*I, 0.0L + 0.0L*I, 0.0L + 0.0L*I, \
93  1.0L }
94 
99 {
100  return((cabsf(q->p1) < 1.0f) && (cabsf(q->p2) < 1.0f) && (cabsf(q->p3) < 1.0f));
101 }
102 
107 {
108  return((cabs(q->p1) < 1.0L) && (cabs(q->p2) < 1.0L) && (cabs(q->p3) < 1.0L));
109 }
110 
111 // \brief All ZPK functions exist in its respective controller conversion type
112 // All the ZPK conversion function prototypes are listed below
113 /*
118 extern void DCL_loadDF11asZPK(DCL_DF11 *p, DCL_ZPK3 *q);
119 
124 extern void DCL_loadDF12asZPK(DCL_DF12 *p, DCL_ZPK3 *q);
125 
129 extern void DCL_loadDF13asZPK(DCL_DF13 *p, DCL_ZPK3 *q);
130 
135 extern void DCL_loadDF22asZPK(DCL_DF22 *p, DCL_ZPK3 *q);
136 
140 extern void DCL_loadDF23asZPK(DCL_DF23 *p, DCL_ZPK3 *q);
141 
147 extern void DCL_loadSeriesPIasZPK(DCL_PI *p, DCL_ZPK3 *q);
148 
153 extern void DCL_loadParallelPIasZPK(DCL_PI *p, DCL_ZPK3 *q);
154 
159 extern void DCL_loadSeriesPIDasZPK(DCL_PID *p, DCL_ZPK3 *q);
160 
165 extern void DCL_loadParallelPIDasZPK(DCL_PID *p, DCL_ZPK3 *q);
166 
171 extern void DCL_loadSeriesPIDF64asZPK(DCL_PIDF64 *p, DCL_ZPK3 *q);
172 
177 extern void DCL_loadParallelPIDF64asZPK(DCL_PIDF64 *p, DCL_ZPK3F64 *q);
178 */
179 
182 #ifdef __cplusplus
183 }
184 #endif // extern "C"
185 
186 #endif // _DCL_ZPK3_H_
DCL_ZPK3::K
float32_t K
Real gain.
Definition: dcl_zpk3.h:67
DCL_ZPK3::z2
float complex z2
Complex zeros 2.
Definition: dcl_zpk3.h:62
DCL_ZPK3::p2
float complex p2
Complex poles 2.
Definition: dcl_zpk3.h:65
DCL_ZPK3F64::p1
double complex p1
Complex poles 1.
Definition: dcl_zpk3.h:83
_DCL_CODE_ACCESS
#define _DCL_CODE_ACCESS
Defines the scope of dcl functions.
Definition: dcl_common.h:63
DCL_ZPK3F64::p3
double complex p3
Complex poles 3.
Definition: dcl_zpk3.h:85
DCL_ZPK3::p1
float complex p1
Complex poles 1.
Definition: dcl_zpk3.h:64
DCL_ZPK3F64::z3
double complex z3
Complex zeros 3.
Definition: dcl_zpk3.h:82
DCL_isStableZpk3
_DCL_CODE_ACCESS bool DCL_isStableZpk3(DCL_ZPK3 *q)
Determines stability of a ZPK3 representation by checking pole magnitude.
Definition: dcl_zpk3.h:98
DCL_ZPK3::z3
float complex z3
Complex zeros 3.
Definition: dcl_zpk3.h:63
DCL_isStableZpk3F64
_DCL_CODE_ACCESS bool DCL_isStableZpk3F64(DCL_ZPK3 *q)
Determines stability of a ZPK3F64 representation by checking pole magnitude.
Definition: dcl_zpk3.h:106
DCL_ZPK3F64::p2
double complex p2
Complex poles 2.
Definition: dcl_zpk3.h:84
DCL_ZPK3F64::K
float64_t K
Real gain.
Definition: dcl_zpk3.h:86
DCL_ZPK3::p3
float complex p3
Complex poles 3.
Definition: dcl_zpk3.h:66
DCL_ZPK3
Defines the DCL_ZPK3 structure.
Definition: dcl_zpk3.h:60
float64_t
double float64_t
Definition: dcl_common.h:59
DCL_ZPK3F64
Defines the 64bit ZPK3 structure.
Definition: dcl_zpk3.h:79
DCL_ZPK3F64::z2
double complex z2
Complex zeros 2.
Definition: dcl_zpk3.h:81
float32_t
float float32_t
Definition: dcl_common.h:58
DCL_ZPK3F64::z1
double complex z1
Complex zeros 1.
Definition: dcl_zpk3.h:80
DCL_ZPK3::z1
float complex z1
Complex zeros 1.
Definition: dcl_zpk3.h:61