Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
b15e7c19
Commit
b15e7c19
authored
Feb 05, 2012
by
cjt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix problem with labeled ground nodes
parent
afe72b59
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
js/cktsim.js
+12
-5
No files found.
js/cktsim.js
View file @
b15e7c19
...
...
@@ -96,9 +96,15 @@ cktsim = (function() {
// load circuit from JSON netlist (see schematic.js)
Circuit
.
prototype
.
load_netlist
=
function
(
netlist
)
{
// set up mapping for ground node always called '0' in JSON netlist
var
gnd_label
=
'0'
;
this
.
node_map
[
gnd_label
]
=
this
.
gnd_node
();
// set up mapping for all ground connections
for
(
var
i
=
netlist
.
length
-
1
;
i
>=
0
;
--
i
)
{
var
component
=
netlist
[
i
];
var
type
=
component
[
0
];
if
(
type
==
'g'
)
{
var
connections
=
component
[
3
];
this
.
node_map
[
connections
[
0
]]
=
this
.
gnd_node
();
}
}
// process each component in the JSON netlist (see schematic.js for format)
var
found_ground
=
false
;
...
...
@@ -120,9 +126,9 @@ cktsim = (function() {
var
connections
=
component
[
3
];
for
(
var
j
=
connections
.
length
-
1
;
j
>=
0
;
--
j
)
{
var
node
=
connections
[
j
];
if
(
node
==
gnd_label
)
found_ground
=
true
;
var
index
=
this
.
node_map
[
node
];
if
(
index
==
undefined
)
index
=
this
.
node
(
node
,
T_VOLTAGE
);
else
if
(
index
==
this
.
gnd_node
())
found_ground
=
true
;
connections
[
j
]
=
index
;
}
...
...
@@ -146,7 +152,8 @@ cktsim = (function() {
else
if
(
type
==
'p'
)
// p fet
this
.
p
(
connections
[
0
],
connections
[
1
],
connections
[
2
],
properties
[
'W/L'
],
name
);
}
if
(
found_ground
==
false
)
{
// No ground on schematic
if
(
!
found_ground
)
{
// No ground on schematic
alert
(
'Please make at least one connection to ground (inverted T symbol)'
);
return
false
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment