Post Reply 
Circuit Simulation
10-11-2016, 04:32 AM (This post was last modified: 10-21-2016 08:20 PM by toshk.)
Post: #1
Circuit Simulation
eNet(M1)
M1 has 6 columns
M1=[[busfrom] [busto] [Resistor] [Independent Voltage] [Independent Current] [Opamp] ]
M1 for linedata: column1=busFrom, column2=busTo, column3=Z, column4=Voltage, column5=Curr.Source, column6=Oamp
BusFrom To BusTo will follow current path
Current flows through the -ve terminal of the battery


"\left(\begin{array}{cccccc}\n1 & 2 & 10 & 0 & 0 & 0 \\\n1 & 1 & 0 & 0 & 5 & 0 \\\n2 & 3 & 40 & 0 & 0 & 0 \\\n1 & 3 & 20 & 0 & 0 & 0 \\\n2 & 2 & 50 & 0 & 0 & 0 \\\n3 & 3 & 0 & 0 & 2 & 0\n\end{array}\right) "

node1 to node2 has 10_Ohms (or node2 to node1 has 10_Ohms )
node1 to node1 has 5_Amps (to node1 to ground, 5 because current flow into Node1)
node2 to node3 has 40_ohms
node1 to node3 has 20_Ohms
node2 to node2 has 50_Ohms (node2 to ground)
node3 to node3 has 2amps (to node3 to ground, 2 because current flow into Node3)

eNet(M1)
results:
"\left(\begin{array}{c}\n404.285714286 \\\n350 \\\n412.857142857\n\end{array}\right) "

interpretative of the the results: type: nkll

CAS programming you can enter variables for elements:
node1 to node2 has r1 (or node2 to node1 has 10_Ohms )
node1 to node1 has Ig1 (to node1 to ground, 5 because current flow into Node1)
node2 to node3 has r2
node1 to node3 has r3
node2 to node2 has r4 (node2 to ground)
node3 to node3 has Ig3 (to node3 to ground, 2 because current flow into Node3)


For Capacitor impedance: 1/s*c1 into resistor column3; (c1, c2.... not c) qualify the variable c
For Inductor impedance: s*l1 into resistor column3
Opamp: [1 2 0 0 0 4] (positive node1 to 1, -ve node2 to 2) 0 in column5 (for ideal Opamp) and node4 for the feedback path;





[Image: Nodal-Analysis-Special-Cases_(1)...png]

"\left(\begin{array}{cccccc}
1 & 1 & 0 & 0 & 4 & 0 \\
1 & 1 & 500 & 0 & 0 & 0 \\
1 & 2 & 450 & 0 & 0 & 0 \\
2 & 2 & 1500 & 0 & 0 & 0 \\
2 & 3 & 600 & 0 & 0 & 0 \\
3 & 3 & 550 & 0 & 0 & 0 \\
3 & 3 & 0 & 0 & 5 & 0
\end{array}\right) "

OR

"\left(\begin{array}{cccccc}
1 & 1 & 500 & 0 & 4 & 0 \\
1 & 2 & 450 & 0 & 0 & 0 \\
2 & 2 & 1500 & 0 & 0 & 0 \\
2 & 3 & 600 & 0 & 0 & 0 \\
3 & 3 & 550 & 0 & 0 & 0 \\
3 & 3 & 0 & 0 & 5 & 0
\end{array}\right) "

[Image: nodal-analysis-voltage.png]
"\left(\begin{array}{cccccc}
1 & 2 & 4 & 0 & 0 & 0 \\
2 & 3 & 0 & 10 & 0 & 0 \\
1 & 3 & 8 & 0 & 0 & 0 \\
1 & 1 & 0 & 20 & 0 & 0 \\
3 & 3 & 12 & 0 & 0 & 0 \\
2 & 2 & 16 & 0 & 0 & 0
\end{array}\right) "

row2: can be written as
[3 2 0 -10 0 0 ]

[Image: images?q=tbn:ANd9GcTr1F4C4aRFgK7qYgREC2m...lXtyJx2d4g]
"\left(\begin{array}{cccccc}
1 & 1 & 0 & 1 & 0 & 0 \\
1 & 2 & 6000 & 0 & 0 & 0 \\
2 & 2 & 9000 & 0 & 0 & 0 \\
2 & 3 & 18000 & 0 & 0 & 0 \\
3 & 4 & 54000 & 0 & 0 & 0 \\
4 & 4 & 45000 & 0 & 0 & 0 \\
3 & 3 & 0 & 0 & 0 & 4
\end{array}\right) "
last row: Opamp input


Attached File(s)
.hpprgm  eNetworki.hpprgm (Size: 11.25 KB / Downloads: 7)
Find all posts by this user
Quote this message in a reply
10-11-2016, 12:06 PM (This post was last modified: 10-11-2016 12:06 PM by compsystems.)
Post: #2
RE: Circuit Simulation
Please you can add in the code, a function with examples

Code:

#cas
examples():=
BEGIN
....
END;
#end
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: