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

Adding yeti simulator #862

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Adding yeti simulator #862

wants to merge 1 commit into from

Conversation

MarzellT
Copy link
Member

@MarzellT MarzellT commented Sep 10, 2024

Describe your changes

Issue ticket number and link

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • I read the contribution documentation and made sure that my changes meet its requirements

@MarzellT MarzellT marked this pull request as ready for review September 12, 2024 13:39
@MarzellT MarzellT force-pushed the tm-adding-yeti-simulator branch 4 times, most recently from 8529f5f to 7ac3d30 Compare September 12, 2024 13:51
@corneliusclaussen corneliusclaussen force-pushed the tm-adding-yeti-simulator branch 2 times, most recently from 59b66bc to 9583e7c Compare October 2, 2024 10:04
Signed-off-by: MarzellT <tobias.marzell@pionix.de>
Copy link
Contributor

@SebaLukas SebaLukas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am divided on the PR. I think that the code basically works, but I find the architecture confusing.

I think that the complete code from the simulation.hpp can also be moved and executed in the YetiSimulator.cpp.
This saves the many get functions and the module structure would also be like other EVerest modules. And I think that the clarity will not suffer.

I also don't like the large ModuleState struct. This could be reduced by moving the code to YetiSimulator.cpp and define the individual variables and structs, such as PowermeterData and SimulationDatadirectly in the YetiSimulator class.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see no documentation, so delete this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this too

Comment on lines +13 to +23
const auto capabilities = types::evse_board_support::HardwareCapabilities{
.max_current_A_import = 32.0,
.min_current_A_import = 6.0,
.max_phase_count_import = 3,
.min_phase_count_import = 1,
.max_current_A_export = 16.0,
.min_current_A_export = 0.0,
.max_phase_count_export = 3,
.min_phase_count_export = 1,
.supports_changing_phases_during_charging = true,
.connector_type = types::evse_board_support::Connector_type::IEC62196Type2Cable};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to a set_default_capabilities() function


void ev_board_supportImpl::handle_enable(bool& value) {
auto& module_state = mod->get_module_state();
if (module_state.simulation_enabled && !value) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and not instead of && !

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing line on eof

{"irmsN", powermeter_data.irmsN}};
}

} // namespace module::state
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing line on eof


namespace module {

template <typename YetiSimulatorT, typename BoardSupportT> class Simulator {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you define a template class?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this code should be in YetiSimulator.cpp and not in a separated header file.

.max_phase_count_export = 3,
.min_phase_count_export = 1,
.supports_changing_phases_during_charging = true,
.connector_type = types::evse_board_support::Connector_type::IEC62196Type2Cable};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Designated initializers are only supported in C++20 and above.

(Also below with return {.ampacity = Ampacity::None};.)

Copy link
Contributor

@a-w50 a-w50 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comments in #887 (comment). Not sure why this is another PR.
I created a working example in this branch: https://github.com/EVerest/everest-core/tree/refactor/cleanup_yeti_sim_error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants