シミュレーションの演習のコード
BGSA3のコードを以下に示します。このコードは20-Sim用です。
BGSA3のコード
MSe
variables
real flow;
equations
p.e = effort;
flow = p.f;
MSe1
variables
real flow;
equations
p.e = effort;
flow = p.f;
Controller
// Created by C. Kleijn, 22 Sep 1999
parameters
real K = 8.0 {}; // Proportional gain
real Ti = 0.8 {s}; // Integral time constant (Ti > 0).
variables
real error;
real hidden uP,uI;
equations
error = SP - MV;
uP = K * error;
uI = int (error * K / Ti );
output = uP + uI;
Gain
parameters
real K =0.03070; // gain
equations
output = K * input;
I
parameters
real i = 0.175;
equations
state = int(p.e);
p.f = state / i;
I1
parameters
real i = 0.8;
equations
state = int(p.e);
p.f = state / i;
Limit
parameters
real maximum = 220;
real minimum = -1;
equations
output = limit (input, minimum, maximum);
MGY
equations
p1.e = r * p2.f;
p2.e = r * p1.f;
MSe
variables
real flow;
equations
p.e = effort;
flow = p.f;
MSe1
variables
real flow;
equations
p.e = effort;
flow = p.f;
R
parameters
real r = 0.875;
equations
p.e = r * p.f;
R1
parameters
real r = 0.066;
equations
p.e = r * p.f;
Step
parameters
real amplitude = 100;
real start_time = 0.0 {s};
variables
boolean hidden change;
equations
"calculate at least at the start time"
change = timeevent (start_time);
"calculate the step signal"
output = amplitude * step (start_time);
Step1
parameters
real amplitude = -50;
real start_time = 2.0 {s};
variables
boolean hidden change;
equations
"calculate at least at the start time"
change = timeevent (start_time);
"calculate the step signal"
output = amplitude * step (start_time);
