Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improving unit tests for constants 2
- Loading branch information
Showing
5 changed files
with
174 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,4 @@ comment: | |
|
||
ignore: | ||
- "examples/*" | ||
- "include/gravity/doctest.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,60 @@ | ||
//// | ||
//// Gen.cpp | ||
//// Gravity++ | ||
//// | ||
//// Created by Hassan Hijazi on 30/01/2015. | ||
// | ||
// Gen.cpp | ||
// Gravity++ | ||
// | ||
// Created by Hassan Hijazi on 30/01/2015. | ||
|
||
// | ||
|
||
#include "Gen.h" | ||
|
||
using namespace std; | ||
|
||
/** @brief Initialiser with linked Bus and generator properties | ||
@note Designated initialiser | ||
*/ | ||
Gen::Gen(Bus* bus, string name, double p_min, double p_max, double q_min, double q_max):_bus(bus), _cost(new GenCost()), _ps(0), _qs(0){ | ||
_active = true; | ||
_name = name; | ||
_pbound.min = p_min; | ||
_pbound.max = p_max; | ||
_qbound.min = q_min; | ||
_qbound.max = q_max; | ||
_id = -1; | ||
}; | ||
|
||
Gen::Gen(const string& name):_cost(new GenCost()){ | ||
_name = name; | ||
_active = true; | ||
} | ||
|
||
Gen::~Gen(){ | ||
delete _cost; | ||
} | ||
|
||
//void Gen::init_complex(){ | ||
// _S_ = Complex("S", &pg, &qg); | ||
// _S_._name.append(_name); | ||
//// | ||
// | ||
//#include "Gen.h" | ||
// | ||
//using namespace std; | ||
// | ||
///** @brief Initialiser with linked Bus and generator properties | ||
// @note Designated initialiser | ||
// */ | ||
//Gen::Gen(Bus* bus, string name, double p_min, double p_max, double q_min, double q_max):_bus(bus), _cost(new GenCost()), _ps(0), _qs(0){ | ||
// _active = true; | ||
// _name = name; | ||
// _pbound.min = p_min; | ||
// _pbound.max = p_max; | ||
// _qbound.min = q_min; | ||
// _qbound.max = q_max; | ||
// _id = -1; | ||
//}; | ||
// | ||
//Gen::Gen(const string& name):_cost(new GenCost()){ | ||
// _name = name; | ||
// _active = true; | ||
//} | ||
// | ||
//Gen::~Gen(){ | ||
// delete _cost; | ||
//} | ||
|
||
/** @brief Prints generator infos */ | ||
void Gen::print(){ | ||
|
||
// cout << "Gen Id: "<< std::atoi(_name.c_str()); | ||
cout << _name; | ||
if(!_active) | ||
cout << " | WARNING: Inactive generator"; | ||
printf(" | Cost coefficients: (c0=%.02f,c1=%.02f,c2=%.02f)", _cost->c0, _cost->c1, _cost->c2); | ||
printf(" | Active Power Bounds: (%.02f,%.02f)", _pbound.min, _pbound.max); | ||
printf(" | Reactive Power Bounds: (%.02f,%.02f)", _qbound.min, _qbound.max); | ||
printf(" | Participation Factor: %.02f%%\n", _part_factor); | ||
|
||
}; | ||
|
||
/** @brief Set cost coefficients fot the current generator */ | ||
void Gen::set_costs(double c0, double c1, double c2){ | ||
_cost->c0 = c0; | ||
_cost->c1 = c1; | ||
_cost->c2 = c2; | ||
}; | ||
|
||
// | ||
////void Gen::init_complex(){ | ||
//// _S_ = Complex("S", &pg, &qg); | ||
//// _S_._name.append(_name); | ||
////} | ||
// | ||
///** @brief Prints generator infos */ | ||
//void Gen::print(){ | ||
// | ||
//// cout << "Gen Id: "<< std::atoi(_name.c_str()); | ||
// cout << _name; | ||
// if(!_active) | ||
// cout << " | WARNING: Inactive generator"; | ||
// printf(" | Cost coefficients: (c0=%.02f,c1=%.02f,c2=%.02f)", _cost->c0, _cost->c1, _cost->c2); | ||
// printf(" | Active Power Bounds: (%.02f,%.02f)", _pbound.min, _pbound.max); | ||
// printf(" | Reactive Power Bounds: (%.02f,%.02f)", _qbound.min, _qbound.max); | ||
// printf(" | Participation Factor: %.02f%%\n", _part_factor); | ||
// | ||
//}; | ||
// | ||
///** @brief Set cost coefficients fot the current generator */ | ||
//void Gen::set_costs(double c0, double c1, double c2){ | ||
// _cost->c0 = c0; | ||
// _cost->c1 = c1; | ||
// _cost->c2 = c2; | ||
//}; | ||
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,86 @@ | ||
// | ||
// Gen.h | ||
// PowerTools++ | ||
// | ||
// Created by Hassan Hijazi on 30/01/2015. | ||
// Copyright (c) 2015 NICTA. All rights reserved. | ||
// | ||
|
||
#ifndef Gen_h | ||
#define Gen_h | ||
|
||
#include <stdio.h> | ||
#include <gravity/var.h> | ||
#include "Bound.h" | ||
#include "GenCost.h" | ||
#include <iostream> | ||
#include <stdio.h> | ||
#include <gravity/Auxiliary.h> | ||
|
||
class Bus; | ||
|
||
class Gen: public gravity::aux{ | ||
public: | ||
/** @brief Unit name | ||
@note One bus may have multiple generators | ||
*/ | ||
string _unit_name; | ||
|
||
string _type_name="Gen"; | ||
|
||
|
||
|
||
int _gen_type = -1; | ||
|
||
/** Position of a generator in a container. **/ | ||
int _id; | ||
|
||
/** @brief Corresponding Bus */ | ||
Bus* _bus; | ||
|
||
/** @brief Active Power Generation Bounds */ | ||
Bound _pbound; | ||
|
||
/** @brief Reactive Power Generation Bounds */ | ||
Bound _qbound; | ||
|
||
/** @brief Participation Factor */ | ||
double _part_factor = 0; | ||
|
||
/** @brief generation cost function/coefficients */ | ||
GenCost* _cost; | ||
|
||
/** @brief snapshot value of active power generation */ | ||
double _ps; | ||
/** @brief snapshot value of reactive power generation */ | ||
double _qs; | ||
|
||
/** @brief Complex power generation variable */ | ||
//Complex<double> _S_; | ||
/** @brief Active power generation variable */ | ||
//var<> pg; | ||
/** @brief Reactive power generation variable */ | ||
//var<> qg; | ||
Bus* _src = nullptr; | ||
Bus* _dest = nullptr; | ||
|
||
/** @brief Initialiser with linked Bus and generator properties | ||
*/ | ||
Gen(Bus* b, std::string name, double p_min, double p_max, double q_min, double q_max); | ||
|
||
Gen(const string& name); | ||
|
||
/** @brief Destructor | ||
*/ | ||
~Gen(); | ||
|
||
//void init_complex(); | ||
|
||
/** @brief Prints generator infos */ | ||
void print(); | ||
|
||
/** @brief Set cost coefficients fot the current generator */ | ||
void set_costs(double c0, double c1, double c2); | ||
|
||
}; | ||
#endif /* defined(__PowerTools____Gen__) */ | ||
// // | ||
// // Gen.h | ||
// // PowerTools++ | ||
// // | ||
// // Created by Hassan Hijazi on 30/01/2015. | ||
// // Copyright (c) 2015 NICTA. All rights reserved. | ||
// // | ||
// | ||
//#ifndef Gen_h | ||
//#define Gen_h | ||
// | ||
//#include <stdio.h> | ||
//#include <gravity/var.h> | ||
//#include "Bound.h" | ||
//#include "GenCost.h" | ||
//#include <iostream> | ||
//#include <stdio.h> | ||
//#include <gravity/Auxiliary.h> | ||
// | ||
//class Bus; | ||
// | ||
//class Gen: public gravity::aux{ | ||
//public: | ||
// /** @brief Unit name | ||
// @note One bus may have multiple generators | ||
// */ | ||
// string _unit_name; | ||
// | ||
// string _type_name="Gen"; | ||
// | ||
// | ||
// | ||
// int _gen_type = -1; | ||
// | ||
// /** Position of a generator in a container. **/ | ||
// int _id; | ||
// | ||
// /** @brief Corresponding Bus */ | ||
// Bus* _bus; | ||
// | ||
// /** @brief Active Power Generation Bounds */ | ||
// Bound _pbound; | ||
// | ||
// /** @brief Reactive Power Generation Bounds */ | ||
// Bound _qbound; | ||
// | ||
// /** @brief Participation Factor */ | ||
// double _part_factor = 0; | ||
// | ||
// /** @brief generation cost function/coefficients */ | ||
// GenCost* _cost; | ||
// | ||
// /** @brief snapshot value of active power generation */ | ||
// double _ps; | ||
// /** @brief snapshot value of reactive power generation */ | ||
// double _qs; | ||
// | ||
// /** @brief Complex power generation variable */ | ||
// //Complex<double> _S_; | ||
// /** @brief Active power generation variable */ | ||
// //var<> pg; | ||
// /** @brief Reactive power generation variable */ | ||
// //var<> qg; | ||
// Bus* _src = nullptr; | ||
// Bus* _dest = nullptr; | ||
// | ||
// /** @brief Initialiser with linked Bus and generator properties | ||
// */ | ||
// Gen(Bus* b, std::string name, double p_min, double p_max, double q_min, double q_max); | ||
// | ||
// Gen(const string& name); | ||
// | ||
// /** @brief Destructor | ||
// */ | ||
// ~Gen(); | ||
// | ||
// //void init_complex(); | ||
// | ||
// /** @brief Prints generator infos */ | ||
// void print(); | ||
// | ||
// /** @brief Set cost coefficients fot the current generator */ | ||
// void set_costs(double c0, double c1, double c2); | ||
// | ||
//}; | ||
//#endif /* defined(__PowerTools____Gen__) */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
//// | ||
//// Auxiliary.h | ||
//// Gravity | ||
//// | ||
//// Created by Hassan Hijazi on 1/3/18. | ||
//// | ||
//// | ||
// | ||
// Auxiliary.h | ||
// Gravity | ||
//#ifndef Auxiliary_h | ||
//#define Auxiliary_h | ||
// | ||
// Created by Hassan Hijazi on 1/3/18. | ||
//using namespace std; | ||
// | ||
// | ||
|
||
#ifndef Auxiliary_h | ||
#define Auxiliary_h | ||
|
||
using namespace std; | ||
|
||
namespace gravity { | ||
|
||
/** Backbone class for auxiliary objects that can be attached to nodes, e.g., generators. */ | ||
class aux{ | ||
public: | ||
bool _active; | ||
string _name; | ||
virtual ~aux(){}; | ||
}; | ||
}; | ||
#endif /* Auxiliary_h */ | ||
//namespace gravity { | ||
// | ||
// /** Backbone class for auxiliary objects that can be attached to nodes, e.g., generators. */ | ||
// class aux{ | ||
// public: | ||
// bool _active; | ||
// string _name; | ||
// virtual ~aux(){}; | ||
// }; | ||
//}; | ||
//#endif /* Auxiliary_h */ |