Self-adjusting analog signal translator
Get an ADC. Set its analogue reference to be the voltage value on line A.

Get a DAC. Set its analogue reference to be the voltage value on line B.

Connect the ADC digital output with the DAC digital input.

Connect signal &quot;C&quot; to the ADC input.

Connect line &quot;D&quot; output to the DAC output.

Set both ADC and DAC for continual conversion (you might need a pulse generator).


If the &quot;A&quot; line range of 0 to 20 volts is too high for a particular ADC, then pot down to make 20 volts become 5 volts (for instance). Ditto the signal line &quot;C&quot;. Same ratio of potting down.
If you can't get a suitable DAC that can have a reference input of 6 volts (line &quot;B&quot;) then pot it down then, take the DAC output through an op-amp amplifier to restore to the value you need for line &quot;D&quot;.