Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filter to current shaper output. #920

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/current_shaper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,16 @@ void CurrentShaperTask::shapeCurrent() {
// if (livepwr > max_pwr) {
// livepwr = max_pwr;
// }
double max_cur;
if(!config_threephase_enabled()) {
_max_cur = ((max_pwr - livepwr) / evse.getVoltage()) + evse.getAmps();
max_cur = ((max_pwr - livepwr) / evse.getVoltage()) + evse.getAmps();
}

else {
_max_cur = ((max_pwr - livepwr) / evse.getVoltage() / 3.0) + evse.getAmps();
max_cur = ((max_pwr - livepwr) / evse.getVoltage() / 3.0) + evse.getAmps();
}


// Smooth shaper output to avoid instability with delayed live power samples.
_max_cur = _outputFilter.filter(max_cur, _max_cur, current_shaper_smoothing_time);

_changed = true;
}
Expand Down
1 change: 1 addition & 0 deletions src/current_shaper.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class CurrentShaperTask: public MicroTasks::Task
uint32_t _pause_timer;
bool _updated;
InputFilter _inputFilter;
InputFilter _outputFilter;

protected:
void setup();
Expand Down
Loading