diff options
author | nielmishra | 2016-01-04 15:14:57 +0530 |
---|---|---|
committer | nielmishra | 2016-01-04 15:14:57 +0530 |
commit | c39feead6b8a792b86e43e18fdf7c13ddaaf0387 (patch) | |
tree | 948cc46433e39d8e650da0d1294b73facd2f2c42 | |
parent | 769fcf719320e5b9c740f455630aeb44b3deb575 (diff) | |
download | eSIM-webapp-master.tar.gz eSIM-webapp-master.tar.bz2 eSIM-webapp-master.zip |
-rwxr-xr-x | __init__.py | 0 | ||||
-rwxr-xr-x | __main__.py | 72 | ||||
-rwxr-xr-x | buttons/download.png | bin | 0 -> 659 bytes | |||
-rwxr-xr-x | buttons/generate.png | bin | 0 -> 2860 bytes | |||
-rw-r--r-- | docs/.~lock.development doc .odt# | 1 | ||||
-rw-r--r-- | docs/development doc .odt | bin | 0 -> 369590 bytes | |||
-rwxr-xr-x | download.php | 53 | ||||
-rwxr-xr-x[-rw-r--r--] | favicon.ico | bin | 1150 -> 1150 bytes | |||
-rwxr-xr-x[-rw-r--r--] | icons/logo.png | bin | 15765 -> 15765 bytes | |||
-rwxr-xr-x | schematic.html | 33 | ||||
-rwxr-xr-x | screenshorts/Screenshot from 2015-10-14 15_10_50.png | bin | 0 -> 83775 bytes | |||
-rwxr-xr-x | screenshorts/Screenshot from 2015-10-14 15_11_03.png | bin | 0 -> 87330 bytes | |||
-rwxr-xr-x | screenshorts/Screenshot from 2015-10-14 15_11_14.png | bin | 0 -> 98539 bytes | |||
-rwxr-xr-x | screenshorts/Screenshot from 2015-10-14 15_11_44.png | bin | 0 -> 116979 bytes | |||
-rwxr-xr-x | script/savenetlist.js | 137 | ||||
-rwxr-xr-x | script/savenetlist.js~ | 511 | ||||
-rwxr-xr-x | simulation.php | 42 |
17 files changed, 260 insertions, 589 deletions
diff --git a/__init__.py b/__init__.py new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/__init__.py diff --git a/__main__.py b/__main__.py new file mode 100755 index 0000000..dc2985a --- /dev/null +++ b/__main__.py @@ -0,0 +1,72 @@ +import os +import sys +import numpy as np + +import matplotlib +# Force matplotlib to not use any Xwindows backend. +matplotlib.use('Agg') + +import matplotlib.pyplot as plt + +def get_plot_files(file): + open_file = open(os.path.realpath(file),'r') + raw_data = open_file.read() + array = raw_data.split('* ') + + array.pop(0) + dict_data = {} + parameters = [] + parsed_files = [] + dir1 = str(file) + + + if not os.path.exists(dir1[:-4]): + os.makedirs(dir1[:-4]) + + + for i in range(len(array)): + dict_data[i] = array[i] + + sample = dict_data[i].split('\n') + write_file = open(os.path.realpath(dir1[:-4])+'/parsed_%s.txt'%(i),'w') + + for j in sample[3:]: + if j.startswith('Index'): + items = j.split() + parameters.append(items) if len(parameters) < i+1 else None + continue + if j.startswith('--') or '*' in j: + continue + else: + write_file.write(j+'\n') + + parsed_files.append(os.path.realpath(dir1[:-4])+'/parsed_%s.txt'%(i)) + return parameters, parsed_files + +def parse_files(file): + parameters, parsed_files = get_plot_files(file) + + for plot_file, parameter in zip(parsed_files, parameters): + data = np.loadtxt(plot_file, unpack=True, dtype=str) + for i in range(2, len(data)): + + plt.plot([x.strip(',') for x in data[1]], [y.strip(',') for y in data[i]]) + + try: + plt.xlabel(parameter[1]), plt.ylabel(parameter[i]) + plt.title('%s vs %s'%(parameter[1], parameter[i])) + plt.savefig(plot_file+str(i)+'.png'), plt.clf() + except IndexError: + plt.xlabel(parameter[1]), plt.ylabel('missing y label') + plt.title('%s vs missing y label'%(parameter[1], )) + plt.savefig(plot_file+str(i)+'.png'), plt.clf() + + +def main(): + + files = sys.argv[1:] + for fi in files: + parse_files(fi) + +if __name__ == '__main__': + main() diff --git a/buttons/download.png b/buttons/download.png Binary files differnew file mode 100755 index 0000000..29bae4b --- /dev/null +++ b/buttons/download.png diff --git a/buttons/generate.png b/buttons/generate.png Binary files differnew file mode 100755 index 0000000..57a5e16 --- /dev/null +++ b/buttons/generate.png diff --git a/docs/.~lock.development doc .odt# b/docs/.~lock.development doc .odt# new file mode 100644 index 0000000..59f528c --- /dev/null +++ b/docs/.~lock.development doc .odt# @@ -0,0 +1 @@ +,fossee,fossee-HP-240-G3-Notebook-PC,04.01.2016 15:01,file:///home/fossee/.config/libreoffice/4;
\ No newline at end of file diff --git a/docs/development doc .odt b/docs/development doc .odt Binary files differnew file mode 100644 index 0000000..132a866 --- /dev/null +++ b/docs/development doc .odt diff --git a/download.php b/download.php index cc2a8f3..a0ecaf7 100755 --- a/download.php +++ b/download.php @@ -1,47 +1,58 @@ <?php -echo "connection sucessful"; -$netlistval = $_POST["netlist"]; // for ajax -//$netlistval = "CONTENT"; // without ajax -$myfile = fopen("netlist.txt", "w") or die("Unable to open file!"); -fwrite($myfile, $netlistval); -fclose($myfile); -echo "file written"; -$response = array(); +if (isset ($_POST["netlist"])) +{ + $netlistval = $_POST["netlist"]; // for ajax + //$netlistval = "CONTENT"; // without ajax + $myfile = fopen("netlist.txt", "w") or die("Unable to open file!"); + fwrite($myfile, $netlistval); + fclose($myfile); + +/* + + //echo "file written"; + + if ( $netlistval == null ) { - $response['status'] = 'error'; - $response['message'] = 'This failed'; - } /*else ( $netlistval !== null ) { - $response['status'] = 'success'; - $response['message'] = 'This was successful'; + echo "fail"; + // $response['status'] = 'error'; + // $response['message'] = 'This failed'; + } else if ( $netlistval != null ) +{ echo "success"; + // $response['status'] = 'success'; + // $response['message'] = 'This was successful'; - } */ - -// echo json_encode($response); + } + // echo json_encode($response); + + */ +} +else +{ /*------------------------------------------------------------------------------------------------------------------------------------------------- FILE DOWNLOAD CODE PHP -------------------------------------------------------------------------------------------------------------------------------------------------*/ -/*header('Content-Type: application/octet-stream'); + header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename('netlist.txt')); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize('netlist.txt')); - readfile('netlist.txt'); - exit; */ - + readfile('/var/www/html/eSIM/netlist.txt'); + exit; +} -echo "file download start"; +//echo "file download start"; ?> diff --git a/favicon.ico b/favicon.ico Binary files differindex a1869b6..a1869b6 100644..100755 --- a/favicon.ico +++ b/favicon.ico diff --git a/icons/logo.png b/icons/logo.png Binary files differindex f3d5d7c..f3d5d7c 100644..100755 --- a/icons/logo.png +++ b/icons/logo.png diff --git a/schematic.html b/schematic.html index 2ee409b..fee90c2 100755 --- a/schematic.html +++ b/schematic.html @@ -29,7 +29,7 @@ toolbar <fieldset> <legend>Circuit</legend> <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_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"> @@ -67,7 +67,7 @@ toolbar <br> <a href="http://esim.fossee.in/" target="_blank"><img src="icons/logo.png"/></a> <br> - <a href="http://www.gnucap.org/dokuwiki/doku.php?id=gnucap:start" target="_blank">GNUCAP</a> + <a href="https://github.com/FOSSEE/eSIM-webapp" target="_blank">Fossee</a> <br> <a href="https://github.com/nielmishra" target="_blank">Github</a> @@ -232,10 +232,11 @@ or try adding </pre> </div> <div id="webtronics_netlist_buttons"> -<img id="webtronics_netlist_text_run" class="normal_button" src="buttons/run.png"> +<!--<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_text_save" class="normal_button" src="buttons/savenetlist.png"> -<img id="webtronics_netlist_generate" class="normal_button" src="buttons/generate.jpg"> +<img id="webtronics_netlist_generate" class="normal_button" src="buttons/generate.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"> <select id="analysis_selectbox" class="exclude_button"> <option value="" disabled="disabled" selected="selected">Analysis type</option> <option value="1">DC</option> @@ -259,7 +260,7 @@ AC MENU FORM AND DIV <tr> <td> <label for="dummy1">Start Frequency</label> -<input type="number" id="startfreqval" pattern="[0-9]{3}" min="0" max="100" name="Start Frequency"> +<input type="number" id="startfreqval" pattern="[0-9]{3}" min="0" name="Start Frequency"> </td> <td> @@ -277,7 +278,7 @@ AC MENU FORM AND DIV <tr> <td> <label for="dummy2">Stop Frequency</label> -<input type="number" id="stopfreqval" pattern="[0-9]{3}" min="0" max="100" name="Stop Frequency" > +<input type="number" id="stopfreqval" pattern="[0-9]{3}" min="0" name="Stop Frequency" > </td> <td> <select id="stop_frequency_selectbox" class="exclude_button"> @@ -293,7 +294,7 @@ AC MENU FORM AND DIV <tr> <td> <label for="dummy3">Number Of Points</label> -<input type="number" id="noofpointsval" min="0" pattern="[0-9]{3}" max="100" name="No of Points"> +<input type="number" id="noofpointsval" min="0" pattern="[0-9]{3}" name="No of Points"> </td> <td> <select id="scale_selectbox" class="exclude_button"> @@ -329,7 +330,7 @@ TRANSIENT MENU FORM AND DIV <tr> <td> <label for="dummy1">Start Time</label> -<input type="number" id="start_time" pattern="[0-9]{3}" min="0" max="100" name="Start Time"> +<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> @@ -345,7 +346,7 @@ TRANSIENT MENU FORM AND DIV <tr> <td> <label for="dummy2">Step Time</label> -<input type="number" id="step_time" pattern="[0-9]{3}" min="0" max="100" name="Step Time" > +<input type="number" id="step_time" pattern="[0-9]{3}" min="0" name="Step Time" > <select id="step_time_selectbox" class="exclude_button"> @@ -361,7 +362,7 @@ TRANSIENT MENU FORM AND DIV <tr> <td> <label for="dummy3">Stop Time</label> -<input type="number" id="stop_time" pattern="[0-9]{3}" min="0" max="100" name="Stop Time"> +<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> @@ -405,8 +406,8 @@ DC MENU FORM AND DIV <tr> <td> -<label for="dummy2">Start Time</label> -<input type="number" id="startval" pattern="[0-9]{3}" min="0" max="100" name="Start" > +<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> @@ -423,7 +424,7 @@ DC MENU FORM AND DIV <td> <label for="dummy3">Incrememnt</label> -<input type="number" id="Incrementval" pattern="[0-9]{3}" min="0" max="100" name="Increment"> +<input type="number" id="Incrementval" pattern="[0-9]{3}" min="0" name="Increment"> <select id="inc_volt_selectbox" class="exclude_button"> @@ -439,8 +440,8 @@ DC MENU FORM AND DIV <tr> <td> -<label for="dummy4">Stop Time</label> -<input type="number" id="stopval" pattern="[0-9]{3}" min="0" max="100" name="Stop"> +<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> diff --git a/screenshorts/Screenshot from 2015-10-14 15_10_50.png b/screenshorts/Screenshot from 2015-10-14 15_10_50.png Binary files differnew file mode 100755 index 0000000..9b6ee9a --- /dev/null +++ b/screenshorts/Screenshot from 2015-10-14 15_10_50.png diff --git a/screenshorts/Screenshot from 2015-10-14 15_11_03.png b/screenshorts/Screenshot from 2015-10-14 15_11_03.png Binary files differnew file mode 100755 index 0000000..03d2d52 --- /dev/null +++ b/screenshorts/Screenshot from 2015-10-14 15_11_03.png diff --git a/screenshorts/Screenshot from 2015-10-14 15_11_14.png b/screenshorts/Screenshot from 2015-10-14 15_11_14.png Binary files differnew file mode 100755 index 0000000..3c93db5 --- /dev/null +++ b/screenshorts/Screenshot from 2015-10-14 15_11_14.png diff --git a/screenshorts/Screenshot from 2015-10-14 15_11_44.png b/screenshorts/Screenshot from 2015-10-14 15_11_44.png Binary files differnew file mode 100755 index 0000000..b89db79 --- /dev/null +++ b/screenshorts/Screenshot from 2015-10-14 15_11_44.png diff --git a/script/savenetlist.js b/script/savenetlist.js index fc45a63..2d89915 100755 --- a/script/savenetlist.js +++ b/script/savenetlist.js @@ -1,10 +1,83 @@ jQuery(document).ready(function(){ - jQuery("#webtronics_netlist_text_save").click(function(){ - console.log("button clicked"); + +/*------------------------------------------------------------------------------------------------------------------------------------------------ +For Simulation of Netlist and Removal of netlist Window +------------------------------------------------------------------------------------------------------------------------------------------------*/ + + jQuery("#webtronics_netlist_simulate").click(function(){ + 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.ajax({ + + url: "/eSIM/simulation.php", + type: "POST", + data: {netlist:jQuery("#webtronics_netlist_text_area").val()}, + dataType: "html", + + /* + type: "POST", + url: "/eSIM/simulation.php", + data: '$image,$image1', + success:function(phpData){ + alert(phpData); + }*/ + + + + + success:function() { + + //console.log(data); + //window.location = "/eSIM/simulation.php"; + window.open('/eSIM/simulation.php','about:blank','scrollbars=auto , scrollbars=1, left=300,top=50,width=800,height=600,toolbar=0,resizable=0'); + //alert (); + //if( data == 'fail' ) { + //console.log("nada"); + //} + + // else if (data = 'success') { + //console.log("ya"); + //} +}, + + + }); + + + }); + +/*------------------------------------------------------------------------------------------------------------------------------------------------ +VIEW NETLIST WINDOW +------------------------------------------------------------------------------------------------------------------------------------------------*/ + +jQuery("#webtronics_netlist").click(function(){ + + jQuery('#webtronics_netlist_text_div').show(); + jQuery('#webtronics_netlist_buttons').show(); + jQuery('#webtronics_netlist_text').show(); + jQuery('#webtronics_disable').show(); + + + }); + +/*------------------------------------------------------------------------------------------------------------------------------------------------ +For Download of netlist +------------------------------------------------------------------------------------------------------------------------------------------------*/ + + jQuery("#webtronics_netlist_text_download").click(function(){ + //console.log("button clicked"); jQuery.ajax({ - url: "/webtronix/webtronix-master/download.php", + url: "/eSIM/download.php", type: "POST", data: {netlist:jQuery("#webtronics_netlist_text_area").val()}, @@ -15,15 +88,16 @@ jQuery(document).ready(function(){ } */ - - success: function( data ) { - console.log(data.status); - if( data.status == 'error' ) { + success: function() { + //console.log(data); + window.location = "/eSIM/download.php" ; + //if( data == 'fail' ) { + //console.log("nahi hua "); + //} - console.log("nahi hua bc"); - } else /*if (data.status == 'success')*/ { - console.log("ho gaya bc"); - } + // else if (data = 'success') { + //console.log("ho gaya "); + //} }, @@ -31,6 +105,9 @@ jQuery(document).ready(function(){ }); + + + /*------------------------------------------------------------------------------------------------------------------------------------------------ DC FUNCTIONALITY IS WRITTEN HERE ---------------------------------------------------------------------------------------------------------------------------------------------------*/ @@ -367,7 +444,7 @@ jQuery("#step_time_selectbox").change(function(){ step_trans_unit = "12"; } - //console.log(step_trans_unit); + console.log(step_trans_unit); }); jQuery("#stop_time_selectbox").change(function(){ @@ -391,7 +468,7 @@ jQuery("#stop_time_selectbox").change(function(){ stop_trans_unit = "12"; } - //console.log(stop_trans_unit); + console.log(stop_trans_unit); }); /*------------------------------------------------------------------------------------------------------------------------------------------------ @@ -417,7 +494,7 @@ Flag = ""; { //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"+ ".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"; //console.log(jQuery("#analysis_selectbox").val()); @@ -429,7 +506,7 @@ 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"+".endc \n"+ ".end \n" ); + 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"; } @@ -439,7 +516,7 @@ Here are the all Transiet Cases for generating final netlist values //else if (analysis_type == "3" && time == "1") else if (analysis_type == "3") { - jQuery("#webtronics_netlist_text_area").val(Flag + '\n' + ".tran" + " " + step_trans + "e" + "-" + step_trans_unit + " " + stop_trans + "e"+ "-" + stop_trans_unit + " " + start_trans + "e" + "-" + start_trans_unit + '\n' + '\n'+ ".control \n"+ "run \n"+ ".endc \n" +".end \n" ); + 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"; } @@ -459,7 +536,7 @@ else if( change_val == "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"+ ".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"; } @@ -467,7 +544,7 @@ else if( 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"+".endc \n"+ ".end \n" ); + 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"; } @@ -475,7 +552,7 @@ else if( 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"+ ".endc \n" +".end \n" ); + 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"; } @@ -487,25 +564,3 @@ else if( change_val == "1") }); }); - - - - - - - - - -//jQuery("#analysis_selectbox").click(function(){ -//var eles = '<select><option>AC Analysis</option><option>DC analysis</option><option>Transient Analysis</option></select>'; - -// jQuery('#domchange').append(eles); -//jQuery(this).prop('disabled', true); -//console.log(jQuery(this)); -//if opt - //alert("hello world"); - - - -//jQuery("#analysis").click(function(){ - diff --git a/script/savenetlist.js~ b/script/savenetlist.js~ deleted file mode 100755 index fc45a63..0000000 --- a/script/savenetlist.js~ +++ /dev/null @@ -1,511 +0,0 @@ -jQuery(document).ready(function(){ - jQuery("#webtronics_netlist_text_save").click(function(){ - console.log("button clicked"); - - jQuery.ajax({ - - url: "/webtronix/webtronix-master/download.php", - - type: "POST", - data: {netlist:jQuery("#webtronics_netlist_text_area").val()}, - dataType: "html", - - /* success: function() { - console.log("success"); - } - - */ - - success: function( data ) { - console.log(data.status); - if( data.status == 'error' ) { - - console.log("nahi hua bc"); - } else /*if (data.status == 'success')*/ { - console.log("ho gaya bc"); - } -}, - - - }); - - - }); -/*------------------------------------------------------------------------------------------------------------------------------------------------ -DC FUNCTIONALITY IS WRITTEN HERE ----------------------------------------------------------------------------------------------------------------------------------------------------*/ -jQuery(function(){ - jQuery("#dc_menu").hide(); - jQuery("#ac_menu").hide(); - jQuery("#transient_menu").hide(); - jQuery("#analysis_selectbox").change(function(){ - if (jQuery(this).val() == "1") - { - jQuery("#dc_menu").show(); - jQuery("#ac_menu").hide(); - jQuery("#transient_menu").hide(); - } - else if (jQuery(this).val() == "2") - { - jQuery("#ac_menu").show(); - jQuery("#dc_menu").hide(); - jQuery("#transient_menu").hide(); - } - else if (jQuery(this).val() == "3") - { - jQuery("#transient_menu").show(); - jQuery("#dc_menu").hide(); - jQuery("#ac_menu").hide(); - - } - - //$("#preview").change(function(){ - //jQuery"#analysis_selectbox".val(); - //$("#div1, #div2").toggle(); - }); -}); - - - -jQuery("#analysis_selectbox").change(function(){ - - analysis_type = jQuery(this).val(); - //console.log(analysis_type); -}); - -/*------------------------------------------------------------------------------------------------------------------------------------------------ -Ac netlist variable for ac -------------------------------------------------------------------------------------------------------------------------------------------------*/ - -jQuery("#saveac").click(function(){ - - startfreq = jQuery("#startfreqval").val(); - stopfreq = jQuery("#stopfreqval").val(); - noofpoint = jQuery("#noofpointsval").val(); - //console.log(startfreq,stopfreq,noofpoint); - //console.log(startfreq); - if (startfreq == "") - { - alert("Please enter Start Frequency"); - } - else if (stopfreq == "") - { - alert("Please enter Stop Frequency value"); - } - else if (noofpoint == "") - { - alert("Please Enter No Of Points"); - } -}); - - -jQuery("#frequency_selectbox").change(function(){ - - freq = jQuery(this).val(); - //console.log(freq); -}); - -jQuery("#scale_selectbox").change(function(){ - scale = jQuery(this).val(); - - if (scale == "1") - { - scale_val = "lin"; - } - else if (scale == "2") - { - scale_val = "dec"; - } - else if (scale == "3") - { - scale_val = "octal"; - } -}); - -jQuery("#start_frequency_selectbox").change(function(){ - - ac_start_freq = jQuery(this).val(); - - if (ac_start_freq == "1") - { - start_ac_unit = "Hz"; - } - else if (ac_start_freq == "2") - { - start_ac_unit = "THz"; - } - if (ac_start_freq == "3") - { - start_ac_unit = "GHz"; - } - else if (ac_start_freq == "4") - { - start_ac_unit = "Meg"; - } - else if (ac_start_freq == "5") - { - start_ac_unit = "KHz"; - } - -}); - -jQuery("#stop_frequency_selectbox").change(function(){ - - ac_stop_freq = jQuery(this).val(); - - if (ac_stop_freq == "1") - { - stop_ac_unit = "Hz"; - } - else if (ac_stop_freq == "2") - { - stop_ac_unit = "THz"; - } - if (ac_stop_freq == "3") - { - stop_ac_unit = "GHz"; - } - else if (ac_stop_freq == "4") - { - stop_ac_unit = "Meg"; - } - else if (ac_stop_freq == "5") - { - stop_ac_unit = "KHz"; - } - -}); - -/*------------------------------------------------------------------------------------------------------------------------------------------------ -Dc netlist variable for dc -------------------------------------------------------------------------------------------------------------------------------------------------*/ -jQuery("#savedc").click(function(){ - - source = jQuery("#sourceval").val(); - start = jQuery("#startval").val(); - increment = jQuery("#Incrementval").val(); - stop = jQuery("#stopval").val(); - //console.log(source,start,increment,stop); - //console.log(start); - if (source == "") - { - alert("Please enter Source Name"); - } - else if (start == "") - { - alert("Please enter Start Time"); - } - else if (increment == "") - { - alert("Please enter the increment value"); - } - else if (stop == "") - { - alert("Please enter the Stop Time"); - } - -}); - - -jQuery("#start_volt_selectbox").change(function(){ - - dc_start_time = jQuery(this).val(); - - if (dc_start_time == "1") - { - start_dc_unit = "00"; - } - else if (dc_start_time == "2") - { - start_dc_unit = "03"; - } - if (dc_start_time == "3") - { - start_dc_unit = "06"; - } - else if (dc_start_time == "4") - { - start_dc_unit = "09"; - } - else if (dc_start_time == "5") - { - start_dc_unit = "12"; - } - - //console.log(start_dc_unit); -}); - -jQuery("#inc_volt_selectbox").change(function(){ - - - dc_increment_time = jQuery(this).val(); - - if (dc_increment_time == "1") - { - increment_dc_unit = "00"; - } - else if (dc_increment_time == "2") - { - increment_dc_unit = "03"; - } - if (dc_increment_time == "3") - { - increment_dc_unit = "06"; - } - else if (dc_increment_time == "4") - { - increment_dc_unit = "09"; - } - else if (dc_increment_time == "5") - { - increment_dc_unit = "12"; - } - - //console.log(increment_dc_unit); -}); - -jQuery("#stop_volt_selectbox").change(function(){ - - - dc_stop_time = jQuery(this).val(); - - if (dc_stop_time == "1") - { - stop_dc_unit = "00"; - } - else if (dc_stop_time == "2") - { - stop_dc_unit = "03"; - } - if (dc_stop_time == "3") - { - stop_dc_unit = "06"; - } - else if (dc_stop_time == "4") - { - stop_dc_unit = "09"; - } - else if (dc_stop_time == "5") - { - stop_dc_unit = "12"; - } - - //console.log(stop_dc_unit); -}); - - - -/*------------------------------------------------------------------------------------------------------------------------------------------------ -netlist variable for transient -------------------------------------------------------------------------------------------------------------------------------------------------*/ -jQuery("#savetransient").click(function(){ - - start_trans = jQuery("#start_time").val(); - step_trans = jQuery("#step_time").val(); - stop_trans = jQuery("#stop_time").val(); - //console.log(start_trans, step_trans, stop_trans); - console - - if (start_trans == "") - { - alert("Please enter Start Time") - } - else if (step_trans == "") - { - alert("Please enter Step Time"); - } - else if (stop_trans == "") - { - alert("Please enter the Stop Time"); - } - -}); - - -jQuery("#start_time_selectbox").change(function(){ - - trans_start_time = jQuery(this).val(); - - if (trans_start_time == "1") - { - start_trans_unit = "03"; - } - else if (trans_start_time == "2") - { - start_trans_unit = "06"; - } - if (trans_start_time == "3") - { - start_trans_unit = "09"; - } - else if (trans_start_time == "4") - { - start_trans_unit = "12"; - } - - //console.log(start_trans_unit); -}); - -jQuery("#step_time_selectbox").change(function(){ - - trans_step_time = jQuery(this).val(); - - if (trans_step_time == "1") - { - step_trans_unit = "03"; - } - else if (trans_step_time == "2") - { - step_trans_unit = "06"; - } - if (trans_step_time == "3") - { - step_trans_unit = "09"; - } - else if (trans_step_time == "4") - { - step_trans_unit = "12"; - } - - //console.log(step_trans_unit); -}); - -jQuery("#stop_time_selectbox").change(function(){ - - trans_stop_time = jQuery(this).val(); - - if (trans_stop_time == "1") - { - stop_trans_unit = "03"; - } - else if (trans_stop_time == "2") - { - stop_trans_unit = "06"; - } - if (trans_stop_time == "3") - { - stop_trans_unit = "09"; - } - else if (trans_stop_time == "4") - { - stop_trans_unit = "12"; - } - - //console.log(stop_trans_unit); -}); - -/*------------------------------------------------------------------------------------------------------------------------------------------------ -Netlist Generation -------------------------------------------------------------------------------------------------------------------------------------------------*/ -change_val = "0"; -Flag = ""; - //console.log("out") - //console.log(change_val) - jQuery("#webtronics_netlist_generate").click(function(){ - //console.log(change_val) - - if (change_val == "0") - { - Flag = jQuery("#webtronics_netlist_text_area").val(); - //console.log("if when 0") - - -/*------------------------------------------------------------------------------------------------------------------------------------- - 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"+ ".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"+".endc \n"+ ".end \n" ); - - change_val = "1"; - } -/*------------------------------------------------------------------------------------------------------------------------------------------------ -Here are the all Transiet Cases for generating final netlist values -------------------------------------------------------------------------------------------------------------------------------------------------*/ - //else if (analysis_type == "3" && time == "1") - else if (analysis_type == "3") - { - jQuery("#webtronics_netlist_text_area").val(Flag + '\n' + ".tran" + " " + step_trans + "e" + "-" + step_trans_unit + " " + stop_trans + "e"+ "-" + stop_trans_unit + " " + start_trans + "e" + "-" + start_trans_unit + '\n' + '\n'+ ".control \n"+ "run \n"+ ".endc \n" +".end \n" ); - - change_val = "1"; - } - - -} - -else if( change_val == "1") - -{ - //console.log(change_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"+ ".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"+".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"+ ".endc \n" +".end \n" ); - - change_val = "1"; - } - - -} - - -}); -}); - - - - - - - - - - -//jQuery("#analysis_selectbox").click(function(){ -//var eles = '<select><option>AC Analysis</option><option>DC analysis</option><option>Transient Analysis</option></select>'; - -// jQuery('#domchange').append(eles); -//jQuery(this).prop('disabled', true); -//console.log(jQuery(this)); -//if opt - //alert("hello world"); - - - -//jQuery("#analysis").click(function(){ - diff --git a/simulation.php b/simulation.php new file mode 100755 index 0000000..2050970 --- /dev/null +++ b/simulation.php @@ -0,0 +1,42 @@ +<?php + +if (isset ($_POST["netlist"])) +{ + $netlistval1 = $_POST["netlist"]; // for ajax + //$netlistval = "CONTENT"; // without ajax + $myfile = fopen("netlist.txt", "w") or die("Unable to open file!"); + fwrite($myfile, $netlistval1); + fclose($myfile); + +} + +else + +{ + + $output=shell_exec('cd /var/www/html/eSIM/; ngspice /var/www/html/eSIM/netlist.txt 2>&1' ); + $output=shell_exec('cd /var/www/html/eSIM/;python /var/www/html/eSIM/__main__.py /var/www/html/eSIM/dumpv.txt /var/www/html/eSIM/dumpi.txt 2>&1' ); + // $output1=shell_exec('cd /var/www/html/eSIM/;python /var/www/html/eSIM/__main__.py /var/www/html/eSIM/dump1.txt 2>&1' ); + + $imagepath = '/eSIM/dumpi/'; + $images = glob('/var/www/html/eSIM/dumpi/*.{jpeg,gif,png}', GLOB_BRACE);//glob($imagesDir . '*.{jpg,jpeg,png,gif}', GLOB_BRACE); + foreach ($images as $value) { + echo " <img src=".$imagepath.basename($value)."><br> "; + + } + + $imagepath = '/eSIM/dumpv/'; + $images1 = glob('/var/www/html/eSIM/dumpv/*.{jpeg,gif,png}', GLOB_BRACE); + foreach ($images1 as $value) { + echo " <img src=".$imagepath.basename($value)."><br> "; + + } + +//$images1 = glob('/var/www/html/eSIM/dump1*.{jpeg,gif,png}', GLOB_BRACE); + // var_dump($images.'-----------'. $images1);die; + //echo json_encode($images); + echo "<pre>$output</pre>"; + } + +//} +?> |