ccs table

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2023-05-08 14:56:43 -07:00
parent 4f013dabd7
commit 647b3a5fb3
1 changed files with 3 additions and 1 deletions

View File

@ -1717,11 +1717,13 @@ OutputWaveforms::voltageTimes(size_t wave_index,
float prev_current = currents->value(0);
float voltage = 0.0;
volts.push_back(voltage);
bool always_rise = true;
bool invert = (always_rise && rf_ == RiseFall::fall());
for (size_t i = 1; i < time_axis->size(); i++) {
float time = time_axis->axisValue(i);
float current = currents->value(i);
float dv = (current + prev_current) / 2.0 * (time - prev_time) / cap;
voltage += dv;
voltage += invert ? -dv : dv;
volts.push_back(voltage);
prev_time = time;
prev_current = current;