|  | Dual Active Bridge Development Board (Part-No. ) |
Content |  |  |  |  |  |

Loading...
Searching...
No Matches
XFT_smps_2p2z_dspic.s File Reference
Power Control » Control Loop Configuration

Contains the dcdt generated assembly code for 2p2z control type with modified code for Adaptive Gain control. More...

Go to the source code of this file.

## Detailed Description

Operation:

Wcp0 ( S + Wcz1 )
Calculate the transfer function Hc(s) = ---- X ------------------------
S ( S + Wcp1 )( S + Wcp2 )
Error Normalization
------------
| prsft |
------------
Reference | e(n) e(n-1) e(n-2)
Input | -------- --------
- - - | | | |
o----|-|-|x|-|x|----o->| z^(-1) |-o->| z^(-1) |-o Post
- - - | | | | | | | Scaling
| NORM | -------- | -------- |
| | | | --------
Measured| --- --- --- | | - - - - - - - - - -
Input | B0=>| X | B1=>| X | B2=>| X | |posft | | |
| --- --- --- |postScalar| | P O W E R |
| | | | ---------- | P L A N T |
| ------------------------------------- | | |
| | | U[n] --- | |
| | A C C U M U L A T O R |--o--| X |------O Duty Ratio=>PWM |
| | | | --- | |
| ------------------------------------- | | Voltage/Current |
| | | | | Feedback |
| --- --- | | O |
| A2=>| X | A1=>| X | | | | |
| --- --- | - - - - - - - - - -
| | | | |
| | -------- | -------- | | A/D
| | | | | | | | | Input
| o--| z^(-1) |<-o-| z^(-1) |<----------- |
| | | | | |
| -------- -------- |
| u[n-2] u[n-1] |
| |
| |
---------------------------------------------------------------------------
controlHistory[n] = errorHistory[n] * bCoefficients[0]
+ errorHistory[n-1] * bCoefficients[1]
+ errorHistory[n-2] * bCoefficients[2]
+ controlHistory[n-1] * aCoefficients[0]
+ controlHistory[n-2] * aCoefficients[1]
where:
aCoefficients[0] = A1
aCoefficients[1] = A2
bCoefficients[0] = B0
bCoefficients[1] = B1
bCoefficients[2] = B2
controlHistory[0] = u(n)
controlHistory[1] = u(n-1)
errorHistory[0] = e(n) => most recent error {(controlReference) - (sourceRegister)}
errorHistory[1] = e(n-1)
errorHistory[2] = e(n-2)
preShift = prsft => pre scaling factor for Q15 normalization purposes
postShift = posft => post scaling factor for normalization purposes
postScaler = postScaler => post scaling coefficient for normalization purpose
Function call inputs:
sourceRegister = ADBUFx => measured feedback input
controlReference = V_ref => reference voltage
targetRegister = PDCx => output duty cycle
where:
aCoefficients, bCoefficients, controlHistory, errorHistory,
preShift and postShift are all members of the data structure SMPS_2P2Z_T.
Input:
w0 = Address of SMPS_2P2Z_T data structure
w1 = Address of the Source Register (Input)
w2 = Control Reference
w3 = Address of the Target Register (Output)
Return:
w0 = Address of SMPS_2P2Z_T data structure
w1 = Address of the Source Register (Input)
w2 = Control Reference
w3 = Address of the Target Register (Output)
System resources usage:
{w4..w5} saved, used, restored
{w8,w10} saved, used, restored
AccA used, not restored
CORCON saved, used, restored

Note
  The function in this assembly file requires CORCON register to be setup in a certain state in order to operate correctly. Due to this requirement, this function will save the CORCON register on the stack in the beginning of the function and restore it before the function return. After saving the CORCON register, this function writes to all bits of the CORCON register. Thus, for the brief duration when this function is executing, the state of CORCON register may be different from its state as set by the function caller. This may change the CPU core behaviour with respect to exception processing latency, DO loop termination, CPU interrupt priority level and DSP-engine behaviour.

Definition in file XFT_smps_2p2z_dspic.s.