Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Scaling in DSP

Status
Not open for further replies.

Maitry07

Full Member level 2
Full Member level 2
Joined
Jun 29, 2022
Messages
130
Helped
0
Reputation
0
Reaction score
0
Trophy points
16
Activity points
1,165
Hello,

I wanted to use PID controller in VHDL to generate corrected output. This PID controller is basically for the amplitude control feedback system. PID controller's measured input is the Hex range 0052 Hex ( 82 decimal) to 1013 Hex (4115 decimal). while the reference input to PID controller is coming via 14 bit ADC with Digital output Hex range is 00000000000000( 14 bit binary) to FFFFFFFFFFFFFF( 14 bit binary).

So, all 1's ( 11111111111111 - 14 BIT Binary) reference digital input means the command to PID controller to go to the full scale ( which is 1013 Hex in terms of measured input range). So , there is a requirement of scaling that means when all ones 11111111111111- 14 bit received , that means PID controller logic should understand that the reference input is 1013 Hex. Let's say current measured input is 0052, the PID controller correction should be in such a way that my measured input becomes 1013 H and at that time error become zero.

In short , my PID controller reference input as well measured input range would be 0052 Hex to 1013 Hex. but currently , My my digital output which is further going to interface with PID controller reference input is 00000000000000- ( 14 bit binary) to 11111111111111- (14 bit binary) . which requires scaling in such a way that PID controller understand 1 11111111111111-14 bit binary as 013 Hex and it can understand all 0's (14 bit) as 0052 Hex.

Could you please provide what are the methods used in DSP for this kind of scaling?

Awaited your guidance.
 

via 14 bit ADC with Digital output Hex range is 00000000000000( 14 bit binary) to FFFFFFFFFFFFFF( 14 bit binary).
Ther´s something wrong.
Do you mean: HEX: 0x0000 to 0x3FFF --> binary: 0b00000000000000 to 0b11111111111111 ???


***
I´m not sure: Is your question how to match the two inputs?

If so:
Then you may adjust the smaller one to match the bigger one.
input --> output
0x0052 --> 0x0000 (i.e. 0%)
0x1013 --> 0x3FFF (i.e. 100%)

then the math would be
1) to get rid of the offset by: scaled_offs = (input - 0x0052)
2) to adjust ranges: input range = (0x1013 - 0x0052); output range is (0x3FFF - 0x0000). divide by input range; multiply by output range
--> in total: scaled = (input - 0x0052) * (0x3FFF - 0x0000) / (0x1013 - 0x0052)

For sure you should simplify the equation by solving the constants.

Klaus
 
Ok thanks, yes I got your point.

I need to adjust the smaller one to match the bigger one.
 

Hi,

for sure you could do the other way round, but then you lose resolution.
Less resolution may benefit in less processing power (less gates and less delay in an FPGA) ... so it´s on the designer which way to go.

Wit PID algorithm you may get results beyond the input levels (both directions). The designer needs to care for this.
The integral part is critical, as it may increase infinitely ... so the designer has to limit it to a useful range.

Klaus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top