Eclipse SUMO - Simulation of Urban MObility
Node.h
Go to the documentation of this file.
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3
// Copyright (C) 2001-2020 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials are made available under the
5
// terms of the Eclipse Public License 2.0 which is available at
6
// https://www.eclipse.org/legal/epl-2.0/
7
// This Source Code may also be made available under the following Secondary
8
// Licenses when the conditions for such availability set forth in the Eclipse
9
// Public License 2.0 are satisfied: GNU General Public License, version 2
10
// or later which is available at
11
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
/****************************************************************************/
19
// Representation of electric circuit nodes, i.e. wire junctions and connection points.
21
/****************************************************************************/
22
#pragma once
23
24
#include <vector>
25
#include <string>
26
27
using namespace
std;
28
29
class
Element
;
30
31
class
Node
{
32
33
private
:
34
bool
isground
;
35
bool
isremovable
;
36
string
name
;
// unique property, each object has distinctive and unique name
37
int
id
;
// a sequential ID number, might be useful when making the equation
38
int
num_matrixRow
;
// number of matrix row during solving the equations
39
int
num_matrixCol
;
// number of matrix column during solving the equations
40
double
voltage
;
41
vector<Element*>*
elements
;
// too lazy to implement a linked list
42
// each node is connected to one or more element, an element is a resistor or voltage/current source
43
44
public
:
45
// A constructor, same functionality as "init" functions
46
Node
(
string
name,
int
id
);
47
48
// connects an element to the node
49
void
addElement(
Element
* element);
50
// disconnects an element to the node
51
void
eraseElement(
Element
* element);
52
// getters and setters
53
double
getVoltage();
54
void
setVoltage(
double
voltage);
55
int
getNumOfElements();
56
// iterates through the vector of the node's elements and returns the first, which is not equal to "element" in the argument of the function
57
Element
* getAnOtherElement(
Element
* element);
58
string
& getName();
59
bool
isGround();
60
bool
isRemovable
() {
61
return
isremovable;
62
};
63
void
setGround(
bool
isground);
64
int
getId();
65
void
setNumMatrixRow(
int
num);
66
int
getNumMatrixRow();
67
void
setNumMatrixCol(
int
num);
68
int
getNumMatrixCol();
69
void
setId(
int
id
);
70
vector<Element*>* getElements();
71
void
setRemovability(
bool
isremovable);
72
};
73
Element
Definition:
Element.h:42
Node
Definition:
Node.h:31
Node::name
string name
Definition:
Node.h:36
Node::id
int id
Definition:
Node.h:37
Node::isRemovable
bool isRemovable()
Definition:
Node.h:60
Node::isground
bool isground
Definition:
Node.h:34
Node::isremovable
bool isremovable
Definition:
Node.h:35
Node::num_matrixCol
int num_matrixCol
Definition:
Node.h:39
Node::num_matrixRow
int num_matrixRow
Definition:
Node.h:38
Node::voltage
double voltage
Definition:
Node.h:40
Node::elements
vector< Element * > * elements
Definition:
Node.h:41
src
utils
traction_wire
Node.h
Generated on Sat Jan 23 2021 10:47:24 for Eclipse SUMO - Simulation of Urban MObility by
1.9.1