suboutR.setOutput(true);
// ---------------------------------
// Create the actors.
// ---------------------------------
TypedAtomicActor lin = null;
ThresholdMonitor mon1 = null;
ThresholdMonitor mon2 = null;
switch (code) {
case 0: // hover state
sub.setName("HoverCTSub");
lin = new HoverLinearizer(sub, "Hover");
break;
case 1: // acc state
sub.setName("AccelCTSub");
lin = new AccelerLinearizer(sub, "Accel");
mon1 = new ThresholdMonitor(sub, "Mon1");
break;
case 2: // first cruise state
sub.setName("Cruise1CTSub");
lin = new CruiseLinearizer(sub, "Cruise1");
mon1 = new ThresholdMonitor(sub, "Mon1");
mon2 = new ThresholdMonitor(sub, "Mon2");
break;
case 3: // climb state
sub.setName("ClimbCTSub");
lin = new ClimbLinearizer(sub, "Climb");
mon1 = new ThresholdMonitor(sub, "Mon1");
mon2 = new ThresholdMonitor(sub, "Mon2");
break;
case 4: // second cruise state
sub.setName("Cruise2CTSub");
lin = new CruiseLinearizer(sub, "Cruise2");
Parameter param = (Parameter) lin.getAttribute("CPz");
param.setToken(new DoubleToken(-10.0));
param = (Parameter) lin.getAttribute("CVx");
param.setToken(new DoubleToken(5.0));
break;
default:
break;
}
/*
ZeroOrderHold hPx = new ZeroOrderHold(sub, "HPx");
ZeroOrderHold hDPx = new ZeroOrderHold(sub, "HDPx");
ZeroOrderHold hDDPx = new ZeroOrderHold(sub, "HDDPx");
ZeroOrderHold hD3Px = new ZeroOrderHold(sub, "HD3Px");
ZeroOrderHold hD4Px = new ZeroOrderHold(sub, "HD4Px");
ZeroOrderHold hPz = new ZeroOrderHold(sub, "HPz");
ZeroOrderHold hDPz = new ZeroOrderHold(sub, "HDPz");
ZeroOrderHold hDDPz = new ZeroOrderHold(sub, "HDDPz");
ZeroOrderHold hD3Pz = new ZeroOrderHold(sub, "HD3Pz");
ZeroOrderHold hD4Pz = new ZeroOrderHold(sub, "HD4Pz");
sub.connect(hPx.input, subinPx);
sub.connect(hDPx.input, subinDPx);
sub.connect(hDDPx.input, subinDDPx);
sub.connect(hD3Px.input, subinD3Px);
sub.connect(hD4Px.input, subinD4Px);
Relation rInPz = sub.connect(hPz.input, subinPz);
sub.connect(hDPz.input, subinDPz);
sub.connect(hDDPz.input, subinDDPz);
sub.connect(hD3Pz.input, subinD3Pz);
sub.connect(hD4Pz.input, subinD4Pz);
sub.connect(hPx.output, (ComponentPort)lin.getPort("inputPx"));
sub.connect(hDPx.output, (ComponentPort)lin.getPort("inputDPx"));
sub.connect(hDDPx.output, (ComponentPort)lin.getPort("inputDDPx"));
sub.connect(hD3Px.output, (ComponentPort)lin.getPort("inputD3Px"));
sub.connect(hD4Px.output, (ComponentPort)lin.getPort("inputD4Px"));
sub.connect(hPz.output, (ComponentPort)lin.getPort("inputPz"));
sub.connect(hDPz.output, (ComponentPort)lin.getPort("inputDPz"));
sub.connect(hDDPz.output, (ComponentPort)lin.getPort("inputDDPz"));
sub.connect(hD3Pz.output, (ComponentPort)lin.getPort("inputD3Pz"));
sub.connect(hD4Pz.output, (ComponentPort)lin.getPort("inputD4Pz"));
*/
sub.connect(subinPx, (ComponentPort) lin.getPort("inputPx"));
sub.connect(subinDPx, (ComponentPort) lin.getPort("inputDPx"));
sub.connect(subinDDPx, (ComponentPort) lin.getPort("inputDDPx"));
sub.connect(subinD3Px, (ComponentPort) lin.getPort("inputD3Px"));
sub.connect(subinD4Px, (ComponentPort) lin.getPort("inputD4Px"));
Relation rInPz = sub.connect(subinPz, (ComponentPort) lin
.getPort("inputPz"));
//sub.connect(hPz.output, (ComponentPort)lin.getPort("inputPz"));
sub.connect(subinDPz, (ComponentPort) lin.getPort("inputDPz"));
sub.connect(subinDDPz, (ComponentPort) lin.getPort("inputDDPz"));
sub.connect(subinD3Pz, (ComponentPort) lin.getPort("inputD3Pz"));
sub.connect(subinD4Pz, (ComponentPort) lin.getPort("inputD4Pz"));
sub.connect(suboutVx, (ComponentPort) lin.getPort("outputVx"));
sub.connect(suboutVz, (ComponentPort) lin.getPort("outputVz"));
Relation rV = sub.connect(suboutV, (ComponentPort) lin
.getPort("outputV"));
Relation rR = sub.connect(suboutR, (ComponentPort) lin
.getPort("outputR"));
// connect and set the monitors
Parameter p = null;