Repository navigation
Expand file tree
/
Copy pathsetImageScript.js
More file actions
88 lines (82 loc) · 3 KB
/
Copy pathsetImageScript.js
File metadata and controls
88 lines (82 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* Author: Aaron Scher
*/ //This function is called at the very end of the main buttonFunction(). The purpose of this function is to generate the correct figure to display based on the user's source, inverter, rectifier, and load options.
function setImage(sourceType, invConst, rectConst, loadType, compensation) {
//Display correct source image
if (sourceType == 1) {
document.getElementById("sourceImage").src = "images/sourceVg.png";
}
if (sourceType == 2) {
document.getElementById("sourceImage").src = "images/sourceIg.png";
}
//Display correct inverter image
if (invConst == 1) {
document.getElementById("inverterImage").src =
"images/inverterHalfBridge.png";
}
if (invConst == 2) {
document.getElementById("inverterImage").src =
"images/inverterFullBridge.png";
}
//Display correct compensation network
if (compensation == 1) {
document.getElementById("couplerImage").src = "images/seriesSeries.png";
}
if (compensation == 2) {
document.getElementById("couplerImage").src = "images/seriesParallel.png";
}
if (compensation == 3) {
document.getElementById("couplerImage").src = "images/lccSeries.png";
}
if (compensation == 4) {
document.getElementById("couplerImage").src = "images/lccLCC.png";
}
//Display correct rectifier image
if (rectConst == 1 && compensation == 1) {
document.getElementById("rectifierImage").src =
"images/rectifierHalfBridgeCurrentDriven.png";
}
if (rectConst == 1 && compensation == 2) {
document.getElementById("rectifierImage").src =
"images/rectifierHalfBridgeVoltageDriven.png";
}
if (rectConst == 1 && compensation == 3) {
document.getElementById("rectifierImage").src =
"images/rectifierHalfBridgeCurrentDriven.png";
}
if (rectConst == 1 && compensation == 4) {
document.getElementById("rectifierImage").src =
"images/rectifierHalfBridgeCurrentDriven.png";
}
if (rectConst == 2 && compensation == 1) {
document.getElementById("rectifierImage").src =
"images/rectifierFullBridgeCurrentDriven.png";
}
if (rectConst == 2 && compensation == 2) {
document.getElementById("rectifierImage").src =
"images/rectifierFullBridgeVoltageDriven.png";
}
if (rectConst == 2 && compensation == 3) {
document.getElementById("rectifierImage").src =
"images/rectifierFullBridgeCurrentDriven.png";
}
if (rectConst == 2 && compensation == 4) {
document.getElementById("rectifierImage").src =
"images/rectifierFullBridgeCurrentDriven.png";
}
//Display correct load
if (loadType == 1) {
document.getElementById("loadImage").src = "images/loadRL.png";
}
if (loadType == 2) {
document.getElementById("loadImage").src = "images/loadVL.png";
}
if (loadType == 3) {
document.getElementById("loadImage").src = "images/loadIL.png";
}
if (loadType == 4) {
document.getElementById("loadImage").src = "images/loadCplVd.png";
}
if (loadType == 5) {
document.getElementById("loadImage").src = "images/loadCplCD.png";
}
}