Add extracted tools: CitrineOS, OpenOCPP, ShapeShifter
- CitrineOS core extracted (CSMS OCPP 2.0.1) - OpenOCPP extracted (firmware OCPP 1.6J/2.0.1) - ShapeShifter library installed (pip install -e) - ShapeShifter specification extracted - EVerest extracted TODO updated with progress
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
# template version 3
|
||||
#
|
||||
|
||||
# module setup:
|
||||
# - ${MODULE_NAME}: module name
|
||||
ev_setup_cpp_module()
|
||||
|
||||
# ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1
|
||||
# insert your custom targets and additional config variables here
|
||||
# ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1
|
||||
|
||||
target_sources(${MODULE_NAME}
|
||||
PRIVATE
|
||||
"main/isolation_monitorImpl.cpp"
|
||||
)
|
||||
|
||||
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1
|
||||
# insert other things like install cmds etc here
|
||||
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1
|
||||
@@ -0,0 +1,15 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#include "IMDSimulator.hpp"
|
||||
|
||||
namespace module {
|
||||
|
||||
void IMDSimulator::init() {
|
||||
invoke_init(*p_main);
|
||||
}
|
||||
|
||||
void IMDSimulator::ready() {
|
||||
invoke_ready(*p_main);
|
||||
}
|
||||
|
||||
} // namespace module
|
||||
@@ -0,0 +1,60 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#ifndef IMDSIMULATOR_HPP
|
||||
#define IMDSIMULATOR_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 2
|
||||
//
|
||||
|
||||
#include "ld-ev.hpp"
|
||||
|
||||
// headers for provided interface implementations
|
||||
#include <generated/interfaces/isolation_monitor/Implementation.hpp>
|
||||
|
||||
// ev@4bf81b14-a215-475c-a1d3-0a484ae48918:v1
|
||||
// insert your custom include headers here
|
||||
// ev@4bf81b14-a215-475c-a1d3-0a484ae48918:v1
|
||||
|
||||
namespace module {
|
||||
|
||||
struct Conf {};
|
||||
|
||||
class IMDSimulator : public Everest::ModuleBase {
|
||||
public:
|
||||
IMDSimulator() = delete;
|
||||
IMDSimulator(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider,
|
||||
std::unique_ptr<isolation_monitorImplBase> p_main, Conf& config) :
|
||||
ModuleBase(info), mqtt(mqtt_provider), p_main(std::move(p_main)), config(config){};
|
||||
|
||||
Everest::MqttProvider& mqtt;
|
||||
const std::unique_ptr<isolation_monitorImplBase> p_main;
|
||||
const Conf& config;
|
||||
|
||||
// ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1
|
||||
// insert your public definitions here
|
||||
// ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1
|
||||
|
||||
protected:
|
||||
// ev@4714b2ab-a24f-4b95-ab81-36439e1478de:v1
|
||||
// insert your protected definitions here
|
||||
// ev@4714b2ab-a24f-4b95-ab81-36439e1478de:v1
|
||||
|
||||
private:
|
||||
friend class LdEverest;
|
||||
void init();
|
||||
void ready();
|
||||
|
||||
// ev@211cfdbe-f69a-4cd6-a4ec-f8aaa3d1b6c8:v1
|
||||
// insert your private definitions here
|
||||
// ev@211cfdbe-f69a-4cd6-a4ec-f8aaa3d1b6c8:v1
|
||||
};
|
||||
|
||||
// ev@087e516b-124c-48df-94fb-109508c7cda9:v1
|
||||
// insert other definitions here
|
||||
// ev@087e516b-124c-48df-94fb-109508c7cda9:v1
|
||||
|
||||
} // namespace module
|
||||
|
||||
#endif // IMDSIMULATOR_HPP
|
||||
@@ -0,0 +1,15 @@
|
||||
.. _everest_modules_handwritten_IMDSimulator:
|
||||
|
||||
.. ############
|
||||
.. IMDSimulator
|
||||
.. ############
|
||||
|
||||
External MQTT Control
|
||||
=====================
|
||||
|
||||
The IMDSimulator module supports setting the simulated isolation resistance via MQTT.
|
||||
To set the resistance, publish an integer value (in Ohms) to the following topic:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
everest_api/<module_id>/cmd/set_resistance
|
||||
@@ -0,0 +1,75 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright (C) 2023 chargebyte GmbH
|
||||
// Copyright (C) 2023 Contributors to EVerest
|
||||
#include "isolation_monitorImpl.hpp"
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
namespace module {
|
||||
|
||||
namespace main {
|
||||
|
||||
void isolation_monitorImpl::init() {
|
||||
this->isolation_monitoring_active = false;
|
||||
this->isolation_measurement.resistance_F_Ohm = this->config.resistance_F_Ohm;
|
||||
this->config_interval = this->config.interval;
|
||||
|
||||
this->isolation_measurement_thread_handle = std::thread(&isolation_monitorImpl::isolation_measurement_worker, this);
|
||||
|
||||
const std::string RESISTANCE_TOPIC = "everest_api/" + this->mod->info.id + "/cmd/set_resistance";
|
||||
this->mod->mqtt.subscribe(RESISTANCE_TOPIC, [this](const std::string& resistance_ohm) {
|
||||
try {
|
||||
int32_t _resistance_ohm = std::stoi(resistance_ohm);
|
||||
EVLOG_info << "Setting simulated isolation resistance to " << _resistance_ohm << " Ohm via MQTT";
|
||||
this->isolation_measurement.resistance_F_Ohm = _resistance_ohm;
|
||||
} catch (const std::invalid_argument& e) {
|
||||
EVLOG_error << "Failed to set isolation resistance via MQTT, invalid value: " << resistance_ohm;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void isolation_monitorImpl::ready() {
|
||||
}
|
||||
|
||||
void isolation_monitorImpl::handle_start() {
|
||||
if (this->isolation_monitoring_active == false) {
|
||||
this->isolation_monitoring_active = true;
|
||||
EVLOG_info << "Started simulated isolation monitoring with " << this->config_interval << " ms interval";
|
||||
}
|
||||
};
|
||||
|
||||
void isolation_monitorImpl::handle_start_self_test(double& test_voltage_V) {
|
||||
selftest_running_countdown = 3 * 1000 / LOOP_SLEEP_MS;
|
||||
}
|
||||
|
||||
void isolation_monitorImpl::isolation_measurement_worker() {
|
||||
while (true) {
|
||||
if (this->isolation_measurement_thread_handle.shouldExit()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (this->isolation_monitoring_active == true) {
|
||||
this->mod->p_main->publish_isolation_measurement(this->isolation_measurement);
|
||||
EVLOG_debug << "Simulated isolation measurement finished";
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(this->config_interval - this->LOOP_SLEEP_MS));
|
||||
}
|
||||
|
||||
if (this->selftest_running_countdown > 0) {
|
||||
this->selftest_running_countdown--;
|
||||
if (this->selftest_running_countdown == 0) {
|
||||
this->mod->p_main->publish_self_test_result(config.selftest_success);
|
||||
}
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(this->LOOP_SLEEP_MS));
|
||||
}
|
||||
}
|
||||
|
||||
void isolation_monitorImpl::handle_stop() {
|
||||
if (this->isolation_monitoring_active == true) {
|
||||
EVLOG_info << "Stopped simulated isolation monitoring";
|
||||
this->isolation_monitoring_active = false;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace main
|
||||
} // namespace module
|
||||
@@ -0,0 +1,81 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright (C) 2023 chargebyte GmbH
|
||||
// Copyright (C) 2023 Contributors to EVerest
|
||||
// Copyright (C) 2024 Pionix GmbH
|
||||
#ifndef MAIN_ISOLATION_MONITOR_IMPL_HPP
|
||||
#define MAIN_ISOLATION_MONITOR_IMPL_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 3
|
||||
//
|
||||
|
||||
#include <generated/interfaces/isolation_monitor/Implementation.hpp>
|
||||
|
||||
#include "../IMDSimulator.hpp"
|
||||
|
||||
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
|
||||
// insert your custom include headers here
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include <utils/thread.hpp>
|
||||
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
|
||||
|
||||
namespace module {
|
||||
namespace main {
|
||||
|
||||
struct Conf {
|
||||
double resistance_F_Ohm;
|
||||
int interval;
|
||||
bool selftest_success;
|
||||
};
|
||||
|
||||
class isolation_monitorImpl : public isolation_monitorImplBase {
|
||||
public:
|
||||
isolation_monitorImpl() = delete;
|
||||
isolation_monitorImpl(Everest::ModuleAdapter* ev, const Everest::PtrContainer<IMDSimulator>& mod, Conf& config) :
|
||||
isolation_monitorImplBase(ev, "main"), mod(mod), config(config){};
|
||||
|
||||
// ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1
|
||||
// insert your public definitions here
|
||||
// ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1
|
||||
|
||||
protected:
|
||||
// command handler functions (virtual)
|
||||
virtual void handle_start() override;
|
||||
virtual void handle_stop() override;
|
||||
virtual void handle_start_self_test(double& test_voltage_V) override;
|
||||
|
||||
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
|
||||
// insert your protected definitions here
|
||||
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
|
||||
|
||||
private:
|
||||
const Everest::PtrContainer<IMDSimulator>& mod;
|
||||
const Conf& config;
|
||||
|
||||
virtual void init() override;
|
||||
virtual void ready() override;
|
||||
|
||||
// ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1
|
||||
// insert your private definitions here
|
||||
types::isolation_monitor::IsolationMeasurement isolation_measurement;
|
||||
std::atomic<bool> isolation_monitoring_active;
|
||||
int config_interval;
|
||||
static constexpr int LOOP_SLEEP_MS{20};
|
||||
|
||||
Everest::Thread isolation_measurement_thread_handle;
|
||||
void isolation_measurement_worker(void);
|
||||
|
||||
std::atomic_int selftest_running_countdown{0};
|
||||
// ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1
|
||||
};
|
||||
|
||||
// ev@3d7da0ad-02c2-493d-9920-0bbbd56b9876:v1
|
||||
// insert other definitions here
|
||||
// ev@3d7da0ad-02c2-493d-9920-0bbbd56b9876:v1
|
||||
|
||||
} // namespace main
|
||||
} // namespace module
|
||||
|
||||
#endif // MAIN_ISOLATION_MONITOR_IMPL_HPP
|
||||
@@ -0,0 +1,24 @@
|
||||
description: SIL Implementation of an Isolation Monitoring Device (IMD) for DC charging
|
||||
provides:
|
||||
main:
|
||||
interface: isolation_monitor
|
||||
description: Main interface for the IMD
|
||||
config:
|
||||
resistance_F_Ohm:
|
||||
description: Resistance to return for the simulated measurements in Ohm
|
||||
type: number
|
||||
default: 900000
|
||||
interval:
|
||||
description: Measurement update interval in milliseconds
|
||||
type: integer
|
||||
default: 1000
|
||||
selftest_success:
|
||||
description: Set to true for successful self testing, false for fault
|
||||
type: boolean
|
||||
default: true
|
||||
enable_external_mqtt: true
|
||||
metadata:
|
||||
license: https://opensource.org/licenses/Apache-2.0
|
||||
authors:
|
||||
- Fabian Hartung (chargebyte GmbH)
|
||||
- Cornelius Claussen (Pionix GmbH)
|
||||
Reference in New Issue
Block a user