public class Vijver extends thesisApplet
{
boolean useBackgroundImage = true;
BaseGraphView graphViewer;
YGraph Graph1,Graph2,Graph3;
TextField Text1,Text2,Text3,Text4;
Label Label1,Label2,Label3,Label4;
NumberChooser Input1,Input2;
double KPF,KNF,KFZ,KDZ,KFB,KZB,KDB,KZC,KBC,KAC,KFS,KDS,
MUFMAX,MUFZMAX,MUDZMAX,MUFBMAX,MUZBMAX,
MUDBMAX,MUZCMAX,MUBCMAX,MUACMAX,MUFSMAX,MUDSMAX,
MBF,MBZ,MBB,MBC,MBS,MBBC,MBBS,
RCMAX,RSMAX,MBOF,MBOZ,MBOB,MBOC,MBOS,
MF,MZ,MB,RESPF,RESPZ,RESPB,RESPC,RESPS,
UDP,UDN,PHOT,ALPHA,RE,OKT,SED,SEDP,LOPT,
KW,KF,KD,KPD,HK,BKR,ZCR,FCR,MB2,MZ2,MF2,
LABDAB,LABDAZ,LABDAF,KA,MK,COP,MG,COD,
HLP1,HLP2,HLP3,HLP4,HLP5,HLP6,HLP7,HLP8,
HLP9,HLP10,HLP11,HLP12,HLP13,HLP14,HLP15,HLP16,
QGF,QFZ,QFB,QFS,QFD,QFE,QDZ,QZB,QZC,QZD,QZE,QDB,QBC,
QBD,QBE,QAC,QDS,QCD,QCE,QSD,QSE,QDP,QPF,QPD,QDN,QNF,
QFO,QOF,QOZ,QOB,QOC,QOS,QOD,QAD,
RC,RS,L,F,D,Z,S,B,C,A,P,N,T,FO,HKTEMP,
DELTAPU,DELTANU,DELTAOU,DELTAAU,PU,NU,OU,AU,
DFDT,DZDT,DBDT,DCDT,DSDT,DPDT,DNDT,DODT,DADT,DDDT,
PTOEG,NTOEG,OTOEG,VTOEG,O,REA,TEMP,L_JAARMAX,TEMP_JAARMAX,
dN1dt,dN2dt,dN3dt,N1,N2,N3,K1,K2,Error;
double t,dt,Tmin,Tmax;
public void readParameters()
{
String useBackgroundImageString = getParameter("useBackgroundImage");
if (useBackgroundImageString != null)
{useBackgroundImageString.trim();
useBackgroundImage = useBackgroundImageString.equalsIgnoreCase("true")}
}
public void setupGraphs(Container screenView)
{
initModel();
screenView.setLayout(new BorderLayout());
if (useBackgroundImage) { graphViewer = new ImageGraphView((thesisApplet)this,Tmin,Tmax);}
else { graphViewer = new ArrayGraphView((thesisApplet)this,Tmin,Tmax);}
screenView.add("Center", graphViewer);
Panel TEMP_panel1 = new Panel();
TEMP_panel1.setLayout(new GridLayout(2,1,6,0));
TEMP_panel1.add(Input1 = new NumberChooser("xxx","[xxx]",1.0,0,1.0));
TEMP_panel1.add(Input2 = new NumberChooser("xxx","[xxx]",0.5,0,1.0));
screenView.add("West", TEMP_panel1);
Graph1 = new YGraph("xx",Color.red,0.0,20.0);
Graph2 = new YGraph("xx",Color.green,0.0,15.0);
Graph3 = new YGraph("xx",Color.orange,0,30.0);
Panel TEMP_panel2 = new Panel();
TEMP_panel2.setLayout(new GridLayout(8,1));
TEMP_panel2.add(Label1 = new Label("xx "));
TEMP_panel2.add(Text1 = new TextField(" "));
Text1.setEditable(false);
TEMP_panel2.add(Label2 = new Label("xx "));
TEMP_panel2.add(Text2 = new TextField(" "));
Text2.setEditable(false);
TEMP_panel2.add(Label3 = new Label("xx "));
TEMP_panel2.add(Text3 = new TextField(" "));
Text3.setEditable(false);
TEMP_panel2.add(Label4 = new Label("Error "));
TEMP_panel2.add(Text4 = new TextField(" "));
Text4.setEditable(false);
screenView.add("East", TEMP_panel2);
Input1.setColor(Color.blue);
Input2.setColor(Color.blue);
graphViewer.addYGraph(Graph1);
graphViewer.addYGraph(Graph2);
graphViewer.addYGraph(Graph3);
}
public void initModel()
{
KPF = 0.1;
KNF = 0.1;
KFZ = 15.0;
KDZ = 60.0;
KFB = 15.0;
KZB = 1.0;
KDB = 60.0;
KZC = 1.0;
KBC = 5.0;
KAC = 0.2;
KFS = 20.0;
KDS = 60.0;
MUFMAX = 4.5;
MUFZMAX = 1.4;
MUDZMAX = 0.5;
MUFBMAX = 0.2;
MUZBMAX = 0.4;
MUDBMAX = 0.2;
MUZCMAX = 0.02;
MUBCMAX = 0.06;
MUACMAX = 0.03;
MUFSMAX = 0.1;
MUDSMAX = 0.07;
MBF = 0.3;
MBZ = 0.3;
MBB = 0.3;
MBC = 0.3;
MBS = 0.3;
MBBC = 0.4;
MBBS = 0.4;
RCMAX = 13.0;
RSMAX = 10.0;
MBOF = 0.001;
MBOZ = 0.001;
MBOB = 0.001;
MBOC = 0.001;
MBOS = 0.001;
MF = 0.025;
MZ = 0.005;
MB = 0.05;
RESPF = 0.001;
RESPZ = 0.01;
RESPB = 0.01;
RESPC = 0.01;
RESPS = 0.01;
UDP = 0.00004;
UDN = 0.002;
PHOT = 1.0;
ALPHA = 0.2;
RE = 0.4;
OKT = 0.085;
SED = 0.05;
SEDP = 0.1;
LOPT = 3000.0;
KW = 0.2;
KF = 0.05;
KD = 0.8;
KPD = 0.5;
HK = 0.1;
BKR = 20.0;
ZCR = 5.0;
FCR = 30.0;
MB2 = 10.0;
MZ2 = 3.0;
MF2 = 15.0;
LABDAB = 1.0;
LABDAZ = 1.0;
LABDAF = 1.0;
KA = 2.0;
MK = 5.0;
COP = 2.0;
MG = 1.0;
COD = 2.0;
HLP1 = MBBC / RCMAX;
HLP2 = MBBS / RSMAX;
HLP3 = XKWAD (KPF);
HLP4 = XKWAD (KNF);
HLP5 = XKWAD (KFZ);
HLP6 = XKWAD (KFB);
HLP7 = XKWAD (KFS);
HLP8 = XKWAD (KDZ);
HLP9 = XKWAD (KZB);
HLP10 = XKWAD (KBC);
HLP11 = W(MUBCMAX, HLP10, BKR);
HLP12 = XKWAD (KZC);
HLP13 = XKWAD (KDB);
HLP14 = XKWAD (KAC);
HLP15 = XKWAD (KDS);
F = 20.0;
Z = 0.0;
B = 0.0;
C = 0.0;
S = 0.0;
P = 0.003;
N = 0.15;
O = 9.8;
A = 0.0;
D = 7.2;
L = 0.0;
FO = 2.0;
REA = REA_MOMENT;
TEMP = TEMP_MOMENT;
NU = 0.0;
PU = 0.0;
OU = 0.0;
AU = 0.0;
PTOEG = 0.0;
NTOEG = 0.0;
OTOEG = 0.0;
VTOEG = 0.0;
L_JAARMAX = 3000.0;
TEMP_JAARMAX = 20.0;
Tmin= 0.0;
t= 0.0;
dt= 0.2;
Tmax= 249.5;
}
double Topt[] = new double[10];
double Q1[] = new double[10];
double Q2[] = new double[10];
double LABDA[] = new double[10];
double M[] = new double[10];
double XKWAD(double x)
{
return (x * x);
}
double W(double mumax ,double k ,double x)
{
double hulp;
hulp = x*x;
return ((mumax * hulp)/(k+hulp));
}
double FF(double L, double F, double D)
{
double K,Rel_licht,extinctie,hulp1,resultaat;
Rel_licht = L/LOPT;
K = KW + KF*F+KD* D * KPD;
hulp1 = -K * HK;
if (hulp1>32) {resultaat = 0}
else { if (hulp1<-32) {resultaat =1}
else { extinctie = Rel_licht * Math.exp(hulp1);
if (extinctie>32) {resultaat = 0}
else { if (extinctie<-32) {resultaat = 1}
else { resultaat = extinctie * Math.exp(1-extinctie) }
} } }
return resultaat;
}
double FT(int i)
{
double hulp1, hulp2, hulp3, resultaat;
if (TEMP
double MIN (double eerste, double tweede)
if (eerste>tweede) {resultaat = tweede}
double JOTA (double X, double LABDA, double M)
double FOX(double O)
double E1(double Tmp)
double E2(double O2)
double E3(double O2)
double KWAD(double x)
double TEMP_MOMENT()
double L_MOMENT()
double REA_MOMENT()
public void initInput()
public void initGraph()
public boolean stepModel()
TEMP = TEMP_MOMENT();
PKWAD= XKWAD(P);
QGF = FT(1)*FF(L,F,D)*MUFMAX*MIN(PKWAD/(HLP3+PKWAD),NKWAD/(5*(HLP4 +NKWAD)))*F;
QZC = FT(4) * FO(4) * MIN((HLP11-HLP16), (W(MUZCMAX,HLP12,Z) * JOTA(B,LABDAB,MB2)))*C;
DELTAPU = PU * dt;
DFDT = (QGF - QFZ - QFB - QFS - QFD - QFE)*dt;
F = F + DFDT; IF (F < 0.0) {F = 0.0;}
PTOEG = PTOEG + DELTAPU;
Graph1.newValue(F);
Enschede, 22 nov. 2000.
hulp3 = XKWAD(hulp1);
hulp2 = -4.6 * XKWAD(hulp3);
if (hulp2<-32) {resultaat = 0.0}
else {resultaat = Math.exp(hulp2)}
return resultaat;
}
{
double resultaat;
else {resultaat = eerste}
return resultaat;
}
double FO(int i)
{
double hulp,resultaat;
hulp = -LABDA[i] * (0 - M[i]);
if (hulp>32) {resultaat = 0.0}
else {if (hulp<-32) {resultaat = 1}
else {resultaat = 1 /(1 + Math.exp(hulp))}}
return resultaat;
}
{
double hulp1,hulp2,resultaat;
hulp1 = LABDA * (X-M);
if (hulp1>32) resultaat = 0}
else {if (hulp1<-32) {resultaat = 1}
else {hulp2 = Math.exp(-hulp1);
resultaat = hulp2/(1+hulp2);}}
return resultaat;
}
{
double resultaat;
if (O ==0) {resultaat = 1.0}
else {resultaat = 1 + (KA/O)}
return resultaat;
}
{
return (Math.exp(Tmp-20)* 0.06931472);
}
{
double hulp1,hulp2,resultaat;
hulp1 = COP * (MG - O2);
if (hulp1>32) {resultaat = 1.0}
else {if (hulp1<-32) {resultaat = 0.0}
else {hulp2 = Math.exp(hulp1);
resultaat = hulp2/(1 + hulp2);}
}
return resultaat;
}
{
double resultaat;
if (0
else {resultaat = (O2 - MG) / (O2 - COD) }}
return resultaat;
}
{
double resultaat;
resultaat = x * x;
return resultaat;
}
{
double TEMP_TIJD, TEMP_SEIZOEN, resultaat;
TEMP_TIJD = -Math.cos(6.283185 * (T - Math.floor(T)));
TEMP_SEIZOEN = 6+6+((1-Math.cos(t*0.0172142)) * (TEMP_JAARMAX-7) * 0.5);
resultaat = TEMP_SEIZOEN * TEMP_TIJD;
return resultaat;
}
{
double L_NU, L_TIJD, L_SEIZOEN, resultaat;
L_TIJD = - Math.cos( 6.283185 * (T - Math.floor(T)));
L_SEIZOEN = -Math.cos(T * 0.0172142) * 0.5;
L_NU = (L_TIJD + L_SEIZOEN) * L_JAARMAX / 1.5;
if (L_NU<0.0) {resultaat = 0.0}
else {resultaat = L_NU}
return resultaat;
}
{
double TEMPTEMP, TEMPTEMPTEMP, resultaat;
TEMPTEMP = XKWAD(TEMP);
TEMPTEMPTEMP = TEMPTEMP * TEMP;
resultaat = 14.61996 - 0.40420 * TEMP + 0.00842 * TEMPTEMP - 0.00009 * TEMPTEMPTEMP;
return resultaat;
}
{
Input1.setValue(K1);
Input2.setValue(K2);
}
{
graphViewer.initGraph();
}
{
K1 = Input1.getValue();
K2 = Input2.getValue();
// t = t + dt;
T = T + dt;
L = L_MOMENT();
REA = REA_MOMENT();
NKWAD= XKWAD(N);
QFZ = FT(2) * FO(2) * W(MUFZMAX,HLP5,F) * Z;
QFB = FT(3) * W(MUFBMAX,HLP6,F) * B;
QFS = FT(5) *FO(5) * W(MUFSMAX, HLP7, F) * S;
QFD = MBF * QGF;
IF (F > FO) {QFD = QFD + MF * F;};
QFE = MBOF *F;
QDZ = FT(2) *FO(2) * W(MUDZMAX, HLP8, D) * Z;
QZB = FT(3) * W(MUZBMAX, HLP9, Z) * B;
HLP16 = W(MUBCMAX, HLP10, B);
QZD = MBZ * (QFZ + QDZ) + FOX(0) * MZ * Z;
QZE = MBOZ * Z;
QDB = FT(3) * W(MUDBMAX, HLP13, D) * B;
QBC = FT(4) * FO(4) * HLP16 * C;
QBD = MBB * (QFB + QZB + QDB);
QBE = MBOB * B;
QAC = FT(4) * FO(4) * W(MUACMAX, HLP14, A) * C;
QDS = FT(5) * FO(5) * W(MUDSMAX, HLP15, D) * S;
RC = QAC * QBC + QZC;
RS = QFS + QDS;
QCD = (MBC + HLP1 * RC) * RC;
QCE = MBOC * C;
QSD = (MBS + HLP2 * RS) * RS;
QSE = MBOS * S;
QDP = UDP * E1(TEMP) * E2(0) * D;
QPF = QGF / 106.0;
QPD = SEDP * E3(0) * P;
QDN = UDN * E1(TEMP) * E2(0) * D;
QNF = QGF * 0.0472;
QFO = PHOT * QGF;
QOF = RESPF * F;
QOZ = RESPZ * Z;
QOB = RESPB * B;
QOC = RESPC * C;
QOS = RESPS * S;
QOD = OKT * D;
QAD = ALPHA * A;
DELTANU = NU * dt;
DELTAOU = OU * dt;
DELTAAU = AU * dt;
DZDT = (QFZ + QDZ - QZB - QZC - QZD - QZE)*dt;
DBDT = (QFB + QZB + QDB - QBC - QBD - QBE)*dt;
DCDT = (QAC + QBC + QZC - QCD - QCE)*dt;
DSDT = (QFS + QDS - QSD - QSE)*dt;
DPDT = DELTAPU + (QDP - QPF - QPD)*dt;
DNDT = DELTANU + (QDN - QNF)*dt;
DODT = DELTAOU + (QFO + RE * (REA - O) - QOF - QOZ - QOB - QOC - QOS - QOD)*dt;
DADT = DELTAAU + (AU - QAC - QAD)*dt;
DDDT = (QFD +QZD +QBD +QCD +QSD +QAD -QPD -QDN -QDZ -QDB -QDS -SED*D)*dt;
Z = Z + DZDT; IF (Z < 0.0) {Z = 0.0;}
B = B + DBDT; IF (B < 0.0) {B = 0.0;}
C = C + DCDT; IF (C < 0.0) {C = 0.0;}
S = S + DSDT; IF (S < 0.0) {S = 0.0;}
P = P + DPDT; IF (P < 0.0) {P = 0.0;}
N = N + DNDT; IF (N < 0.0) {N = 0.0;}
O = O + DODT; IF (O < 0.0) {O = 0.0;}
A = A + DADT; IF (A < 0.0) {A = 0.0;}
D = D + DDDT; IF (D < 0.0) {D = 0.0;}
NTOEG = NTOEG * DELTANU;
OTOEG = OTOEG + DELTAOU;
VTOEG = VTOEG + DELTAAU;
//if (N1 < 0.01) {.....};
Graph2.newValue(Z);
Graph3.newValue(D);
Text1.setText(Double.toString(T));
Text2.setText(Double.toString(F));
Text3.setText(Double.toString(Z));
Text4.setText(Double.toString(D));
graphViewer.newTValue(t);
return t
}