示例#1
0
#declare coefficients & initial settings
coef, set, sol = declare_coef() #1

#to plot interactively
plt.ion()

while set['t'] <= set['T'] and set['k'] < set['Nt']:
    if set['con'] == True:
        sol = main.continuous_iter(coef, set, sol)
        '''PRINTING RESULT AS CONTROL'''
        print 'at Time', set['t']
        if not coef['Si'] == 0:
            print 'NILAI C, b, n MAX', sol['c'].max(),',', sol['b'].max(),',', sol['n'].max()
            print 'NILAI C, b, n MIN', sol['c'].min(),',', sol['b'].min(),',', sol['n'].min()
    else:
        sol = main.boolean_1_iter(coef, set, sol) #2                 
        
        if sol['stop_iter'] >=100000:
            set['k'] = sol['stop_iter']
        '''PRINTING RESULT AS CONTROL'''  
        print 'at Time', set['t']
        print 'Total Tips:', len(sol['matrix_tip'])
        print 'Total Stop Tips:', len(sol['sp_stop'])
        if not coef['C_2'] == 0:
            print 'NILAI C, b, n MAX', sol['c'].max(),',', sol['b'].max(),',', sol['n'].max()
            print 'NILAI C, b, n MIN', sol['c'].min(),',', sol['b'].min(),',', sol['n'].min()
        else:
            print 'NILAI C MAX', sol['c'].max()
            print 'NILAI C MIN', sol['c'].min()
        #print sol['tip_cell']
    
示例#2
0
import numpy
from timeit import default_timer as timer 
import time
import matplotlib.pyplot as plt 

#declare coefficients & initial settings
coef, set, sol = declare_coef() #1

#to plot interactively
plt.ion()

while set['t'] <= set['T'] and set['k'] < set['Nt']:
    if set['con'] == True:
        sol = main2.con_(coef, set, sol)
    else:
        sol = main.boolean_1_iter(coef, set, sol) #2                 
        
        if sol['stop_iter'] >=100000:
            set['k'] = sol['stop_iter']
    
    '''PRINTING RESULT AS CONTROL'''  
    print 'at Time', set['t']
    print 'Total Tips:', len(sol['matrix_tip'])
    print 'Total Stop Tips:', len(sol['sp_stop'])
    if not coef['Si'] == 0:
        print 'NILAI C, b MAX', sol['c'].max(),',', sol['b'].max()
        print 'NILAI C, b MIN', sol['c'].min(),',', sol['b'].min()
    else:
        print 'NILAI C MAX', sol['c'].max()
        print 'NILAI C MIN', sol['c'].min()
    #print sol['tip_cell']