Eclipse SUMO - Simulation of Urban MObility
Element.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 elements: resistors, voltage and current sources
21
/****************************************************************************/
22
#pragma once
23
24
#include <string>
25
#include <iostream>
26
using namespace
std;
27
28
class
Node
;
29
42
class
Element
{
43
44
public
:
45
enum
ElementType
{
46
RESISTOR_traction_wire
,
47
CURRENT_SOURCE_traction_wire
,
48
VOLTAGE_SOURCE_traction_wire
,
49
ERROR_traction_wire
50
};
51
52
private
:
53
Node
*
pNode
;
54
Node
*
nNode
;
55
double
voltage
;
56
double
current
;
57
double
resistance
;
58
double
powerWanted
;
59
ElementType
type
;
60
string
name
;
// unique property, each object has distinctive and unique name
61
int
id
;
// a sequential ID number, might be useful when making the equation
62
bool
isenabled
;
63
64
public
:
65
// a constructor. same functionality as init functions in the last project
66
Element
(
string
name,
ElementType
type,
double
value);
67
68
//getters and setters
69
double
getVoltage();
// get the voltage across the element
70
double
getCurrent();
// get the current running through the element
71
double
getResistance();
72
double
getPowerWanted();
73
double
getPower();
74
int
getId();
75
Node
* getPosNode();
76
Node
* getNegNode();
77
ElementType
getType();
78
string
getName();
79
bool
isEnabled();
80
81
void
setPosNode(
Node
* node);
82
void
setNegNode(
Node
* node);
83
void
setId(
int
id
);
84
void
setVoltage(
double
voltage);
85
void
setCurrent(
double
current);
86
void
setResistance(
double
resistance);
87
void
setPowerWanted(
double
powerWanted);
88
void
setEnabled(
bool
isenabled);
89
90
// if node == pNode, return nNode, else if node == nNode return pNode, else return NULL
91
Node
* getTheOtherNode(
Node
* node);
92
// sets the type of elements
93
void
setType(
ElementType
ET);
94
95
};
Element
Definition:
Element.h:42
Element::type
ElementType type
Definition:
Element.h:59
Element::powerWanted
double powerWanted
Definition:
Element.h:58
Element::id
int id
Definition:
Element.h:61
Element::name
string name
Definition:
Element.h:60
Element::pNode
Node * pNode
Definition:
Element.h:53
Element::isenabled
bool isenabled
Definition:
Element.h:62
Element::nNode
Node * nNode
Definition:
Element.h:54
Element::resistance
double resistance
Definition:
Element.h:57
Element::current
double current
Definition:
Element.h:56
Element::voltage
double voltage
Definition:
Element.h:55
Element::ElementType
ElementType
Definition:
Element.h:45
Element::RESISTOR_traction_wire
@ RESISTOR_traction_wire
Definition:
Element.h:46
Element::CURRENT_SOURCE_traction_wire
@ CURRENT_SOURCE_traction_wire
Definition:
Element.h:47
Element::VOLTAGE_SOURCE_traction_wire
@ VOLTAGE_SOURCE_traction_wire
Definition:
Element.h:48
Node
Definition:
Node.h:31
src
utils
traction_wire
Element.h
Generated on Thu Jan 21 2021 15:59:56 for Eclipse SUMO - Simulation of Urban MObility by
1.9.1