Skip to content

Commit

Permalink
drawcircuit works bit little
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammadali-al committed Aug 5, 2020
1 parent de33335 commit ac8a88f
Show file tree
Hide file tree
Showing 6 changed files with 454 additions and 53 deletions.
18 changes: 8 additions & 10 deletions Circuit examples/DC V_S and res/new 1.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
Vin1 2 0 0 4 1 0
R1 2 1 1
R2 1 0 3
R3 1 0 3
R4 2 3 3
R5 3 0 3
R6 2 0 3
R7 2 0 3
Iin1 1 0 3m 0 0 0
R1 2 1 4k
R2 3 2 4k
R3 1 3 1k
R4 2 0 1k
R5 3 0 2k
dV 1m
dI 1m
dT 1m
dI 1u
dT 100u
.tran 1000m
16 changes: 11 additions & 5 deletions src/model/Branch.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public class Branch {
protected Node nodeN;
private Branch superiorBranch;
private ArrayList<Branch> subBranches = new ArrayList<>();
private String type = new String();
private int width;
private int height;
private String structureType = new String();
private int width = 0;
private int height = 0;
private int isVisited;

public Branch(String name, Node nodeP, Node nodeN) {
Expand All @@ -37,6 +37,10 @@ else if (this.nodeN.equals(node))
}
}

public boolean IsItParallel()
{
return this.getStructureType().equals("Parallel");
}

public void setWidth(int width) { this.width = width; }

Expand All @@ -46,14 +50,16 @@ else if (this.nodeN.equals(node))

public void setSubBranches(ArrayList<Branch> subBranches) { this.subBranches = subBranches; }

public void setTheTypeParallel() { this.type = "Parallel"; }
public void setTheTypeParallel() { this.structureType = "Parallel"; }

public void setTheTypeSeries() { this.type = "Series"; }
public void setTheTypeSeries() { this.structureType = "Series"; }

public void setVisited() { this.isVisited = 1; }

public void setNotVisited() {this.isVisited = 0; }

public String getStructureType() { return structureType; }

public boolean getIsVisited() { return isVisited == 1; }

public Node getNodeP() { return nodeP; }
Expand Down
2 changes: 2 additions & 0 deletions src/model/CurrentSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public double getValue(Node node) {
return getCurrent(node);
}

public double getPhase() { return phase; }

@Override
public Type getType() {
return Type.CURRENT_SOURCE;
Expand Down
2 changes: 2 additions & 0 deletions src/model/VoltageSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public Type getType() {
return Type.VOLTAGE_SOURCE;
}

public double getPhase() { return phase; }

@Override
public String toString() {
return name + " " +
Expand Down
Loading

0 comments on commit ac8a88f

Please sign in to comment.