Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ACS
Public
Teaching materials
LEGOS
Firmware
Merge requests
!13
Virtual load
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Virtual load
virtual_load
into
master
Overview
3
Commits
3
Pipelines
2
Changes
5
All threads resolved!
Hide all comments
Merged
Jan Schmitz
requested to merge
virtual_load
into
master
2 years ago
Overview
3
Commits
3
Pipelines
2
Changes
5
All threads resolved!
Hide all comments
Expand
0
0
Merge request reports
Compare
master
version 2
9dece8c4
2 years ago
version 1
9dece8c4
2 years ago
master (base)
and
latest version
latest version
eb160ae2
3 commits,
2 years ago
version 2
9dece8c4
3 commits,
2 years ago
version 1
9dece8c4
4 commits,
2 years ago
5 files
+
201
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
components/virtual_load/include/virtual_load.h
0 → 100644
+
82
−
0
Options
// Copyright: 2022, Institute for Automation of Complex Power Systems, EONERC
// Contact: Matthias Marcus Nowak <marcus.nowak@rwth-aachen.de>
// License: MIT
#ifndef _VIRTUAL_LOAD_H_
#define _VIRTUAL_LOAD_H_
#include
"driver/dac.h"
#include
"driver/gpio.h"
#ifdef __cplusplus
extern
"C"
{
#endif
/**
* @brief Virtual load device handle. Should be created with virtual_load_init
*
* @param[in] load_v Maximum voltage across the virtual load and dac pin - 3V
* @param[in] load_r Load Resistor Value
* @param[in] load_max_a Software limited maximum current
* @param[in] dac_channel DAC Channel used for virtual load output
* @param[in] disable_pin Pin used for disable function
*/
typedef
struct
virtual_load_t
{
float
load_v
;
// Voltage across the load circuit
float
load_r
;
// Load Resistor Value
float
load_max_a
;
// Software limit for maximum current
dac_channel_t
dac_channel
;
// DAC Pin to set the Virtual Load
gpio_num_t
disable_pin
;
// Pin connected to the disable pin from the OpAmp
}
virtual_load_t
;
/**
* @brief Virtual load init
*
* @param[in] v_load_v Maximum voltage across the virtual load and dac pin - 3V
* @param[in] v_load_r Load Resistor Value
* @param[in] v_load_max_a Software limited maximum current
* @param[in] v_dac_channel DAC Channel used for virtual load output
* @param[in] v_disable_pin Pin used for disable function
*
* @return handle struct for the configured virtual load
*/
virtual_load_t
virtual_load_init
(
float
v_load_v
,
float
v_load_r
,
float
v_load_max_a
,
dac_channel_t
v_dac_channel
,
gpio_num_t
v_disable_pin
);
/**
* @brief Set the load in watts
*
* @param[in] vl device handle
* @param[in] v_watt Load watt value
*/
void
virtual_load_set_watt
(
virtual_load_t
*
vl
,
float
v_watt
);
/**
* @brief Set the load in amps
*
* @param[in] vl device handle
* @param[in] v_current Load amperage value
*/
void
virtual_load_set_current
(
virtual_load_t
*
vl
,
float
v_current
);
/**
* @brief Set the load in total % - Unsafe, without current limiting
*
* @param[in] vl device handle
* @param[in] c_percent Load percent Value
*/
void
virtual_load_set_percent
(
virtual_load_t
*
vl
,
float
v_percent
);
/**
* @brief Disable the load in hardware
*
* @param[in] vl device handle
* @param[in] v_disable true if load should be disabled, true for enabled
*/
void
virtual_load_disable
(
virtual_load_t
*
vl
,
bool
v_disable
);
#ifdef __cplusplus
}
#endif //__cplusplus
#endif //_VIRTUAL_LOAD_H_
Loading