Examples of ThresholdMonitor


Examples of org.jboss.monitor.ThresholdMonitor

      }
      else
      {
         try
         {
            ThresholdMonitor monitor = new ThresholdMonitor();

            monitor.setMonitorName(monitorName);
            monitor.setObservedObject(oname);
            monitor.setObservedAttribute(attribute);
            monitor.setThreshold(threshold);
            monitor.setEnabled(new Boolean(enabled).booleanValue());
            monitor.setPeriod(timePeriod);
            monitor.setCompareTo(compareTo);
            ArrayList list = new ArrayList();
            for (int i = 0; i < alerts.length; i++)
            {
               list.add(new ObjectName(alerts[i]));
            }
            monitor.setAlertListeners(list);
            mbeanServer.registerMBean(monitor, new ObjectName("jboss.monitor:name=" + monitorName));
            monitor.create();
            monitor.start();
         }
         catch (Exception ex)
         {
            error("Failed to create non-persisted monitor: " + ex.toString(), req, resp);
         }
View Full Code Here

Examples of ptolemy.domains.ct.lib.ThresholdMonitor

        // ---------------------------------
        // 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;

        switch (code) {
        case 1: // accel state
            mon1.input.link(rInPz);
            p = (Parameter) mon1.getAttribute("thresholdWidth");
            p.setToken(new DoubleToken(0.1));
            p = (Parameter) mon1.getAttribute("thresholdCenter");
            p.setToken(new DoubleToken(-2.0));
            break;

        case 2: // first cruise state
            mon1.input.link(rV);
            p = (Parameter) mon1.getAttribute("thresholdWidth");
            p.setToken(new DoubleToken(0.2));
            p = (Parameter) mon1.getAttribute("thresholdCenter");
            p.setToken(new DoubleToken(5.0));
            mon2.input.link(rR);
            p = (Parameter) mon2.getAttribute("thresholdWidth");
            p.setToken(new DoubleToken(0.02));
            p = (Parameter) mon2.getAttribute("thresholdCenter");
            p.setToken(new DoubleToken(0.0));
            break;

        case 3: // climb state
            mon1.input.link(rInPz);
            p = (Parameter) mon1.getAttribute("thresholdWidth");
            p.setToken(new DoubleToken(0.1));
            p = (Parameter) mon1.getAttribute("thresholdCenter");
            p.setToken(new DoubleToken(-10.0));
            mon2.input.link(rV);
            p = (Parameter) mon2.getAttribute("thresholdWidth");
            p.setToken(new DoubleToken(0.2));
            p = (Parameter) mon2.getAttribute("thresholdCenter");
            p.setToken(new DoubleToken(5.0));
            break;

        default:
            break;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.