Esempio n. 1
0

#%% Starting the MT_PEU main object
# Model: Pass the model defined in def Model;
# symbols_x: List of symbols for quantity x;
# symbols_y: List of symbols for quantity y;
# symbols_param: List of symbols for the parameters to be estimated;
# label_latex_param: List of symbols for parameters written in LaTex;
# units_y: List of units of measurement for independent quantities;
# units_x: List of units of measurement of dependent quantities;
# units_param: List of units of measurement of the parameters;
# Folder: Defines the name of the folder where the results will be saved.
Estime = EstimacaoNaoLinear(Model,
                            symbols_x=['t', 'Tao'],
                            units_x=['s', 'K'],
                            symbols_y=[r'y'],
                            units_y=['adm'],
                            symbols_param=['ko', 'E'],
                            units_param=['adm', 'K'],
                            Folder='Exemple2')

#%% Defining observed data
# Input data
# input 1
time = [
    120.0, 60.0, 60.0, 120.0, 120.0, 60.0, 60.0, 30.0, 15.0, 60.0, 45.1, 90.0,
    150.0, 60.0, 60.0, 60.0, 30.0, 90.0, 150.0, 90.4, 120.0, 60.0, 60.0, 60.0,
    60.0, 60.0, 60.0, 30.0, 45.1, 30.0, 30.0, 45.0, 15.0, 30.0, 90.0, 25.0,
    60.1, 60.0, 30.0, 30.0, 60.0
]
# input 1 uncertainty
uxtime = [1] * 41
Esempio n. 2
0
#%% Starting the MT_PEU main object
# Model: Pass the model defined in def Model;
# symbols_x: List of symbols for quantity x;
# symbols_y: List of symbols for quantity y;
# symbols_param: List of symbols for the parameters to be estimated;
# label_latex_param: List of symbols for parameters written in LaTex;
# label_latex_x: List of symbols for quantities x written in LaTex
# units_y: List of units of measurement for independent quantities;
# units_param: List of units of measurement of the parameters;
# units_x: List of units of measurement of dependent quantities;
# Folder: Defines the name of the folder where the results will be saved.
Estime = EstimacaoNaoLinear(Model,
                            symbols_x=[r't', 'Tau'],
                            units_x=['s', 'K'],
                            label_latex_x=[r'$t$', '$T$'],
                            symbols_y=[r'y'],
                            units_y=['adm'],
                            symbols_param=['ko', 'E'],
                            units_param=['adm', 'K'],
                            label_latex_param=[r'$k_o$', r'$E$'],
                            Folder='Exemple5')

#%% Defining observed data
# Input data
# input 1
time = [
    120.0, 60.0, 120.0, 60.0, 30.0, 15.0, 45.1, 90.0, 150.0, 60.0, 60.0, 30.0,
    150.0, 90.4, 120.0, 60.0, 60.0, 60.0, 30.0, 45.1, 30.0, 45.0, 15.0, 90.0,
    25.0, 60.1, 60.0, 30.0, 60.0
]
# input 1 uncertainty
uxtime = [0.001] * 29
Esempio n. 3
0
def Model(param, x, args):
    T = x[:, 0]
    A, B, C = param[0], param[1], param[2]

    return exp(A - (B / (T + C)))  # Pvp calculation - vectorized


#%% Starting the MT_PEU main object
# Model: Pass the model defined in def Model;
# symbols_x: List of ymbols for quantity x;
# symbols_y: List of ymbols for quantity y;
# symbols_param: List of Symbols for the parameters to be estimated;
# Folder: Defines the name of the folder where the results will be saved.
Estimation = EstimacaoNaoLinear(Model,
                                symbols_x=[r'T'],
                                symbols_y=[r'y'],
                                symbols_param=['A', 'B', 'C'],
                                Folder='Exemple3')

#%% Defining observed data
# Input data
T = [
    297.1, 298.2, 299.3, 301.2, 304.2, 307.2, 310.2, 314.1, 316.2, 317.8,
    318.2, 320.2, 323.1, 326.2, 329.1, 331.2, 334.2, 337.1, 340.2, 343.2,
    346.2, 349.1, 352.2
]
# Input data uncertainty
uxT = [0.1] * len(T)

