diff options
author | Abhishek Patel | 2016-06-03 12:27:47 +0530 |
---|---|---|
committer | Abhishek Patel | 2016-06-03 12:27:47 +0530 |
commit | 9fa336d9b103b8522a3c3d3880a92ead2ecd7945 (patch) | |
tree | a768bd218012e05470192c266df6066dbb810421 | |
parent | a2562ae6883ed5ac824794df6b8bb3d63e834e8f (diff) | |
download | eSimWebApp-9fa336d9b103b8522a3c3d3880a92ead2ecd7945.tar.gz eSimWebApp-9fa336d9b103b8522a3c3d3880a92ead2ecd7945.tar.bz2 eSimWebApp-9fa336d9b103b8522a3c3d3880a92ead2ecd7945.zip |
power,test,diodes updated,footer added
-rw-r--r-- | views/icons/images.jpeg | bin | 0 -> 1131 bytes | |||
-rw-r--r-- | views/schematic.html | 995 | ||||
-rw-r--r-- | views/schematic1.html | 843 | ||||
-rw-r--r-- | views/script/gui.js | 1905 | ||||
-rw-r--r-- | views/script/netlist.js | 931 | ||||
-rw-r--r-- | views/script/savenetlist.js | 8 | ||||
-rw-r--r-- | views/script/schematic.js | 4 | ||||
-rw-r--r-- | views/style/schematic.css | 2 | ||||
-rw-r--r-- | views/webtronix_server/parts.json | 69 | ||||
-rw-r--r-- | views/webtronix_server/power/ac.svg | 28 | ||||
-rw-r--r-- | views/webtronix_server/power/current.svg | 2 | ||||
-rw-r--r-- | views/webtronix_server/power/exponential.svg | 58 | ||||
-rw-r--r-- | views/webtronix_server/power/pulse.svg | 60 | ||||
-rw-r--r-- | views/webtronix_server/power/pwl.svg | 68 | ||||
-rw-r--r-- | views/webtronix_server/power/sinvoltagesource.svg | 39 | ||||
-rw-r--r-- | views/webtronix_server/spice/1N34A.lib | 3 | ||||
-rw-r--r-- | views/webtronix_server/spice/1N5711.lib | 4 | ||||
-rw-r--r-- | views/webtronix_server/spice/1n4007.lib | 5 | ||||
-rw-r--r-- | views/webtronix_server/spice/1n4148.lib | 4 |
19 files changed, 3482 insertions, 1546 deletions
diff --git a/views/icons/images.jpeg b/views/icons/images.jpeg Binary files differnew file mode 100644 index 0000000..7cff199 --- /dev/null +++ b/views/icons/images.jpeg 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 @@ <!DOCTYPE html> <html> <head> -<meta charset="UTF-8"> -<title>eSim</title> -<link rel="shortcut icon" href="../icons/favicon.ico" /> -<meta charset="UTF-8"> -<link rel="stylesheet" href="style/schematic.css" type="text/css"> -<link rel="stylesheet" href="style/input.css" type="text/css"> -<script type="text/javascript" src="script/jquery-1.10.2.js"></script> -<script type="text/javascript" src="script/utils.js"></script> -<script type="text/javascript" src="script/prototype.js"></script> -<script type="text/javascript" src="script/chipmaker.js"></script> -<script type="text/javascript" src="script/wtx2kicad.js"></script> -<script type="text/javascript" src="script/gui.js"></script> -<script type="text/javascript" src="script/netlist.js"></script> -<script type="text/javascript" src="script/canvg.js"></script> -<script type="text/javascript" src="script/rgbcolor.js"></script> -<script type="text/javascript" src="script/savenetlist.js"></script> + <meta charset="UTF-8"> + <title>eSim</title> + <link rel="shortcut icon" href="../icons/favicon.ico" /> + <meta charset="UTF-8"> + <link rel="stylesheet" href="style/schematic.css" type="text/css"> + <link rel="stylesheet" href="style/input.css" type="text/css"> + <script type="text/javascript" src="script/jquery-1.10.2.js"></script> + <script type="text/javascript" src="script/utils.js"></script> + <script type="text/javascript" src="script/prototype.js"></script> + <script type="text/javascript" src="script/chipmaker.js"></script> + <script type="text/javascript" src="script/wtx2kicad.js"></script> + <script type="text/javascript" src="script/gui.js"></script> + <script type="text/javascript" src="script/netlist.js"></script> + <script type="text/javascript" src="script/canvg.js"></script> + <script type="text/javascript" src="script/rgbcolor.js"></script> + <script type="text/javascript" src="script/savenetlist.js"></script> @@ -26,27 +26,32 @@ <!-- toolbar --> - <div id="webtronics_toolbar"> - <img id='webtronics_file' title="file menu" src="buttons/openmenu.png"> - <fieldset> - <legend>Circuit</legend> - <img id="webtronics_analysis" class="normal_button" title="analysis" src="buttons/analysis.png"> - <img id="webtronics_netlist" class="normal_button" title="view the netlist" src="buttons/netlist.png"> +<div id="webtronics_toolbar"> + <table><tr><td> + <a href="http://esim.fossee.in/" target="_blank" ><img src="icons/images.jpeg"/></a> + + </td><td> + <img id='webtronics_file' title="file menu" src="buttons/openmenu.png"></td> + <td> + <fieldset> + <legend>Circuit</legend> + <img id="webtronics_analysis" class="normal_button" title="analysis" src="buttons/analysis.png"> + <img id="webtronics_netlist" class="normal_button" title="view the netlist" src="buttons/netlist.png"> <!-- <img id="webtronics_run" class="normal_button" title="run spice" src="buttons/run.png"> --> - <img id="webtronics_chips_open" class="normal_button" title="make chips" src="buttons/icbut.png"> - <img id="webtronics_delete" class="normal_button" title="Delete selected shape" src="buttons/delete.png"> - <img id="webtronics_text" class="normal_button" title="add text" src="buttons/text.png"> - - </fieldset> - <fieldset> - <legend>History</legend> - <img id="webtronics_undo" class="normal_button" title="undo last action" src="buttons/undo.png"> - <img id="webtronics_redo" class="normal_button" title="redo last action" src="buttons/redo.png"> - </fieldset> - <fieldset> - <legend>Settings</legend> - <form> - <table border="0" cellpadding="0" cellspacing="0"> + <img id="webtronics_chips_open" class="normal_button" title="make chips" src="buttons/icbut.png"> + <img id="webtronics_delete" class="normal_button" title="Delete selected shape" src="buttons/delete.png"> + <img id="webtronics_text" class="normal_button" title="add text" src="buttons/text.png"> + + </fieldset> + <fieldset> + <legend>History</legend> + <img id="webtronics_undo" class="normal_button" title="undo last action" src="buttons/undo.png"> + <img id="webtronics_redo" class="normal_button" title="redo last action" src="buttons/redo.png"> + </fieldset> + <fieldset> + <legend>Settings</legend> + <form> + <table border="0" cellpadding="0" cellspacing="0"> <tr> <td><input id="webtronics_connections" type="checkbox"></td><td> connections</td> <td><input id="webtronics_graph" type="checkbox"></td><td>graph</td> @@ -55,10 +60,11 @@ toolbar <td><input type="checkbox" id="webtronics_invert"></td><td>invert</td> <td><input type="checkbox" id="webtronics_showhelp"></td><td>help</td> </tr> - </table> - </form> - </fieldset> - </div> + </table> + </form> + </fieldset> + </td></tr></table> +</div> <!--part selection menu --> <div id="webtronics_center" > <div id="webtronics_side_bar" > @@ -66,12 +72,11 @@ toolbar </div> - - <br> - <a href="http://esim.fossee.in/" target="_blank"><img src="icons/logo.png"/></a> - <br> - <a href="https://github.com/FOSSEE/eSimWebApp" target="_blank">Fossee</a> - + + + + <br> + <a href="https://github.com/FOSSEE/eSimWebApp" target="_blank" >Fossee</a><br> </div> <!-- @@ -82,13 +87,31 @@ tab area <!-- display area --> - <div id="webtronics_diagram_area" ></div> + + + +<div id="webtronics_diagram_area" > + + + +</div> + + + + + + </div> <!-- status bar --> - - <div id="webtronics_status_bar">Mode: Draw Rectangle</div> + +<div id="webtronics_footer"> + + + <p align="center">© 2016 FOSSEE, IIT Bombay</p> + +</div> @@ -98,75 +121,328 @@ make chips --> <div id="webtronics_chips_box" class='modal'> - <div id="webtronics_chip_display" ></div> - <form name="webtronics_chips_form" > - <fieldset> - <legend>pin count</legend> - <select id="webtronics_vert_pins"></select> - <select id="webtronics_hor_pins"></select> - </fieldset> - <br/> - <fieldset> - <legend>model</legend> - <input id="webtronics_chip_spice"><br/> - <select size=5 id="webtronics_chip_spice_select"> - <option value="">none</option> - </select> - </fieldset> - </form> - <img id="webtronics_chip_ok" class="normal_button" src="buttons/ok.png"> - <img id="webtronics_chip_cancel" class="normal_button" src="buttons/cancel.png"> + <div id="webtronics_chip_display" ></div> + <form name="webtronics_chips_form" > + <fieldset> + <legend>pin count</legend> + <select id="webtronics_vert_pins"></select> + <select id="webtronics_hor_pins"></select> + </fieldset> + <br/> + <fieldset> + <legend>model</legend> + <input id="webtronics_chip_spice"><br/> + <select size=5 id="webtronics_chip_spice_select"> + <option value="">none</option> + </select> + </fieldset> + </form> + <img id="webtronics_chip_ok" class="normal_button" src="buttons/ok.png"> + <img id="webtronics_chip_cancel" class="normal_button" src="buttons/cancel.png"> </div> <!-- add text - --> +--> <div id="webtronics_add_text" class='modal'> -<textarea cols="50" rows="4" id="webtronics_comment"></textarea> + <textarea cols="50" rows="4" id="webtronics_comment"></textarea> </div> <!-- properties form --> <div id="webtronics_properties_div" class='modal'> -<form name="webtronics_properties_form"> -<fieldset> -<legend>part id</legend> -<input id="webtronics_part_id"><br> -</fieldset> -<br> -<fieldset> -<legend>value or model</legend> -<input id="webtronics_part_value"> -<select id="webtronics_part_model"> -<option value="">none</option> -</select> -</fieldset> -<br> -<fieldset> -<legend>spice directive</legend> -<input id="webtronics_part_dir_value"> -<select id="webtronics_part_dir_model"> -<option value="">none</option> -</select> -</fieldset> -<br> -<fieldset id="webtronics_print_dir_field"> -<legend>measurements</legend> -<input id="webtronics_print_dir_value"/> -</fieldset> -<!--**OPEN LOCAL SPICE MODELS EXPERIMENT<input id="webtronics_part_file" type="file"/>--> -</form> -<div class="webtronics_help"> -spice: -<pre id="webtronics_part_help"> -</pre> -</div> + <form name="webtronics_properties_form"> + <table><tr><td> + <fieldset> + + <legend>part id</legend> + <input id="webtronics_part_id"><br> + + </fieldset> + </td></tr><tr id="valuemodel"><td> + <fieldset > + + <legend>value or model</legend> + <input id="webtronics_part_value"> + <select id="webtronics_part_model"> + <option value="">none</option> + </select> + + </fieldset> + </td></tr><tr id="directive"><td> + <fieldset > + + <legend>spice directive</legend> + <input id="webtronics_part_dir_value"> + <select id="webtronics_part_dir_model"> + <option value="">none</option> + </select> + + </fieldset> + </td></tr><tr id="webtronics_amplitude"><td> + <fieldset > + + <legend>Amplitude</legend> + <input id="webtronics_amplitude_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_phase"><td> + + <fieldset > + + <legend>Phase</legend> + <input id="webtronics_phase_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_offsetvoltage"><td> + + <fieldset > + + <legend>Offset Voltage VO:</legend> + <input id="webtronics_offsetvoltage_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_voltageamplitude"><td> + + <fieldset > + + <legend>Voltage Amplitude VA:</legend> + <input id="webtronics_voltageamplitude_value" type="text" value="0" > + + </fieldset> + </td></tr><tr id="webtronics_frequency"><td> + + <fieldset > + + <legend>Frequency FREQ:</legend> + <input id="webtronics_frequency_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_delaytime"><td> + + <fieldset > + + <legend>Delay Time TD:</legend> + <input id="webtronics_delaytime_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_dampingfactor"><td> + + <fieldset > + + <legend>Damping Factor THETA:</legend> + <input id="webtronics_dampingfactor_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_print_dir_field"><td> + + + <fieldset > + + <legend>measurements</legend> + <input id="webtronics_print_dir_value"> + + </fieldset> + </td></tr> + <!-- + pulse source properties + --> + + <tr id="webtronics_pulval1"><td> + <fieldset > + + <legend>Initial Value V1:</legend> + <input id="webtronics_pulval1_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pulval2"><td> + + <fieldset > + + <legend>Pulse Value V2:</legend> + <input id="webtronics_pulval2_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pulval3"><td> + + <fieldset > + + <legend>Delay Time TD:</legend> + <input id="webtronics_pulval3_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pulval4"><td> + + <fieldset > + + <legend>Rise Time TR:</legend> + <input id="webtronics_pulval4_value" type="text" value="0" > + + </fieldset> + </td></tr><tr id="webtronics_pulval5"><td> + + <fieldset > + + <legend>Fall Time TF:</legend> + <input id="webtronics_pulval5_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pulval6"><td> + + <fieldset > + + <legend>Pulse Width PW:</legend> + <input id="webtronics_pulval6_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pulval7"><td> + + <fieldset > + + <legend>Pulse Width PER:</legend> + <input id="webtronics_pulval7_value" type="text" value="0"> + + </fieldset> + </td></tr> + + + <!--for pwl voltage source + --> + +<tr id="webtronics_pwlval1"><td> + <fieldset > + + <legend>Time T1:</legend> + <input id="webtronics_pwlval1_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pwlval2"><td> + + <fieldset > + + <legend>Voltage Value V1:</legend> + <input id="webtronics_pwlval2_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pwlval3"><td> + + <fieldset > + + <legend>Time T2:</legend> + <input id="webtronics_pwlval3_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pwlval4"><td> + + <fieldset > + + <legend>Voltage Value V2:</legend> + <input id="webtronics_pwlval4_value" type="text" value="0" > + + </fieldset> + </td></tr><tr id="webtronics_pwlval5"><td> + + <fieldset > + + <legend>Time T3:</legend> + <input id="webtronics_pwlval5_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pwlval6"><td> + + <fieldset > + + <legend>Voltage Value V3:</legend> + <input id="webtronics_pwlval6_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pwlval7"><td> + + <fieldset > + + <legend>Time T4:</legend> + <input id="webtronics_pwlval7_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pwlval8"><td> + + <fieldset > + + <legend>Voltage Value V4:</legend> + <input id="webtronics_pwlval8_value" type="text" value="0"> + + </fieldset> + </td></tr> + + <!--for exponential voltage source + --> + +<tr id="webtronics_eval1"><td> + <fieldset > + + <legend>Initial Value V1:</legend> + <input id="webtronics_eval1_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_eval2"><td> + + <fieldset > + + <legend>Pulse Value V2:</legend> + <input id="webtronics_eval2_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_eval3"><td> + + <fieldset > + + <legend>Rise Time Delay TD1:</legend> + <input id="webtronics_eval3_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_eval4"><td> + + <fieldset > + + <legend>Rise Time Constant TAU1:</legend> + <input id="webtronics_eval4_value" type="text" value="0" > + + </fieldset> + </td></tr><tr id="webtronics_eval5"><td> + + <fieldset > + + <legend>Fall Time Delay TD2:</legend> + <input id="webtronics_eval5_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_eval6"><td> + + <fieldset > + + <legend>Fall Time Constant TAU2:</legend> + <input id="webtronics_eval6_value" type="text" value="0"> + + </fieldset> + </td></tr> + + + + </table> + + <!--**OPEN LOCAL SPICE MODELS EXPERIMENT<input id="webtronics_part_file" type="file"/>--> + </form> + <div class="webtronics_help"> + spice: + <pre id="webtronics_part_help"> + </pre> + </div> -<div id="webtronics_properties_buttons"> -<img id="webtronics_properties_ok" class="normal_button" src="buttons/ok.png"> -<img id="webtronics_properties_cancel" class="normal_button" src="buttons/cancel.png"> -</div> + <div id="webtronics_properties_buttons"> + <img id="webtronics_properties_ok" class="normal_button" src="buttons/ok.png"> + <img id="webtronics_properties_cancel" class="normal_button" src="buttons/cancel.png"> + </div> </div> @@ -175,40 +451,40 @@ spice: select source server --> <div id="webtronics_add source" class='modal'> -<div> -<input class="webtronics_add_source_input" /></br> -<input class="webtronics_add_source_input" /></br> -<input class="webtronics_add_source_input" /></br> -<input class="webtronics_add_source_input" /></br> -<input class="webtronics_add_source_input" /> -</div></br> -<div class="webtronics_help" ></br> -<pre> -sources can be local or remote + <div> + <input class="webtronics_add_source_input" /></br> + <input class="webtronics_add_source_input" /></br> + <input class="webtronics_add_source_input" /></br> + <input class="webtronics_add_source_input" /></br> + <input class="webtronics_add_source_input" /> + </div></br> + <div class="webtronics_help" ></br> + <pre> + sources can be local or remote -webtronix_server is the default server parts + webtronix_server is the default server parts -remote sources must start with http:// + remote sources must start with http:// -local source are absolute + local source are absolute -/local/source/webtronix_server + /local/source/webtronix_server -</pre> -</div></br> -<img id="webtronics_add source_ok" src="buttons/ok.png"> -<img id="webtronics_add_source_cancel" src="buttons/cancel.png"> + </pre> + </div></br> + <img id="webtronics_add source_ok" src="buttons/ok.png"> + <img id="webtronics_add_source_cancel" src="buttons/cancel.png"> </div> <!-- add code text - --> +--> <div id="webtronics_open_text" class='modal'> -<textarea cols="50" rows="4" id="webtronics_svg_code"></textarea> -<img id="webtronics_open_text_ok" src="buttons/ok.png"> -<img id="webtronics_open_text_cancel" src="buttons/cancel.png"> + <textarea cols="50" rows="4" id="webtronics_svg_code"></textarea> + <img id="webtronics_open_text_ok" src="buttons/ok.png"> + <img id="webtronics_open_text_cancel" src="buttons/cancel.png"> </div> @@ -218,171 +494,171 @@ add code text <div id="webtronics_netlist_analysis" class='modal'> -<br> + <br> -<br> + <br> -<br> + <br> -<br> -<br> + <br> + <br> -<select id="analysis_selectbox" class="exclude_button"><br> - <option selected="selected" value="4">Analysis Type</option> - <option value="1">DC</option> - <option value="2">AC</option> - <option value="3">Transient</option> - <!-- <option value="4">Four</option> --> -</select> + <select id="analysis_selectbox" class="exclude_button"><br> + <option selected="selected" value="4">Analysis Type</option> + <option value="1">DC</option> + <option value="2">AC</option> + <option value="3">Transient</option> + <!-- <option value="4">Four</option> --> + </select> -<div id = "select" display: none;> -<input id ="webtronics_netlist_cancels" class="button_cancel" type="button" value="cancel" ><br> + <div id = "select" display: none;> + <input id ="webtronics_netlist_cancels" class="button_cancel" type="button" value="cancel" ><br> -</div> + </div> -<!------------------------- AC MENU FORM AND DIV --------------------------------------------------------------------------------------------------------------> + <!------------------------- AC MENU FORM AND DIV --------------------------------------------------------------------------------------------------------------> -<div id = "ac_menu" display: none;> + <div id = "ac_menu" display: none;> -<div id="inputbox_ac" display: table;> - -<form > -<table> - -<tr> -<td> -<label for="dummy1">Start Frequency</label> -<input type="number" id="startfreqval" pattern="[0-9]{3}" min="0" name="Start Frequency"> -</td> - -<td> -<select id="start_frequency_selectbox" class="exclude_button"> - <option value="" disabled="disabled" selected="selected"> Start Frequency Units</option> - <option value="1">Hz</option> - <option value="2">THz</option> - <option value="3">GHz</option> - <option value="4">Meg</option> - <option value="5">KHz</option> -</select> -</td> -</tr> - -<tr> -<td> -<label for="dummy2">Stop Frequency</label> -<input type="number" id="stopfreqval" pattern="[0-9]{3}" min="0" name="Stop Frequency" > -</td> -<td> -<select id="stop_frequency_selectbox" class="exclude_button"> - <option value="" disabled="disabled" selected="selected">Stop Frequency Units</option> - <option value="1">Hz</option> - <option value="2">THz</option> - <option value="3">GHz</option> - <option value="4">Meg</option> - <option value="5">KHz</option> -</select> -</td> -</tr> -<tr> -<td> -<label for="dummy3">Number Of Points</label> -<input type="number" id="noofpointsval" min="0" pattern="[0-9]{3}" name="No of Points"> -</td> -<td> -<select id="scale_selectbox" class="exclude_button"> -<option value="" disabled="disabled" selected="selected">Scale</option> - <option value="1">Lin</option> - <option value="2">Dec</option> - <option value="3">Oct</option> - -</select> -</td> -</tr> -</table> -<input id ="saveac" class="view_netlist" type="button" value="save" > + <div id="inputbox_ac" display: table;> -<input id ="webtronics_netlist_cancela" class="button_cancel" type="button" value="cancel" ><br> + <form > + <table> -</form> + <tr> + <td> + <label for="dummy1">Start Frequency</label> + <input type="number" id="startfreqval" pattern="[0-9]{3}" min="0" name="Start Frequency"> + </td> + + <td> + <select id="start_frequency_selectbox" class="exclude_button"> + <option value="" disabled="disabled" selected="selected"> Start Frequency Units</option> + <option value="1">Hz</option> + <option value="2">THz</option> + <option value="3">GHz</option> + <option value="4">Meg</option> + <option value="5">KHz</option> + </select> + </td> + </tr> -</div> + <tr> + <td> + <label for="dummy2">Stop Frequency</label> + <input type="number" id="stopfreqval" pattern="[0-9]{3}" min="0" name="Stop Frequency" > + </td> + <td> + <select id="stop_frequency_selectbox" class="exclude_button"> + <option value="" disabled="disabled" selected="selected">Stop Frequency Units</option> + <option value="1">Hz</option> + <option value="2">THz</option> + <option value="3">GHz</option> + <option value="4">Meg</option> + <option value="5">KHz</option> + </select> + </td> + </tr> + <tr> + <td> + <label for="dummy3">Number Of Points</label> + <input type="number" id="noofpointsval" min="0" pattern="[0-9]{3}" name="No of Points"> + </td> + <td> + <select id="scale_selectbox" class="exclude_button"> + <option value="" disabled="disabled" selected="selected">Scale</option> + <option value="1">Lin</option> + <option value="2">Dec</option> + <option value="3">Oct</option> + + </select> + </td> + </tr> + </table> + <input id ="saveac" class="view_netlist" type="button" value="save" > -</div> + <input id ="webtronics_netlist_cancela" class="button_cancel" type="button" value="cancel" ><br> + </form> + </div> -<!----------------------------------------- TRANSIENT MENU FORM AND DIV ------------------------------------------------------------> + </div> + <!----------------------------------------- TRANSIENT MENU FORM AND DIV ------------------------------------------------------------> -<div id="transient_menu" display: none;> -<div id="inputbox_transient" display: table;> -<form > -<table> + <div id="transient_menu" display: none;> -<tr> -<td> -<label for="dummy1">Start Time</label> -<input type="number" id="start_time" pattern="[0-9]{3}" min="0" name="Start Time"> + <div id="inputbox_transient" display: table;> -<select id="start_time_selectbox" class="exclude_button"> -<option value="" disabled="disabled" selected="selected">Start Time units</option> - <option value="1">ms</option> - <option value="2">us</option> - <option value="3">ns</option> - <option value="4">ps</option> -</select> -</td> -</tr> + <form > + <table> -<tr> -<td> -<label for="dummy2">Step Time</label> -<input type="number" id="step_time" pattern="[0-9]{3}" min="0" name="Step Time" > + <tr> + <td> + <label for="dummy1">Start Time</label> + <input type="number" id="start_time" pattern="[0-9]{3}" min="0" name="Start Time"> + + <select id="start_time_selectbox" class="exclude_button"> + <option value="" disabled="disabled" selected="selected">Start Time units</option> + <option value="1">ms</option> + <option value="2">us</option> + <option value="3">ns</option> + <option value="4">ps</option> + </select> + </td> + </tr> -<select id="step_time_selectbox" class="exclude_button"> -<option value="" disabled="disabled" selected="selected">Step Time units</option> - <option value="1">ms</option> - <option value="2">us</option> - <option value="3">ns</option> - <option value="4">ps</option> -</select> -</td> -</tr> + <tr> + <td> + <label for="dummy2">Step Time</label> + <input type="number" id="step_time" pattern="[0-9]{3}" min="0" name="Step Time" > + + + <select id="step_time_selectbox" class="exclude_button"> + <option value="" disabled="disabled" selected="selected">Step Time units</option> + <option value="1">ms</option> + <option value="2">us</option> + <option value="3">ns</option> + <option value="4">ps</option> + </select> + </td> + </tr> -<tr> -<td> -<label for="dummy3">Stop Time</label> -<input type="number" id="stop_time" pattern="[0-9]{3}" min="0" name="Stop Time"> -<select id="stop_time_selectbox" class="exclude_button"> -<option value="" disabled="disabled" selected="selected">Stop Time units</option> - <option value="1">ms</option> - <option value="2">us</option> - <option value="3">ns</option> - <option value="4">ps</option> -</select> -</td> -</tr> -</table> -<input id ="savetransient" class="view_netlist" type="button" value="save" > -<input id ="webtronics_netlist_cancelt" class="button_cancel" type="button" value="cancel" ><br> + <tr> + <td> + <label for="dummy3">Stop Time</label> + <input type="number" id="stop_time" pattern="[0-9]{3}" min="0" name="Stop Time"> + <select id="stop_time_selectbox" class="exclude_button"> + <option value="" disabled="disabled" selected="selected">Stop Time units</option> + <option value="1">ms</option> + <option value="2">us</option> + <option value="3">ns</option> + <option value="4">ps</option> + </select> + </td> + </tr> + </table> + <input id ="savetransient" class="view_netlist" type="button" value="save" > + <input id ="webtronics_netlist_cancelt" class="button_cancel" type="button" value="cancel" ><br> -</form> -</div> + </form> + </div> -</div> + </div> <!------------------------------------------------------------------------------------------------------------------------------------------------ DC MENU FORM AND DIV @@ -392,77 +668,77 @@ DC MENU FORM AND DIV -<div id="inputbox_dc" display: table;> - -<form > - + <div id="inputbox_dc" display: table;> + + <form > + <!-- Source name: <input type="text" name="source" id ='sourceval' size="10"><br> Start : <input type="text" name="start" id ='startval' size="10"><br> Increment : <input type="text" name="increment" id ='incrementval' size="10"><br> Stop : <input type="text" name="stop" id = 'stopval' size="10"><br> - --> - -<table> -<td> - -<label for="dummy1">Source name</label> -<input type="text" id="sourceval" name="Source Name"> - -</td> - -<tr> -<td> -<label for="dummy2">Start </label> -<input type="number" id="startval" pattern="[0-9]{3}" min="0" name="Start" > - -<select id="start_volt_selectbox" class="exclude_button"> - <option value="" disabled="disabled" selected="selected">Start Time Units</option> - <option value="1">Volts or Amperes</option> - <option value="2">mV or mA</option> - <option value="3">uV or uA</option> - <option value="4">nV or nA</option> - <option value="5">pV or pA</option> -</select> -</td> -</tr> - -<tr> -<td> - -<label for="dummy3">Incrememnt</label> -<input type="number" id="Incrementval" pattern="[0-9]{3}" min="0" name="Increment"> - - -<select id="inc_volt_selectbox" class="exclude_button"> - <option value="" disabled="disabled" selected="selected">Increment Time Units</option> - <option value="1">Volts or Amperes</option> - <option value="2">mV or mA</option> - <option value="3">uV or uA</option> - <option value="4">nV or nA</option> - <option value="5">pV or pA</option> -</select> -</td> -</tr> - -<tr> -<td> -<label for="dummy4">Stop </label> -<input type="number" id="stopval" pattern="[0-9]{3}" min="0" name="Stop"> - -<select id="stop_volt_selectbox" class="exclude_button"> - <option value="" disabled="disabled" selected="selected">Stop Time Units</option> - <option value="1">Volts or Amperes</option> - <option value="2">mV or mA</option> - <option value="3">uV or uA</option> - <option value="4">nV or nA</option> - <option value="5">pV or pA</option> -</select> -</td> -</tr> -</table> - -<input id ="savedc" class="view_netlist" type="button" value="save" > -<input id ="webtronics_netlist_canceld" class="button_cancel" type="button" value="cancel" ><br> + --> + + <table> + <td> + + <label for="dummy1">Source name</label> + <input type="text" id="sourceval" name="Source Name"> + + </td> + + <tr> + <td> + <label for="dummy2">Start </label> + <input type="number" id="startval" pattern="[0-9]{3}" min="0" name="Start" > + + <select id="start_volt_selectbox" class="exclude_button"> + <option value="" disabled="disabled" selected="selected">Start Time Units</option> + <option value="1">Volts or Amperes</option> + <option value="2">mV or mA</option> + <option value="3">uV or uA</option> + <option value="4">nV or nA</option> + <option value="5">pV or pA</option> + </select> + </td> + </tr> + + <tr> + <td> + + <label for="dummy3">Incrememnt</label> + <input type="number" id="Incrementval" pattern="[0-9]{3}" min="0" name="Increment"> + + + <select id="inc_volt_selectbox" class="exclude_button"> + <option value="" disabled="disabled" selected="selected">Increment Time Units</option> + <option value="1">Volts or Amperes</option> + <option value="2">mV or mA</option> + <option value="3">uV or uA</option> + <option value="4">nV or nA</option> + <option value="5">pV or pA</option> + </select> + </td> + </tr> + + <tr> + <td> + <label for="dummy4">Stop </label> + <input type="number" id="stopval" pattern="[0-9]{3}" min="0" name="Stop"> + + <select id="stop_volt_selectbox" class="exclude_button"> + <option value="" disabled="disabled" selected="selected">Stop Time Units</option> + <option value="1">Volts or Amperes</option> + <option value="2">mV or mA</option> + <option value="3">uV or uA</option> + <option value="4">nV or nA</option> + <option value="5">pV or pA</option> + </select> + </td> + </tr> + </table> + + <input id ="savedc" class="view_netlist" type="button" value="save" > + <input id ="webtronics_netlist_canceld" class="button_cancel" type="button" value="cancel" ><br> </form> @@ -480,38 +756,38 @@ netlist display <div id="webtronics_netlist_text" class='modal'> -<div class="webtronics_help" > -<pre> -convergence: + <div class="webtronics_help" > + <pre> + convergence: -increase or decrease step size -or try adding + increase or decrease step size + or try adding -.options dampstrategy=2 + .options dampstrategy=2 -</pre> -</div> + </pre> + </div> -<br><br> -<div id="webtronics_netlist_text_div" ></div> -<br><br> + <br><br> + <div id="webtronics_netlist_text_div" ></div> + <br><br> -<div id="webtronics_netlist_buttons"> -<!--<img id="webtronics_netlist_text_run" class="normal_button" src="buttons/run.png"> --> -<img id="webtronics_netlist_text_ok" class="normal_button" src="buttons/cancel.png"> + <div id="webtronics_netlist_buttons"> + <!--<img id="webtronics_netlist_text_run" class="normal_button" src="buttons/run.png"> --> + <img id="webtronics_netlist_text_ok" class="normal_button" src="buttons/cancel.png"> -<img id="webtronics_netlist_simulate" class="normal_button" src="buttons/run.png"> -<img id="webtronics_netlist_text_download" class="normal_button" src="buttons/download.png"> + <img id="webtronics_netlist_simulate" class="normal_button" src="buttons/run.png"> + <img id="webtronics_netlist_text_download" class="normal_button" src="buttons/download.png"> - -</div> + + </div> </div> @@ -527,6 +803,8 @@ or try adding </div> + + <!-- code for select options of analysis --> @@ -534,21 +812,32 @@ code for select options of analysis simulation display --> <div id="webtronics_scope_display" class="modal" > -<div id="webtronics_scope_display_div"></div> -<img id="webtronics_scope_display_ok" class="normal_button" title="close simulation" src="buttons/cancel.png"> -<img id="webtronics_scope_display_stop" class="normal_button" title="stop simulation" src="buttons/process-stop.png"> -<form> -<input id="webtronics_scope_output_log" type="radio" name="scope_output" >log<br> -<input id="webtronics_scope_output_graph" type="radio" name="scope_output" value="graph">graph -</form> -<br> -<div id="webtronics_scope_status_bar"> -<p id="webtronics_scope_data" ></p> -<p id="webtronics_scope_status" >DOWNLOADING GNUCAP</p> -</div> + <div id="webtronics_scope_display_div"></div> + <img id="webtronics_scope_display_ok" class="normal_button" title="close simulation" src="buttons/cancel.png"> + <img id="webtronics_scope_display_stop" class="normal_button" title="stop simulation" src="buttons/process-stop.png"> + <form> + <input id="webtronics_scope_output_log" type="radio" name="scope_output" >log<br> + <input id="webtronics_scope_output_graph" type="radio" name="scope_output" value="graph">graph + </form> + <br> + <div id="webtronics_scope_footer"> + <p id="webtronics_scope_data" ></p> + <p id="webtronics_scope_status" >DOWNLOADING GNUCAP</p> + </div> </div> + + + </div> + + + <script src="/socket.io/socket.io.js"></script> <script type="text/javascript" src="script/form.js"></script> -</body></html> + +</body> + + + +</html> 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 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="UTF-8"> + <title>eSim</title> + <link rel="shortcut icon" href="../icons/favicon.ico" /> + <meta charset="UTF-8"> + <link rel="stylesheet" href="style/schematic.css" type="text/css"> + <link rel="stylesheet" href="style/input.css" type="text/css"> + <script type="text/javascript" src="script/jquery-1.10.2.js"></script> + <script type="text/javascript" src="script/utils.js"></script> + <script type="text/javascript" src="script/prototype.js"></script> + <script type="text/javascript" src="script/chipmaker.js"></script> + <script type="text/javascript" src="script/wtx2kicad.js"></script> + <script type="text/javascript" src="script/gui.js"></script> + <script type="text/javascript" src="script/netlist.js"></script> + <script type="text/javascript" src="script/canvg.js"></script> + <script type="text/javascript" src="script/rgbcolor.js"></script> + <script type="text/javascript" src="script/savenetlist.js"></script> + + + +</head><body> + +<div id="webtronics_main_window"> +<!-- +toolbar +--> +<div id="webtronics_toolbar"> + <table><tr><td> + <a href="http://esim.fossee.in/" target="_blank" ><img src="icons/images.jpeg"/></a> + + </td><td> + <img id='webtronics_file' title="file menu" src="buttons/openmenu.png"></td> + <td> + <fieldset> + <legend>Circuit</legend> + <img id="webtronics_analysis" class="normal_button" title="analysis" src="buttons/analysis.png"> + <img id="webtronics_netlist" class="normal_button" title="view the netlist" src="buttons/netlist.png"> + <!-- <img id="webtronics_run" class="normal_button" title="run spice" src="buttons/run.png"> --> + <img id="webtronics_chips_open" class="normal_button" title="make chips" src="buttons/icbut.png"> + <img id="webtronics_delete" class="normal_button" title="Delete selected shape" src="buttons/delete.png"> + <img id="webtronics_text" class="normal_button" title="add text" src="buttons/text.png"> + + </fieldset> + <fieldset> + <legend>History</legend> + <img id="webtronics_undo" class="normal_button" title="undo last action" src="buttons/undo.png"> + <img id="webtronics_redo" class="normal_button" title="redo last action" src="buttons/redo.png"> + </fieldset> + <fieldset> + <legend>Settings</legend> + <form> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><input id="webtronics_connections" type="checkbox"></td><td> connections</td> + <td><input id="webtronics_graph" type="checkbox"></td><td>graph</td> + </tr> + <tr> + <td><input type="checkbox" id="webtronics_invert"></td><td>invert</td> + <td><input type="checkbox" id="webtronics_showhelp"></td><td>help</td> + </tr> + </table> + </form> + </fieldset> + </td></tr></table> +</div> +<!--part selection menu --> +<div id="webtronics_center" > + <div id="webtronics_side_bar" > + <div id="webtronics_parts_list" > + + </div> + + + + + <br> + <a href="https://github.com/FOSSEE/eSimWebApp" target="_blank" >Fossee</a><br> + + </div> +<!-- +tab area + + <div id="webtronics_tab_area"></div> +--> +<!-- +display area +--> + + + +<div id="webtronics_diagram_area" > + + + +</div> + + + + + + +</div> +<!-- +status bar +--> + +<div id="webtronics_footer"> + + + <p align="center">© 2016 FOSSEE, IIT Bombay</p> + +</div> + + + +<div id='webtronics_disable'></div> +<!-- +make chips +--> + +<div id="webtronics_chips_box" class='modal'> + <div id="webtronics_chip_display" ></div> + <form name="webtronics_chips_form" > + <fieldset> + <legend>pin count</legend> + <select id="webtronics_vert_pins"></select> + <select id="webtronics_hor_pins"></select> + </fieldset> + <br/> + <fieldset> + <legend>model</legend> + <input id="webtronics_chip_spice"><br/> + <select size=5 id="webtronics_chip_spice_select"> + <option value="">none</option> + </select> + </fieldset> + </form> + <img id="webtronics_chip_ok" class="normal_button" src="buttons/ok.png"> + <img id="webtronics_chip_cancel" class="normal_button" src="buttons/cancel.png"> +</div> + +<!-- +add text +--> + +<div id="webtronics_add_text" class='modal'> + <textarea cols="50" rows="4" id="webtronics_comment"></textarea> +</div> +<!-- +properties form +--> +<div id="webtronics_properties_div" class='modal'> + <form name="webtronics_properties_form"> + <table><tr><td> + <fieldset> + + <legend>part id</legend> + <input id="webtronics_part_id"><br> + + </fieldset> + </td></tr><tr id="valuemodel"><td> + <fieldset > + + <legend>value or model</legend> + <input id="webtronics_part_value"> + <select id="webtronics_part_model"> + <option value="">none</option> + </select> + + </fieldset> + </td></tr><tr id="directive"><td> + <fieldset > + + <legend>spice directive</legend> + <input id="webtronics_part_dir_value"> + <select id="webtronics_part_dir_model"> + <option value="">none</option> + </select> + + </fieldset> + </td></tr><tr id="webtronics_amplitude"><td> + <fieldset > + + <legend>Amplitude</legend> + <input id="webtronics_amplitude_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_phase"><td> + + <fieldset > + + <legend>Phase</legend> + <input id="webtronics_phase_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_offsetvoltage"><td> + + <fieldset > + + <legend>Offset Voltage VO:</legend> + <input id="webtronics_offsetvoltage_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_voltageamplitude"><td> + + <fieldset > + + <legend>Voltage Amplitude VA:</legend> + <input id="webtronics_voltageamplitude_value" type="text" value="0" > + + </fieldset> + </td></tr><tr id="webtronics_frequency"><td> + + <fieldset > + + <legend>Frequency FREQ:</legend> + <input id="webtronics_frequency_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_delaytime"><td> + + <fieldset > + + <legend>Delay Time TD:</legend> + <input id="webtronics_delaytime_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_dampingfactor"><td> + + <fieldset > + + <legend>Damping Factor THETA:</legend> + <input id="webtronics_dampingfactor_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_print_dir_field"><td> + + + <fieldset > + + <legend>measurements</legend> + <input id="webtronics_print_dir_value"> + + </fieldset> + </td></tr> + <!-- + pulse source properties + --> + + <tr id="webtronics_pulval1"><td> + <fieldset > + + <legend>Initial Value V1:</legend> + <input id="webtronics_pulval1_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pulval2"><td> + + <fieldset > + + <legend>Pulse Value V2:</legend> + <input id="webtronics_pulval2_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pulval3"><td> + + <fieldset > + + <legend>Delay Time TD:</legend> + <input id="webtronics_pulval3_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pulval4"><td> + + <fieldset > + + <legend>Rise Time TR:</legend> + <input id="webtronics_pulval4_value" type="text" value="0" > + + </fieldset> + </td></tr><tr id="webtronics_pulval5"><td> + + <fieldset > + + <legend>Fall Time TF:</legend> + <input id="webtronics_pulval5_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pulval6"><td> + + <fieldset > + + <legend>Pulse Width PW:</legend> + <input id="webtronics_pulval6_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pulval7"><td> + + <fieldset > + + <legend>Pulse Width PER:</legend> + <input id="webtronics_pulval7_value" type="text" value="0"> + + </fieldset> + </td></tr> + + + <!--for pwl voltage source + --> + +<tr id="webtronics_pwlval1"><td> + <fieldset > + + <legend>Time T1:</legend> + <input id="webtronics_pwlval1_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pwlval2"><td> + + <fieldset > + + <legend>Voltage Value V1:</legend> + <input id="webtronics_pwlval2_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pwlval3"><td> + + <fieldset > + + <legend>Time T2:</legend> + <input id="webtronics_pwlval3_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pwlval4"><td> + + <fieldset > + + <legend>Voltage Value V2:</legend> + <input id="webtronics_pwlval4_value" type="text" value="0" > + + </fieldset> + </td></tr><tr id="webtronics_pwlval5"><td> + + <fieldset > + + <legend>Time T3:</legend> + <input id="webtronics_pwlval5_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pwlval6"><td> + + <fieldset > + + <legend>Voltage Value V3:</legend> + <input id="webtronics_pwlval6_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pwlval7"><td> + + <fieldset > + + <legend>Time T4:</legend> + <input id="webtronics_pwlval7_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_pwlval8"><td> + + <fieldset > + + <legend>Voltage Value V4:</legend> + <input id="webtronics_pwlval8_value" type="text" value="0"> + + </fieldset> + </td></tr> + + <!--for exponential voltage source + --> + +<tr id="webtronics_eval1"><td> + <fieldset > + + <legend>Initial Value V1:</legend> + <input id="webtronics_eval1_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_eval2"><td> + + <fieldset > + + <legend>Pulse Value V2:</legend> + <input id="webtronics_eval2_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_eval3"><td> + + <fieldset > + + <legend>Rise Time Delay TD1:</legend> + <input id="webtronics_eval3_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_eval4"><td> + + <fieldset > + + <legend>Rise Time Constant TAU1:</legend> + <input id="webtronics_eval4_value" type="text" value="0" > + + </fieldset> + </td></tr><tr id="webtronics_eval5"><td> + + <fieldset > + + <legend>Fall Time Delay TD2:</legend> + <input id="webtronics_eval5_value" type="text" value="0"> + + </fieldset> + </td></tr><tr id="webtronics_eval6"><td> + + <fieldset > + + <legend>Fall Time Constant TAU2:</legend> + <input id="webtronics_eval6_value" type="text" value="0"> + + </fieldset> + </td></tr> + + + + </table> + + <!--**OPEN LOCAL SPICE MODELS EXPERIMENT<input id="webtronics_part_file" type="file"/>--> + </form> + <div class="webtronics_help"> + spice: + <pre id="webtronics_part_help"> + </pre> + </div> + + <div id="webtronics_properties_buttons"> + <img id="webtronics_properties_ok" class="normal_button" src="buttons/ok.png"> + <img id="webtronics_properties_cancel" class="normal_button" src="buttons/cancel.png"> + </div> + + +</div> + +<!-- +select source server +--> +<div id="webtronics_add source" class='modal'> + <div> + <input class="webtronics_add_source_input" /></br> + <input class="webtronics_add_source_input" /></br> + <input class="webtronics_add_source_input" /></br> + <input class="webtronics_add_source_input" /></br> + <input class="webtronics_add_source_input" /> + </div></br> + <div class="webtronics_help" ></br> + <pre> + sources can be local or remote + + webtronix_server is the default server parts + + remote sources must start with http:// + + local source are absolute + + /local/source/webtronix_server + + </pre> + </div></br> + <img id="webtronics_add source_ok" src="buttons/ok.png"> + <img id="webtronics_add_source_cancel" src="buttons/cancel.png"> +</div> + + +<!-- +add code text +--> + +<div id="webtronics_open_text" class='modal'> + <textarea cols="50" rows="4" id="webtronics_svg_code"></textarea> + <img id="webtronics_open_text_ok" src="buttons/ok.png"> + <img id="webtronics_open_text_cancel" src="buttons/cancel.png"> +</div> + + + + + + +<div id="webtronics_netlist_analysis" class='modal'> + + <br> + + <br> + + <br> + + <br> + <br> + + + <select id="analysis_selectbox" class="exclude_button"><br> + <option selected="selected" value="4">Analysis Type</option> + <option value="1">DC</option> + <option value="2">AC</option> + <option value="3">Transient</option> + <!-- <option value="4">Four</option> --> + </select> + + + <div id = "select" display: none;> + <input id ="webtronics_netlist_cancels" class="button_cancel" type="button" value="cancel" ><br> + + </div> + + <!------------------------- AC MENU FORM AND DIV --------------------------------------------------------------------------------------------------------------> + + + <div id = "ac_menu" display: none;> + + + + + <div id="inputbox_ac" display: table;> + + <form > + <table> + + <tr> + <td> + <label for="dummy1">Start Frequency</label> + <input type="number" id="startfreqval" pattern="[0-9]{3}" min="0" name="Start Frequency"> + </td> + + <td> + <select id="start_frequency_selectbox" class="exclude_button"> + <option value="" disabled="disabled" selected="selected"> Start Frequency Units</option> + <option value="1">Hz</option> + <option value="2">THz</option> + <option value="3">GHz</option> + <option value="4">Meg</option> + <option value="5">KHz</option> + </select> + </td> + </tr> + + <tr> + <td> + <label for="dummy2">Stop Frequency</label> + <input type="number" id="stopfreqval" pattern="[0-9]{3}" min="0" name="Stop Frequency" > + </td> + <td> + <select id="stop_frequency_selectbox" class="exclude_button"> + <option value="" disabled="disabled" selected="selected">Stop Frequency Units</option> + <option value="1">Hz</option> + <option value="2">THz</option> + <option value="3">GHz</option> + <option value="4">Meg</option> + <option value="5">KHz</option> + </select> + </td> + </tr> + <tr> + <td> + <label for="dummy3">Number Of Points</label> + <input type="number" id="noofpointsval" min="0" pattern="[0-9]{3}" name="No of Points"> + </td> + <td> + <select id="scale_selectbox" class="exclude_button"> + <option value="" disabled="disabled" selected="selected">Scale</option> + <option value="1">Lin</option> + <option value="2">Dec</option> + <option value="3">Oct</option> + + </select> + </td> + </tr> + </table> + <input id ="saveac" class="view_netlist" type="button" value="save" > + + <input id ="webtronics_netlist_cancela" class="button_cancel" type="button" value="cancel" ><br> + + </form> + + </div> + + </div> + + + + <!----------------------------------------- TRANSIENT MENU FORM AND DIV ------------------------------------------------------------> + + + + + <div id="transient_menu" display: none;> + + <div id="inputbox_transient" display: table;> + + + <form > + <table> + + <tr> + <td> + <label for="dummy1">Start Time</label> + <input type="number" id="start_time" pattern="[0-9]{3}" min="0" name="Start Time"> + + <select id="start_time_selectbox" class="exclude_button"> + <option value="" disabled="disabled" selected="selected">Start Time units</option> + <option value="1">ms</option> + <option value="2">us</option> + <option value="3">ns</option> + <option value="4">ps</option> + </select> + </td> + </tr> + + + <tr> + <td> + <label for="dummy2">Step Time</label> + <input type="number" id="step_time" pattern="[0-9]{3}" min="0" name="Step Time" > + + + <select id="step_time_selectbox" class="exclude_button"> + <option value="" disabled="disabled" selected="selected">Step Time units</option> + <option value="1">ms</option> + <option value="2">us</option> + <option value="3">ns</option> + <option value="4">ps</option> + </select> + </td> + </tr> + + <tr> + <td> + <label for="dummy3">Stop Time</label> + <input type="number" id="stop_time" pattern="[0-9]{3}" min="0" name="Stop Time"> + <select id="stop_time_selectbox" class="exclude_button"> + <option value="" disabled="disabled" selected="selected">Stop Time units</option> + <option value="1">ms</option> + <option value="2">us</option> + <option value="3">ns</option> + <option value="4">ps</option> + </select> + </td> + </tr> + </table> + <input id ="savetransient" class="view_netlist" type="button" value="save" > + <input id ="webtronics_netlist_cancelt" class="button_cancel" type="button" value="cancel" ><br> + + </form> + </div> + + </div> + +<!------------------------------------------------------------------------------------------------------------------------------------------------ +DC MENU FORM AND DIV +--------------------------------------------------------------------------------------------------------------------------------------------> +<div id="dc_menu" display: none;> + + + + + <div id="inputbox_dc" display: table;> + + <form > + + <!-- Source name: <input type="text" name="source" id ='sourceval' size="10"><br> + Start : <input type="text" name="start" id ='startval' size="10"><br> + Increment : <input type="text" name="increment" id ='incrementval' size="10"><br> + Stop : <input type="text" name="stop" id = 'stopval' size="10"><br> + --> + + <table> + <td> + + <label for="dummy1">Source name</label> + <input type="text" id="sourceval" name="Source Name"> + + </td> + + <tr> + <td> + <label for="dummy2">Start </label> + <input type="number" id="startval" pattern="[0-9]{3}" min="0" name="Start" > + + <select id="start_volt_selectbox" class="exclude_button"> + <option value="" disabled="disabled" selected="selected">Start Time Units</option> + <option value="1">Volts or Amperes</option> + <option value="2">mV or mA</option> + <option value="3">uV or uA</option> + <option value="4">nV or nA</option> + <option value="5">pV or pA</option> + </select> + </td> + </tr> + + <tr> + <td> + + <label for="dummy3">Incrememnt</label> + <input type="number" id="Incrementval" pattern="[0-9]{3}" min="0" name="Increment"> + + + <select id="inc_volt_selectbox" class="exclude_button"> + <option value="" disabled="disabled" selected="selected">Increment Time Units</option> + <option value="1">Volts or Amperes</option> + <option value="2">mV or mA</option> + <option value="3">uV or uA</option> + <option value="4">nV or nA</option> + <option value="5">pV or pA</option> + </select> + </td> + </tr> + + <tr> + <td> + <label for="dummy4">Stop </label> + <input type="number" id="stopval" pattern="[0-9]{3}" min="0" name="Stop"> + + <select id="stop_volt_selectbox" class="exclude_button"> + <option value="" disabled="disabled" selected="selected">Stop Time Units</option> + <option value="1">Volts or Amperes</option> + <option value="2">mV or mA</option> + <option value="3">uV or uA</option> + <option value="4">nV or nA</option> + <option value="5">pV or pA</option> + </select> + </td> + </tr> + </table> + + <input id ="savedc" class="view_netlist" type="button" value="save" > + <input id ="webtronics_netlist_canceld" class="button_cancel" type="button" value="cancel" ><br> + +</form> + +</div> +</div> + +<div id="domchange"> </div> + +</div> + + +<!-- +netlist display +--> + +<div id="webtronics_netlist_text" class='modal'> + + <div class="webtronics_help" > + <pre> + convergence: + + increase or decrease step size + or try adding + + .options dampstrategy=2 + + </pre> + </div> + + + + + <br><br> + <div id="webtronics_netlist_text_div" ></div> + <br><br> + + + + <div id="webtronics_netlist_buttons"> + <!--<img id="webtronics_netlist_text_run" class="normal_button" src="buttons/run.png"> --> + <img id="webtronics_netlist_text_ok" class="normal_button" src="buttons/cancel.png"> + + + <img id="webtronics_netlist_simulate" class="normal_button" src="buttons/run.png"> + <img id="webtronics_netlist_text_download" class="normal_button" src="buttons/download.png"> + + + + </div> +</div> + + + + + + + + + + + + +</div> + + + +<!-- +code for select options of analysis +--> +<!-- +simulation display +--> +<div id="webtronics_scope_display" class="modal" > + <div id="webtronics_scope_display_div"></div> + <img id="webtronics_scope_display_ok" class="normal_button" title="close simulation" src="buttons/cancel.png"> + <img id="webtronics_scope_display_stop" class="normal_button" title="stop simulation" src="buttons/process-stop.png"> + <form> + <input id="webtronics_scope_output_log" type="radio" name="scope_output" >log<br> + <input id="webtronics_scope_output_graph" type="radio" name="scope_output" value="graph">graph + </form> + <br> + <div id="webtronics_scope_footer"> + <p id="webtronics_scope_data" ></p> + <p id="webtronics_scope_status" >DOWNLOADING GNUCAP</p> + </div> +</div> + + + + +</div> + + + +<script src="/socket.io/socket.io.js"></script> +<script type="text/javascript" src="script/form.js"></script> + +</body> + + + +</html> 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;i<webtronics.partslists.length;i++){
- if(webtronics.partslists[i].parts[cat][part].values!=undefined){
- for(var model in webtronics.partslists[i].parts[cat][part].values){
- console.log("model");
- $("webtronics_part_model").insert(new Element("option",{"value":model}).update(model));
- }
- if(JSON.stringify(list).indexOf(part)!=-1){
- $("webtronics_part_help").innerHTML=webtronics.partslists[i].parts[cat][part].help;
- }
- }
- }
- }
- },
-
- center:function(e){
-
- e.style.left = ($('webtronics_main_window').offsetWidth/2)-(e.offsetWidth/2)+'px';
- e.style.top = ($('webtronics_main_window').offsetHeight/2)-(e.offsetHeight/2)+'px';
- },
-
- disablepage:function(){
- $("webtronics_disable").style.display="block";
- },
- enablepage:function(){
- $("webtronics_disable").style.display="none";
- },
-
- returnchip:function(){
- if($('webtronics_chip_display').getElementsByTagName('g').length){
- this.circuit.getgroup($('webtronics_chip_display').getElementsByTagName('g')[0]);
- netlistcreator.writewtx(this.circuit.selected[0],"id",this.circuit.getnextid(this.circuit.selected[0],0));
- this.circuit.createvalue(this.circuit.selected[0]);
- }
- $('webtronics_chips_box').style.display='none';
- this.setMode('select','Selection');
- },
-
- openProperties:function(){
- document.forms['webtronics_properties_form'].reset();
- var c=netlistcreator.readwtx(this.circuit.selected[0],"name");
- if(!c){
- netlistcreator.writewtx(this.circuit.selected[0],"name","ic");
- }
- if(c=="ac"){
- this.getvalues(this.circuit.selected[0]);
- $("webtronics_print_dir_field").style.display='block'
- $("webtronics_print_dir_value").value=netlistcreator.readwtx(this.circuit.selected[0],'measure');
+ 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;i<webtronics.partslists.length;i++){
+ if(webtronics.partslists[i].parts[cat][part].values!=undefined){
+ for(var model in webtronics.partslists[i].parts[cat][part].values){
+ console.log("model");
+ $("webtronics_part_model").insert(new Element("option",{"value":model}).update(model));
+ }
+ if(JSON.stringify(list).indexOf(part)!=-1){
+ $("webtronics_part_help").innerHTML=webtronics.partslists[i].parts[cat][part].help;
}
- else if(c=="scope"){
- this.getvalues(this.circuit.selected[0]);
+ }
+}
+}
+},
+
+center:function(e){
+
+ e.style.left = ($('webtronics_main_window').offsetWidth/2)-(e.offsetWidth/2)+'px';
+ e.style.top = ($('webtronics_main_window').offsetHeight/2)-(e.offsetHeight/2)+'px';
+},
+
+disablepage:function(){
+ $("webtronics_disable").style.display="block";
+},
+enablepage:function(){
+ $("webtronics_disable").style.display="none";
+},
+
+returnchip:function(){
+ if($('webtronics_chip_display').getElementsByTagName('g').length){
+ this.circuit.getgroup($('webtronics_chip_display').getElementsByTagName('g')[0]);
+ netlistcreator.writewtx(this.circuit.selected[0],"id",this.circuit.getnextid(this.circuit.selected[0],0));
+ this.circuit.createvalue(this.circuit.selected[0]);
+ }
+ $('webtronics_chips_box').style.display='none';
+ this.setMode('select','Selection');
+},
+
+openProperties:function(){
+ document.forms['webtronics_properties_form'].reset();
+ var c=netlistcreator.readwtx(this.circuit.selected[0],"name");
+
+ if(!c){
+ netlistcreator.writewtx(this.circuit.selected[0],"name","ic");
+ }
+ if(c=="ac"){
+ this.getvalues(this.circuit.selected[0]);
+ $("webtronics_amplitude").style.display='block'
+ $("webtronics_phase").style.display='block'
+
+ var amplitude=netlistcreator.readwtx(this.circuit.selected[0],"amplitude");
+ var phase=netlistcreator.readwtx(this.circuit.selected[0],"phase");
+
+ if(amplitude!=""){
+ $('webtronics_amplitude_value').value=amplitude;
+ //jQuery("#webtronics_amplitude_value").val()=amplitude;
+ }
+
+ if(phase!=""){$('webtronics_phase_value').value=phase;}
+
+
+ $("webtronics_eval1").style.display='none'
+ $("webtronics_eval2").style.display='none'
+ $("webtronics_eval3").style.display='none'
+ $("webtronics_eval4").style.display='none'
+ $("webtronics_eval5").style.display='none'
+ $("webtronics_eval6").style.display='none'
+
+
+ $("webtronics_pwlval1").style.display='none'
+ $("webtronics_pwlval2").style.display='none'
+ $("webtronics_pwlval3").style.display='none'
+ $("webtronics_pwlval4").style.display='none'
+ $("webtronics_pwlval5").style.display='none'
+ $("webtronics_pwlval6").style.display='none'
+ $("webtronics_pwlval7").style.display='none'
+ $("webtronics_pwlval8").style.display='none'
+
+
+ $("webtronics_offsetvoltage").style.display='none'
+ $("webtronics_frequency").style.display='none'
+ $("webtronics_voltageamplitude").style.display='none'
+ $("webtronics_delaytime").style.display='none'
+ $("webtronics_dampingfactor").style.display='none'
+ $("directive").style.display='none'
+
+
+ $("webtronics_pulval1").style.display='none'
+ $("webtronics_pulval2").style.display='none'
+ $("webtronics_pulval3").style.display='none'
+ $("webtronics_pulval4").style.display='none'
+ $("webtronics_pulval5").style.display='none'
+ $("webtronics_pulval6").style.display='none'
+ $("webtronics_pulval7").style.display='none'
+
+
+ $("valuemodel").style.display='none'
+
$("webtronics_print_dir_field").style.display='block'
$("webtronics_print_dir_value").value=netlistcreator.readwtx(this.circuit.selected[0],'measure');
}
- else {
- this.getvalues(this.circuit.selected[0]);
- }
- var id=netlistcreator.readwtx(this.circuit.selected[0],"id");
- var value=netlistcreator.readwtx(this.circuit.selected[0],"value");
-
-
- if(id!=""){$('webtronics_part_id').value=id;}
+
+
+ else if(c=="sinvoltagesource"){
+ $("webtronics_amplitude").style.display='none'
+ $("webtronics_phase").style.display='none'
+
+
+ $("webtronics_eval1").style.display='none'
+ $("webtronics_eval2").style.display='none'
+ $("webtronics_eval3").style.display='none'
+ $("webtronics_eval4").style.display='none'
+ $("webtronics_eval5").style.display='none'
+ $("webtronics_eval6").style.display='none'
+
+
+ $("webtronics_offsetvoltage").style.display='block'
+ $("webtronics_frequency").style.display='block'
+ $("webtronics_voltageamplitude").style.display='block'
+ $("webtronics_delaytime").style.display='block'
+ $("webtronics_dampingfactor").style.display='block'
+ $("directive").style.display='none'
+
+
+ $("webtronics_pwlval1").style.display='none'
+ $("webtronics_pwlval2").style.display='none'
+ $("webtronics_pwlval3").style.display='none'
+ $("webtronics_pwlval4").style.display='none'
+ $("webtronics_pwlval5").style.display='none'
+ $("webtronics_pwlval6").style.display='none'
+ $("webtronics_pwlval7").style.display='none'
+ $("webtronics_pwlval8").style.display='none'
+
+
+ $("webtronics_pulval1").style.display='none'
+ $("webtronics_pulval2").style.display='none'
+ $("webtronics_pulval3").style.display='none'
+ $("webtronics_pulval4").style.display='none'
+ $("webtronics_pulval5").style.display='none'
+ $("webtronics_pulval6").style.display='none'
+ $("webtronics_pulval7").style.display='none'
+
+
+ var offsetvoltage=netlistcreator.readwtx(this.circuit.selected[0],"offsetvoltage");
+ var voltageamplitude=netlistcreator.readwtx(this.circuit.selected[0],"voltageamplitude");
+ var frequency=netlistcreator.readwtx(this.circuit.selected[0],"frequency");
+ var delaytime=netlistcreator.readwtx(this.circuit.selected[0],"delaytime");
+ var dampingfactor=netlistcreator.readwtx(this.circuit.selected[0],"dampingfactor");
+
+ if(offsetvoltage!=""){$('webtronics_offsetvoltage_value').value=offsetvoltage;}
+ if(voltageamplitude!=""){$('webtronics_voltageamplitude_value').value=voltageamplitude;}
+ if(frequency!=""){$('webtronics_frequency_value').value=frequency;}
+ if(delaytime!=""){$('webtronics_delaytime_value').value=delaytime;}
+ if(dampingfactor!=""){$('webtronics_dampingfactor_value').value=dampingfactor;}
+
+
+ $("valuemodel").style.display='none'
+ }
+
+
+ else if(c=="pulse"){
+ $("webtronics_amplitude").style.display='none'
+ $("webtronics_phase").style.display='none'
+
+ $("webtronics_offsetvoltage").style.display='none'
+ $("webtronics_frequency").style.display='none'
+ $("webtronics_voltageamplitude").style.display='none'
+ $("webtronics_delaytime").style.display='none'
+ $("webtronics_dampingfactor").style.display='none'
+
+
+ $("webtronics_eval1").style.display='none'
+ $("webtronics_eval2").style.display='none'
+ $("webtronics_eval3").style.display='none'
+ $("webtronics_eval4").style.display='none'
+ $("webtronics_eval5").style.display='none'
+ $("webtronics_eval6").style.display='none'
+
+
+
+ $("webtronics_pwlval1").style.display='none'
+ $("webtronics_pwlval2").style.display='none'
+ $("webtronics_pwlval3").style.display='none'
+ $("webtronics_pwlval4").style.display='none'
+ $("webtronics_pwlval5").style.display='none'
+ $("webtronics_pwlval6").style.display='none'
+ $("webtronics_pwlval7").style.display='none'
+ $("webtronics_pwlval8").style.display='none'
+
+ $("webtronics_pulval1").style.display='block'
+ $("webtronics_pulval2").style.display='block'
+ $("webtronics_pulval3").style.display='block'
+ $("webtronics_pulval4").style.display='block'
+ $("webtronics_pulval5").style.display='block'
+ $("webtronics_pulval6").style.display='block'
+ $("webtronics_pulval7").style.display='block'
+
+ $("directive").style.display='none'
+ var pulval1=netlistcreator.readwtx(this.circuit.selected[0],"pulval1");
+ var pulval2=netlistcreator.readwtx(this.circuit.selected[0],"pulval2");
+ var pulval3=netlistcreator.readwtx(this.circuit.selected[0],"pulval3");
+ var pulval4=netlistcreator.readwtx(this.circuit.selected[0],"pulval4");
+ var pulval5=netlistcreator.readwtx(this.circuit.selected[0],"pulval5");
+ var pulval6=netlistcreator.readwtx(this.circuit.selected[0],"pulval6");
+ var pulval7=netlistcreator.readwtx(this.circuit.selected[0],"pulval7");
+ if(pulval1!=""){$('webtronics_pulval1_value').value=pulval1;}
+ if(pulval2!=""){$('webtronics_pulval2_value').value=pulval2;}
+ if(pulval3!=""){$('webtronics_pulval3_value').value=pulval3;}
+ if(pulval4!=""){$('webtronics_pulval4_value').value=pulval4;}
+ if(pulval5!=""){$('webtronics_pulval5_value').value=pulval5;}
+ if(pulval6!=""){$('webtronics_pulval6_value').value=pulval6;}
+ if(pulval7!=""){$('webtronics_pulval7_value').value=pulval7;}
+
+ $("valuemodel").style.display='none'
+ }
+
+ else if(c=="exponential"){
+ $("webtronics_amplitude").style.display='none'
+ $("webtronics_phase").style.display='none'
+
+ $("webtronics_offsetvoltage").style.display='none'
+ $("webtronics_frequency").style.display='none'
+ $("webtronics_voltageamplitude").style.display='none'
+ $("webtronics_delaytime").style.display='none'
+ $("webtronics_dampingfactor").style.display='none'
+
+
+ $("webtronics_pulval1").style.display='none'
+ $("webtronics_pulval2").style.display='none'
+ $("webtronics_pulval3").style.display='none'
+ $("webtronics_pulval4").style.display='none'
+ $("webtronics_pulval5").style.display='none'
+ $("webtronics_pulval6").style.display='none'
+ $("webtronics_pulval7").style.display='none'
+
+
+ $("webtronics_pwlval1").style.display='none'
+ $("webtronics_pwlval2").style.display='none'
+ $("webtronics_pwlval3").style.display='none'
+ $("webtronics_pwlval4").style.display='none'
+ $("webtronics_pwlval5").style.display='none'
+ $("webtronics_pwlval6").style.display='none'
+ $("webtronics_pwlval7").style.display='none'
+ $("webtronics_pwlval8").style.display='none'
+
+ $("webtronics_eval1").style.display='block'
+ $("webtronics_eval2").style.display='block'
+ $("webtronics_eval3").style.display='block'
+ $("webtronics_eval4").style.display='block'
+ $("webtronics_eval5").style.display='block'
+ $("webtronics_eval6").style.display='block'
+
+
+ $("directive").style.display='none'
+ var eval1=netlistcreator.readwtx(this.circuit.selected[0],"eval1");
+ var eval2=netlistcreator.readwtx(this.circuit.selected[0],"eval2");
+ var eval4=netlistcreator.readwtx(this.circuit.selected[0],"eval4");
+ var eval3=netlistcreator.readwtx(this.circuit.selected[0],"eval3");
+ var eval5=netlistcreator.readwtx(this.circuit.selected[0],"eval5");
+ var eval6=netlistcreator.readwtx(this.circuit.selected[0],"eval6");
+
+ if(eval1!=""){$('webtronics_eval1_value').value=eval1;}
+ if(eval2!=""){$('webtronics_eval2_value').value=eval2;}
+ if(eval3!=""){$('webtronics_eval3_value').value=eval3;}
+ if(eval4!=""){$('webtronics_eval4_value').value=eval4;}
+ if(eval5!=""){$('webtronics_eval5_value').value=eval5;}
+ if(eval6!=""){$('webtronics_eval6_value').value=eval6;}
+
+
+ $("valuemodel").style.display='none'
+ }
+
+
+
+
+ else if(c=="pwl"){
+ $("webtronics_amplitude").style.display='none'
+ $("webtronics_phase").style.display='none'
+
+ $("webtronics_offsetvoltage").style.display='none'
+ $("webtronics_frequency").style.display='none'
+ $("webtronics_voltageamplitude").style.display='none'
+ $("webtronics_delaytime").style.display='none'
+ $("webtronics_dampingfactor").style.display='none'
+
+
+
+ $("webtronics_eval1").style.display='none'
+ $("webtronics_eval2").style.display='none'
+ $("webtronics_eval3").style.display='none'
+ $("webtronics_eval4").style.display='none'
+ $("webtronics_eval5").style.display='none'
+ $("webtronics_eval6").style.display='none'
+
+ $("webtronics_pulval1").style.display='none'
+ $("webtronics_pulval2").style.display='none'
+ $("webtronics_pulval3").style.display='none'
+ $("webtronics_pulval4").style.display='none'
+ $("webtronics_pulval5").style.display='none'
+ $("webtronics_pulval6").style.display='none'
+ $("webtronics_pulval7").style.display='none'
+
+
+ $("webtronics_pwlval1").style.display='block'
+ $("webtronics_pwlval2").style.display='block'
+ $("webtronics_pwlval3").style.display='block'
+ $("webtronics_pwlval4").style.display='block'
+ $("webtronics_pwlval5").style.display='block'
+ $("webtronics_pwlval6").style.display='block'
+ $("webtronics_pwlval7").style.display='block'
+ $("webtronics_pwlval8").style.display='block'
+
+ $("directive").style.display='none'
+ var pwlval1=netlistcreator.readwtx(this.circuit.selected[0],"pwlval1");
+ var pwlval2=netlistcreator.readwtx(this.circuit.selected[0],"pwlval2");
+ var pwlval3=netlistcreator.readwtx(this.circuit.selected[0],"pwlval3");
+ var pwlval4=netlistcreator.readwtx(this.circuit.selected[0],"pwlval4");
+ var pwlval5=netlistcreator.readwtx(this.circuit.selected[0],"pwlval5");
+ var pwlval6=netlistcreator.readwtx(this.circuit.selected[0],"pwlval6");
+ var pwlval7=netlistcreator.readwtx(this.circuit.selected[0],"pwlval7");
+ var pwlval8=netlistcreator.readwtx(this.circuit.selected[0],"pwlval8");
+ if(pwlval1!=""){$('webtronics_pwlval1_value').value=pwlval1;}
+ if(pwlval2!=""){$('webtronics_pwlval2_value').value=pwlval2;}
+ if(pwlval3!=""){$('webtronics_pwlval3_value').value=pwlval3;}
+ if(pwlval4!=""){$('webtronics_pwlval4_value').value=pwlval4;}
+ if(pwlval5!=""){$('webtronics_pwlval5_value').value=pwlval5;}
+ if(pwlval6!=""){$('webtronics_pwlval6_value').value=pwlval6;}
+ if(pwlval7!=""){$('webtronics_pwlval7_value').value=pwlval7;}
+ if(pwlval8!=""){$('webtronics_pwlval7_value').value=pwlval8;}
+
+ $("valuemodel").style.display='none'
+ }
+
+
+
+
+
+
+ else if(c=="scope"){
+ this.getvalues(this.circuit.selected[0]);
+ $("webtronics_print_dir_field").style.display='block'
+ $("webtronics_print_dir_value").value=netlistcreator.readwtx(this.circuit.selected[0],'measure');
+ $("directive").style.display='none'
+
+ $("webtronics_offsetvoltage").style.display='none'
+ $("webtronics_frequency").style.display='none'
+ $("webtronics_voltageamplitude").style.display='none'
+ $("webtronics_delaytime").style.display='none'
+ $("webtronics_dampingfactor").style.display='none'
+
+
+ $("webtronics_eval1").style.display='none'
+ $("webtronics_eval2").style.display='none'
+ $("webtronics_eval3").style.display='none'
+ $("webtronics_eval4").style.display='none'
+ $("webtronics_eval5").style.display='none'
+ $("webtronics_eval6").style.display='none'
+
+
+ $("webtronics_pwlval1").style.display='none'
+ $("webtronics_pwlval2").style.display='none'
+ $("webtronics_pwlval3").style.display='none'
+ $("webtronics_pwlval4").style.display='none'
+ $("webtronics_pwlval5").style.display='none'
+ $("webtronics_pwlval6").style.display='none'
+ $("webtronics_pwlval7").style.display='none'
+ $("webtronics_pwlval8").style.display='none'
+
+ $("webtronics_pulval1").style.display='none'
+ $("webtronics_pulval2").style.display='none'
+ $("webtronics_pulval3").style.display='none'
+ $("webtronics_pulval4").style.display='none'
+ $("webtronics_pulval5").style.display='none'
+ $("webtronics_pulval6").style.display='none'
+ $("webtronics_pulval7").style.display='none'
+
+ $("webtronics_amplitude").style.display='none'
+ $("webtronics_phase").style.display='none'
+ }
+ else {
+ this.getvalues(this.circuit.selected[0]);
+ $("directive").style.display='none'
+
+ $("webtronics_offsetvoltage").style.display='none'
+ $("webtronics_frequency").style.display='none'
+ $("webtronics_voltageamplitude").style.display='none'
+ $("webtronics_delaytime").style.display='none'
+ $("webtronics_dampingfactor").style.display='none'
+ $("valuemodel").style.display='block'
+
+ $("webtronics_amplitude").style.display='none'
+ $("webtronics_phase").style.display='none'
+
+
+ $("webtronics_eval1").style.display='none'
+ $("webtronics_eval2").style.display='none'
+ $("webtronics_eval3").style.display='none'
+ $("webtronics_eval4").style.display='none'
+ $("webtronics_eval5").style.display='none'
+ $("webtronics_eval6").style.display='none'
+
+
+ $("webtronics_pwlval1").style.display='none'
+ $("webtronics_pwlval2").style.display='none'
+ $("webtronics_pwlval3").style.display='none'
+ $("webtronics_pwlval4").style.display='none'
+ $("webtronics_pwlval5").style.display='none'
+ $("webtronics_pwlval6").style.display='none'
+ $("webtronics_pwlval7").style.display='none'
+ $("webtronics_pwlval8").style.display='none'
+
+
+ $("webtronics_pulval1").style.display='none'
+ $("webtronics_pulval2").style.display='none'
+ $("webtronics_pulval3").style.display='none'
+ $("webtronics_pulval4").style.display='none'
+ $("webtronics_pulval5").style.display='none'
+ $("webtronics_pulval6").style.display='none'
+ $("webtronics_pulval7").style.display='none'
+ var value=netlistcreator.readwtx(this.circuit.selected[0],"value");
if(value!=""){$('webtronics_part_value').value=value;}
+ }
-
+ if(c=="diode")$("directive").style.display='block'
+ var id=netlistcreator.readwtx(this.circuit.selected[0],"id");
- $("webtronics_part_dir_value").value=netlistcreator.readwtx(this.circuit.selected[0],'model');
-
- if(!netlistcreator.readwtx(webtronics.circuit.selected[0],"value")){
- $('webtronics_part_id').value=this.circuit.getnextid(this.circuit.selected[0],0);
- }
-
- this.disablepage();
- $('webtronics_properties_div').style.display = "block";
-
- },
-
- sanitize:function(xmldoc){
- var elems=xmldoc.getElementsByTagName('*');
- for(var i=0;i<elems.length;i++){
- if(!elems[i].tagName.match(this.Elist))return elems[i].tagName;
- var attr=elems[i].attributes;
- for(var j=0;j<attr.length;j++){
- if(!attr[j].name.match(this.Alist))return attr[j].name;
- if(attr[j].value.match(this.Vlist))return attr[j].value;
- }
- }
- },
- createfilemenu:function(x,y,id,parent,list){
- var menu=document.createElement('div');
- menu.id=id;
- menu.className='webtronics_menu';
- menu.style.left=x+'px';
- menu.style.top=y+'px';
- for(var i=0;i<list.length;i++){
- var item=new Element('a',{Title:list[i].label,id:'webtronics_context_option',class:'enabled'})
- .observe('click',list[i].cb.bind(this))
- .observe('contextmenu', Event.stop)
- .update(list[i].label);
- menu.insert(item);
- menu.insert(new Element('br'));
- }
- menu.observe('click',Event.stop)
- .observe('contextmenu',Event.stop);
- menu.style.display='none';
- return menu;
-
- },
- file_open:function(){
- var file=new Element('input',{'type':'file'});
- var div=new Element('div',{'class':'modal'}).insert(file);
- Event.observe(file,'change',function(){
- if(window.FileReader){
- var textReader = new FileReader();
- textReader.onloadend=function(){
- if(!textReader.result){
- console.log("error opening file");
- return;
- };
-
- var xmlDoc=this.docfromtext(textReader.result);
- if(!xmlDoc){alert("error parsing svg");}
- else{
- var result=this.sanitize(xmlDoc)
- if(result){console.log(result+ ' found');alert('unclean file');return;}
- var node=xmlDoc.getElementsByTagName('svg')[0];
- if(!node){alert("svg node not found")}
- else this.circuit.getfile(node);
- }
- }.bind(this);
- textReader.readAsText(file.files[0]);
- $('webtronics_main_window').removeChild(div);
- }
- }.bind(this));
- $('webtronics_main_window').insert(div);
- div.style.display='block';
- file.focus();
- file.click();
- $('webtronics_file_menu').style.display='none';
- div.style.display='none';
-
- },
+ if(id!=""){$('webtronics_part_id').value=id;}
- download:function(filename, data) {
- var pom = document.createElement('a');
- pom.setAttribute('href', data);
- pom.setAttribute('download', filename);
- document.body.appendChild(pom);
- pom.click();
- pom.parentNode.removeChild(pom);
- },
- saveuri:function(){
- var string="<?xml version='1.0' ?>\n";
- string+="<!--Created by webtronics 0.1-->\n";
- var doc=this.circuit.getDoc(true,false);
- string += (new XMLSerializer()).serializeToString(doc);
- this.download("webtronix.svg","data:application/octet-stream;charset=utf-8;base64," + encode64(string));
-
- $('webtronics_file_menu').style.display='none';
+ $("webtronics_part_dir_value").value=netlistcreator.readwtx(this.circuit.selected[0],'model');
- },
-
-
-
-
- file_new:function(){
- $('webtronics_file_menu').style.display='none';
+ if(!netlistcreator.readwtx(webtronics.circuit.selected[0],"value")){
+ $('webtronics_part_id').value=this.circuit.getnextid(this.circuit.selected[0],0);
+ }
+
+ this.disablepage();
+ $('webtronics_properties_div').style.display = "block";
+
+},
+
+sanitize:function(xmldoc){
+ var elems=xmldoc.getElementsByTagName('*');
+ for(var i=0;i<elems.length;i++){
+ if(!elems[i].tagName.match(this.Elist))return elems[i].tagName;
+ var attr=elems[i].attributes;
+ for(var j=0;j<attr.length;j++){
+ if(!attr[j].name.match(this.Alist))return attr[j].name;
+ if(attr[j].value.match(this.Vlist))return attr[j].value;
+ }
+ }
+},
+createfilemenu:function(x,y,id,parent,list){
+ var menu=document.createElement('div');
+ menu.id=id;
+ menu.className='webtronics_menu';
+ menu.style.left=x+'px';
+ menu.style.top=y+'px';
+ for(var i=0;i<list.length;i++){
+ var item=new Element('a',{Title:list[i].label,id:'webtronics_context_option',class:'enabled'})
+ .observe('click',list[i].cb.bind(this))
+ .observe('contextmenu', Event.stop)
+ .update(list[i].label);
+ menu.insert(item);
+ menu.insert(new Element('br'));
+ }
+ menu.observe('click',Event.stop)
+ .observe('contextmenu',Event.stop);
+ menu.style.display='none';
+ return menu;
+
+},
+
+file_open:function(){
+ var file=new Element('input',{'type':'file'});
+ var div=new Element('div',{'class':'modal'}).insert(file);
+ Event.observe(file,'change',function(){
+ if(window.FileReader){
+ var textReader = new FileReader();
+ textReader.onloadend=function(){
+ if(!textReader.result){
+ console.log("error opening file");
+ return;
+ };
+
+ var xmlDoc=this.docfromtext(textReader.result);
+ if(!xmlDoc){alert("error parsing svg");}
+ else{
+ var result=this.sanitize(xmlDoc)
+ if(result){console.log(result+ ' found');alert('unclean file');return;}
+ var node=xmlDoc.getElementsByTagName('svg')[0];
+ if(!node){alert("svg node not found")}
+ else this.circuit.getfile(node);
+ }
+ }.bind(this);
+ textReader.readAsText(file.files[0]);
+ $('webtronics_main_window').removeChild(div);
+ }
+ }.bind(this));
+ $('webtronics_main_window').insert(div);
+ div.style.display='block';
+ file.focus();
+ file.click();
+ $('webtronics_file_menu').style.display='none';
+ div.style.display='none';
+
+},
+
+download:function(filename, data) {
+ var pom = document.createElement('a');
+ pom.setAttribute('href', data);
+ pom.setAttribute('download', filename);
+ document.body.appendChild(pom);
+ pom.click();
+ pom.parentNode.removeChild(pom);
+},
+saveuri:function(){
+ var string="<?xml version='1.0' ?>\n";
+ string+="<!--Created by webtronics 0.1-->\n";
+ var doc=this.circuit.getDoc(true,false);
+ string += (new XMLSerializer()).serializeToString(doc);
+ this.download("webtronix.svg","data:application/octet-stream;charset=utf-8;base64," + encode64(string));
+
+ $('webtronics_file_menu').style.display='none';
+
+},
+
+
+
+
+file_new:function(){
+ $('webtronics_file_menu').style.display='none';
//this.setMode('webtronics_select','select','Selection');
input_box=confirm("Click OK to Clear the Drawing.");
if (input_box==true){
@@ -265,14 +628,14 @@ var webtronics={ var frame=new Element('iframe',{id:'webtronics_display_frame',src:'canvas/canvas.html'});
$('webtronics_diagram_area').insert(frame);
Event.observe(frame,'load',function(){
- var filename='Schematic.svg';
- this.attachframe(filename,frame);
-
- }.bind(this));
- $("webtronics_showhelp").checked=false;
- $$(".webtronics_help").forEach(function(e){
- e.style.display="none";
- });
+ var filename='Schematic.svg';
+ this.attachframe(filename,frame);
+
+ }.bind(this));
+ $("webtronics_showhelp").checked=false;
+ $$(".webtronics_help").forEach(function(e){
+ e.style.display="none";
+ });
$("webtronics_invert").checked=false;
$("webtronics_graph").checked=false;
$("webtronics_connections").checked=false;
@@ -291,20 +654,20 @@ var webtronics={ $('webtronics_context_menu').style.left=Event.pointerX(e)+'px';
if(this.circuit.mode =="select")$('webtronics_context_menu').style.display='block';
if(this.circuit.selected.length===1&& this.circuit.selected[0].tagName==='g'){
- $$('div#webtronics_context_menu [title=Properties]')[0].className='enabled';
- }
- else {
- $$('div#webtronics_context_menu [title=Properties]')[0].className='disabled';
- }
- Event.stop(e);
- }.bind(this));
+ $$('div#webtronics_context_menu [title=Properties]')[0].className='enabled';
+ }
+ else {
+ $$('div#webtronics_context_menu [title=Properties]')[0].className='disabled';
+ }
+ Event.stop(e);
+ }.bind(this));
Event.observe(this.circuit.container,'click',function(e){
if(Event.isLeftClick(e)){
- if($('webtronics_context_menu')){
- $('webtronics_context_menu').style.display='none';
- }
- }
- }.bind(this));
+ if($('webtronics_context_menu')){
+ $('webtronics_context_menu').style.display='none';
+ }
+ }
+ }.bind(this));
},
@@ -362,17 +725,17 @@ console.log(exception); },
*/
- savepng:function(){
+savepng:function(){
/*
if(navigator.appName == 'Microsoft Internet Explorer'){
$('webtronics_image_div').innerHTML="<img id='webtronics_image_save' >";
}
-*/
+ */
if(this.circuit.drawing.getAttribute('class')==="inv"){
- var doc=this.circuit.getDoc(true,true);
+ var doc=this.circuit.getDoc(true,true);
}
else{
- var doc=this.circuit.getDoc(true,false);
+ var doc=this.circuit.getDoc(true,false);
}
var svgsize=this.circuit.svgSize();
var canvas=new Element('canvas',{'id':'webtronics_canvas','width':svgsize.width-svgsize.x+20+'px','height':svgsize.height-svgsize.y+20+'px',style:"display:none"});
@@ -381,123 +744,123 @@ console.log(exception); ctx.drawSvg(doc, 0, 0, svgsize.width-svgsize.x+20,svgsize.height-svgsize.y+20);
var url= canvas.toDataURL("application/octet-stream");
- this.download("webtronix.png",url);
- canvas.parentNode.removeChild(canvas);
+ this.download("webtronix.png",url);
+ canvas.parentNode.removeChild(canvas);
},
addpart:function(url,cat,partname) {
- var listfile=function(partsvg){
- var part=new Element("div",{"id":"webtronics_"+partname,"class":"webtronics_menu_part",'style':"display:none",'title':partname})
- .update(partsvg);
- $("webtronics_"+cat).insert(part);
- Event.observe(part,'mousedown',function(e){
- var group=$$( "#"+ part.id+" g" )[0];
- webtronics.circuit.getgroup(group);
- webtronics.setMode('select','Selection');
- });
- Event.observe(part,'mouseup',function(e){
- webtronics.circuit.deleteSelection();
- });
-
-
- }
-
- if(url.indexOf("http://")==-1){
- openfile(url+'/'+cat+'/'+partname+'.svg',listfile);
-
- }
- else{
- new request(url,cat+"/"+partname+'.svg',listfile);
-
- }
-
- },
+ var listfile=function(partsvg){
+ var part=new Element("div",{"id":"webtronics_"+partname,"class":"webtronics_menu_part",'style':"display:none",'title':partname})
+ .update(partsvg);
+ $("webtronics_"+cat).insert(part);
+ Event.observe(part,'mousedown',function(e){
+ var group=$$( "#"+ part.id+" g" )[0];
+ webtronics.circuit.getgroup(group);
+ webtronics.setMode('select','Selection');
+ });
+ Event.observe(part,'mouseup',function(e){
+ webtronics.circuit.deleteSelection();
+ });
+
+
+ }
+
+ if(url.indexOf("http://")==-1){
+ openfile(url+'/'+cat+'/'+partname+'.svg',listfile);
+
+ }
+ else{
+ new request(url,cat+"/"+partname+'.svg',listfile);
+
+ }
+
+ },
+
-
//this takes an objectand returns a menu element
- makemenu:function(url, partlist,menu){
-
-
- for (var cat in partlist.parts){
- if(!$("webtronics_"+cat)){
- var category=new Element("div",{"id":"webtronics_"+cat})
- .insert(new Element("p").update(cat)
- .observe('click',function(e){
-
- var menuitems=$$('#'+menu.id+'>div>div');
-
- for(var i=0;i<menuitems.length;i++){
- if(menuitems[i].parentNode==Event.element(e).parentNode){
- if(menuitems[i].style.display=='none'){
- menuitems[i].style.display='block';
- }
- else{
- menuitems[i].style.display='none';
- }
- }
- else{
- menuitems[i].style.display='none';
- }
- }
- }));
- menu.insertBefore(category,menu.firstChild);
-
- for(var partname in partlist.parts[cat]){
- if(!$("webtronics_"+partname)){
- webtronics.addpart(url , cat,partname);
-
- }
+makemenu:function(url, partlist,menu){
+
+
+ for (var cat in partlist.parts){
+ if(!$("webtronics_"+cat)){
+ var category=new Element("div",{"id":"webtronics_"+cat})
+ .insert(new Element("p").update(cat)
+ .observe('click',function(e){
+
+ var menuitems=$$('#'+menu.id+'>div>div');
+
+ for(var i=0;i<menuitems.length;i++){
+ if(menuitems[i].parentNode==Event.element(e).parentNode){
+ if(menuitems[i].style.display=='none'){
+ menuitems[i].style.display='block';
+ }
+ else{
+ menuitems[i].style.display='none';
+ }
+ }
+ else{
+ menuitems[i].style.display='none';
+ }
+ }
+ }));
+ menu.insertBefore(category,menu.firstChild);
+
+ for(var partname in partlist.parts[cat]){
+ if(!$("webtronics_"+partname)){
+ webtronics.addpart(url , cat,partname);
+
+ }
//if(partlist.parts[cat][partname].indexOf()<0){}
- }
-
- }
+ }
- }
- },
- populatemenu:function(){
- /*asynchronous part loading */
- $("webtronics_parts_list").innerHTML="";
- webtronics.serverurls.each(function(url){
- if(url=="webtronix_server"){
- openfile(url+"/parts.json",function(text){
- webtronics.partslists.push(text.evalJSON(true));
- webtronics.partslists[webtronics.partslists.length-1].url=url;
- webtronics.makemenu(url,webtronics.partslists[webtronics.partslists.length-1] , $("webtronics_parts_list"));
- });
-
- }
- else{
- new request(url,"parts.json",function(text){
- webtronics.partslists.push(text.evalJSON(true));
- webtronics.partslists[webtronics.partslists.length-1].url=url;
- webtronics.makemenu(url,webtronics.partslists[webtronics.partslists.length-1] , $("webtronics_parts_list"));
- });
-
- }
- }.bind(this));
-
-
- },
-
- opensources:function(){
- var sources=$$(".webtronics_add_source_input");
- for( var i=0;i<sources.length;i++){
- if(webtronics.serverurls[i])sources[i].value=webtronics.serverurls[i];
- else sources[i].value="";
- }
- $("webtronics_add source").style.display="block";
- this.center($("webtronics_add source"));
- this.disablepage();
- },
-
- /*all events are loaded here*/
- init:function(){
- Event.observe(window, 'load', function(){
- if (!window.console) {
- window.console = {};
- window.console.log = function(){};
- }
-
- webtronics.setsize();
+ }
+
+ }
+ },
+ populatemenu:function(){
+ /*asynchronous part loading */
+ $("webtronics_parts_list").innerHTML="";
+ webtronics.serverurls.each(function(url){
+ if(url=="webtronix_server"){
+ openfile(url+"/parts.json",function(text){
+ webtronics.partslists.push(text.evalJSON(true));
+ webtronics.partslists[webtronics.partslists.length-1].url=url;
+ webtronics.makemenu(url,webtronics.partslists[webtronics.partslists.length-1] , $("webtronics_parts_list"));
+ });
+
+ }
+ else{
+ new request(url,"parts.json",function(text){
+ webtronics.partslists.push(text.evalJSON(true));
+ webtronics.partslists[webtronics.partslists.length-1].url=url;
+ webtronics.makemenu(url,webtronics.partslists[webtronics.partslists.length-1] , $("webtronics_parts_list"));
+ });
+
+ }
+ }.bind(this));
+
+
+ },
+
+ opensources:function(){
+ var sources=$$(".webtronics_add_source_input");
+ for( var i=0;i<sources.length;i++){
+ if(webtronics.serverurls[i])sources[i].value=webtronics.serverurls[i];
+ else sources[i].value="";
+ }
+ $("webtronics_add source").style.display="block";
+ this.center($("webtronics_add source"));
+ this.disablepage();
+ },
+
+ /*all events are loaded here*/
+ init:function(){
+ Event.observe(window, 'load', function(){
+ if (!window.console) {
+ window.console = {};
+ window.console.log = function(){};
+ }
+
+ webtronics.setsize();
// $('webtronics_scope_display_iframe').src="";
var menu;
$("webtronics_showhelp").checked=false;
@@ -506,21 +869,21 @@ console.log(exception); $("webtronics_connections").checked=false;
menu=this.createfilemenu($('webtronics_file').offsetLeft,
- $('webtronics_file').offsetTop+$('webtronics_file').offsetHeight,
- 'webtronics_file_menu',
- $('webtronics_main_window'),
- [{label:'sources',cb:webtronics.opensources},
- {label:'import',cb:webtronics.file_open},
- {label:'save',cb:webtronics.saveuri},
- {label:'kicad',cb:wtx2kicad},
- {label:'save-png',cb:webtronics.savepng},
- {label:'new',cb:webtronics.file_new}]);
+ $('webtronics_file').offsetTop+$('webtronics_file').offsetHeight,
+ 'webtronics_file_menu',
+ $('webtronics_main_window'),
+ [{label:'sources',cb:webtronics.opensources},
+ {label:'import',cb:webtronics.file_open},
+ {label:'save',cb:webtronics.saveuri},
+ {label:'kicad',cb:wtx2kicad},
+ {label:'save-png',cb:webtronics.savepng},
+ {label:'new',cb:webtronics.file_new}]);
menu.observe('mouseout',function(e){
- if((e.relatedTarget!=null)&&!((e.relatedTarget == menu) || e.relatedTarget.descendantOf(menu))){
+ if((e.relatedTarget!=null)&&!((e.relatedTarget == menu) || e.relatedTarget.descendantOf(menu))){
// if(!(e.relatedTarget == menu) ){
- menu.style.display='none';
- }
- });
+ menu.style.display='none';
+ }
+ });
$("webtronics_main_window").insertBefore(menu,$("webtronics_disable"));
@@ -528,124 +891,125 @@ console.log(exception); /*replace context menu*/
var myLinks = [
{label:'copy',cb:function(){
- webtronics.copy=webtronics.circuit.copy();
- $('webtronics_context_menu').style.display='none';
- }},
- {label:'paste',cb:function(){
- webtronics.circuit.paste(webtronics.copy);
- $('webtronics_context_menu').style.display='none';}},
-
- {label:'delete',cb:function(){
- webtronics.circuit.deleteSelection();
- $('webtronics_context_menu').style.display='none';}},
-
- {label:'Properties',cb:function(){
- webtronics.openProperties()
- webtronics.center($('webtronics_properties_div'));
- document.forms['webtronics_properties_form'].focus();
- $('webtronics_context_menu').style.display='none';
-
-
- }}];
- var contextmenu=this.createfilemenu(0,
- 0,
- 'webtronics_context_menu',
- $('webtronics_diagram_area'),
- myLinks);
- $("webtronics_diagram_area").insert(contextmenu);
- /*add a new frame */
- var frame=new Element('iframe',{id:'webtronics_display_frame',src:'canvas/canvas.html'});
- $('webtronics_diagram_area').insert(frame);
-
- Event.observe(frame,'load',function(){
- var filename='Schematic.svg';
- this.attachframe(filename,frame);
- }.bind(this));
-
- Event.observe(window, 'resize', function() {
- webtronics.setsize();
- webtronics.circuit.addtools();
- });
-
- $('webtronics_toolbar').onselectstart = function() {return false;}
-
- $('webtronics_diagram_area').onselectstart = function() {return false;}
- $('webtronics_side_bar').onselectstart = function() {return false;}
-
+ webtronics.copy=webtronics.circuit.copy();
+ $('webtronics_context_menu').style.display='none';
+ }},
+ {label:'paste',cb:function(){
+ webtronics.circuit.paste(webtronics.copy);
+ $('webtronics_context_menu').style.display='none';}},
+
+ {label:'delete',cb:function(){
+ webtronics.circuit.deleteSelection();
+ $('webtronics_context_menu').style.display='none';}},
+
+ {label:'Properties',cb:function(){
+ webtronics.openProperties()
+ webtronics.center($('webtronics_properties_div'));
+ document.forms['webtronics_properties_form'].focus();
+ $('webtronics_context_menu').style.display='none';
+
+
+ }}];
+ var contextmenu=this.createfilemenu(0,
+ 0,
+ 'webtronics_context_menu',
+ $('webtronics_diagram_area'),
+ myLinks);
+ $("webtronics_diagram_area").insert(contextmenu);
+ /*add a new frame */
+ var frame=new Element('iframe',{id:'webtronics_display_frame',src:'canvas/canvas.html'});
+ $('webtronics_diagram_area').insert(frame);
+
+ Event.observe(frame,'load',function(){
+ var filename='Schematic.svg';
+ this.attachframe(filename,frame);
+ }.bind(this));
+
+ Event.observe(window, 'resize', function() {
+ webtronics.setsize();
+ webtronics.circuit.addtools();
+ });
+
+ $('webtronics_toolbar').onselectstart = function() {return false;}
+
+ $('webtronics_diagram_area').onselectstart = function() {return false;}
+ $('webtronics_side_bar').onselectstart = function() {return false;}
+
//populate default menu
- webtronics.populatemenu();
+webtronics.populatemenu();
- /*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();
- });
+
+/*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<content.length;i++){
- $("webtronics_netlist_text_div").removeChild(content[i]);
- }
- $("webtronics_netlist_text_div").insert(webtronics.formatnetlist(netlist,null));
- $("webtronics_netlist_text").style.display='block';
- globalVariable=1;
- webtronics.center($('webtronics_netlist_text_div'));
- webtronics.disablepage();});
+ 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<content.length;i++){
+ $("webtronics_netlist_text_div").removeChild(content[i]);
+ }
+ $("webtronics_netlist_text_div").insert(webtronics.formatnetlist(netlist,null));
+ $("webtronics_netlist_text").style.display='block';
+ globalVariable=1;
+ webtronics.center($('webtronics_netlist_text_div'));
+ webtronics.disablepage();});
- jQuery('#webtronics_netlist_buttons').show();
-
+ jQuery('#webtronics_netlist_buttons').show();
-change_val = "0";
-Flag = "";
+
+
+ change_val = "0";
+ Flag = "";
//console.log("out")
-
+
if (change_val == "0")
{
Flag = jQuery("#webtronics_netlist_text_area").val();
-
+
/*-------------------------------------------------------------------------------------------------------------------------------------
Here are the conditions concatenated to give final netlist values for dc all cases
----------------------------------------------------------------------------------------------------------------------------------------------*/
- 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());
- }
-
+ ---------------------------------------------------------------------------------------------------------------------------------------------*/
+ 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;i<webtronics.partslists.length;i++){
- for(var j=0;j<webtronics.partslists[i].parts[cat][part].values[$('webtronics_part_model').value].length;j++){
- $("webtronics_part_dir_model").insert(new Element("option",{"value":webtronics.partslists[i].parts[cat][part].values[$('webtronics_part_model').value][j]}).update(webtronics.partslists[i].parts[cat][part].values[$('webtronics_part_model').value][j]));
- }
- }
- }
- $('webtronics_part_value').value=$("webtronics_part_model").options[$("webtronics_part_model").selectedIndex].value;
-
- });
-
- if($('webtronics_part_dir_model'))Event.observe($('webtronics_part_dir_model'),'change',function(){
- $('webtronics_part_dir_value').value=$("webtronics_part_dir_model").options[$("webtronics_part_dir_model").selectedIndex].value;
-
- });
+
+}
+
+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);
+ }
+
+
+ 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;i<webtronics.partslists.length;i++){
+ for(var j=0;j<webtronics.partslists[i].parts[cat][part].values[$('webtronics_part_model').value].length;j++){
+ $("webtronics_part_dir_model").insert(new Element("option",{"value":webtronics.partslists[i].parts[cat][part].values[$('webtronics_part_model').value][j]}).update(webtronics.partslists[i].parts[cat][part].values[$('webtronics_part_model').value][j]));
+ }
+ }
+ }
+ $('webtronics_part_value').value=$("webtronics_part_model").options[$("webtronics_part_model").selectedIndex].value;
+
+ });
+
+ if($('webtronics_part_dir_model'))Event.observe($('webtronics_part_dir_model'),'change',function(){
+ $('webtronics_part_dir_value').value=$("webtronics_part_dir_model").options[$("webtronics_part_dir_model").selectedIndex].value;
+
+ });
//**OPEN LOCAL SPICE MODELS EXPERIMENT
// if($("webtronics_part_file"))Event.observe($("webtronics_part_file"),'change',function(){
// console.log($("webtronics_part_file").files[0]);
@@ -932,165 +1338,166 @@ else if( change_val == "1") /*save as png modal*/
if($("webtronics_image_ok")){
- Event.observe($('webtronics_image_ok'), 'click', function() {
- webtronics.enablepage();
- $('webtronics_image').style.display='none';
- webtronics.setMode('select','Selection');
- });
-
-
- }
-
- /*chip box events*/
- Event.observe($('webtronics_vert_pins'), 'change', function() {
- $("webtronics_chip_display").parentNode.removeChild($("webtronics_chip_display"));
- var div=new Element("div",{id:"webtronics_chip_display"})
- .insert(chipmaker.drawchip($('webtronics_hor_pins').value,$('webtronics_vert_pins').value));
- $("webtronics_chips_box").insertBefore(div,$("webtronics_chips_box").firstChild);
- });
- Event.observe($('webtronics_hor_pins'), 'change', function() {
- $("webtronics_chip_display").parentNode.removeChild($("webtronics_chip_display"));
- var div=new Element("div",{id:"webtronics_chip_display"})
- .update(chipmaker.drawchip($('webtronics_hor_pins').value,$('webtronics_vert_pins').value));
- $("webtronics_chips_box").insertBefore(div,$("webtronics_chips_box").firstChild);
- });
-
- Event.observe($('webtronics_chip_spice_select'), 'change', function() {
- $("webtronics_chip_display").parentNode.removeChild($("webtronics_chip_display"));
- var div=new Element("div",{id:"webtronics_chip_display"})
- $("webtronics_chips_box").insertBefore(div,$("webtronics_chips_box").firstChild);
- $("webtronics_chip_spice").value=$('webtronics_chip_spice_select').value;
- if($('webtronics_chip_spice_select').value!="none"){
- openfile("symbols/predefined/"+$('webtronics_chip_spice_select').value+".svg",function(svg){
- div.update(svg);
- var model=$("webtronics_chip_display").getElementsByTagName("g")[0];
- netlistcreator.writewtx(model,"value",$('webtronics_chip_spice_select').value);
- netlistcreator.writewtx(model,"model",webtronics.models[$('webtronics_chip_spice_select').value]);
- });
- }
- });
-
-
- Event.observe($('webtronics_chip_ok'), 'click', function() {
- webtronics.enablepage()
- webtronics.returnchip();
+ Event.observe($('webtronics_image_ok'), 'click', function() {
+ webtronics.enablepage();
+ $('webtronics_image').style.display='none';
+ webtronics.setMode('select','Selection');
+ });
+
+
+ }
+
+ /*chip box events*/
+ Event.observe($('webtronics_vert_pins'), 'change', function() {
+ $("webtronics_chip_display").parentNode.removeChild($("webtronics_chip_display"));
+ var div=new Element("div",{id:"webtronics_chip_display"})
+ .insert(chipmaker.drawchip($('webtronics_hor_pins').value,$('webtronics_vert_pins').value));
+ $("webtronics_chips_box").insertBefore(div,$("webtronics_chips_box").firstChild);
+ });
+ Event.observe($('webtronics_hor_pins'), 'change', function() {
+ $("webtronics_chip_display").parentNode.removeChild($("webtronics_chip_display"));
+ var div=new Element("div",{id:"webtronics_chip_display"})
+ .update(chipmaker.drawchip($('webtronics_hor_pins').value,$('webtronics_vert_pins').value));
+ $("webtronics_chips_box").insertBefore(div,$("webtronics_chips_box").firstChild);
+ });
+
+ Event.observe($('webtronics_chip_spice_select'), 'change', function() {
+ $("webtronics_chip_display").parentNode.removeChild($("webtronics_chip_display"));
+ var div=new Element("div",{id:"webtronics_chip_display"})
+ $("webtronics_chips_box").insertBefore(div,$("webtronics_chips_box").firstChild);
+ $("webtronics_chip_spice").value=$('webtronics_chip_spice_select').value;
+ if($('webtronics_chip_spice_select').value!="none"){
+ openfile("symbols/predefined/"+$('webtronics_chip_spice_select').value+".svg",function(svg){
+ div.update(svg);
+ var model=$("webtronics_chip_display").getElementsByTagName("g")[0];
+ netlistcreator.writewtx(model,"value",$('webtronics_chip_spice_select').value);
+ netlistcreator.writewtx(model,"model",webtronics.models[$('webtronics_chip_spice_select').value]);
+ });
+ }
+ });
+
+
+ Event.observe($('webtronics_chip_ok'), 'click', function() {
+ webtronics.enablepage()
+ webtronics.returnchip();
//chipmaker.clear();
});
- Event.observe($('webtronics_chip_cancel'), 'click', function() {
- webtronics.enablepage();
- $('webtronics_chips_box').style.display='none';
- webtronics.setMode('select','Selection');
- });
- /*text add events*/
- if($("webtronics_text_ok")){
- Event.observe($('webtronics_text_ok'), 'click', function() {
- webtronics.circuit.addtext($('webtronics_comment').value);
- $('webtronics_add_text').style.display='none';
- webtronics.setMode('select','Selection');
- });
- }
- if($("webtronics_text_cancel")){
- Event.observe($('webtronics_text_cancel'), 'click', function() {
- webtronics.setMode('select','Selection');
- $('webtronics_add_text').style.display='none';
- });
- }
- /*netlist text events*/
- if($("webtronics_netlist_text_ok")){
- Event.observe($('webtronics_netlist_text_ok'), 'click', function() {
- webtronics.setMode('select','Selection');
- $('webtronics_netlist_text').style.display='none';
- webtronics.enablepage();
- });
- }
+ Event.observe($('webtronics_chip_cancel'), 'click', function() {
+ webtronics.enablepage();
+ $('webtronics_chips_box').style.display='none';
+ webtronics.setMode('select','Selection');
+ });
+ /*text add events*/
+ if($("webtronics_text_ok")){
+ Event.observe($('webtronics_text_ok'), 'click', function() {
+ webtronics.circuit.addtext($('webtronics_comment').value);
+ $('webtronics_add_text').style.display='none';
+ webtronics.setMode('select','Selection');
+ });
+ }
+ if($("webtronics_text_cancel")){
+ Event.observe($('webtronics_text_cancel'), 'click', function() {
+ webtronics.setMode('select','Selection');
+ $('webtronics_add_text').style.display='none';
+ });
+ }
+ /*netlist text events*/
+ if($("webtronics_netlist_text_ok")){
+ Event.observe($('webtronics_netlist_text_ok'), 'click', function() {
+ webtronics.setMode('select','Selection');
+ $('webtronics_netlist_text').style.display='none';
+ webtronics.enablepage();
+ });
+ }
- if($("webtronics_netlist_text_run")){
- Event.observe($('webtronics_netlist_text_run'), 'click', function() {
- webtronics.gnucapjs($("webtronics_netlist_text_area").value);
+
+ if($("webtronics_netlist_text_run")){
+ Event.observe($('webtronics_netlist_text_run'), 'click', function() {
+ webtronics.gnucapjs($("webtronics_netlist_text_area").value);
//$('webtronics_netlist_text').style.visibility='none';
//webtronics.enablepage();
});
- }
- /*scope events*/
- if($("webtronics_scope_display")){
- this.scopestatus=$("webtronics_scope_status");
- this.scopedata=$("webtronics_scope_data");
-
- $("webtronics_scope_output_graph").checked=true;
- Event.observe($("webtronics_scope_output_graph"),'click',function(){$("webtronics_scope_display_frame").contentWindow.displaygraph()});
- Event.observe($("webtronics_scope_output_log"),'click', function(){$("webtronics_scope_display_frame").contentWindow.displaylog()});
-
- Event.observe($('webtronics_scope_display_ok'), 'click', function() {
- webtronics.setMode('select','Selection');
- $('webtronics_scope_display').style.display='none';
- $('webtronics_scope_display_div').innerHTML="";
+ }
+ /*scope events*/
+ if($("webtronics_scope_display")){
+ this.scopestatus=$("webtronics_scope_status");
+ this.scopedata=$("webtronics_scope_data");
+
+ $("webtronics_scope_output_graph").checked=true;
+ Event.observe($("webtronics_scope_output_graph"),'click',function(){$("webtronics_scope_display_frame").contentWindow.displaygraph()});
+ Event.observe($("webtronics_scope_output_log"),'click', function(){$("webtronics_scope_display_frame").contentWindow.displaylog()});
+
+ Event.observe($('webtronics_scope_display_ok'), 'click', function() {
+ webtronics.setMode('select','Selection');
+ $('webtronics_scope_display').style.display='none';
+ $('webtronics_scope_display_div').innerHTML="";
// webtronics.enablepage();
});
- Event.observe($('webtronics_scope_display_stop'), 'click', function() {
- webtronics.setMode('select','Selection');
- $("webtronics_scope_display_frame").contentWindow.stopsimulation()
+ Event.observe($('webtronics_scope_display_stop'), 'click', function() {
+ webtronics.setMode('select','Selection');
+ $("webtronics_scope_display_frame").contentWindow.stopsimulation()
// $('webtronics_scope_display').style.display='none';
// $('webtronics_scope_display_div').innerHTML="";
// webtronics.enablepage();
});
-
-
-
- Event.observe($("webtronics_scope_display"),'mousedown',function(e){
- var startx=e.layerX;
- var starty=e.layerY;
- Event.observe($("webtronics_scope_display"),'mousemove',function(e){
- $("webtronics_scope_display").style.top =e.clientY-starty + 'px';
- $("webtronics_scope_display").style.left =e.clientX-startx + 'px';
- });
- e.preventDefault();
- });
- Event.observe($("webtronics_scope_display"),'mouseup',function(){
- Event.stopObserving($("webtronics_scope_display"),'mousemove');
- });
-
- }
-
-
-
- /*text open events*/
- Event.observe($('webtronics_open_text_ok'), 'click', function() {
- $('webtronics_open_text').style.display='none';
- });
- Event.observe($('webtronics_open_text_cancel'), 'click', function() {
- webtronics.setMode('select','Selection');
-
- $('webtronics_open_text').style.display='none';
- });
+
+
+
+ Event.observe($("webtronics_scope_display"),'mousedown',function(e){
+ var startx=e.layerX;
+ var starty=e.layerY;
+ Event.observe($("webtronics_scope_display"),'mousemove',function(e){
+ $("webtronics_scope_display").style.top =e.clientY-starty + 'px';
+ $("webtronics_scope_display").style.left =e.clientX-startx + 'px';
+ });
+ e.preventDefault();
+ });
+ Event.observe($("webtronics_scope_display"),'mouseup',function(){
+ Event.stopObserving($("webtronics_scope_display"),'mousemove');
+ });
+
+ }
+
+
+
+ /*text open events*/
+ Event.observe($('webtronics_open_text_ok'), 'click', function() {
+ $('webtronics_open_text').style.display='none';
+ });
+ Event.observe($('webtronics_open_text_cancel'), 'click', function() {
+ webtronics.setMode('select','Selection');
+
+ $('webtronics_open_text').style.display='none';
+ });
//sources events
Event.observe($('webtronics_add source_ok'), 'click', function() {
- var sources=$$(".webtronics_add_source_input");
- var addresses=[]
- for( var i=0;i<sources.length;i++){
- if(sources[i].value.match(/.*/)!=-1)addresses.push(sources[i].value);
- }
- webtronics.serverurls=addresses;
- webtronics.populatemenu();
- $('webtronics_add source').style.display='none';
- webtronics.enablepage();
- });
+ var sources=$$(".webtronics_add_source_input");
+ var addresses=[]
+ for( var i=0;i<sources.length;i++){
+ if(sources[i].value.match(/.*/)!=-1)addresses.push(sources[i].value);
+ }
+ webtronics.serverurls=addresses;
+ webtronics.populatemenu();
+ $('webtronics_add source').style.display='none';
+ webtronics.enablepage();
+ });
Event.observe($("webtronics_add_source_cancel"), 'click', function() {
- webtronics.setMode('select','Selection');
-
- $('webtronics_add source').style.display='none';
- webtronics.enablepage();
- });
+ webtronics.setMode('select','Selection');
+
+ $('webtronics_add source').style.display='none';
+ webtronics.enablepage();
+ });
}.bind(this));
-
- }
+
+}
}
webtronics.init();
diff --git a/views/script/netlist.js b/views/script/netlist.js index c3a686f..72766c2 100644 --- a/views/script/netlist.js +++ b/views/script/netlist.js @@ -1,160 +1,163 @@ var netlistcreator={ -matrixxform:function(point,matrix){ - var pin=webtronics.circuit.svgRoot.createSVGPoint(); - pin.x=point.x; - pin.y=point.y; - pin=pin.matrixTransform(matrix); - return {x:Math.round(pin.x),y:Math.round(pin.y)}; -}, - -/*tests if 2 point are within 3 pixels of each other*/ -ispoint:function(point1,point2){ - return (Math.abs(point2.x-point1.x)<3)&&(Math.abs(point2.y-point1.y)<3); -}, - -sortnetlist:function(list){ - var G=[]; - var A=[]; - var B=[]; - var C=[]; - var D=[]; - var I=[]; - var J=[]; - var K=[]; - var L=[]; - var M=[]; - var N=[]; - var P=[]; - var Q=[]; - var R=[]; - var U=[]; - var V=[]; - var wire=[]; - var other=[] - for(var i=0;i<list.length;i++){ - if(list[i].type=='gnd'){ - G.push(list[i]); - } - else if(list[i].type=='v'){ - V.push(list[i]); - } - else if(list[i].type=='wire'){ - wire.push(list[i]); - } - else if(list[i].type=='b'){ - B.push(list[i]); - } - else if(list[i].type=='c'){ - C.push(list[i]); - } - else if(list[i].type=='d'){ - D.push(list[i]); - } - else if(list[i].type=='i'){ - J.push(list[i]); - } - else if(list[i].type=='j'){ - J.push(list[i]); - } - else if(list[i].type=='k'){ - K.push(list[i]); - } - else if(list[i].type=='l'){ - L.push(list[i]); - } - else if(list[i].type=='m'){ - M.push(list[i]); - } - else if(list[i].type=='n'){ - N.push(list[i]); - } - else if(list[i].type=='plot'){ - P.push(list[i]); - } - else if(list[i].type=='q'){ - Q.push(list[i]); - } - else if(list[i].type=='r'){ - R.push(list[i]); - } - else if(list[i].type=='u'){ - U.push(list[i]); - } - /* this is the best way I could think to tell if a part i digital */ - else if(list[i].category=="digital"){ - A.push(list[i]); - } - else { - list[i].error='unknown device'; - other.push(list[i]); + matrixxform:function(point,matrix){ + var pin=webtronics.circuit.svgRoot.createSVGPoint(); + pin.x=point.x; + pin.y=point.y; + pin=pin.matrixTransform(matrix); + return {x:Math.round(pin.x),y:Math.round(pin.y)}; + }, + + /*tests if 2 point are within 3 pixels of each other*/ + ispoint:function(point1,point2){ + return (Math.abs(point2.x-point1.x)<3)&&(Math.abs(point2.y-point1.y)<3); + }, + + sortnetlist:function(list){ + var G=[]; + var S=[]; + var A=[]; + var B=[]; + var C=[]; + var D=[]; + var I=[]; + var J=[]; + var K=[]; + var L=[]; + var M=[]; + var N=[]; + var P=[]; + var Q=[]; + var R=[]; + var U=[]; + var V=[]; + var wire=[]; + var other=[] + for(var i=0;i<list.length;i++){ + if(list[i].type=='gnd'){ + G.push(list[i]); + } + else if(list[i].type=='v'){ + V.push(list[i]); + } + else if(list[i].type=='wire'){ + wire.push(list[i]); + } + else if(list[i].type=='b'){ + B.push(list[i]); + } + else if(list[i].type=='c'){ + C.push(list[i]); + } + else if(list[i].type=='d'){ + D.push(list[i]); + } + else if(list[i].type=='i'){ + J.push(list[i]); + } + else if(list[i].type=='j'){ + J.push(list[i]); + } + else if(list[i].type=='k'){ + K.push(list[i]); + } + else if(list[i].type=='l'){ + L.push(list[i]); + } + else if(list[i].type=='m'){ + M.push(list[i]); + } + else if(list[i].type=='n'){ + N.push(list[i]); + } + else if(list[i].type=='plot'){ + P.push(list[i]); + } + else if(list[i].type=='q'){ + Q.push(list[i]); + } + else if(list[i].type=='r'){ + R.push(list[i]); + } + else if(list[i].type=='u'){ + U.push(list[i]); + } + /* this is the best way I could think to tell if a part i digital */ + else if(list[i].category=="digital"){ + A.push(list[i]); + } + else { + list[i].error='unknown device'; + other.push(list[i]); + } } - } - - var sortfunction=function(a,b){ - var apart=a.id.replace(a.type,""); - var bpart=b.id.replace(b.type,""); - if(!apart)apart=0; - if(!bpart)bpart=0; - return (apart>bpart); - }; - 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<list.length;i++){ - if((list[i].type=="wire") || (list[i].type=="gnd")){ - for(var j=i;j<list.length;j++){ - if( (list[i]!=list[j]) && ((list[i].id==list[j].id) || (list[i].type=="gnd" && list[j].type=="gnd")) ){ - var line= webtronics.circuit.createline('yellow',1,list[i]['analogpins'][0]['x'],list[i]['analogpins'][0]['y'],list[j]['analogpins'][0]['x'],list[j]['analogpins'][0]['y']); - line.setAttributeNS(null,'class','webtronics_namewire_connector'); - webtronics.circuit.info.appendChild(line); + var sortfunction=function(a,b){ + var apart=a.id.replace(a.type,""); + var bpart=b.id.replace(b.type,""); + if(!apart)apart=0; + if(!bpart)bpart=0; + return (apart>bpart); + }; + 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<list.length;i++){ + if((list[i].type=="wire") || (list[i].type=="gnd")){ + for(var j=i;j<list.length;j++){ + if( (list[i]!=list[j]) && ((list[i].id==list[j].id) || (list[i].type=="gnd" && list[j].type=="gnd")) ){ + var line= webtronics.circuit.createline('yellow',1,list[i]['analogpins'][0]['x'],list[i]['analogpins'][0]['y'],list[j]['analogpins'][0]['x'],list[j]['analogpins'][0]['y']); + line.setAttributeNS(null,'class','webtronics_namewire_connector'); + webtronics.circuit.info.appendChild(line); //console.log(line); break; } - } - } - } +} +} +} }, /*check for vectors and convert them*/ @@ -163,7 +166,7 @@ tovector:function(pin,nodenumber){ if(pin.parentNode.tagName=="wtx:vector"){ var vector=Element.descendants(pin.parentNode); if(pin==vector[0]){v+="["} - v+="a"+nodenumber; + v+="a"+nodenumber; if(pin==vector[vector.length-1]){v+="]";} } else{ @@ -192,76 +195,213 @@ tovector:function(pin,nodenumber){ */ -getwtxdata:function(parts){ + getwtxdata:function(parts){ list=[]; for(var i=0;i<parts.length;i++){ - var part={error:"", elem:{}, analogpins:[],digitalpins:[],type:"", name:"", category:"", value:"", spice:"", model:"",measure:""} + var part={error:"", elem:{}, analogpins:[],digitalpins:[],amplitude:"",phase:"",offsetvoltage:"",voltageamplitude:"",frequency:"",delaytime:"",dampingfactor:"",type:"", name:"", category:"", value:"", spice:"", model:"",measure:"", + pulval1:"",pulval2:"",pulval3:"",pulval4:"",pulval5:"",pulval6:"",pulval7:"",eval1:"",eval2:"",eval3:"",eval4:"",eval5:"",eval6:"", pwlval1:"",pwlval2:"",pwlval3:"",pwlval4:"",pwlval5:"",pwlval6:"",pwlval7:"",pwlval8:"" + } /* * try{ * part.nodes=this.getwtxpins(part[i]); } catch{part.error="wtx:pins not found"} */ - part.elem=parts[i]; - - try{ - var category=webtronics.circuit.getwtxtagname(parts[i],"analog")[0]; - var nodes = webtronics.circuit.getwtxtagname(category,"node"); - for(var j=0;j<nodes.length;j++){ - var point = this.matrixxform( {x:webtronics.circuit.getwtxattribute(nodes[j],"x"),y:webtronics.circuit.getwtxattribute(nodes[j],"y")},webtronics.circuit.parseMatrix(part.elem)); - part.analogpins.push({index:webtronics.circuit.getwtxattribute(nodes[j],"index"),x:point.x,y:point.y,node:undefined}) ; - } + part.elem=parts[i]; + + try{ + var category=webtronics.circuit.getwtxtagname(parts[i],"analog")[0]; + var nodes = webtronics.circuit.getwtxtagname(category,"node"); + for(var j=0;j<nodes.length;j++){ + var point = this.matrixxform( {x:webtronics.circuit.getwtxattribute(nodes[j],"x"),y:webtronics.circuit.getwtxattribute(nodes[j],"y")},webtronics.circuit.parseMatrix(part.elem)); + part.analogpins.push({index:webtronics.circuit.getwtxattribute(nodes[j],"index"),x:point.x,y:point.y,node:undefined}) ; + } //sort nodes int correct order part.analogpins.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 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<nodes.length;j++){ - 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;}); + 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<analogwires.length;j++){ var crossed=this.getconnected(digitalwires,analogwires[j]); if(crossed>-1){ @@ -284,13 +424,13 @@ getconnected:function(wirelist,wire){ for(var i=0;i<wirelist.length;i++){ for(var j=0;j<wirelist[i].length;j++){ for(var k=0;k<wire.length;k++){ - if(this.ispoint(wirelist[i][j],wire[k])){ - return i; - } - } - } - } - return -1; + if(this.ispoint(wirelist[i][j],wire[k])){ + return i; + } + } + } + } + return -1; }, //returns points connected by lines @@ -305,18 +445,18 @@ followwires:function(wires,pin){ var point2={x:lines[i].getAttribute('x2')-0,y:lines[i].getAttribute('y2')-0}; if(wires.indexOf(lines[i])<0){ if(this.ispoint(point1,pin)){ - wires.push(lines[i]); - var p=this.followwires(wires,point2); - for(var j=0;j<p.length;j++)points.push(p[j]); - } - else if(this.ispoint(point2,pin)){ - wires.push(lines[i]); - var p=this.followwires(wires,point1); - for(var j=0;j<p.length;j++)points.push(p[j]); - } - } - } - return points; + wires.push(lines[i]); + var p=this.followwires(wires,point2); + for(var j=0;j<p.length;j++)points.push(p[j]); + } + else if(this.ispoint(point2,pin)){ + wires.push(lines[i]); + var p=this.followwires(wires,point1); + for(var j=0;j<p.length;j++)points.push(p[j]); + } +} +} +return points; }, @@ -331,44 +471,44 @@ numberwires:function(parts){ if( parts[i].type=="gnd"){ if (analogpoints.length==0 ){ - var wire=this.followwires(null,{x:parts[i].analogpins[0]['x'],y:parts[i].analogpins[0]['y']}); - analogpoints.push(wire); + var wire=this.followwires(null,{x:parts[i].analogpins[0]['x'],y:parts[i].analogpins[0]['y']}); + analogpoints.push(wire); //add this node to thelist of digital wires - digitalpoints.push(wire); - } - parts[i].analogpins[0]["node"]=0; +digitalpoints.push(wire); +} +parts[i].analogpins[0]["node"]=0; // parts[i].digitalpins[0]["node"]=0; - continue; - } - if(parts[i].analogpins!=undefined){ - for(var j=0;j<parts[i].analogpins.length;j++){ - var wire=this.followwires(null,{x:parts[i].analogpins[j]['x'],y:parts[i].analogpins[j]['y']}); - var found=this.getconnected(analogpoints,wire); - if(found<0){ - analogpoints.push(wire); - parts[i].analogpins[j]["node"]=analogpoints.length-1; - } - else{ - parts[i].analogpins[j]["node"]=found; - } - } - } +continue; +} +if(parts[i].analogpins!=undefined){ + for(var j=0;j<parts[i].analogpins.length;j++){ + var wire=this.followwires(null,{x:parts[i].analogpins[j]['x'],y:parts[i].analogpins[j]['y']}); + var found=this.getconnected(analogpoints,wire); + if(found<0){ + analogpoints.push(wire); + parts[i].analogpins[j]["node"]=analogpoints.length-1; + } + else{ + parts[i].analogpins[j]["node"]=found; + } + } +} //digital node numbering loop if(parts[i].digitalpins!=undefined){ for(var j=0;j<parts[i].digitalpins.length;j++){ - var wire=this.followwires(null,{x:parts[i].digitalpins[j]['x'],y:parts[i].digitalpins[j]['y']}); - var found=this.getconnected(digitalpoints,wire); - if(found<0){ - digitalpoints.push(wire); - parts[i].digitalpins[j]["node"]=digitalpoints.length-1; - } - else{ - parts[i].digitalpins[j]["node"]=found; - } - } - } - } + var wire=this.followwires(null,{x:parts[i].digitalpins[j]['x'],y:parts[i].digitalpins[j]['y']}); + var found=this.getconnected(digitalpoints,wire); + if(found<0){ + digitalpoints.push(wire); + parts[i].digitalpins[j]["node"]=digitalpoints.length-1; + } + else{ + parts[i].digitalpins[j]["node"]=found; + } + } + } + } //returns true if digital and analog are mixed return this.mixedsignals(analogpoints,digitalpoints); } , @@ -386,38 +526,41 @@ getnodes:function(parts){ // check what type of simulation to use if(parts[i].type=='gnd' || parts[i].type=='wire')continue; if(parts[i].type=="plot"){ - if(sections.simulation.length==0){ - sections.simulation.push(".op"); - sections.simulation.push(".print tran"); - } - if(sections.simulation[1] !=undefined && sections.simulation[1].match(/\.print\sac/g)==null){ - sections.simulation[1]+=" v("+parts[i].analogpins[0]["node"]+")"; - sections.simulation[1]+=" "+parts[i].measure; - if(parts[i].model)sections.simulation.push(parts[i].model); - } - - - } - else{ - if(parts[i].type=="v"){ - if(sections.simulation.length==0 && parts[i].model.length){ - sections.simulation.push(".op"); - sections.simulation.push(".print ac "+parts[i].measure); - sections.simulation.push(parts[i].model); - } - } - else if(parts[i].type=="l"){ - if(parts[i].model.length){ - sections.coupling.push(parts[i].model); - } - } - else{ - if(parts[i].model.match(/\.mod/i) && !parts[i].id.match(/^x/))parts[i].id="x"+parts[i].id; - if(parts[i].model.length)sections.firstdir.push(parts[i].model); - - } + if(sections.simulation.length==0){ + sections.simulation.push(".op"); + sections.simulation.push(".print tran"); + } + if(sections.simulation[1] !=undefined && sections.simulation[1].match(/\.print\sac/g)==null){ + sections.simulation[1]+=" v("+parts[i].analogpins[0]["node"]+")"; + sections.simulation[1]+=" "+parts[i].measure; + if(parts[i].model)sections.simulation.push(parts[i].model); + } + + + } + else{ + if(parts[i].type=="v"){ + if(sections.simulation.length==0 && parts[i].model.length){ + sections.simulation.push(".op"); + sections.simulation.push(".print ac "+parts[i].measure); + sections.simulation.push(parts[i].model); + } + } + else if(parts[i].type=="l"){ + if(parts[i].model.length){ + sections.coupling.push(parts[i].model); + } + } + else{ + if(parts[i].model.match(/\.mod/i) && !parts[i].id.match(/^x/))parts[i].id="x"+parts[i].id; + if(parts[i].model.length)sections.firstdir.push(parts[i].model); + + } //create pins array - var net={error:parts[i].error,partid:parts[i].id,pins:{analog:parts[i].analogpins,digital:parts[i].digitalpins},model:parts[i].value}; + var net={error:parts[i].error,pwlval1:parts[i].pwlval1,pwlval2:parts[i].pwlval2,pwlval3:parts[i].pwlval3,pwlval4:parts[i].pwlval4,pwlval5:parts[i].pwlval5,pwlval6:parts[i].pwlval6,pwlval7:parts[i].pwlval7,pwlval8:parts[i].pwlval8,pulval1:parts[i].pulval1,pulval2:parts[i].pulval2,pulval3:parts[i].pulval3,pulval4:parts[i].pulval4,pulval5:parts[i].pulval5,pulval6:parts[i].pulval6,pulval7:parts[i].pulval7,name:parts[i].name, + partid:parts[i].id,pins:{analog:parts[i].analogpins,digital:parts[i].digitalpins},model:parts[i].value,amplitude:parts[i].amplitude, + phase:parts[i].phase,offsetvoltage:parts[i].offsetvoltage,voltageamplitude:parts[i].voltageamplitude,frequency:parts[i].frequency, + delaytime:parts[i].delaytime,dampingfactor:parts[i].dampingfactor,eval1:parts[i].eval1,eval2:parts[i].eval2,eval3:parts[i].eval3,eval4:parts[i].eval4,eval5:parts[i].eval5,eval6:parts[i].eval6}; if(net!=null)sections.netlist.push(net); } @@ -428,18 +571,18 @@ getnodes:function(parts){ /* organizes data into netlist*/ createnetlist:function(responsefunc){ - + var parts=webtronics.circuit.getwithselector('#webtronics_drawing > 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<sections.netlist.length;i++){ if(sections.netlist[i].error!=""){ - spice+=sections.netlist[i].error+'\n'; - continue; - } - command=sections.netlist[i].partid; - var pins=[]; - for(var j=0;j<sections.netlist[i].pins['analog'].length;j++)pins.push(sections.netlist[i].pins['analog'][j]); + spice+=sections.netlist[i].error+'\n'; + continue; + } + command=sections.netlist[i].partid; + var pins=[]; + for(var j=0;j<sections.netlist[i].pins['analog'].length;j++)pins.push(sections.netlist[i].pins['analog'][j]); for(var j=0;j<sections.netlist[i].pins['digital'].length;j++)pins.push(sections.netlist[i].pins['digital'][j]); - pins.sort(function(a,b){return a.index > 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<pins.length;j++){command += " "+pins[j].node;} +for(var j=0;j<pins.length;j++){command += " "+pins[j].node;} + + if(sections.netlist[i].name=="ac"){ + command+=" "+"AC "+sections.netlist[i].amplitude+" "+sections.netlist[i].phase; + }else if(sections.netlist[i].name=="sinvoltagesource"){ + command+=" "+"SIN ("+sections.netlist[i].offsetvoltage+" "+sections.netlist[i].voltageamplitude+" "+sections.netlist[i].frequency+" "+sections.netlist[i].delaytime+" "+sections.netlist[i].dampingfactor+")"; + }else if(sections.netlist[i].name=="battery"){ + command+=" "+"DC "+sections.netlist[i].model; +}else if(sections.netlist[i].name=="current"){ + command+=" "+"dc "+sections.netlist[i].model; +}else if(sections.netlist[i].name=="pulse"){ + command+=" "+"PULSE ("+sections.netlist[i].pulval1+" "+sections.netlist[i].pulval2+" "+sections.netlist[i].pulval3+" "+sections.netlist[i].pulval4+" "+sections.netlist[i].pulval5+" "+sections.netlist[i].pulval6+" "+sections.netlist[i].pulval7+")"; +} +else if(sections.netlist[i].name=="pwl"){ + command+=" "+"PWL ("+sections.netlist[i].pwlval1+" "+sections.netlist[i].pwlval2+" "+sections.netlist[i].pwlval3+" "+sections.netlist[i].pwlval4+" "+sections.netlist[i].pwlval5+" "+sections.netlist[i].pwlval6+" "+sections.netlist[i].pwlval7+" "+sections.netlist[i].pwlval8+")"; +} +else if(sections.netlist[i].name=="exponential"){ + command+=" "+"EXP ("+sections.netlist[i].eval1+" "+sections.netlist[i].eval2+" "+sections.netlist[i].eval3+" "+sections.netlist[i].eval4+" "+sections.netlist[i].eval5+" "+sections.netlist[i].eval6+")"; +} +else{ + command+=" "+sections.netlist[i].model; +} +if(command!="")spice+=command+'\n'; +} +} - command+=" "+sections.netlist[i].model; - - if(command!="")spice+=command+'\n'; - } +if(sections.coupling.length){ + for(var i=0;i<sections.coupling.length;i++){ + spice+=sections.coupling[i]+'\n'; } - - if(sections.coupling.length){ - for(var i=0;i<sections.coupling.length;i++){ - spice+=sections.coupling[i]+'\n'; - } - } - - - var modelloader={ - modeltext:"", - modelcount:0, - download:function(name){ - var found=false; - for( var i=0;i<webtronics.partslists.length;i++){ - - if(JSON.stringify(webtronics.partslists[i]).indexOf(name)!=-1){ - found=true; +} + + +var modelloader={ + modeltext:"", + modelcount:0, + download:function(name){ + var found=false; + for( var i=0;i<webtronics.partslists.length;i++){ + + if(JSON.stringify(webtronics.partslists[i]).indexOf(name)!=-1){ + found=true; if(webtronics.partslists[i].url.indexOf("http://")==-1){//see if path is local - openfile( webtronics.partslists[i].url+"/spice/"+ name,this.responder); - } - else{ - server.requestfile(list.url,this.responder); - } - break; - this.modelcount++; - } - - } - if(!found)console.log("model not found"); + openfile( webtronics.partslists[i].url+"/spice/"+ name,this.responder); + } + else{ + server.requestfile(list.url,this.responder); + } + break; + this.modelcount++; + } + + } + if(!found)console.log("model not found"); }, finish:function(){ spice+=modelloader.modeltext; if(sections.simulation.length){ - for(var i=0;i<sections.simulation.length;i++){ - if(sections.simulation[i]!="")spice+=sections.simulation[i]+"\n"; - } + for(var i=0;i<sections.simulation.length;i++){ + if(sections.simulation[i]!="")spice+=sections.simulation[i]+"\n"; + } + } + if(sections.lastdir.length){ + sections.lastdir=sections.lastdir.uniq(); + for(var i=0;i<sections.lastdir.length;i++){ + if(sections.lastdir[i]!="")spice+=sections.lastdir[i]+"\n"; } - if(sections.lastdir.length){ - sections.lastdir=sections.lastdir.uniq(); - for(var i=0;i<sections.lastdir.length;i++){ - if(sections.lastdir[i]!="")spice+=sections.lastdir[i]+"\n"; - } - } - responsefunc(spice); - }, - - responder:function(text){ - console.log("reponded"); - modelloader.modeltext+=text; - if(!modelloader.modelcount){ - modelloader.finish(); - spice=spice.concat(".end \n"); - - } } + responsefunc(spice); + }, + + responder:function(text){ + console.log("reponded"); + modelloader.modeltext+=text; + if(!modelloader.modelcount){ + modelloader.finish(); + spice=spice.concat(".end \n"); + + } } - - - if(sections.firstdir.length){ - sections.firstdir=sections.firstdir.uniq(); - - for(var i=0;i<sections.firstdir.length;i++){ +} + + +if(sections.firstdir.length){ + sections.firstdir=sections.firstdir.uniq(); + + for(var i=0;i<sections.firstdir.length;i++){ // console.log(sections.firstdir[i]); - - if(sections.firstdir[i].length){ +if(sections.firstdir[i].length){ + + + + modelloader.download(sections.firstdir[i],sections,webtronics.partslists); +} +} +} +else modelloader.finish(); +var connector=webtronics.circuit.getwithselector('#information > .webtronics_namewire_connector') +for(var i=0;i<connector.length;i++)connector[i].parentNode.removeChild(connector[i]); - modelloader.download(sections.firstdir[i],sections,webtronics.partslists); - } - } - } - else modelloader.finish(); - var connector=webtronics.circuit.getwithselector('#information > .webtronics_namewire_connector') - for(var i=0;i<connector.length;i++)connector[i].parentNode.removeChild(connector[i]); - - }, @@ -558,7 +719,7 @@ createnetlist:function(responsefunc){ writeconnects:function(pins){ - + var str=[]; for(var i=0;i<pins.length;i++){ @@ -569,38 +730,38 @@ writeconnects:function(pins){ getconnects:function(elem){ - var pins=[]; - var nodes = this.getwtxtagname(elem,"node"); - for(var j=0;j<nodes.length;j++){ + var pins=[]; + var nodes = this.getwtxtagname(elem,"node"); + for(var j=0;j<nodes.length;j++){ // console.log(nodes[j]); // console.log(this.parseMatrix(elem)); - var point = this.matrixxform( {x:this.getwtxattribute(nodes[j],"x"),y:this.getwtxattribute(nodes[j],"y")},this.parseMatrix(elem)); - pins.push({x:point.x,y:point.y}) ; - } +var point = this.matrixxform( {x:this.getwtxattribute(nodes[j],"x"),y:this.getwtxattribute(nodes[j],"y")},this.parseMatrix(elem)); +pins.push({x:point.x,y:point.y}) ; +} //sort nodes int correct order - return pins; -}, + return pins; + }, -isconnect:function(pin,radius,x,y){ - return (Math.abs(pin.x-x)<3)&&(Math.abs(pin.y-y)<3); -}, + isconnect:function(pin,radius,x,y){ + return (Math.abs(pin.x-x)<3)&&(Math.abs(pin.y-y)<3); + }, -isconnects:function(parts,radius,x,y){ - - for(var i=0; i<parts.length; i++){ - if(parts[i].tagName =='g'){ - var pins=this.getconnects(parts[i]); - if(pins){ - for(var j=0;j<pins.length;j++){ - if(this.isconnect(pins[j],radius,x,y)){ - return pins[j]; - } - } - } - } - } - return null; -}, + isconnects:function(parts,radius,x,y){ + + for(var i=0; i<parts.length; i++){ + if(parts[i].tagName =='g'){ + var pins=this.getconnects(parts[i]); + if(pins){ + for(var j=0;j<pins.length;j++){ + if(this.isconnect(pins[j],radius,x,y)){ + return pins[j]; + } + } + } + } + } + return null; + }, //get the number by part id and leg getnodenumber:function(name, leg){ @@ -616,8 +777,8 @@ getnodenumber:function(name, leg){ return -1 }, getwtxtagname:function(elem,tagname){ - - + + var tag=elem.getElementsByTagName("wtx:"+tagname); if(!tag.length){ tag=elem.getElementsByTagName(tagname); diff --git a/views/script/savenetlist.js b/views/script/savenetlist.js index 33898bb..b5ead3c 100644 --- a/views/script/savenetlist.js +++ b/views/script/savenetlist.js @@ -7,10 +7,10 @@ For Simulation of Netlist and Removal of netlist Window jQuery("#webtronics_netlist_simulate").click(function(){ socket.emit('netlist', jQuery("#webtronics_netlist_text_area").val()); console.log("simulation button clicked"); - jQuery('#webtronics_netlist_text_div').hide(); - jQuery('#webtronics_netlist_buttons').hide(); - jQuery('#webtronics_netlist_text').hide(); - jQuery('#webtronics_disable').hide(); + // jQuery('#webtronics_netlist_text_div').hide(); + // jQuery('#webtronics_netlist_buttons').hide(); + // jQuery('#webtronics_netlist_text').hide(); + // jQuery('#webtronics_disable').hide(); diff --git a/views/script/schematic.js b/views/script/schematic.js index ab611ee..1d064df 100644 --- a/views/script/schematic.js +++ b/views/script/schematic.js @@ -106,6 +106,7 @@ Schematic.prototype.getwithselector=function(selector){ Schematic.prototype.getnextid=function(elem,count){
var type=this.readwtx(elem,"type");
+ if(type=="gnd")return "gnd";// to make universal id gnd for ground
if(!count)count=1;
var newid=type+count
var parts=this.drawing.getElementsByTagName("g");
@@ -699,8 +700,7 @@ Schematic.prototype.createvalue=function(elem){ }
$(label).appendChild(idspan);
$(label).appendChild(valuespan);
- $(label).appendChild(tempspan);
- }
+ }
else{
var text=this.createtext("",'black',0,0-this.fontsize);
this.drawing.appendChild(text);
diff --git a/views/style/schematic.css b/views/style/schematic.css index 1a3f93f..031ef32 100644 --- a/views/style/schematic.css +++ b/views/style/schematic.css @@ -331,7 +331,7 @@ float:left; clear:right; } -div#webtronics_status_bar{ +div#webtronics_footer{ float:left; width:100%; height:auto ; diff --git a/views/webtronix_server/parts.json b/views/webtronix_server/parts.json index 8ae516d..cd05bfa 100644 --- a/views/webtronix_server/parts.json +++ b/views/webtronix_server/parts.json @@ -119,20 +119,17 @@ "diode":{ "values":{ - "1n4148":["models.lib"], - "1n4007":["models.lib"], - "1n34a":["models.lib"], - "1n5711":["models.lib"] + "1n4148":["1n4148.lib"], + "1n4007":["1n4007.lib"], + "1n34a":["1n34a.lib"], + "1n5711":["1n5711.lib"] }, "help":"dx a k model\na=anode\nk=kathode" }, - "led":{}, - "photodiode":{}, "scr":{}, "triac":{}, - "trigger":{}, "zener":{} }, "switches":{ @@ -187,53 +184,45 @@ }, "power":{ + "pulse":{}, + "pwl":{}, + "exponential":{}, + + "sinvoltagesource":{ + "help":"SIN = sine wave source\nAC = AC frequency sweep", + "values":{ + } + + }, + + "current":{ "values":{ - "DC 1ma":[""], - "DC 10ma":[""], - "DC 100ma":[""], - "DC 1a":[""], - "SIN(0 1ma 1KHZ)":[""], - "SIN(0 10ma 1KHZ)":[""] + "1m":[""], + "10m":[""], + "100m":[""], + "1":[""] } }, "ac":{ - "help":"SIN = sine wave source\nAC = AC frequency sweep", - "values":{ - "SIN(0 5 1KHZ)":[""], - "SIN(0 12 60HZ)":[""], - "SIN(0 120 60HZ)":[""], - "PWL(0 0 10ns 0 10ns 5 20ns 5)R=0":[""], - "PULSE(0 1 0 0 0 2n 4n)":[""], - "SFFM( 0 1V 20K 5 1K)":[""], - "AC 1 SIN":[".ac lin 20 100 200 "] - + "help":"Amplitude= amplitude of wave \n phase = phase of wave", + "values":{ } }, + + "battery":{ "values":{ - "dc 5v":[""], - "dc 9v":[""], - "dc 12v":[""] + "5":[""], + "9":[""], + "12":[""] } }, "ground":{}, "namewire":{} - }, + } - - "test":{ - "scope":{ - "help":".TRAN step total \nstep = step size\ntotal = total length of time", - "values":{ - "tran":[".TRAN 1NS 100NS", - ".TRAN 1NS 1000NS 500NS", - ".TRAN 10NS 1US UIC", - ".TRAN 1ms 100ms"] - - } - } - } + }, "model":{ "555":["555.mod"] diff --git a/views/webtronix_server/power/ac.svg b/views/webtronix_server/power/ac.svg index 723fe11..db703bd 100644 --- a/views/webtronix_server/power/ac.svg +++ b/views/webtronix_server/power/ac.svg @@ -1,8 +1,12 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg id="svg2" xmlns="http://www.w3.org/2000/svg" width="60" height="40"> - <g id="v" stroke="#000" stroke-width="2px" connects="0,20;60,20" class="ac"> +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg width="60pt" height="40pt" version="1.1" xmlns="http://www.w3.org/2000/svg"> + +<g id="v" class="ac"> + + <metadata class="part" > -<wtx:part xmlns:wtx="/home/niel/Desktop/webtronics" > +<wtx:part xmlns:wtx="http://code.google.com/p/webtronics" > <wtx:pins> <wtx:analog> <wtx:node index="1" x="0" y="20"/> @@ -14,19 +18,21 @@ <wtx:name>ac</wtx:name> <wtx:category>power</wtx:category> <wtx:value></wtx:value> + <wtx:amplitude></wtx:amplitude> + <wtx:phase></wtx:phase> <wtx:label></wtx:label> <wtx:spice></wtx:spice> <wtx:flip></wtx:flip> <wtx:model></wtx:model> - <wtx:measure></wtx:measure> </wtx:part> </metadata> - <path id="path2816" fill="none" d="m50.381,19.923a20.203,19.698,0,1,1,-40.406,0,20.203,19.698,0,1,1,40.406,0z"/> - <path id="path2818" d="M10,20,0,20"/> - <path id="path2820" d="m50,20,10,0"/> - <path id="path2819" d="M15.763,19.492c10.699,23.004,16.424-16.073,27.966,0.169" stroke-width="1px" fill="none"/> -<text x="0" y="20" id="text5025" font-size='12px' stroke-width='0px'>+</text> -<text x="53" y="15" id="text5029" font-size='12px' stroke-width='0px'>_</text> + + +<path fill="#ffffff" d=" M 0.00 0.00 L 60.00 0.00 L 60.00 18.92 C 56.43 18.92 52.87 18.89 49.31 18.96 C 48.41 13.74 45.89 8.64 41.32 5.69 C 33.28 -0.05 21.18 1.19 14.58 8.58 C 11.86 11.37 10.75 15.20 9.91 18.90 C 6.61 18.91 3.31 18.91 0.01 18.92 L 0.00 18.02 L 0.00 0.00 Z" /> +<path fill="#242223" d=" M 14.58 8.58 C 21.18 1.19 33.28 -0.05 41.32 5.69 C 45.89 8.64 48.41 13.74 49.31 18.96 C 52.87 18.89 56.43 18.92 60.00 18.92 L 60.00 20.36 C 56.44 20.37 52.88 20.42 49.32 20.35 C 48.37 25.00 46.49 29.68 42.57 32.61 C 34.59 39.35 21.31 38.48 14.46 30.51 C 11.81 27.77 10.77 24.01 9.90 20.41 C 6.60 20.40 3.30 20.40 0.00 20.40 L 0.00 18.02 L 0.01 18.92 C 3.31 18.91 6.61 18.91 9.91 18.90 C 10.75 15.20 11.86 11.37 14.58 8.58 Z" /> +<path fill="#ffffff" d=" M 16.79 8.70 C 24.26 1.38 38.00 2.26 44.27 10.71 C 46.12 13.28 47.66 16.48 46.84 19.71 C 47.83 25.27 43.64 30.47 39.04 33.09 C 30.82 38.00 18.81 35.44 13.93 27.02 C 10.46 21.21 11.70 13.17 16.79 8.70 Z" /> +<path fill="#242223" d=" M 35.50 14.74 L 37.09 14.62 C 37.08 16.05 37.08 17.47 37.07 18.89 C 38.40 18.90 39.74 18.91 41.07 18.92 L 41.06 20.37 C 39.72 20.39 38.38 20.42 37.04 20.44 C 37.06 22.02 37.09 23.59 37.10 25.17 L 35.52 25.19 C 35.49 23.60 35.48 22.02 35.47 20.43 C 34.22 20.42 32.96 20.40 31.71 20.39 L 31.56 18.91 C 32.86 18.91 34.16 18.91 35.46 18.90 C 35.47 17.51 35.48 16.12 35.50 14.74 Z" /> +<path fill="#ffffff" d=" M 49.32 20.35 C 52.88 20.42 56.44 20.37 60.00 20.36 L 60.00 40.00 L 0.00 40.00 L 0.00 20.40 C 3.30 20.40 6.60 20.40 9.90 20.41 C 10.77 24.01 11.81 27.77 14.46 30.51 C 21.31 38.48 34.59 39.35 42.57 32.61 C 46.49 29.68 48.37 25.00 49.32 20.35 Z" /> </g> </svg> 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 @@ <wtx:id>i</wtx:id> <wtx:type>i</wtx:type> <wtx:name>current</wtx:name> - <wtx:category>test</wtx:category> + <wtx:category>power</wtx:category> <wtx:value></wtx:value> <wtx:label></wtx:label> <wtx:spice></wtx:spice> 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg width="60pt" height="40pt" version="1.1" xmlns="http://www.w3.org/2000/svg"> + +<g id="Exp" class="exponential"> + + +<!-- + eval1=Initial Value + eval2=Pulse Value + eval3=Rise Time Delay + eval4=Rise Time Constant + eval5=Fall Time Delay + eval6=Fall Time Constant + --> + + +<metadata class="part" > +<wtx:part xmlns:wtx="http://code.google.com/p/webtronics" > + <wtx:pins> + <wtx:analog> + <wtx:node index="1" x="0" y="20"/> + <wtx:node index="2" x="60" y="20"/> + </wtx:analog> + </wtx:pins> + <wtx:id>e</wtx:id> + <wtx:type>v</wtx:type> + <wtx:name>exponential</wtx:name> + <wtx:category>power</wtx:category> + <wtx:value></wtx:value> + + <wtx:eval1></wtx:eval1> + <wtx:eval2></wtx:eval2> + <wtx:eval3></wtx:eval3> + <wtx:eval4></wtx:eval4> + <wtx:eval5></wtx:eval5> + <wtx:eval6></wtx:eval6> + + + + <wtx:label></wtx:label> + <wtx:spice></wtx:spice> + <wtx:flip></wtx:flip> + <wtx:model></wtx:model> +</wtx:part> +</metadata> + + +<path fill="#ffffff" d=" M 0.00 0.00 L 60.00 0.00 L 60.00 19.00 C 55.39 19.00 50.78 19.00 46.17 19.01 C 44.98 13.67 42.89 7.90 37.81 5.10 C 32.32 1.22 24.68 1.22 19.19 5.10 C 14.11 7.90 12.02 13.67 10.83 19.01 C 7.22 19.00 3.61 18.99 0.00 19.00 L 0.00 0.00 Z" /> +<path fill="#000000" d=" M 19.19 5.10 C 24.68 1.22 32.32 1.22 37.81 5.10 C 42.89 7.90 44.98 13.67 46.17 19.01 C 50.78 19.00 55.39 19.00 60.00 19.00 L 60.00 21.00 C 55.39 21.00 50.77 21.00 46.16 21.00 C 45.00 26.55 42.65 32.46 37.32 35.22 C 29.65 40.48 18.24 37.29 13.79 29.33 C 12.08 26.85 11.76 23.79 10.84 21.00 C 7.23 21.00 3.61 21.01 0.00 21.00 L 0.00 19.00 C 3.61 18.99 7.22 19.00 10.83 19.01 C 12.02 13.67 14.11 7.90 19.19 5.10 Z" /> +<path fill="#ffffff" d=" M 27.28 3.12 C 31.69 2.89 36.15 4.61 39.60 7.38 C 45.19 12.79 46.59 21.93 42.60 28.67 C 38.39 36.58 27.11 39.31 19.73 34.22 C 9.85 28.50 9.60 12.21 19.22 6.13 C 21.52 4.24 24.49 3.83 27.28 3.12 Z" /> +<path fill="#000000" d=" M 22.01 10.69 C 23.86 14.48 29.36 14.07 31.08 18.01 C 32.04 19.42 32.00 21.14 32.14 22.77 C 28.99 23.71 25.77 24.41 23.06 26.39 C 22.94 28.11 23.44 30.08 22.11 31.47 C 21.95 29.73 21.98 27.99 21.98 26.25 C 24.39 23.71 27.84 22.86 31.02 21.72 C 31.01 21.14 31.00 19.97 30.99 19.38 C 28.58 16.58 25.67 14.44 21.98 13.75 C 21.99 12.99 22.00 11.46 22.01 10.69 Z" /> +<path fill="#000000" d=" M 35.80 20.55 C 37.86 20.12 38.14 18.11 38.88 16.50 C 38.94 17.38 39.06 19.14 39.12 20.01 C 40.42 20.00 41.72 20.00 43.01 19.99 L 43.01 21.00 C 41.71 21.00 40.42 20.99 39.13 20.99 C 39.05 21.88 38.89 23.65 38.81 24.54 C 38.33 23.49 37.97 22.41 37.73 21.29 C 37.25 21.11 36.29 20.73 35.80 20.55 Z" /> +<path fill="#000000" d=" M 17.30 18.10 C 18.80 19.34 18.08 22.97 17.70 24.90 C 16.19 23.66 16.92 20.03 17.30 18.10 Z" /> +<path fill="#ffffff" d=" M 0.00 21.00 C 3.61 21.01 7.23 21.00 10.84 21.00 C 11.76 23.79 12.08 26.85 13.79 29.33 C 18.24 37.29 29.65 40.48 37.32 35.22 C 42.65 32.46 45.00 26.55 46.16 21.00 C 50.77 21.00 55.39 21.00 60.00 21.00 L 60.00 40.00 L 24.76 40.00 C 26.25 37.97 22.80 37.85 23.92 40.00 L 0.00 40.00 L 0.00 21.00 Z" /> +<path fill="#000000" d=" M 23.92 40.00 C 22.80 37.85 26.25 37.97 24.76 40.00 L 23.92 40.00 Z" /> +</g> +</svg> 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg width="60pt" height="40pt" version="1.1" xmlns="http://www.w3.org/2000/svg"> + +<g id="Pulse" class="pulse"> + +<!-- + pulval1=Initial Value + pulval2=Pulse Value + pulval3=Delay Time + pulval4=Rise Time + pulval5=Fall Time + pulval6=Pulse Period + pulval7=Pulse Width + --> + + +<metadata class="part" > +<wtx:part xmlns:wtx="http://code.google.com/p/webtronics" > + <wtx:pins> + <wtx:analog> + <wtx:node index="1" x="0" y="20"/> + <wtx:node index="2" x="60" y="20"/> + </wtx:analog> + </wtx:pins> + <wtx:id>p</wtx:id> + <wtx:type>v</wtx:type> + <wtx:name>pulse</wtx:name> + <wtx:category>power</wtx:category> + <wtx:value></wtx:value> + + <wtx:pulval1></wtx:pulval1> + <wtx:pulval2></wtx:pulval2> + <wtx:pulval3></wtx:pulval3> + <wtx:pulval4></wtx:pulval4> + <wtx:pulval5></wtx:pulval5> + <wtx:pulval6></wtx:pulval6> + <wtx:pulval7></wtx:pulval7> + + + + <wtx:label></wtx:label> + <wtx:spice></wtx:spice> + <wtx:flip></wtx:flip> + <wtx:model></wtx:model> +</wtx:part> +</metadata> + + + + +<path fill="#ffffff" d=" M 0.00 0.00 L 60.00 0.00 L 60.00 19.01 C 55.73 18.96 51.45 19.03 47.18 19.00 C 46.09 14.57 44.71 9.96 41.21 6.80 C 36.79 3.19 30.59 0.79 25.00 2.91 C 17.49 4.65 12.99 11.79 11.82 19.00 C 7.88 19.04 3.94 18.96 0.00 19.01 L 0.00 0.00 Z" /> +<path fill="#000000" d=" M 25.00 2.91 C 30.59 0.79 36.79 3.19 41.21 6.80 C 44.71 9.96 46.09 14.57 47.18 19.00 C 51.45 19.03 55.73 18.96 60.00 19.01 L 60.00 20.99 C 55.72 21.04 51.45 20.96 47.17 21.01 C 46.10 25.43 44.71 30.01 41.24 33.17 C 36.79 36.83 30.53 39.22 24.89 37.06 C 17.45 35.29 12.98 28.18 11.83 21.01 C 7.89 20.96 3.94 21.04 0.00 20.99 L 0.00 19.01 C 3.94 18.96 7.88 19.04 11.82 19.00 C 12.99 11.79 17.49 4.65 25.00 2.91 Z" /> +<path fill="#ffffff" d=" M 28.28 3.12 C 32.70 2.89 37.16 4.62 40.61 7.38 C 46.36 12.95 47.67 22.51 43.22 29.26 C 40.47 34.30 34.56 36.58 29.11 37.01 C 24.19 36.26 18.84 34.38 16.19 29.87 C 10.56 22.21 12.89 9.85 21.42 5.34 C 23.47 3.99 25.97 3.79 28.28 3.12 Z" /> +<path fill="#000000" d=" M 23.12 11.34 C 23.59 12.48 23.99 13.65 24.29 14.85 C 27.21 15.20 30.03 16.16 33.00 16.15 C 33.00 19.05 33.00 21.95 33.00 24.85 C 30.03 24.84 27.21 25.79 24.29 26.15 C 23.99 27.35 23.60 28.51 23.11 29.65 C 22.99 28.15 22.93 26.65 22.94 25.14 C 26.03 25.17 28.96 24.16 32.00 23.78 C 32.01 21.59 32.01 19.41 32.00 17.22 C 28.96 16.83 26.03 15.83 22.94 15.86 C 22.93 14.35 22.99 12.84 23.12 11.34 Z" /> +<path fill="#000000" d=" M 36.98 20.34 C 39.72 20.14 38.70 17.11 39.83 15.40 C 40.02 16.93 40.10 18.47 40.07 20.01 C 41.39 20.00 42.70 20.00 44.01 20.00 L 44.01 21.00 C 42.71 21.00 41.41 21.00 40.11 21.00 C 40.06 21.89 39.97 23.68 39.92 24.58 C 39.20 22.97 38.72 21.14 36.98 20.34 Z" /> +<path fill="#000000" d=" M 18.00 16.99 L 19.00 16.99 C 19.01 19.66 19.01 22.34 19.00 25.01 L 18.00 25.01 C 17.99 22.34 17.99 19.66 18.00 16.99 Z" /> +<path fill="#ffffff" d=" M 0.00 20.99 C 3.94 21.04 7.89 20.96 11.83 21.01 C 12.98 28.18 17.45 35.29 24.89 37.06 C 30.53 39.22 36.79 36.83 41.24 33.17 C 44.71 30.01 46.10 25.43 47.17 21.01 C 51.45 20.96 55.72 21.04 60.00 20.99 L 60.00 40.00 L 25.85 40.00 C 27.24 37.91 23.78 37.85 25.01 40.00 L 0.00 40.00 L 0.00 20.99 Z" /> +<path fill="#000000" d=" M 25.01 40.00 C 23.78 37.85 27.24 37.91 25.85 40.00 L 25.01 40.00 Z" /></g> +</svg> 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg width="60pt" height="40pt" version="1.1" xmlns="http://www.w3.org/2000/svg"> + + + +<g id="Pwl" class="pwl"> + + +<!-- + pwlval1=first time part T1 + pwlval2=first voltage part V1 + pwlval3=T2 + pwlval4=V2 + pwlval5=T3 + pwlval6=V3 + pwlval7=T4 + pwlval8=V4 + --> + + +<metadata class="part" > +<wtx:part xmlns:wtx="http://code.google.com/p/webtronics" > + <wtx:pins> + <wtx:analog> + <wtx:node index="1" x="0" y="20"/> + <wtx:node index="2" x="60" y="20"/> + </wtx:analog> + </wtx:pins> + <wtx:id>w</wtx:id> + <wtx:type>v</wtx:type> + <wtx:name>pwl</wtx:name> + <wtx:category>power</wtx:category> + <wtx:value></wtx:value> + + <wtx:pwlval1></wtx:pwlval1> + <wtx:pwlval2></wtx:pwlval2> + <wtx:pwlval3></wtx:pwlval3> + <wtx:pwlval4></wtx:pwlval4> + <wtx:pwlval5></wtx:pwlval5> + <wtx:pwlval6></wtx:pwlval6> + <wtx:pwlval7></wtx:pwlval7> + + <wtx:pwlval8></wtx:pwlval8> + + + <wtx:label></wtx:label> + <wtx:spice></wtx:spice> + <wtx:flip></wtx:flip> + <wtx:model></wtx:model> +</wtx:part> +</metadata> + + + + + +<path fill="#ffffff" d=" M 0.00 0.00 L 60.00 0.00 L 60.00 19.00 C 55.63 19.00 51.25 18.97 46.88 19.05 C 46.14 13.35 43.15 7.80 38.02 4.92 C 30.21 -0.51 18.48 2.78 13.93 10.98 C 11.98 13.26 11.92 16.30 11.12 19.05 C 7.42 18.98 3.71 19.00 0.00 19.00 L 0.00 0.00 Z" /> +<path fill="#000000" d=" M 13.93 10.98 C 18.48 2.78 30.21 -0.51 38.02 4.92 C 43.15 7.80 46.14 13.35 46.88 19.05 C 51.25 18.97 55.63 19.00 60.00 19.00 L 60.00 21.00 C 55.62 21.00 51.23 21.02 46.85 20.97 C 46.09 29.36 39.19 36.93 30.66 37.64 C 20.97 38.83 11.90 30.52 11.16 20.97 C 7.44 21.01 3.72 21.00 0.00 21.00 L 0.00 19.00 C 3.71 19.00 7.42 18.98 11.12 19.05 C 11.92 16.30 11.98 13.26 13.93 10.98 Z" /> +<path fill="#ffffff" d=" M 28.25 3.15 C 30.45 2.91 32.57 4.05 34.78 4.17 C 39.08 5.83 42.38 9.51 44.67 13.46 C 45.05 15.66 45.53 17.84 45.97 20.04 C 45.50 22.21 45.05 24.39 44.65 26.57 C 42.53 30.39 39.39 33.53 35.57 35.66 C 33.37 36.06 31.18 36.51 29.00 36.97 C 26.81 36.51 24.63 36.06 22.43 35.66 C 18.61 33.53 15.47 30.39 13.35 26.57 C 12.95 24.39 12.50 22.21 12.03 20.03 C 12.47 17.84 12.95 15.66 13.33 13.46 C 15.46 9.61 18.62 6.46 22.46 4.33 C 24.39 3.94 26.34 3.67 28.25 3.15 Z" /> +<path fill="#000000" d=" M 20.36 10.85 C 24.06 11.65 27.69 12.79 31.43 13.46 C 29.65 14.76 27.50 13.55 25.62 13.22 C 23.70 12.89 21.83 12.17 20.36 10.85 Z" /> +<path fill="#000000" d=" M 24.99 18.15 C 27.91 16.85 30.35 14.52 33.47 13.75 C 31.77 16.31 28.64 17.09 26.01 18.34 C 26.00 20.52 26.00 22.70 25.98 24.88 C 28.77 26.74 32.43 27.40 34.54 30.18 C 31.30 28.80 28.26 26.98 25.00 25.63 C 25.00 23.14 25.00 20.64 24.99 18.15 Z" /> +<path fill="#000000" d=" M 38.99 16.00 L 40.00 15.98 C 40.00 17.32 40.00 18.66 40.01 20.00 C 41.34 20.00 42.68 20.00 44.02 19.99 L 44.00 20.90 C 41.99 20.94 39.55 20.53 39.51 23.32 C 39.31 22.80 38.90 21.76 38.70 21.25 C 37.57 20.99 36.48 20.64 35.41 20.20 C 36.32 20.12 38.13 19.94 39.03 19.86 C 39.01 18.57 39.00 17.28 38.99 16.00 Z" /> +<path fill="#000000" d=" M 18.30 17.09 C 19.80 18.34 19.07 21.98 18.70 23.91 C 17.20 22.66 17.93 19.02 18.30 17.09 Z" /> +<path fill="#ffffff" d=" M 0.00 21.00 C 3.72 21.00 7.44 21.01 11.16 20.97 C 11.90 30.52 20.97 38.83 30.66 37.64 C 39.19 36.93 46.09 29.36 46.85 20.97 C 51.23 21.02 55.62 21.00 60.00 21.00 L 60.00 40.00 L 24.81 40.00 C 26.25 37.94 22.80 37.85 23.96 40.00 L 0.00 40.00 L 0.00 21.00 Z" /> +<path fill="#000000" d=" M 23.96 40.00 C 22.80 37.85 26.25 37.94 24.81 40.00 L 23.96 40.00 Z" /> +</g> +</svg> 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 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg id="svg2" xmlns="http://www.w3.org/2000/svg" width="60" height="40"> + <g id="S" stroke="#000" stroke-width="2px" connects="0,20;60,20" class="sinvoltagesource"> +<metadata class="part" > +<wtx:part xmlns:wtx="http://code.google.com/p/webtronics" > + <wtx:pins> + <wtx:analog> + <wtx:node index="1" x="0" y="20"/> + <wtx:node index="2" x="60" y="20"/> + </wtx:analog> + </wtx:pins> + <wtx:id>s</wtx:id> + <wtx:type>v</wtx:type> + <wtx:name>sinvoltagesource</wtx:name> + <wtx:category>power</wtx:category> + <wtx:value></wtx:value> + + <wtx:offsetvoltage></wtx:offsetvoltage> + <wtx:voltageamplitude></wtx:voltageamplitude> + <wtx:frequency></wtx:frequency> + <wtx:delaytime></wtx:delaytime> + <wtx:dampingfactor></wtx:dampingfactor> + + <wtx:label></wtx:label> + <wtx:spice></wtx:spice> + <wtx:flip></wtx:flip> + <wtx:model></wtx:model> + <wtx:measure></wtx:measure> +</wtx:part> +</metadata> + <path id="path2816" fill="none" d="m50.381,19.923a20.203,19.698,0,1,1,-40.406,0,20.203,19.698,0,1,1,40.406,0z"/> + <path id="path2818" d="M10,20,0,20"/> + <path id="path2820" d="m50,20,10,0"/> + <path id="path2819" d="M15.763,19.492c10.699,23.004,16.424-16.073,27.966,0.169" stroke-width="1px" fill="none"/> +<text x="0" y="20" id="text5025" font-size='12px' stroke-width='0px'>+</text> +<text x="53" y="15" id="text5029" font-size='12px' stroke-width='0px'>_</text> + +</g> +</svg> 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) + |