add a new idea
parent
5046ffb4cc
commit
3b6d299816
|
@ -59,6 +59,9 @@ app.py ----服务器的主程序
|
|||
|
||||
## 更新日志
|
||||
|
||||
* 2021年3月18号,后端更新
|
||||
|
||||
* idea & todo:仿真结果数据可视化的基本思路为:在后端的python代码中,用一个自定义类封装的simulation result data container来容纳数据,并新增一个用于处理get/post请求的处理函数,当前端需要这些相关数据时,通过ajax发送过去;同时前端使用bokehjs封装一个通用的结果显示的“示波器”,向服务器后端发送请求,接收相关数据,并展示结果。
|
||||
* 2021年3月17号,后端更新
|
||||
|
||||
* 新增:根据前端传入的电路数据和仿真参数,进行参数转换,调用pyspice执行电路仿真
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
class Sim_Data_Container :
|
||||
def __init__(self):
|
||||
self.analysis = None
|
||||
|
||||
def load_analysis(self,analysis):
|
||||
self.analysis = analysis
|
||||
|
|
@ -3,9 +3,11 @@ from .js import js_import, js_code_1
|
|||
import tornado.web
|
||||
from .MongoDB import *
|
||||
from .simulation import Simulator_CZ
|
||||
from .sim_data_container import Sim_Data_Container
|
||||
# from bokeh.embed import server_document
|
||||
# from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
Container_SimResult = Sim_Data_Container()
|
||||
|
||||
class SpiceHandler(AuthBaseHandler):
|
||||
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/* 基于bokeh.js库文件
|
||||
使用该文件前请现在html加载相关js文件*/
|
||||
|
||||
|
||||
|
||||
|
||||
// create a data source to hold data
|
||||
var source = new Bokeh.ColumnDataSource({
|
||||
data: { x: [], y: [] }
|
||||
});
|
||||
|
||||
// make a plot with some tools
|
||||
var plot = Bokeh.Plotting.figure({
|
||||
title:'Example of Random data',
|
||||
tools: "pan,wheel_zoom,box_zoom,reset,save",
|
||||
height: 300,
|
||||
width: 300
|
||||
});
|
||||
|
||||
// add a line with data from the source
|
||||
plot.line({ field: "x" }, { field: "y" }, {
|
||||
source: source,
|
||||
line_width: 2
|
||||
});
|
||||
|
||||
// show the plot, appending it to the end of the current section
|
||||
Bokeh.Plotting.show(plot,'#bokeh_01');
|
||||
|
||||
function addPoint() {
|
||||
// add data --- all fields must be the same length.
|
||||
source.data.x.push(Math.random())
|
||||
source.data.y.push(Math.random())
|
||||
|
||||
// notify the DataSource of "in-place" changes
|
||||
source.change.emit()
|
||||
}
|
||||
|
||||
function Callback_Button() {
|
||||
addPoint();
|
||||
}
|
||||
|
||||
var addDataButton = document.createElement("Button");
|
||||
addDataButton.appendChild(document.createTextNode("Add Some Data!!!"));
|
||||
document.currentScript.parentElement.appendChild(addDataButton);
|
||||
addDataButton.addEventListener("click", Callback_Button);
|
||||
|
||||
addPoint();
|
||||
addPoint();
|
Loading…
Reference in New Issue