由于本蓝没有正版vissim,只能用学生版来仿真,但是仿真次数多了,一次次的复制粘贴,一次次矩阵转置让在下苦不堪言。因此,我写了一个程序,只需要将所有仿真做完后,把结果复制到excel中,然后代码自动整理数据。代码如下:
import numpy as np
import pandas as pd
import random
import xlrd
from pandas import DataFrame
class result(object):
def __init__(self,name,path,shape):
self.name = name
self.path = path
self.shape = shape - 1
def read(self,path,name,shape):
ratings = pd.read_csv(self.path)
times = ratings['times'] #read simulation times
cal = ratings[name] #read the column we want to arrange
times = np.array(times) #change str to array
R = np.zeros([max(times),self.shape + 1]) #constructs a matrix
j = 0
for i in range(len(times)):
if j |