Package fr.soleil.salsa.entity.scan1d

Examples of fr.soleil.salsa.entity.scan1d.IDimension1D


    @Override
    public List<? extends IRange> getRangeList() {
        List<? extends IRange> rangeList = null;

        if (this instanceof IDimension1D) {
            IDimension1D dimension1D = ((IDimension1D) this);
            rangeList = dimension1D.getRangesXList();
        }
        else if (this instanceof IDimension2DX) {
            IDimension2DX dimension2DX = ((IDimension2DX) this);
            rangeList = dimension2DX.getRangesList();
        }
View Full Code Here


                    // Actuators
                    List<IActuator> actuatorsList;
                    List<String> actuatorsNamesList;
                    String[] actuatorsNamesArray;
                    IDimension1D dimension = config.getDimensionX();
                    actuatorsList = dimension.getActuatorsList();
                    actuatorsNamesList = new ArrayList<String>(actuatorsList.size());
                    for (IActuator actuator : actuatorsList) {
                        if (actuator.isEnabled()) {
                            actuatorsNamesList.add(actuator.getName());
                        }
                    }
                    actuatorsNamesArray = actuatorsNamesList.toArray(new String[actuatorsNamesList
                            .size()]);
                    setAttribute("actuators", actuatorsNamesArray);

                    // Dimensions
                    // Tango exchanges trajectories as double arrays that contains the positions, in
                    // order,
                    // actuator after actuator, range after range, of the trajectories of all the
                    // actuators.
                    // There is one such array per dimension.
                    double[] allActuatorsPositionsArray;
                    double initialValue;
                    // Contains the positions in order, range after range, of the trajectories of an
                    // actuator.
                    List<Double> actuatorPositionsList;
                    // Contains the positions in order, actuator after actuator, range after range,
                    // of
                    // the trajectories of all the actuators.
                    List<Double> allActuatorsPositionsList;
                    // The list of integrations times.
                    List<Double> integrationsTimesList;
                    double[] integrationsTimesArray;
                    int integrationTimeIndex;
                    // The list of speeds.
                    List<Double> speedList = new ArrayList<Double>();
                    double[] speedArray;
                    // The number of points, which is the total steps numbers + 1 per range.
                    int totalStepsNumber;
                    // The actuators used for this dimension
                    List<IActuator> dimensionActuatorsList;
                    // Dimension.
                    // Initial computations.
                    dimensionActuatorsList = dimension.getActuatorsList();
                    // The positions, sorted as Tango expect them.
                    allActuatorsPositionsList = new ArrayList<Double>();
                    // The number of enabled actuators.
                    int enabledActuatorsNumber = 0;
                    // The positions must be sorted by actuator, so we loop over the actuators.
                    for (IActuator actuator : dimensionActuatorsList) {
                        if (actuator.isEnabled()) {
                            initialValue = ActuatorConnector.getData(actuator);
                            actuatorPositionsList = new ArrayList<Double>();
                            // For each actuators, the positions must be sorted by range.
                            for (ITrajectory trajectory : findActuatorTrajectories(dimension,
                                    actuator)) {
                                actuatorPositionsList.addAll(TrajectoryCalculator
                                        .calculateLinearTrajectoriesPosition(
                                                (ITrajectory1D) trajectory, initialValue));
                                // The speeds must be sorted in the same order, so we read them
                                // here.
                                speedList.add(trajectory.getSpeed());
                            }
                            allActuatorsPositionsList.addAll(actuatorPositionsList);
                            ++enabledActuatorsNumber;
                        }
                    }

                    // Integration Time and steps number.
                    integrationsTimesList = new ArrayList<Double>(dimension.getRangesXList().size());
                    int stepsNumber;
                    totalStepsNumber = 0;
                    for (IRange1D range : dimension.getRangesXList()) {
                        stepsNumber = range.getStepsNumber();
                        for (integrationTimeIndex = 0; integrationTimeIndex < stepsNumber + 1; ++integrationTimeIndex) {
                            integrationsTimesList.add(range.getIntegrationTime());
                        }
                        totalStepsNumber += stepsNumber + 1;
View Full Code Here

    }

    @Override
    protected IConfig<IDimension1D> initModel() {
        Config1DModel config1DModel = new Config1DModel(this);
        IDimension1D dimension1D = (IDimension1D) getDimensionX();
        if (dimension1D != null) {
            IDimension1D dimensionModel = (IDimension1D) dimension1D.toModel();
            List<IActuator> actuatorList = dimension1D.getActuatorsList();
            List<IActuator> actuatorListModel = convertActuatorListToModel(actuatorList);
            dimensionModel.setActuatorsList(actuatorListModel);

            List<IRange1D> rangeList = dimension1D.getRangesXList();
            List<IRange1D> rangeModelList = new ArrayList<IRange1D>();
            for (IRange1D range : rangeList) {
                rangeModelList.add((IRange1D) range.toModel());
View Full Code Here

        if ((config instanceof IConfig2D) && yActuator) {
            dimension = ((IConfig2D) config).getDimensionY();
        }

        if (dimension instanceof IDimension1D) {
            IDimension1D dimension1D = ((IDimension1D) dimension);
            rangeList = dimension1D.getRangesXList();
        }
        else if (dimension instanceof IDimension2DX) {
            IDimension2DX dimension2DX = ((IDimension2DX) dimension);
            rangeList = dimension2DX.getRangesList();
        }
View Full Code Here

                        if (!actuatorTrajectoryMap.isEmpty()) {
                            switch (config.getType()) {

                                case SCAN_1D:
                                    IConfig1D config1d = (IConfig1D) config;
                                    IDimension1D dimensionX = config1d.getDimensionX();
                                    List<IActuator> actuatorList = dimensionX.getActuatorsList();
                                    List<IRange1D> range1DList = dimensionX.getRangesXList();

                                    for (int rangeid = 0; rangeid < range1DList.size(); rangeid++) {
                                        modifyTrajectory(range1DList.get(rangeid), actuatorList,
                                                actuatorTrajectoryMap);
                                    }
View Full Code Here

                Element actuators = document.createElement("actuators");
                switch (config.getType()) {

                    case SCAN_1D:
                        IConfig1D config1d = (IConfig1D) config;
                        IDimension1D dimensionX = config1d.getDimensionX();
                        List<IActuator> listActuator = dimensionX.getActuatorsList();
                        ArrayList<ITrajectory> trajectories = new ArrayList<ITrajectory>();
                        List<IRange1D> range1d = dimensionX.getRangesXList();

                        for (int i = 0; i < range1d.size(); i++) {
                            List<ITrajectory> listTrajectory = range1d.get(i).getTrajectoriesList();
                            for (int j = 0; j < listTrajectory.size(); j++) {
                                TrajectoryImpl trajectory = new TrajectoryImpl();
View Full Code Here

               
                // Actuators
                List<IActuator> actuatorsList;
                List<String> actuatorsNamesList;
                String[] actuatorsNamesArray;
                IDimension1D dimension = config.getDimensionX();
                actuatorsList = dimension.getActuatorsList();
                actuatorsNamesList = new ArrayList<String>(actuatorsList.size());
                for(IActuator actuator : actuatorsList) {
                    if(actuator.isEnabled()) {
                        actuatorsNamesList.add(actuator.getName());
                    }
                }
                actuatorsNamesArray = actuatorsNamesList.toArray(new String[actuatorsNamesList.size()]);
                setAttribute("actuators", actuatorsNamesArray);
               
                // Dimensions
                // Tango exchanges trajectories as double arrays that contains the positions, in order,
                // actuator after actuator, range after range, of the trajectories of all the actuators.
                // There is one such array per dimension.
                double[] allActuatorsPositionsArray;
                double initialValue;
                // Contains the positions in order, range after range, of the trajectories of an actuator.
                List<Double> actuatorPositionsList;
                // Contains the positions in order, actuator after actuator, range after range, of the trajectories of all the actuators.
                List<Double> allActuatorsPositionsList;
                // The list of integrations times.
                List<Double> integrationsTimesList;
                double[] integrationsTimesArray;
                int integrationTimeIndex;
                // The list of speeds.
                List<Double> speedList = new ArrayList<Double>();
                double[] speedArray;
                // The number of points, which is the total steps numbers + 1 per range.
                int totalStepsNumber;
                // The actuators used for this dimension
                List<IActuator> dimensionActuatorsList;
                // Dimension.
                // Initial computations.
                dimensionActuatorsList = dimension.getActuatorsList();
                // The positions, sorted as Tango expect them.
                allActuatorsPositionsList = new ArrayList<Double>();
                // The number of enabled actuators.
                int enabledActuatorsNumber = 0;
                // The positions must be sorted by actuator, so we loop over the actuators.
                for(IActuator actuator : dimensionActuatorsList) {
                    if(actuator.isEnabled()) {
                        initialValue = ActuatorConnector.getData(actuator);
                        actuatorPositionsList = new ArrayList<Double>();
                        // For each actuators, the positions must be sorted by range.
                        for(ITrajectory trajectory : findActuatorTrajectories(dimension, actuator)) {
                            actuatorPositionsList.addAll(
                                    TrajectoryCalculator.calculateLinearTrajectoriesPosition((ITrajectory1D) trajectory, initialValue));
                            // The speeds must be sorted in the same order, so we read them here.
                            speedList.add(trajectory.getSpeed());
                        }
                        allActuatorsPositionsList.addAll(actuatorPositionsList);
                        ++enabledActuatorsNumber;
                    }
                }

                // Integration Time and steps number.
                integrationsTimesList = new ArrayList<Double>(dimension.getRangesXList().size());
                int stepsNumber;
                totalStepsNumber = 0;
                for(IRange1D range : dimension.getRangesXList()) {
                    stepsNumber = range.getStepsNumber();
                    for(integrationTimeIndex = 0; integrationTimeIndex < stepsNumber + 1; ++integrationTimeIndex) {
                        integrationsTimesList.add(range.getIntegrationTime());
                    }
                    totalStepsNumber += stepsNumber + 1;
View Full Code Here

    /**
     *
     */
    public void setDimensionX(IDimension1D dimensionX) {
        IDimension1D oldValue = this.baseBean.getDimensionX();
        this.baseBean.setDimensionX(dimensionX);
        this.firePropertyChange("dimensionX", oldValue, dimensionX);
    }
View Full Code Here

        indent("**" + c1.getName(), _d);
        indent("  id : " + c1.getId(), _d);
        indent("  scanNumber : " + c1.getScanNumber(), _d);

        IDimension1D X = c1.getDimensionX();
        if (X != null) {
            for (int i = 0; i < X.getActuatorsList().size(); i++) {
                IActuator actuator = X.getActuatorsList().get(i);
                indent("  actuator" + i + " : " + actuator.getName()
                        + (actuator.isEnabled() ? " (on)" : " (off)"), _d);
            }
        }

View Full Code Here

     * Adds a range and associated trajectories for the model and the view.
     */
    @Override
    public void notifyNewRangeAction() {
        if (this.config != null) {
            IDimension1D dimension = ((IConfig1D) config).getDimensionX();
            Range1DModel rangeToAdd = new Range1DModel();
            rangeToAdd.setDimension(dimension);
            rangeToAdd.setIntegrationTime(1.0);
            rangeToAdd.setStepsNumber(1);
            this.rangeModelsList.add(rangeToAdd);
            List<IRange1D> range1DList = dimension.getRangesXList();

            for (int i = 0; i < this.actuatorModelsList.size(); i++) {
                Trajectory1DModel trajectory1DModelToAdd = new Trajectory1DModel();
                trajectory1DModelToAdd.setBeginPosition(0.0);
                trajectory1DModelToAdd.setEndPosition(0.0);
                trajectory1DModelToAdd.setDelta(0.0);
                trajectory1DModelToAdd.setRelative(false);
                trajectory1DModelToAdd.setSpeed(0.0);

                rangeToAdd.getTrajectoriesList().add(trajectory1DModelToAdd);
                trajectory1DModelToAdd.setRange(rangeToAdd);
                trajectory1DModelToAdd.setActuator(actuatorModelsList.get(i));
                dimension.getTrajectoriesList().add(trajectory1DModelToAdd);
                trajectory1DModelToAdd.addListener(listenerTrajectory1D);
            }

            if (view != null) {
                view.addRange();
View Full Code Here

TOP

Related Classes of fr.soleil.salsa.entity.scan1d.IDimension1D

Copyright © 2018 www.massapicom. 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.