From 9fa336d9b103b8522a3c3d3880a92ead2ecd7945 Mon Sep 17 00:00:00 2001 From: Abhishek Patel Date: Fri, 3 Jun 2016 12:27:47 +0530 Subject: power,test,diodes updated,footer added --- views/icons/images.jpeg | Bin 0 -> 1131 bytes views/schematic.html | 995 +++++++---- views/schematic1.html | 843 +++++++++ views/script/gui.js | 1905 +++++++++++++-------- views/script/netlist.js | 931 +++++----- views/script/savenetlist.js | 8 +- views/script/schematic.js | 4 +- views/style/schematic.css | 2 +- views/webtronix_server/parts.json | 69 +- views/webtronix_server/power/ac.svg | 28 +- views/webtronix_server/power/current.svg | 2 +- views/webtronix_server/power/exponential.svg | 58 + views/webtronix_server/power/pulse.svg | 60 + views/webtronix_server/power/pwl.svg | 68 + views/webtronix_server/power/sinvoltagesource.svg | 39 + views/webtronix_server/spice/1N34A.lib | 3 + views/webtronix_server/spice/1N5711.lib | 4 + views/webtronix_server/spice/1n4007.lib | 5 + views/webtronix_server/spice/1n4148.lib | 4 + 19 files changed, 3482 insertions(+), 1546 deletions(-) create mode 100644 views/icons/images.jpeg create mode 100644 views/schematic1.html create mode 100644 views/webtronix_server/power/exponential.svg create mode 100644 views/webtronix_server/power/pulse.svg create mode 100644 views/webtronix_server/power/pwl.svg create mode 100644 views/webtronix_server/power/sinvoltagesource.svg create mode 100644 views/webtronix_server/spice/1N34A.lib create mode 100644 views/webtronix_server/spice/1N5711.lib create mode 100644 views/webtronix_server/spice/1n4007.lib create mode 100644 views/webtronix_server/spice/1n4148.lib diff --git a/views/icons/images.jpeg b/views/icons/images.jpeg new file mode 100644 index 0000000..7cff199 Binary files /dev/null and b/views/icons/images.jpeg differ diff --git a/views/schematic.html b/views/schematic.html index b571ab8..5e3e8c5 100644 --- a/views/schematic.html +++ b/views/schematic.html @@ -1,22 +1,22 @@ - -eSim - - - - - - - - - - - - - - + + eSim + + + + + + + + + + + + + + @@ -26,27 +26,32 @@ -
- -
- Circuit - - +
+ +
+ + + + +
+ Circuit + + - - - - -
-
- History - - -
-
- Settings -
- + + + + + +
+ History + + +
+
+ Settings + +
@@ -55,10 +60,11 @@ toolbar -
connections graphinvert help
-
-
- +
+ +
+ +
@@ -66,12 +72,11 @@ toolbar
- -
- -
- Fossee - + + + +
+ Fossee
-
+ + + +
+ + + +
+ + + + + + - -
Mode: Draw Rectangle
+ + @@ -98,75 +121,328 @@ make chips --> +--> @@ -175,40 +451,40 @@ spice: select source server --> +--> @@ -218,171 +494,171 @@ add code text - - - - - - - - - - - - - - - -
- - - - -
- - - - -
- - - - - - -
- - - - -
- - -
+ --> + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + +
+ + + + +
+ + +
@@ -480,38 +756,38 @@ netlist display @@ -527,6 +803,8 @@ or try adding + + @@ -534,21 +812,32 @@ code for select options of analysis simulation display --> + + + + + + - + + + + + + diff --git a/views/schematic1.html b/views/schematic1.html new file mode 100644 index 0000000..5e3e8c5 --- /dev/null +++ b/views/schematic1.html @@ -0,0 +1,843 @@ + + + + + eSim + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + +
+ Circuit + + + + + + + +
+
+ History + + +
+
+ Settings +
+ + + + + + + + + +
connectionsgraph
inverthelp
+
+
+
+
+ +
+
+
+ +
+ + + + +
+ Fossee
+ +
+ + + + + +
+ + + +
+ + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + diff --git a/views/script/gui.js b/views/script/gui.js index d410c44..f537b5a 100644 --- a/views/script/gui.js +++ b/views/script/gui.js @@ -20,7 +20,7 @@ var webtronics={ Vlist:/\s*expression|\s*url|.*script/, Alist:/^(x|y|x1|y1|x2|y2|dx|dy|cx|cy|r|width|height|transform|d|id|class|fill|stroke|visibility|stroke-width|xmlns|xmlns:wtx|connects|partvalue|flippable|spice|index|font-size|font-weight|font-style|font-family)$/, - Elist:/^(path|circle|rect|line|text|g|tspan|svg|wtx:part|wtx:pins|wtx:analog|wtx:digital|wtx:node|wtx:id|wtx:type|wtx:name|wtx:category|wtx:value|wtx:label|wtx:spice|wtx:flip|wtx:model|wtx:measure|metadata|)$/, + Elist:/^(path|circle|rect|line|text|g|tspan|svg|wtx:eval1|wtx:eval2|wtx:eval3|wtx:eval4|wtx:eval5|wtx:eval6|wtx:pwlval1|wtx:pwlval2|wtx:pwlval3|wtx:pwlval4|wtx:pwlval5|wtx:pwlval6|wtx:pwlval7|wtx:pwlval8|wtx:pulval1|wtx:pulval2|wtx:pulval3|wtx:pulval4|wtx:pulval5|wtx:pulval6|wtx:pulval7|wtx:amplitude|wtx:phase|wtx:offsetvoltage|wtx:voltageamplitude|wtx:frequency|wtx:delaytime|wtx:dampingfactor|wtx:part|wtx:pins|wtx:analog|wtx:digital|wtx:node|wtx:id|wtx:type|wtx:name|wtx:category|wtx:value|wtx:label|wtx:spice|wtx:flip|wtx:model|wtx:measure|metadata|)$/, /* .lib files contain spice .model devices .mod devices contain .subckt devices and the id must begin with x*/ // serverurls:["http://logical.github.io/webtronix/webtronix_server"], serverurls:["webtronix_server"], @@ -44,7 +44,7 @@ var webtronics={ setsize:function(){ var buffer=30; - var realheight=window.innerHeight-$('webtronics_toolbar').offsetHeight-$('webtronics_status_bar').offsetHeight; + var realheight=window.innerHeight-$('webtronics_toolbar').offsetHeight-$('webtronics_footer').offsetHeight; var realwidth=window.innerWidth-$('webtronics_side_bar').offsetWidth; $('webtronics_center').style.width = window.offsetWidth+'px'; $('webtronics_center').style.height = realheight-buffer+'px'; @@ -58,9 +58,9 @@ var webtronics={ setMode:function(mode, status){ - - - $('webtronics_status_bar').innerHTML = 'Mode: '+status; + + + //$('webtronics_status_bar').innerHTML = 'Mode: '+status; $('webtronics_add_text').style.display='none'; if(mode=='select'){ if($('webtronics_context_menu'))$('webtronics_context_menu').style.display='block'; @@ -68,196 +68,559 @@ var webtronics={ else if(mode=='line'){ if($('webtronics_context_menu'))$('webtronics_context_menu').style.display='none'; if(this.circuit.selected){ - this.circuit.unselect(); - } - } - else if(mode=='text'){ - if($('webtronics_context_menu'))$('webtronics_context_menu').style.display='none'; - } - $('webtronics_context_menu').style.display='none'; - this.circuit.mode=mode; - - }, - - - getvalues:function(elem){ - - - $("webtronics_part_model").options.length=0; - $("webtronics_part_dir_model").options.length=0; - $("webtronics_part_model").appendChild(new Element("option",{"value":""}).update("none")); - $("webtronics_part_dir_model").appendChild(new Element("option",{"value":""}).update("none")); - var part=netlistcreator.readwtx(elem,"name"); - var cat=netlistcreator.readwtx(elem,"category"); - if(cat && (part != "model")){ - for(var i=0;idiv>div'); - - for(var i=0;idiv>div'); + + for(var i=0;i3){ - $("webtronics_hor_pins").insert(Element("option",{"value":i}).update(i*2)); - } - $("webtronics_vert_pins").insert(Element("option",{"value":i}).update(i*2)); - - } - - /*menu events*/ - - Event.observe($('webtronics_file'), 'click', function() { - if($('webtronics_file_menu').style.display=='block'){ - $('webtronics_file_menu').style.display='none'; - } - else { - $('webtronics_file_menu').style.display='block'; - } - }); - Event.observe($('webtronics_chips_open'), 'click', function() { - webtronics.circuit.clearinfo(); - webtronics.setMode('select','Selection'); - chipmaker.openmaker(); - $('webtronics_chips_box').style.display = "block"; - webtronics.center($('webtronics_chips_box')); - webtronics.disablepage(); - }); - if($("webtronics_select"))Event.observe($('webtronics_select'), 'click', function() { - webtronics.circuit.clearinfo(); - webtronics.setMode('select', 'Selection'); - }); - if($("webtronics_wire"))Event.observe($('webtronics_wire'), 'click', function() { - webtronics.circuit.clearinfo(); - webtronics.setMode('line','Wire'); - }); - Event.observe($('webtronics_text'), 'click', function() { - webtronics.circuit.clearinfo(); - if($('webtronics_text').className=='pressed_button'){ - $('webtronics_text').className = 'normal_button'; - webtronics.setMode('select', 'Selection'); - } - else { - $('webtronics_text').className = 'pressed_button'; - webtronics.setMode('text', 'Text'); - } - - }); - if($('webtronics_undo')){ - Event.observe($('webtronics_undo'),'click',function(){ - webtronics.circuit.undo(); - - }); - } - if($('webtronics_redo')){ - Event.observe($('webtronics_redo'),'click',function(){ - webtronics.circuit.redo(); - }); - } - - Event.observe($('webtronics_delete'), 'click', function() { - webtronics.circuit.clearinfo(); - webtronics.circuit.addhistory(); - webtronics.circuit.deleteSelection(); - }); + +/*chipmaker*/ +$("webtronics_hor_pins").insert(Element("option",{"value":0}).update(0)); +for(var i=1;i<50;i++){ + if(i>3){ + $("webtronics_hor_pins").insert(Element("option",{"value":i}).update(i*2)); + } + $("webtronics_vert_pins").insert(Element("option",{"value":i}).update(i*2)); + +} + +/*menu events*/ + +Event.observe($('webtronics_file'), 'click', function() { + if($('webtronics_file_menu').style.display=='block'){ + $('webtronics_file_menu').style.display='none'; + } + else { + $('webtronics_file_menu').style.display='block'; + } +}); +Event.observe($('webtronics_chips_open'), 'click', function() { + webtronics.circuit.clearinfo(); + webtronics.setMode('select','Selection'); + chipmaker.openmaker(); + $('webtronics_chips_box').style.display = "block"; + webtronics.center($('webtronics_chips_box')); + webtronics.disablepage(); +}); +if($("webtronics_select"))Event.observe($('webtronics_select'), 'click', function() { + webtronics.circuit.clearinfo(); + webtronics.setMode('select', 'Selection'); +}); + if($("webtronics_wire"))Event.observe($('webtronics_wire'), 'click', function() { + webtronics.circuit.clearinfo(); + webtronics.setMode('line','Wire'); + }); + Event.observe($('webtronics_text'), 'click', function() { + webtronics.circuit.clearinfo(); + if($('webtronics_text').className=='pressed_button'){ + $('webtronics_text').className = 'normal_button'; + webtronics.setMode('select', 'Selection'); + } + else { + $('webtronics_text').className = 'pressed_button'; + webtronics.setMode('text', 'Text'); + } + + }); + if($('webtronics_undo')){ + Event.observe($('webtronics_undo'),'click',function(){ + webtronics.circuit.undo(); + + }); + } + if($('webtronics_redo')){ + Event.observe($('webtronics_redo'),'click',function(){ + webtronics.circuit.redo(); + }); + } + + Event.observe($('webtronics_delete'), 'click', function() { + webtronics.circuit.clearinfo(); + webtronics.circuit.addhistory(); + webtronics.circuit.deleteSelection(); + }); /* if($('webtronics_save')){ Event.observe($('webtronics_save'), 'click', function() { @@ -653,80 +1017,80 @@ console.log(exception); webtronics.showMarkup(); }); } -*/ + */ flag1=0; -jQuery("#analysis_selectbox").change(function(){ + jQuery("#analysis_selectbox").change(function(){ - analysis_type = jQuery(this).val(); + analysis_type = jQuery(this).val(); -}); + }); - if($('webtronics_netlist')){ - Event.observe($('webtronics_netlist'), 'click', function() { - if(flag1!=0){ - - netlistcreator.createnetlist(function(netlist){ - var content=$$("#webtronics_netlist_text_div > *") - for(var i=0;i *") + for(var i=0;i dumpv.txt \n" + "print alli > dumpi.txt \n" + ".endc \n"+ ".end \n" ); - - change_val = "1"; - console.log(jQuery("#analysis_selectbox").val()); - } - + ---------------------------------------------------------------------------------------------------------------------------------------------*/ + if (analysis_type == "1") + { + + console.log(jQuery("#analysis_selectbox").val()); + + jQuery("#webtronics_netlist_text_area").val(Flag + '\n'+ ".dc" + " " + source + " " + start + "e" + "-" + start_dc_unit + " " + stop + "e" + "-" + stop_dc_unit + " " + increment + "e" + "-" + increment_dc_unit + '\n' + '\n'+ ".control \n"+ "run \n"+ "print allv > dumpv.txt \n" + "print alli > dumpi.txt \n" + ".endc \n"+ ".end \n" ); + + change_val = "1"; + console.log(jQuery("#analysis_selectbox").val()); +} + /*------------------------------------------------------------------------------------------------------------------------------------------------ Here are the all AC Cases for generating final netlist values ------------------------------------------------------------------------------------------------------------------------------------------------*/ - else if (analysis_type == "2") - { - jQuery("#webtronics_netlist_text_area").val(Flag + '\n'+ ".ac" + " " + scale_val + " " + noofpoint + " " + startfreq + start_ac_unit + " " + stopfreq + stop_ac_unit + '\n' + '\n'+ ".control \n"+ "run \n"+ "print allv > dumpv.txt \n" + "print alli > dumpi.txt \n" + ".endc \n"+ ".end \n" ); +else if (analysis_type == "2") +{ + jQuery("#webtronics_netlist_text_area").val(Flag + '\n'+ ".ac" + " " + scale_val + " " + noofpoint + " " + startfreq + start_ac_unit + " " + stopfreq + stop_ac_unit + '\n' + '\n'+ ".control \n"+ "run \n"+ "print allv > dumpv.txt \n" + "print alli > dumpi.txt \n" + ".endc \n"+ ".end \n" ); - change_val = "1"; - } + change_val = "1"; +} /*------------------------------------------------------------------------------------------------------------------------------------------------ Here are the all Transiet Cases for generating final netlist values ------------------------------------------------------------------------------------------------------------------------------------------------*/ @@ -737,182 +1101,224 @@ Here are the all Transiet Cases for generating final netlist values change_val = "1"; } - + } else if( change_val == "1") - + { - - jQuery("#webtronics_netlist_text_area").val(""); + + jQuery("#webtronics_netlist_text_area").val(""); //console.log("if when 1") - - if (analysis_type == "1") - - { - - - jQuery("#webtronics_netlist_text_area").val(Flag + '\n'+ ".dc" + " " + source + " " + start + "e" + "-" + start_dc_unit + " " + stop + "e" + "-" + stop_dc_unit + " " + increment + "e" + "-" + increment_dc_unit + '\n' + '\n'+ ".control \n"+ "run \n"+ "print allv > dumpv.txt \n" + "print alli > dumpi.txt \n" + ".endc \n"+ ".end \n" ); - change_val = "1"; - } - - - else if (analysis_type == "2") - { - jQuery("#webtronics_netlist_text_area").val(Flag + '\n'+ ".ac" + " " + scale_val + " " + noofpoint + " " + startfreq + start_ac_unit + " " + stopfreq + stop_ac_unit + '\n' + '\n'+ ".control \n"+ "run \n"+ "print allv > dumpv.txt \n" + "print alli > dumpi.txt \n" + ".endc \n"+ ".end \n" ); + if (analysis_type == "1") - change_val = "1"; - } + { - else if (analysis_type == "3") - { - jQuery("#webtronics_netlist_text_area").val(Flag + '\n' + ".tran" + " " + step_trans + "e" + "-" + step_trans_unit + " " + stop_trans + "e"+ "-" + stop_trans_unit + " " + start_trans + "e" + "-" + start_trans_unit + '\n' + '\n'+ ".control \n"+ "run \n"+ "print allv > dumpv.txt \n" + "print alli > dumpi.txt \n" + ".endc \n" +".end \n" ); + jQuery("#webtronics_netlist_text_area").val(Flag + '\n'+ ".dc" + " " + source + " " + start + "e" + "-" + start_dc_unit + " " + stop + "e" + "-" + stop_dc_unit + " " + increment + "e" + "-" + increment_dc_unit + '\n' + '\n'+ ".control \n"+ "run \n"+ "print allv > dumpv.txt \n" + "print alli > dumpi.txt \n" + ".endc \n"+ ".end \n" ); + change_val = "1"; + } + + + + else if (analysis_type == "2") + { + jQuery("#webtronics_netlist_text_area").val(Flag + '\n'+ ".ac" + " " + scale_val + " " + noofpoint + " " + startfreq + start_ac_unit + " " + stopfreq + stop_ac_unit + '\n' + '\n'+ ".control \n"+ "run \n"+ "print allv > dumpv.txt \n" + "print alli > dumpi.txt \n" + ".endc \n"+ ".end \n" ); change_val = "1"; + } + + + else if (analysis_type == "3") + { + jQuery("#webtronics_netlist_text_area").val(Flag + '\n' + ".tran" + " " + step_trans + "e" + "-" + step_trans_unit + " " + stop_trans + "e"+ "-" + stop_trans_unit + " " + start_trans + "e" + "-" + start_trans_unit + '\n' + '\n'+ ".control \n"+ "run \n"+ "print allv > dumpv.txt \n" + "print alli > dumpi.txt \n" + ".endc \n" +".end \n" ); + + change_val = "1"; + } + + } - -} +} +else { + alert("Analysis information is not available !"); - } - else { - alert("Analysis information is not available !"); +} - } +}); +} - }); - } +jQuery("#webtronics_analysis").click(function(){ + flag1=1; + jQuery('#webtronics_netlist_analysis').show(); - jQuery("#webtronics_analysis").click(function(){ - flag1=1; - jQuery('#webtronics_netlist_analysis').show(); - - jQuery('#webtronics_disable').show(); + jQuery('#webtronics_disable').show(); - }); +}); - jQuery(".button_cancel").click(function(){ - flag1=0; - jQuery("#webtronics_netlist_analysis").hide(); - jQuery("#webtronics_disable").hide(); +jQuery(".button_cancel").click(function(){ + flag1=0; + jQuery("#webtronics_netlist_analysis").hide(); + jQuery("#webtronics_disable").hide(); - }); +}); - if($('webtronics_run')){ - Event.observe($('webtronics_run'), 'click', function() { +if($('webtronics_run')){ + Event.observe($('webtronics_run'), 'click', function() { // webtronics.postspice(webtronics.circuit.createnetlist()); netlistcreator.createnetlist(webtronics.gnucapjs); }); - - } - - if($('webtronics_invert')){ - - Event.observe($('webtronics_invert'),'click',function(){ - webtronics.circuit.invert($('webtronics_invert').checked); - - }); - } - if($('webtronics_graph')){ - Event.observe($('webtronics_graph'),'click',function(){ - if($('webtronics_graph').checked){ - webtronics.circuit.graph=true; - webtronics.circuit.showbackground(); - } - else{ - webtronics.circuit.graph=false; - webtronics.circuit.showbackground(); - } - }); - } - if($('webtronics_connections')){ - $('webtronics_connections').checked=false; - Event.observe($('webtronics_connections'),'click',function(){ - webtronics.circuit.showconnections($('webtronics_connections').checked); - - }); - } - if($("webtronics_showhelp")){ - Event.observe($("webtronics_showhelp"),"click",function(){ - if($("webtronics_showhelp").checked){ - $$(".webtronics_help").forEach(function(e){ - e.style.display="block"; - }); - } - else{ - $$(".webtronics_help").forEach(function(e){ - e.style.display="none"; - }); - } - }); - } - /*properties events*/ - - - if($('webtronics_properties_ok'))Event.observe($('webtronics_properties_ok'), 'click', function() { - $("webtronics_print_dir_field").style.display="none"; - $('webtronics_properties_div').style.display='none'; - webtronics.enablepage(); - var model=webtronics.circuit.selected[0]; - netlistcreator.writewtx(model,"id",$('webtronics_part_id').value); - netlistcreator.writewtx(model,"value",$('webtronics_part_value').value); - netlistcreator.writewtx(model,"model",$('webtronics_part_dir_value').value); - netlistcreator.writewtx(model,"measure",$('webtronics_print_dir_value').value); - - - - webtronics.circuit.createvalue(webtronics.circuit.selected[0]); - }); - - if($('webtronics_properties_cancel'))Event.observe($('webtronics_properties_cancel'), 'click', function() { - $("webtronics_print_dir_field").style.display="none"; - $('webtronics_properties_div').style.display='none'; - webtronics.enablepage(); - }); - - if($('webtronics_part_model'))Event.observe($('webtronics_part_model'),'change',function(){ - var part=netlistcreator.readwtx(webtronics.circuit.selected[0],"name"); - var cat=netlistcreator.readwtx(webtronics.circuit.selected[0],"category"); - if($('webtronics_part_model').value){ - $("webtronics_part_dir_model").options.length=0; - $("webtronics_part_dir_model").appendChild(new Element("option",{"value":""}).update("none")); - for( var i=0;ibpart); - }; - V.sort(sortfunction); - wire.sort(sortfunction); - B.sort(sortfunction); - C.sort(sortfunction); - D.sort(sortfunction); - I.sort(sortfunction); - J.sort(sortfunction); - K.sort(sortfunction); - L.sort(sortfunction); - M.sort(sortfunction); - N.sort(sortfunction); - P.sort(sortfunction); - Q.sort(sortfunction); - R.sort(sortfunction); - U.sort(sortfunction); - A.sort(sortfunction); - - var newlist=[]; - G.each(function(item){newlist.push(item)}); - G.reverse(); - V.each(function(item){newlist.push(item)}); - wire.each(function(item){newlist.push(item)}); - B.each(function(item){newlist.push(item)}); - C.each(function(item){newlist.push(item)}); - D.each(function(item){newlist.push(item)}); - I.each(function(item){newlist.push(item)}); - J.each(function(item){newlist.push(item)}); - K.each(function(item){newlist.push(item)}); - L.each(function(item){newlist.push(item)}); - M.each(function(item){newlist.push(item)}); - N.each(function(item){newlist.push(item)}); - Q.each(function(item){newlist.push(item)}); - R.each(function(item){newlist.push(item)}); - U.each(function(item){newlist.push(item)}); - A.each(function(item){newlist.push(item)}); - other.each(function(item){newlist.push(item)}); - - /*plots go last*/ - P.each(function(item){newlist.push(item)}); - return newlist; -}, -/* draws wires to namewire ports with the same id*/ -connectnamewires:function(list){ - - for(var i=0;ibpart); + }; + V.sort(sortfunction); + wire.sort(sortfunction); + B.sort(sortfunction); + C.sort(sortfunction); + D.sort(sortfunction); + I.sort(sortfunction); + J.sort(sortfunction); + K.sort(sortfunction); + L.sort(sortfunction); + M.sort(sortfunction); + N.sort(sortfunction); + P.sort(sortfunction); + Q.sort(sortfunction); + R.sort(sortfunction); + U.sort(sortfunction); + A.sort(sortfunction); + + var newlist=[]; + G.each(function(item){newlist.push(item)}); + G.reverse(); + V.each(function(item){newlist.push(item)}); + wire.each(function(item){newlist.push(item)}); + B.each(function(item){newlist.push(item)}); + C.each(function(item){newlist.push(item)}); + D.each(function(item){newlist.push(item)}); + I.each(function(item){newlist.push(item)}); + J.each(function(item){newlist.push(item)}); + K.each(function(item){newlist.push(item)}); + L.each(function(item){newlist.push(item)}); + M.each(function(item){newlist.push(item)}); + N.each(function(item){newlist.push(item)}); + Q.each(function(item){newlist.push(item)}); + R.each(function(item){newlist.push(item)}); + U.each(function(item){newlist.push(item)}); + A.each(function(item){newlist.push(item)}); + other.each(function(item){newlist.push(item)}); + + /*plots go last*/ + P.each(function(item){newlist.push(item)}); + + + return newlist; + }, + + /* draws wires to namewire ports with the same id*/ + connectnamewires:function(list){ + + for(var i=0;i b.name)return 1;if (a.name < b.name)return -1;return 0;}); - } + } catch(e){console.log("no analog pins found");} try{ var category=webtronics.circuit.getwtxtagname(parts[i],"digital")[0]; var nodes = webtronics.circuit.getwtxtagname(category,"node"); for(var j=0;j b.name)return 1;if (a.name < b.name)return -1;return 0;}); + var point = this.matrixxform( {x:webtronics.circuit.getwtxattribute(nodes[j],"x"),y:webtronics.circuit.getwtxattribute(nodes[j],"y")},webtronics.circuit.parseMatrix(part.elem)); + part.digitalpins.push({index:webtronics.circuit.getwtxattribute(nodes[j],"index"),x:point.x,y:point.y,node:undefined}) ; + } + part.digitalpins.sort(function(a,b){if (a.name > b.name)return 1;if (a.name < b.name)return -1;return 0;}); + } + catch(e){console.log("no digital pins found");} + try{ + part.id=this.readwtx(parts[i],'id'); + if(part.type=="gnd"){part.id=part.type;this.writewtx(parts[i],'id',part.id);console.log(this.readwtx(parts[i],'id')+" sfd ");} + } + catch(e){part.error="wtx:id not found";} + try{ + part.type=this.readwtx(parts[i],'type'); + } + catch(e){ + part.error="wtx:type not found"; + } + try{ + part.name=this.readwtx(parts[i],'name'); + } + catch(e){part.error="wtx:name not found";} + try{ + part.category=this.readwtx(parts[i],'category'); + } + catch(e){part.error="wtx:category not found";} + try{ + part.value=this.readwtx(parts[i],'value'); + + } + catch(e){part.error="wtx:value not found";} + try{ + part.spice=this.readwtx(parts[i],'spice'); + } + catch(e){part.error="wtx:spice not found";} + try{ + part.model=this.readwtx(parts[i],'model'); + } + catch(e){part.error="wtx:model not found";} + //for ac voltage source + try{ + part.amplitude=this.readwtx(parts[i],'amplitude'); + + } - catch(e){console.log("no digital pins found");} - try{ - part.id=this.readwtx(parts[i],'id'); + + catch(e){part.error="wtx:amplitude not found";} + try{ + part.phase=this.readwtx(parts[i],'phase'); } - catch(e){part.error="wtx:id not found";} - try{ - part.type=this.readwtx(parts[i],'type'); + catch(e){part.error="wtx:phase not found";} + + //for sinusoidal voltage source + + try{ + part.offsetvoltage=this.readwtx(parts[i],'offsetvoltage'); } - catch(e){ - part.error="wtx:type not found"; + catch(e){part.error="wtx:offsetvoltage not found";} + + try{ + part.voltageamplitude=this.readwtx(parts[i],'voltageamplitude'); } - try{ - part.name=this.readwtx(parts[i],'name'); + catch(e){part.error="wtx:voltageamplitude not found";} + try{ + part.frequency=this.readwtx(parts[i],'frequency'); } - catch(e){part.error="wtx:name not found";} - try{ - part.category=this.readwtx(parts[i],'category'); + catch(e){part.error="wtx:frequency not found";} + try{ + part.delaytime=this.readwtx(parts[i],'delaytime'); } - catch(e){part.error="wtx:category not found";} - try{ - part.value=this.readwtx(parts[i],'value'); + catch(e){part.error="wtx:delaytime not found";} + try{ + part.dampingfactor=this.readwtx(parts[i],'dampingfactor'); } - catch(e){part.error="wtx:value not found";} - try{ - part.spice=this.readwtx(parts[i],'spice'); + catch(e){part.error="wtx:dampingfactor not found";} + + // FOR pulse volatge source + try{ + part.pulval1=this.readwtx(parts[i],'pulval1'); + } + catch(e){part.error="wtx:Initial Value not found";} + + try{ + part.pulval2=this.readwtx(parts[i],'pulval2'); + } + catch(e){part.error="wtx:Pulse Value not found";} + try{ + part.pulval3=this.readwtx(parts[i],'pulval3'); + } + catch(e){part.error="wtx:Delay Time not found";} + try{ + part.pulval4=this.readwtx(parts[i],'pulval4'); + } + catch(e){part.error="wtx:Rise Time not found";} + + try{ + part.pulval5=this.readwtx(parts[i],'pulval5'); + } + catch(e){part.error="wtx:Fall Time not found";} + try{ + part.pulval6=this.readwtx(parts[i],'pulval6'); + } + catch(e){part.error="wtx:Pulse Period not found";} + try{ + part.pulval7=this.readwtx(parts[i],'pulval7'); + } + catch(e){part.error="wtx:Pulse Width not found";} + + //FOR pwl volatge source + try{ + part.pwlval1=this.readwtx(parts[i],'pwlval1'); + } + catch(e){part.error="wtx:Time T1 Value not found";} + + try{ + part.pwlval2=this.readwtx(parts[i],'pwlval2'); + } + catch(e){part.error="wtx:Voltage V1 Value not found";} + try{ + part.pwlval3=this.readwtx(parts[i],'pwlval3'); + } + catch(e){part.error="wtx:Time T2 Value not found";} + try{ + part.pwlval4=this.readwtx(parts[i],'pwlval4'); + } + catch(e){part.error="wtx:Voltage V2 value not found";} + + try{ + part.pwlval5=this.readwtx(parts[i],'pwlval5'); + } + catch(e){part.error="wtx:Time T3 value not found";} + try{ + part.pwlval6=this.readwtx(parts[i],'pwlval6'); + } + catch(e){part.error="wtx:Voltage V3 value not found";} + try{ + part.pwlval7=this.readwtx(parts[i],'pwlval7'); } - catch(e){part.error="wtx:spice not found";} + catch(e){part.error="wtx:Time T4 Value not found";} try{ - part.model=this.readwtx(parts[i],'model'); + part.pwlval8=this.readwtx(parts[i],'pwlval8'); } - catch(e){part.error="wtx:model not found";} + catch(e){part.error="wtx:Voltage V4 Value not found";} + +//FOR exponential volatge source +try{ + part.eval1=this.readwtx(parts[i],'eval1'); +} +catch(e){part.error="wtx:Initial Value not found";} + +try{ + part.eval2=this.readwtx(parts[i],'eval2'); +} +catch(e){part.error="wtx:Pulse Value not found";} +try{ + part.eval3=this.readwtx(parts[i],'eval3'); +} +catch(e){part.error="wtx:Rise Time Delay value not found";} +try{ + part.eval4=this.readwtx(parts[i],'eval4'); +} +catch(e){part.error="wtx:Rise Time Constant value not found";} + +try{ + part.eval5=this.readwtx(parts[i],'eval5'); +} +catch(e){part.error="wtx:Fall Time Delay value not found";} +try{ + part.eval6=this.readwtx(parts[i],'eval6'); +} +catch(e){part.error="wtx:Fall Time Constan value not found";} + //special tag for parts that do simulation try{ part.measure=this.readwtx(parts[i],'measure'); } catch(e){} - + list.push(part); } return list; @@ -269,7 +409,7 @@ getwtxdata:function(parts){ }, /*detect analog and digital mix*/ mixedsignals:function(analogwires,digitalwires){ - + for(var j=1;j-1){ @@ -284,13 +424,13 @@ getconnected:function(wirelist,wire){ for(var i=0;i g'); - + if(parts.length<1){ responsefunc("no parts found \n"); return; } - + var partswtx=this.sortnetlist(this.getwtxdata(parts)); - + if(partswtx[0].type.toLowerCase()!='gnd'){ responsefunc('no ground node'); @@ -456,101 +599,119 @@ createnetlist:function(responsefunc){ var command=""; for(var i=0;i b.index? 1:a.index < b.index?-1:0;}) + pins.sort(function(a,b){return a.index > b.index? 1:a.index < b.index?-1:0;}) // console.log(pins); - for(var j=0;j .webtronics_namewire_connector') +for(var i=0;i .webtronics_namewire_connector') - for(var i=0;i - - + + + + + + + - + @@ -14,19 +18,21 @@ ac power + + - - - - - -+ -_ + + + + + + + diff --git a/views/webtronix_server/power/current.svg b/views/webtronix_server/power/current.svg index d81b3a4..9cd318d 100644 --- a/views/webtronix_server/power/current.svg +++ b/views/webtronix_server/power/current.svg @@ -12,7 +12,7 @@ i i current - test + power diff --git a/views/webtronix_server/power/exponential.svg b/views/webtronix_server/power/exponential.svg new file mode 100644 index 0000000..b9fb80d --- /dev/null +++ b/views/webtronix_server/power/exponential.svg @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + e + v + exponential + power + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/views/webtronix_server/power/pulse.svg b/views/webtronix_server/power/pulse.svg new file mode 100644 index 0000000..3834374 --- /dev/null +++ b/views/webtronix_server/power/pulse.svg @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + p + v + pulse + power + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/views/webtronix_server/power/pwl.svg b/views/webtronix_server/power/pwl.svg new file mode 100644 index 0000000..ec3603a --- /dev/null +++ b/views/webtronix_server/power/pwl.svg @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + w + v + pwl + power + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/views/webtronix_server/power/sinvoltagesource.svg b/views/webtronix_server/power/sinvoltagesource.svg new file mode 100644 index 0000000..c381378 --- /dev/null +++ b/views/webtronix_server/power/sinvoltagesource.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + s + v + sinvoltagesource + power + + + + + + + + + + + + + + + + + + + ++ +_ + + + diff --git a/views/webtronix_server/spice/1N34A.lib b/views/webtronix_server/spice/1N34A.lib new file mode 100644 index 0000000..e0d0ac6 --- /dev/null +++ b/views/webtronix_server/spice/1N34A.lib @@ -0,0 +1,3 @@ + +.MODEL 1N34A D(bv=75 cjo=0.5e-12 eg=0.67 ibv=18e-3 ++ is=2e-7 rs=7 n=1.3 vj=0.1 m=0.27 ) diff --git a/views/webtronix_server/spice/1N5711.lib b/views/webtronix_server/spice/1N5711.lib new file mode 100644 index 0000000..7892200 --- /dev/null +++ b/views/webtronix_server/spice/1N5711.lib @@ -0,0 +1,4 @@ + +.MODEL 1N5711 D (IS=5.5987E-9 N=1.0023 RS=30.053 IKF=19.036 CJO=1.7605E-12 ++ M=.20029 VJ=.3905 ISR=24.229E-9 NR=4.1695 FC=0.5 TT=0 XTI=2) + diff --git a/views/webtronix_server/spice/1n4007.lib b/views/webtronix_server/spice/1n4007.lib new file mode 100644 index 0000000..0e9e31e --- /dev/null +++ b/views/webtronix_server/spice/1n4007.lib @@ -0,0 +1,5 @@ + +.model 1n4007 D(IS=3.872n RS=1.66E-02 N=1.776 XTI=3.0 EG=1.110 ++ CJO=1.519E-11 M=0.3554 VJ=0.5928 FC=0.5 ISR=1.356E-09 ++ NR=2.152 BV=1000.0 IBV=1.0E-03 Tt=4u) + diff --git a/views/webtronix_server/spice/1n4148.lib b/views/webtronix_server/spice/1n4148.lib new file mode 100644 index 0000000..27cf411 --- /dev/null +++ b/views/webtronix_server/spice/1n4148.lib @@ -0,0 +1,4 @@ + +.model 1n4148 D(Is=5.84n N=1.94 Rs=.7017 Ikf=44.17m Xti=3 Eg=1.11 Cjo=.95p ++ M=.55 Vj=.75 Fc=.5 Isr=11.07n Nr=2.088 Bv=100 Ibv=100u Tt=11.07n) + -- cgit