AM263x Motor Control SDK  09.02.00
dcl_zpk3.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/
3  *
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the
15  * distribution.
16  *
17  * * Neither the name of Texas Instruments Incorporated nor the names of
18  * its contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef _DCL_ZPK3_H_
35 #define _DCL_ZPK3_H_
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
50 #include <complex.h>
51 
52 //--- ZPK3 structure ---------------------------------------------------------
53 
61 typedef struct dcl_zpk3
62 {
63  float complex z1;
64  float complex z2;
65  float complex z3;
66  float complex p1;
67  float complex p2;
68  float complex p3;
70 } DCL_ZPK3;
71 
74 #define ZPK3_DEFAULTS { 0.0f + 0.0f*I, 0.0f + 0.0f*I, 0.0f + 0.0f*I, \
75  0.0f + 0.0f*I, 0.0f + 0.0f*I, 0.0f + 0.0f*I, \
76  1.0f }
77 
80 typedef struct dcl_zpk3f64
81 {
82  double complex z1;
83  double complex z2;
84  double complex z3;
85  double complex p1;
86  double complex p2;
87  double complex p3;
89 } DCL_ZPK3F64;
90 
93 #define ZPK3F64_DEFAULTS { 0.0L + 0.0L*I, 0.0L + 0.0L*I, 0.0L + 0.0L*I, \
94  0.0L + 0.0L*I, 0.0L + 0.0L*I, 0.0L + 0.0L*I, \
95  1.0L }
96 
101 {
102  return((cabsf(q->p1) < 1.0f) && (cabsf(q->p2) < 1.0f) && (cabsf(q->p3) < 1.0f));
103 }
104 
109 {
110  return((cabs(q->p1) < 1.0L) && (cabs(q->p2) < 1.0L) && (cabs(q->p3) < 1.0L));
111 }
112 
113 // \brief All ZPK functions exist in its respective controller conversion type
114 // All the ZPK conversion function prototypes are listed below
115 /*
120 extern void DCL_loadDF11asZPK(DCL_DF11 *p, DCL_ZPK3 *q);
121 
126 extern void DCL_loadDF12asZPK(DCL_DF12 *p, DCL_ZPK3 *q);
127 
131 extern void DCL_loadDF13asZPK(DCL_DF13 *p, DCL_ZPK3 *q);
132 
137 extern void DCL_loadDF22asZPK(DCL_DF22 *p, DCL_ZPK3 *q);
138 
142 extern void DCL_loadDF23asZPK(DCL_DF23 *p, DCL_ZPK3 *q);
143 
149 extern void DCL_loadSeriesPIasZPK(DCL_PI *p, DCL_ZPK3 *q);
150 
155 extern void DCL_loadParallelPIasZPK(DCL_PI *p, DCL_ZPK3 *q);
156 
161 extern void DCL_loadSeriesPIDasZPK(DCL_PID *p, DCL_ZPK3 *q);
162 
167 extern void DCL_loadParallelPIDasZPK(DCL_PID *p, DCL_ZPK3 *q);
168 
173 extern void DCL_loadSeriesPIDF64asZPK(DCL_PIDF64 *p, DCL_ZPK3 *q);
174 
179 extern void DCL_loadParallelPIDF64asZPK(DCL_PIDF64 *p, DCL_ZPK3F64 *q);
180 */
181 
184 #ifdef __cplusplus
185 }
186 #endif // extern "C"
187 
188 #endif // _DCL_ZPK3_H_
DCL_ZPK3::K
float32_t K
Real gain.
Definition: dcl_zpk3.h:69
DCL_ZPK3::z2
float complex z2
Complex zeros 2.
Definition: dcl_zpk3.h:64
DCL_ZPK3::p2
float complex p2
Complex poles 2.
Definition: dcl_zpk3.h:67
DCL_ZPK3F64::p1
double complex p1
Complex poles 1.
Definition: dcl_zpk3.h:85
_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:87
DCL_ZPK3::p1
float complex p1
Complex poles 1.
Definition: dcl_zpk3.h:66
DCL_ZPK3F64::z3
double complex z3
Complex zeros 3.
Definition: dcl_zpk3.h:84
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:100
DCL_ZPK3::z3
float complex z3
Complex zeros 3.
Definition: dcl_zpk3.h:65
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:108
DCL_ZPK3F64::p2
double complex p2
Complex poles 2.
Definition: dcl_zpk3.h:86
DCL_ZPK3F64::K
float64_t K
Real gain.
Definition: dcl_zpk3.h:88
DCL_ZPK3::p3
float complex p3
Complex poles 3.
Definition: dcl_zpk3.h:68
DCL_ZPK3
Defines the DCL_ZPK3 structure.
Definition: dcl_zpk3.h:62
float64_t
double float64_t
Definition: dcl_common.h:59
DCL_ZPK3F64
Defines the 64bit ZPK3 structure.
Definition: dcl_zpk3.h:81
DCL_ZPK3F64::z2
double complex z2
Complex zeros 2.
Definition: dcl_zpk3.h:83
float32_t
float float32_t
Definition: dcl_common.h:58
DCL_ZPK3F64::z1
double complex z1
Complex zeros 1.
Definition: dcl_zpk3.h:82
DCL_ZPK3::z1
float complex z1
Complex zeros 1.
Definition: dcl_zpk3.h:63