# Output data
P = [
Esempio n. 4
0
def Model(param,x,*args):

    a1, b1, a2, b2 = param[0], param[1], param[2], param[3]
    x1, x2 = x[:,0], x[:,1]

    return vertcat(a1*x1/(1+b1*x1), a2*(x2**b2))

#%% Starting the MT_PEU main object
# Model: Pass the model defined in def Model;
# symbols_x: Lis of symbols for quantity x;
# symbols_y: List of symbols for quantity y;
# symbols_param: List of symbols for the parameters to be estimated;
# label_latex_param: List of ymbols for parameters written in LaTex;
# units_y: List of units of measurement for independent quantities;
# Folder: Defines the name of the folder where the results will be saved.
Estime = EstimacaoNaoLinear(Model,symbols_x=['x1','x2'],symbols_y=['y1','y2'],symbols_param=['alpha1','alpha2', 'beta1', 'beta2'],
                          label_latex_param=[r'$\alpha_1$',r'$\alpha_2$',r'$\beta_1$',r'$\beta_2$'],units_y=['kg','kg'],Folder='Exemple4')

#%% Defining observed data
# Input data
# input 1
x1 = [1.,2.,3.,5.,10,15.,20.,30.,40.,50.]
# input 1 uncertainty
ux1 = [1]*10
# input 2
x2 = [1.,2.,3.,5.,10,15.,20.,30.,40.,50.]
# input 2 ucertainty
ux2 = [1]*10

# Output data
# output 1
y1 = [1.66,6.07,7.55,9.72,15.24,18.79,19.33,22.38,24.27,25.51]
Esempio n. 5
0
]
temperatura = [
    600.0, 600.0, 612.0, 612.0, 612.0, 612.0, 620.0, 620.0, 620.0, 620.0,
    620.0, 620.0, 620.0, 620.0, 620.0, 620.0, 620.0, 620.0, 620.0, 620.0,
    620.0, 620.0, 620.0, 620.0, 620.0, 620.0, 620.0, 631.0, 631.0, 631.0,
    631.0, 631.0, 639.0, 639.0, 639.0, 639.0, 639.0, 639.0, 639.0, 639.0, 639.0
]

uy = [1] * 41
uxtempo = [1] * 41
uxtemperatura = [1] * 41

#Execução do MT_PEU
Estime = EstimacaoNaoLinear(Modelo,
                            simbolos_x=['t', 'T'],
                            simbolos_y=['y'],
                            simbolos_param=['ko', 'E'],
                            Folder='Exemplo1')
Estime.setDados(0, (tempo, uxtempo), (temperatura, uxtemperatura))
Estime.setDados(1, (y, uy))
Estime.setConjunto(tipo='estimacao')
Estime.optimize(initial_estimative=[0.5, 25000], algoritmo='ipopt')
Estime.incertezaParametros(metodoIncerteza='Geral' '')
Estime.predicao()

# Valores originais
hessian = array([[5.46625676e+00, -7.50116238e-03],
                 [-7.50116238e-03, 1.02960714e-05]])
sensibilidade = array([[-1.06335451e-01, 1.52826132e-04],
                       [-5.59353653e-02, 8.03907392e-05],
                       [-1.28132438e-01, 1.80542088e-04],
Esempio n. 6
0
ux1 = ones((10, 1))
ux2 = ones((10, 1))
uy1 = ones((10, 1))
uy2 = ones((10, 1))

x = concatenate((x1, x2), axis=1)
y = concatenate((y1, y2), axis=1)
ux = concatenate((ux1, ux2), axis=1)
uy = concatenate((uy1, uy2), axis=1)

Estime = EstimacaoNaoLinear(
    WLS,
    Modelo,
    simbolos_x=['x1', 'x2'],
    simbolos_y=['y1', 'y2'],
    simbolos_param=[r'a%d' % i for i in xrange(4)],
    label_latex_param=[r'$\alpha_{%d}$' % i for i in xrange(4)],
    unidades_y=['kg', 'kg'],
    projeto='projeto')
sup = [6., .3, 8., 0.7]
inf = [1., 0, 1., 0.]

tipo = None

# =================================================================================
# PARTE II - GENÉRICO (INDEPENDE DO EXEMPLO)
# =================================================================================

Estime.gerarEntradas(x, y, ux, uy, tipo='experimental')
#print Estime._EstimacaoNaoLinear__etapas
Esempio n. 7
0
#%% Model definition
# def Model: The subroutine that specifies the equations with their respective parameters.
def Model(param, x, *args):

    ko, E = param[0], param[1]
    time, T = x[:,0], x[:,1]

    return exp(-(ko*10**17)*time*exp(-E/T))

#%% Starting the MT_PEU main object
# Model: Pass the model defined in def Model;
# symbols_x: list of symbols for quantity x;
# symbols_y: list of symbols for quantity y;
# symbols_param: list of symbols for the parameters to be estimated;
# Folder: string with the name of the folder where reports and charts will be saved;
Estime = EstimacaoNaoLinear(Model, symbols_x=['t','Tao'], symbols_y=['y'], symbols_param=['ko','E'], Folder='Example1')

#%% Defining observed data
# Observed data of dependent variable
y = [0.9,0.949,0.886,0.785,0.791,0.890,0.787,0.877,0.938,
0.782,0.827,0.696,0.582,0.795,0.800,0.790,0.883,0.712,0.576,0.715,0.673,
0.802,0.802,0.804,0.794,0.804,0.799,0.764,0.688,0.717,0.802,0.695,0.808,
0.655,0.309,0.689,0.437,0.425,0.638,.659,0.449]
# uncertainty of dependent variables
uy = [1]*41
# Observed data of independent variable (input 1)
time = [120.0,60.0,60.0,120.0,120.0,60.0,60.0,30.0,15.0,60.0,
45.1,90.0,150.0,60.0,60.0,60.0,30.0,90.0,150.0,90.4,120.0,
60.0,60.0,60.0,60.0,60.0,60.0,30.0,45.1,30.0,30.0,45.0,15.0,30.0,90.0,25.0,
60.1,60.0,30.0,30.0,60.0]
# input 1 uncertainty