Package fr.soleil.salsa.entity.scan1d

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


        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 (dimensionK == null) {
            dimensionK = new DimensionKImpl();
            configK.setDimensionX(dimensionK);
        }

        IDimension1D dimension1D = config1D.getDimensionX();
        if (dimension1D == null) {
            dimension1D = new Dimension1DImpl();
            config1D.setDimensionX(dimension1D);
        }
    }
View Full Code Here

                    ArrayList<ITrajectory> trajectories = new ArrayList<ITrajectory>();
                    switch (config.getType()) {

                        case SCAN_1D:
                            IConfig1D config1d = (IConfig1D) config;
                            IDimension1D dimensionX = config1d.getDimensionX();
                            List<IActuator> listActuator = dimensionX.getActuatorsList();
                            // System.out.println("Actuator Size=" + listActuator.size());
                            List<IRange1D> range1d = dimensionX.getRangesXList();
                            for (int rangeIndex = 0; rangeIndex < range1d.size(); rangeIndex++) {
                                IRange1D range1D = range1d.get(rangeIndex);
                                List<ITrajectory> listTrajectory = range1D.getTrajectoriesList();
                                int trajectorySize = listTrajectory.size();
                                if (listActuator.size() == trajectorySize) {
View Full Code Here

        if (dimensionK == null) {
            dimensionK = new DimensionKImpl();
            configK.setDimensionX(dimensionK);
        }

        IDimension1D dimension1D = config1D.getDimensionX();
        if (dimension1D == null) {
            dimension1D = new Dimension1DImpl();
            config1D.setDimensionX(dimension1D);
        }
    }
View Full Code Here

    @Override
    public void notifyNewRangeAction() {
        if (this.config != null) {
            Range1DModel rangeToAdd = new Range1DModel();
            rangeToAdd.setDimension(((IConfig1D) config).getDimensionX());
            IDimension1D dimension = ((IConfig1D) config).getDimensionX();
            rangeToAdd.setIntegrationTime(1.0);
            rangeToAdd.setStepsNumber(1);
            this.rangeModelsList.add(rangeToAdd);
            ((IConfig1D) config).getDimensionX().getRangesXList().add(rangeToAdd);
            IRange1D range = ((IConfig1D) config).getDimensionX().getRangesXList()
                    .get(((IConfig1D) config).getDimensionX().getRangesXList().size() - 1);
            ((Range1DModel) range).addListener(listenerRange1D);

            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);
                ITrajectory1D t = dimension.getTrajectoriesList().get(
                        dimension.getTrajectoriesList().size() - 1);
                ((Trajectory1DModel) t).addListener(listenerTrajectory1D);

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

            trajectory1DModelToAdd.setDelta(0.0);
            trajectory1DModelToAdd.setRelative(false);
            trajectory1DModelToAdd.setSpeed(0.0);
            trajectory1DModelToAdd.setRange(rangeModelsList.get(i));
            this.rangeModelsList.get(i).getTrajectoriesList().add(trajectory1DModelToAdd);
            IDimension1D dimension = ((IConfig1D) config).getDimensionX();

            dimension.getTrajectoriesList().add(trajectory1DModelToAdd);
            ITrajectory1D t = dimension.getTrajectoriesList().get(
                    dimension.getTrajectoriesList().size() - 1);
            ((Trajectory1DModel) t).addListener(listenerTrajectory1D);
            ITrajectory tr = ((IConfig1D) config)
                    .getDimensionX()
                    .getRangesXList()
                    .get(i)
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

     */
    public void actuatorAddedEvent(List<IActuator> newList) {
        ActuatorModel actuatorModel = (ActuatorModel) newList.get(newList.size() - 1);
        this.actuatorModelsList.add(actuatorModel);
        actuatorModel.addListener(listenerActuator);
        IDimension1D dimension = ((IConfig1D) config).getDimensionX();
        List<IRange1D> range1DList = dimension.getRangesXList();
        if (this.rangeModelsList.size() == 0) {
            this.notifyNewRangeAction();
        }
        for (int i = 0; i < this.rangeModelsList.size(); i++) {
            Range1DModel range = rangeModelsList.get(i);
            IRange1D range1D = range1DList.get(i);
            Trajectory1DModel trajectory1DModelToAdd = new Trajectory1DModel();
            trajectory1DModelToAdd.setBeginPosition(0.0);
            trajectory1DModelToAdd.setEndPosition(0.0);
            trajectory1DModelToAdd.setDelta(0.0);
            trajectory1DModelToAdd.setRelative(false);
            trajectory1DModelToAdd.setSpeed(0.0);
            trajectory1DModelToAdd.setRange(rangeModelsList.get(i));
            range.getTrajectoriesList().add(trajectory1DModelToAdd);
            range1D.getTrajectoriesList().add(trajectory1DModelToAdd);
            dimension.getTrajectoriesList().add(trajectory1DModelToAdd);
            trajectory1DModelToAdd.addListener(listenerTrajectory1D);
            trajectory1DModelToAdd.setActuator(actuatorModel);
        }
        this.notifyAddActuator(actuatorModel.getName(), true);
    }
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

                    // Actuators

                    List<String> actuatorsNamesList;
                    String[] actuatorsNamesArray;
                    IDimension1D dimension = config.getDimensionX();
                    List<IActuator> 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 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 (int index = 0; index < actuatorsList.size(); index++) {
                        IActuator actuator = actuatorsList.get(index);
                        if (actuator.isEnabled()) {
                            initialValue = ActuatorConnector.getData(actuator);
                            actuatorPositionsList = new ArrayList<Double>();
                            // For each actuators, the positions must be sorted by range.
                            List<ITrajectory> trajectoryList = findActuatorTrajectories(dimension,
                                    index);
                            for (ITrajectory trajectory : trajectoryList) {
                                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());
                            }
                            // System.out.println(actuator.getName() + "="
                            // + Arrays.toString(actuatorPositionsList.toArray()));
                            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

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.