From 05936ff17159602918fa196c833fa2dda2ec7818 Mon Sep 17 00:00:00 2001 From: amritaH Date: Mon, 6 Jun 2016 17:12:14 +0530 Subject: digital model properties added --- views/schematic.html | 9 + views/script/gui.js | 17 +- views/script/gui.js~ | 1526 ++++++++++++++++++++++++++++++++++++++++++++ views/script/netlist.js | 9 +- views/script/netlist.js~ | 839 ++++++++++++++++++++++++ views/style/schematic.css | 3 +- views/style/schematic.css~ | 439 +++++++++++++ 7 files changed, 2834 insertions(+), 8 deletions(-) create mode 100644 views/script/gui.js~ create mode 100644 views/script/netlist.js~ create mode 100644 views/style/schematic.css~ diff --git a/views/schematic.html b/views/schematic.html index e24ea83..cec04a8 100644 --- a/views/schematic.html +++ b/views/schematic.html @@ -446,6 +446,15 @@ properties form + +
+ + Input Load: + + +
+ + diff --git a/views/script/gui.js b/views/script/gui.js index 74c2bab..2493245 100644 --- a/views/script/gui.js +++ b/views/script/gui.js @@ -6,7 +6,7 @@ globalVariable=0; var webtronics={ - circuit:nul + circuit:null, copy:null, rightclickmenu:null, title:null, @@ -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: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:risedelay|wtx:falldelay|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:risedelay|wtx:inputload|wtx:falldelay|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"], @@ -130,7 +130,9 @@ returnchip:function(){ openProperties:function(){ document.forms['webtronics_properties_form'].reset(); var c=netlistcreator.readwtx(this.circuit.selected[0],"name"); - + $("webtronics_risedelay").style.display='none'; + $("webtronics_falldelay").style.display='none'; + $("webtronics_inputload").style.display='none'; if(!c){ netlistcreator.writewtx(this.circuit.selected[0],"name","ic"); } @@ -514,10 +516,16 @@ openProperties:function(){ if(c=='and'|| c=='not'|| c=='nand'|| c=='or'||c=='nor'||c=='xor'||c=='xnor') { + + $("webtronics_risedelay").style.display='block'; + $("webtronics_falldelay").style.display='block'; + $("webtronics_inputload").style.display='block'; var risedelay = netlistcreator.readwtx(this.circuit.selected[0],"risedelay"); if(risedelay!=""){$(webtronics_part_risedelay).value=risedelay;} var falldelay = netlistcreator.readwtx(this.circuit.selected[0],"falldelay"); if(falldelay!=""){$(webtronics_part_falldelay).value=falldelay;} + var inputload = netlistcreator.readwtx(this.circuit.selected[0],"inputload"); + if(inputload!=""){$(webtronics_part_inputload).value=inputload;} } @@ -1299,9 +1307,10 @@ if($('webtronics_properties_ok'))Event.observe($('webtronics_properties_ok'), 'c netlistcreator.writewtx(model,"eval6",$('webtronics_eval6_value').value); } - else if(modelname=="and"|| c=='not'|| c=='nand'|| c=='or'||c=='nor'||c=='xor'||c=='xnor')){ + else if(modelname=="and"|| c=='not'|| c=='nand'|| c=='or'||c=='nor'||c=='xor'||c=='xnor'){ netlistcreator.writewtx(model,"risedelay",$('webtronics_risedelay_value').value); netlistcreator.writewtx(model,"falldelay",$('webtronics_falldelay_value').value); + netlistcreator.writewtx(model,"inputload",$('webtronics_inputload_value').value); } webtronics.circuit.createvalue(webtronics.circuit.selected[0]); diff --git a/views/script/gui.js~ b/views/script/gui.js~ new file mode 100644 index 0000000..2493245 --- /dev/null +++ b/views/script/gui.js~ @@ -0,0 +1,1526 @@ + + + + +globalVariable=0; + + +var webtronics={ + circuit:null, + copy:null, + rightclickmenu:null, + title:null, + description:null, + file_id:null, + scopestatus:null, + scopedata:null, + + tabs:[], + mode:'', + + 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: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:risedelay|wtx:inputload|wtx:falldelay|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"], + partslists:[], + models:{}, + docfromtext:function(txt){ + var xmlDoc; + if (window.DOMParser){ + parser=new DOMParser(); + xmlDoc=parser.parseFromString(txt,"text/xml"); + + } + else{ // Internet Explorer + xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); + xmlDoc.async="false"; + xmlDoc.loadXML(txt); + } + return xmlDoc; + }, + + + setsize:function(){ + var buffer=30; + 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'; + $('webtronics_diagram_area').style.width = realwidth-buffer+'px'; + $('webtronics_diagram_area').style.height = realheight-buffer+'px'; + frames=$$('#webtronics_diagram_area>iframe') + if(frames[0])frames[0].width = realwidth-buffer+'px'; + $('webtronics_side_bar').style.height=realheight-buffer+'px'; + }, + + + + setMode:function(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'; + } + 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;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(); + }); +/* + if($('webtronics_save')){ + Event.observe($('webtronics_save'), 'click', function() { + webtronics.circuit.clearinfo(); + webtronics.showMarkup(); + }); + } + */ + + flag1=0; + + + + jQuery("#analysis_selectbox").change(function(){ + + 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 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" ); + + change_val = "1"; +} +/*------------------------------------------------------------------------------------------------------------------------------------------------ +Here are the all Transiet Cases for generating final netlist values +------------------------------------------------------------------------------------------------------------------------------------------------*/ + //else if (analysis_type == "3" && time == "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 if( change_val == "1") + +{ + + 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" ); + + 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 !"); + + +} + + + + +}); +} + + + + + +jQuery("#webtronics_analysis").click(function(){ + flag1=1; + jQuery('#webtronics_netlist_analysis').show(); + + jQuery('#webtronics_disable').show(); + + + +}); + +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() { + // 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); + + var modelname=netlistcreator.readwtx(model,"name"); + + if(modelname=="ac"){ + netlistcreator.writewtx(model,"phase",$('webtronics_phase_value').value); + netlistcreator.writewtx(model,"amplitude",$('webtronics_amplitude_value').value); + + } + else if(modelname=="sinvoltagesource"){ + netlistcreator.writewtx(model,"offsetvoltage",$('webtronics_offsetvoltage_value').value); + netlistcreator.writewtx(model,"voltageamplitude",$('webtronics_voltageamplitude_value').value); + netlistcreator.writewtx(model,"frequency",$('webtronics_frequency_value').value); + netlistcreator.writewtx(model,"delaytime",$('webtronics_delaytime_value').value); + netlistcreator.writewtx(model,"dampingfactor",$('webtronics_dampingfactor_value').value); + + } + else if(modelname=="pulse"){ + netlistcreator.writewtx(model,"pulval1",$('webtronics_pulval1_value').value); + netlistcreator.writewtx(model,"pulval2",$('webtronics_pulval2_value').value); + netlistcreator.writewtx(model,"pulval3",$('webtronics_pulval3_value').value); + netlistcreator.writewtx(model,"pulval4",$('webtronics_pulval4_value').value); + netlistcreator.writewtx(model,"pulval5",$('webtronics_pulval5_value').value); + netlistcreator.writewtx(model,"pulval6",$('webtronics_pulval6_value').value); + netlistcreator.writewtx(model,"pulval7",$('webtronics_pulval7_value').value); + } + else if(modelname=="pwl"){ + netlistcreator.writewtx(model,"pwlval1",$('webtronics_pwlval1_value').value); + netlistcreator.writewtx(model,"pwlval2",$('webtronics_pwlval2_value').value); + netlistcreator.writewtx(model,"pwlval3",$('webtronics_pwlval3_value').value); + netlistcreator.writewtx(model,"pwlval4",$('webtronics_pwlval4_value').value); + netlistcreator.writewtx(model,"pwlval5",$('webtronics_pwlval5_value').value); + netlistcreator.writewtx(model,"pwlval6",$('webtronics_pwlval6_value').value); + netlistcreator.writewtx(model,"pwlval7",$('webtronics_pwlval7_value').value); + netlistcreator.writewtx(model,"pwlval8",$('webtronics_pwlval8_value').value); + } + else if(modelname=="exponential"){ + netlistcreator.writewtx(model,"eval1",$('webtronics_eval1_value').value); + netlistcreator.writewtx(model,"eval2",$('webtronics_eval2_value').value); + netlistcreator.writewtx(model,"eval3",$('webtronics_eval3_value').value); + netlistcreator.writewtx(model,"eval4",$('webtronics_eval4_value').value); + netlistcreator.writewtx(model,"eval5",$('webtronics_eval5_value').value); + netlistcreator.writewtx(model,"eval6",$('webtronics_eval6_value').value); + } + + else if(modelname=="and"|| c=='not'|| c=='nand'|| c=='or'||c=='nor'||c=='xor'||c=='xnor'){ + netlistcreator.writewtx(model,"risedelay",$('webtronics_risedelay_value').value); + netlistcreator.writewtx(model,"falldelay",$('webtronics_falldelay_value').value); + netlistcreator.writewtx(model,"inputload",$('webtronics_inputload_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;i + * + * + * + * + * + * r + * r + * testresistor + * resistors + * + * + * + * + * + */ + + + getwtxdata:function(parts){ + 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;}); + } + 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){part.error="wtx:amplitude not found";} + try{ + part.phase=this.readwtx(parts[i],'phase'); + } + 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:offsetvoltage not found";} + + try{ + part.voltageamplitude=this.readwtx(parts[i],'voltageamplitude'); + } + catch(e){part.error="wtx:voltageamplitude not found";} + try{ + part.frequency=this.readwtx(parts[i],'frequency'); + } + catch(e){part.error="wtx:frequency not found";} + try{ + part.delaytime=this.readwtx(parts[i],'delaytime'); + } + catch(e){part.error="wtx:delaytime not found";} + try{ + part.dampingfactor=this.readwtx(parts[i],'dampingfactor'); + } + 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:Time T4 Value not found";} + try{ + part.pwlval8=this.readwtx(parts[i],'pwlval8'); + } + 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";} + +//digital and + try{ + part.risedelay=this.readwtx(parts[i],'risedelay'); + } +catch(e){ + part.error="wtx:risedelay not found";} + +try{ + part.falldelay=this.readwtx(parts[i],'falldelay'); + } +catch(e){ + part.error="wtx:risedelay not found";} + +try{ + part.inputload=this.readwtx(parts[i],'inputload'); + } +catch(e){ + part.error="wtx:inputload not found";} + + + //special tag for parts that do simulation + try{ + part.measure=this.readwtx(parts[i],'measure'); + } + catch(e){} + + list.push(part); + } + return list; + +}, +/*detect analog and digital mix*/ +mixedsignals:function(analogwires,digitalwires){ + + for(var j=1;j-1){ + return true; + } + } + return false; +}, + +/* test if wires are connected anywhere*/ +getconnected:function(wirelist,wire){ + for(var i=0;i line, #information > .webtronics_namewire_connector'); + 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'); + return; + } + this.connectnamewires(partswtx); + + var spice="*ngspice netlist * \n"; + var sections=this.getnodes(partswtx); + + //dump models into spice + + if(sections.netlist.length){ + var command=""; + for(var i=0;i b.index? 1:a.index < b.index?-1:0;}) +// console.log(pins); +for(var j=0;j .webtronics_namewire_connector') +for(var i=0;ip:hover{ + background-color:#ffffff; + +} + + +div#webtronics_main_window{ + + font-family:verdana,arial; + font-size:10pt; + height:100%; + background-color:#e7e7e7; + border:2px solid #e7e7e7; + +} + +#webtronics_diagram_area>iframe{ + position:absolute; + overflow:hidden; + height:100%; + width:100%; + background-color:#e7e7e7; + border-width: 0px; + margin: 0px; + padding: 0px; + -moz-user-select:none; + -webkit-user-select:none; + -ms-user-select:none; +} + +/*list menu */ +div#webtronics_center{ + position:relative; + overflow:hidden; + background-color:inherit; + border:2px solid #000000; +} +/* tabs */ +div#webtronics_tab_area{ + position:relative; + float:left; + height: 32px; + background-color: #e7e7e7; +} + + +div.webtronics_tab{ + position:relative; + float:left; + overflow:hidden; + height:30px; + border-style:solid; + border-width:2px; + border-color:black; + border-top-left-radius:6px; + border-top-right-radius:6px; + background-color:#bfbfbf; + +} +div.webtronics_selected_tab{ + position:relative; + float:left; + overflow:hidden; + height:30px; + border-style:solid; + border-width:2px; + border-color:black; + border-top-left-radius:6px; + border-top-right-radius:6px; + background-color:inherit; + +} + +div#webtronics_new_tab{ + position:relative; + float:left; + height:30px; + border-style:solid; + border-width:2px; + border-color:black; + border-radius:6px; + background-color:#bfbfbf; +} + +div.webtronics_close_tab{ + position:relative; + float:right; + border-style:solid; + border-width:2px; + border-color:black; + border-radius:6px; + background-color:#bfbfbf; +} + +div#webtronics_side_bar{ + position:relative; + float:left; + width: 132px; + overflow: hidden; + border-style:solid; + border-width:2px; + border-color:black; +} + +div#webtronics_parts_list{ + position:relative; + left:0; + top:0; + width:132px; + display:block; + height:auto; + overflow:auto; +} + +div#webtronics_parts_list p{ + cursor:pointer; +} + + + +div#webtronics_parts_list>div div{ + display:none; + background-color:#ffffff; + cursor:pointer; +} + +div#webtronics_parts_list>div{ + background-color:#cfcfcf; + border-style:solid; + border-width:2px; + border-color:black; +} + +div#webtronics_parts_list>div>p:hover{ + background-color:#ffffff; +} + +div#webtronics_parts_list *{ + margin:0px; + -moz-user-select:none; + -webkit-user-select:none; + -ms-user-select:none; +} + + + +fieldset { + float:left; + margin-left:12px; + padding:0px; +} + + + +div#webtronics_toolbar{ + height:60px; + width:100%; + border-style:solid; + border-width:2px; + border-color:#000000; + overflow:hidden; + -moz-user-select:none; + -webkit-user-select:none; + -ms-user-select:none; + } + + + +/*popups*/ +div.modal{ + display:none; + position:absolute; + left:200px; + top:10px; + border-style: solid; + border-radius:20px; + background-color:inherit; + padding: 5px; +} +div.modal>*{ + float:left; +} +#webtronics_properties_buttons{ + clear:left; +} + +#webtronics_netlist_buttons{ + clear:left; +} + + +.webtronics_help{ + float:right; + border-style: solid; + border-color:#000000; + background-color:#000000; + color:#ffffff; + padding: 5px; + display:none; +} + + +#webtronics_chips_box>*{ +float:left; +} + +#webtronics_netlist_text>*{ +float:left; +} +#webtronics_netlist_text_div{ + overflow:hide; +} + +#webtronics_image{ + width:340px; + height:360px; + border:1px solid black; + background-color:#e7e7e7; + overflow:hide; +} +/*display areas*/ + + + +#webtronics_image_div{ + width:100%; + height:80%; + border:1px solid black; + background-color:#e7e7e7; + overflow:auto; +} +#webtronics_image_div>img{ + max-width:300px; + max-height:280px; + width:auto; + height:auto; +} + +#webtronics_diagram_area { + position:relative; + float:left; + overflow:hidden; + cursor:crosshair; + border:1px solid black; + background-color:#e7e7e7; + -moz-user-select:none; + -webkit-user-select:none; + -ms-user-select:none; + +} + +#webtronics_part_display{ + width:126px; + height:130px; + background-color:#ffffff; + border:2px solid black; + -moz-user-select:none; + -webkit-user-select:none; + -ms-user-select:none; + +} + + + +#webtronics_chip_display{ + width:200px; + height:200px; + border:1px solid black; + background-color:#ffffff; + overflow: auto; + } + +#webtronics_print_dir_field{ + display:none; + clear:right; +} + +div#webtronics_footer{ + float:left; + width:100%; + height:auto ; + background-color:inherit; + -moz-user-select:none; + -webkit-user-select:none; + -ms-user-select:none; +} +div#webtronics_disable{ + display:none; + position:absolute; + left:0; + top:0; + width:100%; + height:100%; + background: rgba(45,45,45,0.5) url(web.png) no-repeat; + background-size: 100% 100%; + -moz-user-select:none; + -webkit-user-select:none; + -ms-user-select:none; +} +div#webtronics_open_file{ + display:none; + overflow:hidden; + position:absolute; + left:200px; + top:10px; + border-style: none; + background-color:inherit; + padding: none; + } + +div#webtronics_open_file_selector{ + font-size:30pt; +} +/*menu style*/ + +div#webtronics_context_menu{ + display:none; + z-index:100; + position:absolute; + top:0; + left:0; + background-color:inherit; +} + +div#webtronics_context_menu .enabled,div#webtronics_file_menu .enabled{ + color:#000000; +} + +div#webtronics_context_menu .disabled,div#webtronics_file_menu .disabled{ + color:#bfbfbf; +} + +div#webtronics_context_menu .enabled:hover,div#webtronics_file_menu .enabled:hover{ + background-color:#bfbfbf; + color:#ffffff; +} + +#webtronics_scope_display>*{ + float:left; +} + +div#webtronics_scope_display_div{ + overflow:hidden; + width:480px; + height:360px; +} +#webtronics_scope_display_frame{ + overflow:hidden; + width:480px; + height:360px; + border-color:#000000; + border-width: 2px; +} + +div#webtronics_scope_display{ + width:540px; + height:auto; + overflow: hide; +} +div#webtronics_scope_status_bar{ + float:left; + width:100%; + height:auto ; + background-color:inherit; + -moz-user-select:none; + -webkit-user-select:none; + -ms-user-select:none; +} + + +#webtronics_risedelay{ + display:none; +} + +#webtronics_falldelay{ + display:none; +} + +#webtronics_inputload{ + display:none; +} + + + + -- cgit