Search in sources :

Example 11 with Generic

use of com.opensimulationplatform.core.model.modeldescription.variablegroup.generic.Generic in project osp-validator by open-simulation-platform.

the class GenericTypeConverter method convert.

@Override
public Generic convert(GenericType genericType) {
    Generic generic = new Generic();
    generic.setName(genericType.getName());
    List<GenericType> genericTypes = genericType.getGeneric();
    List<Generic> generics = context.genericTypeConverter.convert(genericTypes);
    generic.getGenerics().addAll(generics);
    context.modelDescription.getGenerics().addAll(generics);
    List<VariableType> variable = genericType.getVariable();
    List<Variable> variables = context.variableTypeConverter.convert(variable);
    generic.setVariables(variables);
    List<AngularDisplacementType> angularDisplacement = genericType.getAngularDisplacement();
    List<AngularDisplacement> angularDisplacements = context.angularDisplacementTypeConverter.convert(angularDisplacement);
    generic.getAngularDisplacements().addAll(angularDisplacements);
    context.modelDescription.getAngularDisplacements().addAll(angularDisplacements);
    List<ChargeType> charge = genericType.getCharge();
    List<Charge> charges = context.chargeTypeConverter.convert(charge);
    generic.getCharges().addAll(charges);
    context.modelDescription.getCharges().addAll(charges);
    List<LinearDisplacementType> linearDisplacement = genericType.getLinearDisplacement();
    List<LinearDisplacement> linearDisplacements = context.linearDisplacementTypeConverter.convert(linearDisplacement);
    generic.getLinearDisplacements().addAll(linearDisplacements);
    context.modelDescription.getLinearDisplacements().addAll(linearDisplacements);
    List<VolumeType> volume = genericType.getVolume();
    List<Volume> volumes = context.volumeTypeConverter.convert(volume);
    generic.getVolumes().addAll(volumes);
    context.modelDescription.getVolumes().addAll(volumes);
    List<ForceType> force = genericType.getForce();
    List<Force> forces = context.forceTypeConverter.convert(force);
    generic.getForces().addAll(forces);
    context.modelDescription.getForces().addAll(forces);
    List<PressureType> pressure = genericType.getPressure();
    List<Pressure> pressures = context.pressureTypeConverter.convert(pressure);
    generic.getPressures().addAll(pressures);
    context.modelDescription.getPressures().addAll(pressures);
    List<TorqueType> torque = genericType.getTorque();
    List<Torque> torques = context.torqueTypeConverter.convert(torque);
    generic.getTorques().addAll(torques);
    context.modelDescription.getTorques().addAll(torques);
    List<VoltageType> voltage = genericType.getVoltage();
    List<Voltage> voltages = context.voltageTypeConverter.convert(voltage);
    generic.getVoltages().addAll(voltages);
    context.modelDescription.getVoltages().addAll(voltages);
    List<AngularVelocityType> angularVelocity = genericType.getAngularVelocity();
    List<AngularVelocity> angularVelocities = context.angularVelocityTypeConverter.convert(angularVelocity);
    generic.getAngularVelocities().addAll(angularVelocities);
    context.modelDescription.getAngularVelocities().addAll(angularVelocities);
    List<CurrentType> current = genericType.getCurrent();
    List<Current> currents = context.currentTypeConverter.convert(current);
    generic.getCurrents().addAll(currents);
    context.modelDescription.getCurrents().addAll(currents);
    List<LinearVelocityType> linearVelocity = genericType.getLinearVelocity();
    List<LinearVelocity> linearVelocities = context.linearVelocityTypeConverter.convert(linearVelocity);
    generic.getLinearVelocities().addAll(linearVelocities);
    context.modelDescription.getLinearVelocities().addAll(linearVelocities);
    List<VolumeFlowRateType> volumeFlowRate = genericType.getVolumeFlowRate();
    List<VolumeFlowRate> volumeFlowRates = context.volumeFlowRateTypeConverter.convert(volumeFlowRate);
    generic.getVolumeFlowRates().addAll(volumeFlowRates);
    context.modelDescription.getVolumeFlowRates().addAll(volumeFlowRates);
    List<AngularMechanicalPortType> angularMechanicalPort = genericType.getAngularMechanicalPort();
    List<AngularMechanicalPort> angularMechanicalPorts = context.angularMechanicalPortTypeConverter.convert(angularMechanicalPort);
    generic.getAngularMechanicalPorts().addAll(angularMechanicalPorts);
    context.modelDescription.getAngularMechanicalPorts().addAll(angularMechanicalPorts);
    List<ElectromagneticPortType> electromagneticPort = genericType.getElectromagneticPort();
    List<ElectromagneticPort> electromagneticPorts = context.electromagneticPortTypeConverter.convert(electromagneticPort);
    generic.getElectromagneticPorts().addAll(electromagneticPorts);
    context.modelDescription.getElectromagneticPorts().addAll(electromagneticPorts);
    List<HydraulicPortType> hydraulicPort = genericType.getHydraulicPort();
    List<HydraulicPort> hydraulicPorts = context.hydraulicPortTypeConverter.convert(hydraulicPort);
    generic.getHydraulicPorts().addAll(hydraulicPorts);
    context.modelDescription.getHydraulicPorts().addAll(hydraulicPorts);
    List<LinearMechanicalPortType> linearMechanicalPort = genericType.getLinearMechanicalPort();
    List<LinearMechanicalPort> linearMechanicalPorts = context.linearMechanicalPortTypeConverter.convert(linearMechanicalPort);
    generic.getLinearMechanicalPorts().addAll(linearMechanicalPorts);
    context.modelDescription.getLinearMechanicalPorts().addAll(linearMechanicalPorts);
    List<AngularMechanicalQuasiPortType> angularMechanicalQuasiPort = genericType.getAngularMechanicalQuasiPort();
    List<AngularMechanicalQuasiPort> angularMechanicalQuasiPorts = context.angularMechanicalQuasiPortTypeConverter.convert(angularMechanicalQuasiPort);
    generic.getAngularMechanicalQuasiPorts().addAll(angularMechanicalQuasiPorts);
    context.modelDescription.getAngularMechanicalQuasiPorts().addAll(angularMechanicalQuasiPorts);
    List<ElectromagneticQuasiPortType> electromagneticQuasiPort = genericType.getElectromagneticQuasiPort();
    List<ElectromagneticQuasiPort> electromagneticQuasiPorts = context.electromagneticQuasiPortTypeConverter.convert(electromagneticQuasiPort);
    generic.getElectromagneticQuasiPorts().addAll(electromagneticQuasiPorts);
    context.modelDescription.getElectromagneticQuasiPorts().addAll(electromagneticQuasiPorts);
    List<HydraulicQuasiPortType> hydraulicQuasiPort = genericType.getHydraulicQuasiPort();
    List<HydraulicQuasiPort> hydraulicQuasiPorts = context.hydraulicQuasiPortTypeConverter.convert(hydraulicQuasiPort);
    generic.getHydraulicQuasiPorts().addAll(hydraulicQuasiPorts);
    context.modelDescription.getHydraulicQuasiPorts().addAll(hydraulicQuasiPorts);
    List<LinearMechanicalQuasiPortType> linearMechanicalQuasiPort = genericType.getLinearMechanicalQuasiPort();
    List<LinearMechanicalQuasiPort> linearMechanicalQuasiPorts = context.linearMechanicalQuasiPortTypeConverter.convert(linearMechanicalQuasiPort);
    generic.getLinearMechanicalQuasiPorts().addAll(linearMechanicalQuasiPorts);
    context.modelDescription.getLinearMechanicalQuasiPorts().addAll(linearMechanicalQuasiPorts);
    List<NmeaGgaFixType> nmeaGgaFixTypes = genericType.getNmeaGgaFix();
    List<NmeaGgaFix> nmeaGgaFixes = context.nmeaGgaFixTypeConverter.convert(nmeaGgaFixTypes);
    generic.getNmeaGgaFixs().addAll(nmeaGgaFixes);
    context.modelDescription.getNmeaGgaFixs().addAll(nmeaGgaFixes);
    List<NmeaGgaLatitudeLongitudeType> nmeaGgaLatitudeLongitudeTypes = genericType.getNmeaGgaLatitudeLongitude();
    List<NmeaGgaLatitudeLongitude> nmeaGgaLatitudeLongitude = context.nmeaGgaLatitudeLongitudeTypeConverter.convert(nmeaGgaLatitudeLongitudeTypes);
    generic.getNmeaGgaLatitudeLongitudes().addAll(nmeaGgaLatitudeLongitude);
    context.modelDescription.getNmeaGgaLatitudeLongitudes().addAll(nmeaGgaLatitudeLongitude);
    List<NmeaGgaType> nmeaGgaTypes = genericType.getNmeaGga();
    List<NmeaGga> nmeaGga = context.nmeaGgaTypeConverter.convert(nmeaGgaTypes);
    generic.getNmeaGgas().addAll(nmeaGga);
    context.modelDescription.getNmeaGgas().addAll(nmeaGga);
    List<NmeaGstEllipseType> nmeaGstEllipseTypes = genericType.getNmeaGstEllipse();
    List<NmeaGstEllipse> nmeaGstEllipse = context.nmeaGstEllipseTypeConverter.convert(nmeaGstEllipseTypes);
    generic.getNmeaGstEllipses().addAll(nmeaGstEllipse);
    context.modelDescription.getNmeaGstEllipses().addAll(nmeaGstEllipse);
    List<NmeaGstPositionErrorType> nmeaGstPositionErrorTypes = genericType.getNmeaGstPositionError();
    List<NmeaGstPositionError> nmeaGstPositionError = context.nmeaGstPositionErrorTypeConverter.convert(nmeaGstPositionErrorTypes);
    generic.getNmeaGstPositionErrors().addAll(nmeaGstPositionError);
    context.modelDescription.getNmeaGstPositionErrors().addAll(nmeaGstPositionError);
    List<NmeaGstRmsType> nmeaGstRmsTypes = genericType.getNmeaGstRms();
    List<NmeaGstRms> nmeaGstRms = context.nmeaGstRmsTypeConverter.convert(nmeaGstRmsTypes);
    generic.getNmeaGstRmss().addAll(nmeaGstRms);
    context.modelDescription.getNmeaGstRmss().addAll(nmeaGstRms);
    List<NmeaGstType> nmeaGstTypes = genericType.getNmeaGst();
    List<NmeaGst> nmeaGst = context.nmeaGstTypeConverter.convert(nmeaGstTypes);
    generic.getNmeaGsts().addAll(nmeaGst);
    context.modelDescription.getNmeaGsts().addAll(nmeaGst);
    List<NmeaMwvType> nmeaMwvTypes = genericType.getNmeaMwv();
    List<NmeaMwv> nmeaMwv = context.nmeaMwvTypeConverter.convert(nmeaMwvTypes);
    generic.getNmeaMwvs().addAll(nmeaMwv);
    context.modelDescription.getNmeaMwvs().addAll(nmeaMwv);
    List<NmeaStatusType> nmeaStatusTypes = genericType.getNmeaStatus();
    List<NmeaStatus> nmeaStatus = context.nmeaStatusTypeConverter.convert(nmeaStatusTypes);
    generic.getNmeaStatuses().addAll(nmeaStatus);
    context.modelDescription.getNmeaStatuses().addAll(nmeaStatus);
    List<NmeaSxnType> nmeaSxnTypes = genericType.getNmeaSxn();
    List<NmeaSxn> nmeaSxn = context.nmeaSxnTypeConverter.convert(nmeaSxnTypes);
    generic.getNmeaSxns().addAll(nmeaSxn);
    context.modelDescription.getNmeaSxns().addAll(nmeaSxn);
    List<NmeaThsType> nmeaThsTypes = genericType.getNmeaThs();
    List<NmeaThs> nmeaThs = context.nmeaThsTypeConverter.convert(nmeaThsTypes);
    generic.getNmeaThss().addAll(nmeaThs);
    context.modelDescription.getNmeaThss().addAll(nmeaThs);
    List<NmeaTimeType> nmeaTimeTypes = genericType.getNmeaTime();
    List<NmeaTime> nmeaTime = context.nmeaTimeTypeConverter.convert(nmeaTimeTypes);
    generic.getNmeaTimes().addAll(nmeaTime);
    context.modelDescription.getNmeaTimes().addAll(nmeaTime);
    List<NmeaTrueHeadingType> nmeaTrueHeadingTypes = genericType.getNmeaTrueHeading();
    List<NmeaTrueHeading> nmeaTrueHeading = context.nmeaTrueHeadingTypeConverter.convert(nmeaTrueHeadingTypes);
    generic.getNmeaTrueHeadings().addAll(nmeaTrueHeading);
    context.modelDescription.getNmeaTrueHeadings().addAll(nmeaTrueHeading);
    List<NmeaWindDirectionType> nmeaWindDirectionTypes = genericType.getNmeaWindDirection();
    List<NmeaWindDirection> nmeaWindDirection = context.nmeaWindDirectionTypeConverter.convert(nmeaWindDirectionTypes);
    generic.getNmeaWindDirections().addAll(nmeaWindDirection);
    context.modelDescription.getNmeaWindDirections().addAll(nmeaWindDirection);
    List<NmeaWindSpeedType> nmeaWindSpeedTypes = genericType.getNmeaWindSpeed();
    List<NmeaWindSpeed> nmeaWindSpeed = context.nmeaWindSpeedTypeConverter.convert(nmeaWindSpeedTypes);
    generic.getNmeaWindSpeeds().addAll(nmeaWindSpeed);
    context.modelDescription.getNmeaWindSpeeds().addAll(nmeaWindSpeed);
    List<AngularAccelerationType> angularAccelerationTypes = genericType.getAngularAcceleration();
    List<AngularAcceleration> angularAcceleration = context.angularAccelerationTypeConverter.convert(angularAccelerationTypes);
    generic.getAngularAccelerations().addAll(angularAcceleration);
    context.modelDescription.getAngularAccelerations().addAll(angularAcceleration);
    List<AzimuthAngleType> azimuthAngleTypes = genericType.getAzimuthAngle();
    List<AzimuthAngle> azimuthAngle = context.azimuthAngleTypeConverter.convert(azimuthAngleTypes);
    generic.getAzimuthAngles().addAll(azimuthAngle);
    context.modelDescription.getAzimuthAngles().addAll(azimuthAngle);
    List<AzimuthThrusterFeedbackType> azimuthThrusterFeedbackTypes = genericType.getAzimuthThrusterFeedback();
    List<AzimuthThrusterFeedback> azimuthThrusterFeedback = context.azimuthThrusterFeedbackTypeConverter.convert(azimuthThrusterFeedbackTypes);
    generic.getAzimuthThrusterFeedbacks().addAll(azimuthThrusterFeedback);
    context.modelDescription.getAzimuthThrusterFeedbacks().addAll(azimuthThrusterFeedback);
    List<AzimuthThrusterSetpointType> azimuthThrusterSetpointTypes = genericType.getAzimuthThrusterSetpoint();
    List<AzimuthThrusterSetpoint> azimuthThrusterSetpoint = context.azimuthThrusterSetpointTypeConverter.convert(azimuthThrusterSetpointTypes);
    generic.getAzimuthThrusterSetpoints().addAll(azimuthThrusterSetpoint);
    context.modelDescription.getAzimuthThrusterSetpoints().addAll(azimuthThrusterSetpoint);
    List<BatteryFeedbackType> batteryFeedbackTypes = genericType.getBatteryFeedback();
    List<BatteryFeedback> batteryFeedback = context.batteryFeedbackTypeConverter.convert(batteryFeedbackTypes);
    generic.getBatteryFeedbacks().addAll(batteryFeedback);
    context.modelDescription.getBatteryFeedbacks().addAll(batteryFeedback);
    List<BladePitchType> bladePitchTypes = genericType.getBladePitch();
    List<BladePitch> bladePitch = context.bladePitchTypeConverter.convert(bladePitchTypes);
    generic.getBladePitches().addAll(bladePitch);
    context.modelDescription.getBladePitches().addAll(bladePitch);
    List<BusFeedbackType> busFeedbackTypes = genericType.getBusFeedback();
    List<BusFeedback> busFeedback = context.busFeedbackTypeConverter.convert(busFeedbackTypes);
    generic.getBusFeedbacks().addAll(busFeedback);
    context.modelDescription.getBusFeedbacks().addAll(busFeedback);
    List<ElectricPowerType> electricPowerTypes = genericType.getElectricPower();
    List<ElectricPower> electricPower = context.electricPowerTypeConverter.convert(electricPowerTypes);
    generic.getElectricPowers().addAll(electricPower);
    context.modelDescription.getElectricPowers().addAll(electricPower);
    List<FixedThrusterFeedbackType> fixedThrusterFeedbackTypes = genericType.getFixedThrusterFeedback();
    List<FixedThrusterFeedback> fixedThrusterFeedback = context.fixedThrusterFeedbackTypeConverter.convert(fixedThrusterFeedbackTypes);
    generic.getFixedThrusterFeedbacks().addAll(fixedThrusterFeedback);
    context.modelDescription.getFixedThrusterFeedbacks().addAll(fixedThrusterFeedback);
    List<FixedThrusterSetpointType> fixedThrusterSetpointTypes = genericType.getFixedThrusterSetpoint();
    List<FixedThrusterSetpoint> fixedThrusterSetpoint = context.fixedThrusterSetpointTypeConverter.convert(fixedThrusterSetpointTypes);
    generic.getFixedThrusterSetpoints().addAll(fixedThrusterSetpoint);
    context.modelDescription.getFixedThrusterSetpoints().addAll(fixedThrusterSetpoint);
    List<FrequencyType> frequencyTypes = genericType.getFrequency();
    List<Frequency> frequency = context.frequencyTypeConverter.convert(frequencyTypes);
    generic.getFrequencies().addAll(frequency);
    context.modelDescription.getFrequencies().addAll(frequency);
    List<GeneratorFeedbackType> generatorFeedbackTypes = genericType.getGeneratorFeedback();
    List<GeneratorFeedback> generatorFeedback = context.generatorFeedbackTypeConverter.convert(generatorFeedbackTypes);
    generic.getGeneratorFeedbacks().addAll(generatorFeedback);
    context.modelDescription.getGeneratorFeedbacks().addAll(generatorFeedback);
    List<LinearAccelerationType> linearAccelerationTypes = genericType.getLinearAcceleration();
    List<LinearAcceleration> linearAcceleration = context.linearAccelerationTypeConverter.convert(linearAccelerationTypes);
    generic.getLinearAccelerations().addAll(linearAcceleration);
    context.modelDescription.getLinearAccelerations().addAll(linearAcceleration);
    List<ShaftSpeedType> shaftSpeedTypes = genericType.getShaftSpeed();
    List<ShaftSpeed> shaftSpeed = context.shaftSpeedTypeConverter.convert(shaftSpeedTypes);
    generic.getShaftSpeeds().addAll(shaftSpeed);
    context.modelDescription.getShaftSpeeds().addAll(shaftSpeed);
    return generic;
}
Also used : NmeaSxn(com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeasxn.NmeaSxn) LinearAcceleration(com.opensimulationplatform.core.model.modeldescription.variablegroup.linearacceleration.LinearAcceleration) GeneratorFeedback(com.opensimulationplatform.core.model.modeldescription.variablegroup.generatorfeedback.GeneratorFeedback) NmeaThs(com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeaths.NmeaThs) Volume(com.opensimulationplatform.core.model.modeldescription.variablegroup.volume.Volume) NmeaGstRms(com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeagstrms.NmeaGstRms) NmeaStatus(com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeastatus.NmeaStatus) NmeaTime(com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeatime.NmeaTime) AzimuthThrusterSetpoint(com.opensimulationplatform.core.model.modeldescription.variablegroup.azimuththrustersetpoint.AzimuthThrusterSetpoint) NmeaGstEllipse(com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeagstellipse.NmeaGstEllipse) ShaftSpeed(com.opensimulationplatform.core.model.modeldescription.variablegroup.shaftspeed.ShaftSpeed) Frequency(com.opensimulationplatform.core.model.modeldescription.variablegroup.frequency.Frequency) AngularVelocity(com.opensimulationplatform.core.model.modeldescription.variablegroup.angularvelocity.AngularVelocity) LinearDisplacement(com.opensimulationplatform.core.model.modeldescription.variablegroup.lineardisplacement.LinearDisplacement) ElectromagneticQuasiPort(com.opensimulationplatform.core.model.modeldescription.variablegroup.electromagneticquasiport.ElectromagneticQuasiPort) NmeaMwv(com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeamwv.NmeaMwv) LinearVelocity(com.opensimulationplatform.core.model.modeldescription.variablegroup.linearvelocity.LinearVelocity) Force(com.opensimulationplatform.core.model.modeldescription.variablegroup.force.Force) LinearMechanicalQuasiPort(com.opensimulationplatform.core.model.modeldescription.variablegroup.linearmechanicalquasiport.LinearMechanicalQuasiPort) NmeaGgaLatitudeLongitude(com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeaggalatitudelongitude.NmeaGgaLatitudeLongitude) Charge(com.opensimulationplatform.core.model.modeldescription.variablegroup.charge.Charge) NmeaGgaFix(com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeaggafix.NmeaGgaFix) AngularMechanicalQuasiPort(com.opensimulationplatform.core.model.modeldescription.variablegroup.angularmechanicalquasiport.AngularMechanicalQuasiPort) NmeaGstPositionError(com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeagstpositionerror.NmeaGstPositionError) NmeaTrueHeading(com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeatrueheading.NmeaTrueHeading) NmeaGga(com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeagga.NmeaGga) BladePitch(com.opensimulationplatform.core.model.modeldescription.variablegroup.bladepitch.BladePitch) AzimuthAngle(com.opensimulationplatform.core.model.modeldescription.variablegroup.azimuthangle.AzimuthAngle) NmeaWindSpeed(com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeawindspeed.NmeaWindSpeed) AngularDisplacement(com.opensimulationplatform.core.model.modeldescription.variablegroup.angulardisplacement.AngularDisplacement) Current(com.opensimulationplatform.core.model.modeldescription.variablegroup.current.Current) AngularMechanicalPort(com.opensimulationplatform.core.model.modeldescription.variablegroup.angularmechanicalport.AngularMechanicalPort) HydraulicPort(com.opensimulationplatform.core.model.modeldescription.variablegroup.hydraulicport.HydraulicPort) VolumeFlowRate(com.opensimulationplatform.core.model.modeldescription.variablegroup.volumeflowrate.VolumeFlowRate) Torque(com.opensimulationplatform.core.model.modeldescription.variablegroup.torque.Torque) ElectromagneticPort(com.opensimulationplatform.core.model.modeldescription.variablegroup.electromagneticport.ElectromagneticPort) HydraulicQuasiPort(com.opensimulationplatform.core.model.modeldescription.variablegroup.hydraulicquasiport.HydraulicQuasiPort) BatteryFeedback(com.opensimulationplatform.core.model.modeldescription.variablegroup.batteryfeedback.BatteryFeedback) AngularAcceleration(com.opensimulationplatform.core.model.modeldescription.variablegroup.angularacceleration.AngularAcceleration) LinearMechanicalPort(com.opensimulationplatform.core.model.modeldescription.variablegroup.linearmechanicalport.LinearMechanicalPort) Pressure(com.opensimulationplatform.core.model.modeldescription.variablegroup.pressure.Pressure) FixedThrusterSetpoint(com.opensimulationplatform.core.model.modeldescription.variablegroup.fixedthrustersetpoint.FixedThrusterSetpoint) NmeaGst(com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeagst.NmeaGst) BusFeedback(com.opensimulationplatform.core.model.modeldescription.variablegroup.busfeedback.BusFeedback) NmeaWindDirection(com.opensimulationplatform.core.model.modeldescription.variablegroup.nmeawinddirection.NmeaWindDirection) Variable(com.opensimulationplatform.core.model.modeldescription.Variable) Generic(com.opensimulationplatform.core.model.modeldescription.variablegroup.generic.Generic) Voltage(com.opensimulationplatform.core.model.modeldescription.variablegroup.voltage.Voltage) FixedThrusterFeedback(com.opensimulationplatform.core.model.modeldescription.variablegroup.fixedthrusterfeedback.FixedThrusterFeedback) ElectricPower(com.opensimulationplatform.core.model.modeldescription.variablegroup.electricpower.ElectricPower) AzimuthThrusterFeedback(com.opensimulationplatform.core.model.modeldescription.variablegroup.azimuththrusterfeedback.AzimuthThrusterFeedback)

Example 12 with Generic

use of com.opensimulationplatform.core.model.modeldescription.variablegroup.generic.Generic in project osp-validator by open-simulation-platform.

the class ModelDescriptionFactoryTest method canCreate.

@Test
public void canCreate() {
    ModelDescriptionFactory factory = new ModelDescriptionFactory();
    ModelDescription converted = factory.create(TestResources.CRANE_CONTROLLER_XML, TestResources.CRANE_CONTROLLER_FMU.toURI());
    List<Variable> variables = converted.getVariables();
    List<LinearMechanicalPort> linearMechanicalPorts = converted.getLinearMechanicalPorts();
    assertEquals(1, linearMechanicalPorts.size());
    linearMechanicalPorts.forEach(linearMechanicalPort -> {
        assertTrue(variables.containsAll(linearMechanicalPort.getForce().getVariables()));
        assertTrue(variables.containsAll(linearMechanicalPort.getLinearVelocity().getVariables()));
    });
    List<Generic> generics = converted.getGenerics();
    assertEquals(1, generics.size());
    generics.forEach(generic -> {
        assertTrue(variables.containsAll(generic.getVariables()));
    });
}
Also used : Variable(com.opensimulationplatform.core.model.modeldescription.Variable) Generic(com.opensimulationplatform.core.model.modeldescription.variablegroup.generic.Generic) LinearMechanicalPort(com.opensimulationplatform.core.model.modeldescription.variablegroup.linearmechanicalport.LinearMechanicalPort) ModelDescription(com.opensimulationplatform.core.model.modeldescription.ModelDescription) Test(org.junit.Test)

Example 13 with Generic

use of com.opensimulationplatform.core.model.modeldescription.variablegroup.generic.Generic in project osp-validator by open-simulation-platform.

the class SystemStructureValidatorTest method createInvalidModelDescription.

@NotNull
private ModelDescription createInvalidModelDescription() {
    ModelDescription modelDescription = new ModelDescription();
    Variable v1 = new Variable();
    v1.setCausality(Variable.Causality.UNDEFINED);
    v1.setType(Variable.Type.REAL);
    v1.setName("not-unique");
    Variable v2 = new Variable();
    v2.setCausality(Variable.Causality.INPUT);
    v2.setType(Variable.Type.INTEGER);
    v2.setName("not-unique");
    modelDescription.getVariables().add(v1);
    modelDescription.getVariables().add(v2);
    Generic g = new Generic();
    g.setName("variable-container");
    g.setVariables(Arrays.asList(v1, v2));
    modelDescription.getGenerics().add(g);
    Force f1 = new Force();
    f1.setName("not-unique");
    Variable v3 = new Variable();
    v3.setName("v3");
    v3.setType(Variable.Type.REAL);
    v3.setCausality(Variable.Causality.OUTPUT);
    Unit u1 = new Unit();
    u1.setExponent(Unit.Exponent.KILOGRAM, 1);
    v3.setUnit(u1);
    f1.setVariables(Arrays.asList(v3));
    modelDescription.getVariables().add(v3);
    Force f2 = new Force();
    f2.setName("not-unique");
    Variable v4 = new Variable();
    v4.setName("v4");
    v4.setType(Variable.Type.INTEGER);
    v4.setCausality(Variable.Causality.INPUT);
    f2.setVariables(Arrays.asList(v4));
    modelDescription.getVariables().add(v4);
    modelDescription.getForces().add(f1);
    modelDescription.getForces().add(f2);
    Variable v5 = new Variable();
    v5.setName("v5");
    v5.setCausality(Variable.Causality.OUTPUT);
    v5.setType(Variable.Type.REAL);
    Variable v6 = new Variable();
    v6.setName("v6");
    v6.setCausality(Variable.Causality.INPUT);
    v6.setType(Variable.Type.REAL);
    Unit u2 = new Unit();
    u2.setExponent(Unit.Exponent.KILOGRAM, 2);
    v6.setUnit(u2);
    Force f3 = new Force();
    f3.setName("f3");
    f3.setVariables(Arrays.asList(v5, v6));
    modelDescription.getVariables().add(v5);
    modelDescription.getVariables().add(v6);
    modelDescription.getForces().add(f3);
    Variable v7 = new Variable();
    v7.setName("v7");
    v7.setCausality(Variable.Causality.OUTPUT);
    v7.setType(Variable.Type.REAL);
    Variable v8 = new Variable();
    v8.setName("v8");
    v8.setCausality(Variable.Causality.OUTPUT);
    v8.setType(Variable.Type.REAL);
    Force f4 = new Force();
    f4.setName("f4");
    f4.setVariables(Arrays.asList(v7, v8));
    modelDescription.getVariables().add(v7);
    modelDescription.getVariables().add(v8);
    modelDescription.getForces().add(f4);
    Variable v9 = new Variable();
    v9.setName("v9");
    v9.setCausality(Variable.Causality.OUTPUT);
    v9.setType(Variable.Type.REAL);
    Variable v10 = new Variable();
    v10.setName("v10");
    v10.setCausality(Variable.Causality.OUTPUT);
    v10.setType(Variable.Type.REAL);
    LinearVelocity lv1 = new LinearVelocity();
    lv1.setName("lv1");
    lv1.setVariables(Arrays.asList(v9, v10));
    modelDescription.getVariables().add(v9);
    modelDescription.getVariables().add(v10);
    modelDescription.getLinearVelocities().add(lv1);
    LinearMechanicalPort lmp1 = new LinearMechanicalPort();
    lmp1.setName("lmp1");
    lmp1.setForce(f4);
    lmp1.setLinearVelocity(lv1);
    modelDescription.getLinearMechanicalPorts().add(lmp1);
    return modelDescription;
}
Also used : LinearVelocity(com.opensimulationplatform.core.model.modeldescription.variablegroup.linearvelocity.LinearVelocity) Variable(com.opensimulationplatform.core.model.modeldescription.Variable) Force(com.opensimulationplatform.core.model.modeldescription.variablegroup.force.Force) Generic(com.opensimulationplatform.core.model.modeldescription.variablegroup.generic.Generic) LinearMechanicalPort(com.opensimulationplatform.core.model.modeldescription.variablegroup.linearmechanicalport.LinearMechanicalPort) ModelDescription(com.opensimulationplatform.core.model.modeldescription.ModelDescription) Unit(com.opensimulationplatform.core.model.modeldescription.Unit) NotNull(org.jetbrains.annotations.NotNull)

Example 14 with Generic

use of com.opensimulationplatform.core.model.modeldescription.variablegroup.generic.Generic in project osp-validator by open-simulation-platform.

the class NamesValidatorTest method validSystemStructure.

@Test
public void validSystemStructure() {
    SystemStructure systemStructure = new SystemStructure();
    Simulator s1 = new Simulator();
    s1.setName("s1");
    Simulator s2 = new Simulator();
    s2.setName("s2");
    ModelDescription modelDescription = new ModelDescription();
    Variable v1 = new Variable();
    v1.setName("v1");
    Variable v2 = new Variable();
    v2.setName("v2");
    modelDescription.getVariables().add(v1);
    modelDescription.getVariables().add(v2);
    Generic vg1 = new Generic();
    vg1.setName("vg1");
    Generic vg2 = new Generic();
    vg2.setName("vg2");
    modelDescription.getGenerics().add(vg1);
    modelDescription.getGenerics().add(vg2);
    s1.setModelDescription(modelDescription);
    systemStructure.getSimulators().add(s1);
    systemStructure.getSimulators().add(s2);
    NamesValidator namesValidator = new NamesValidator();
    List<ValidationDiagnostic<Name>> diagnostics = namesValidator.validate(systemStructure);
    assertEquals(0, diagnostics.size());
}
Also used : Variable(com.opensimulationplatform.core.model.modeldescription.Variable) SystemStructure(com.opensimulationplatform.core.model.systemstructure.SystemStructure) Generic(com.opensimulationplatform.core.model.modeldescription.variablegroup.generic.Generic) ValidationDiagnostic(com.opensimulationplatform.core.validation.ValidationDiagnostic) ModelDescription(com.opensimulationplatform.core.model.modeldescription.ModelDescription) Simulator(com.opensimulationplatform.core.model.systemstructure.Simulator) Test(org.junit.Test)

Example 15 with Generic

use of com.opensimulationplatform.core.model.modeldescription.variablegroup.generic.Generic in project osp-validator by open-simulation-platform.

the class VE_Name_3_Test method valid.

@Test
public void valid() {
    Generic vg1 = new Generic();
    vg1.setName("vg1-unique-name");
    Generic vg2 = new Generic();
    vg2.setName("vg2-unique-name");
    builder.build(vg1);
    builder.build(vg2);
    builder.complete();
    List<ValidationDiagnostic<Name>> diagnostics = validationError.validate();
    assertTrue(diagnostics.isEmpty());
}
Also used : Generic(com.opensimulationplatform.core.model.modeldescription.variablegroup.generic.Generic) ValidationDiagnostic(com.opensimulationplatform.core.validation.ValidationDiagnostic) Test(org.junit.Test)

Aggregations

Generic (com.opensimulationplatform.core.model.modeldescription.variablegroup.generic.Generic)18 Test (org.junit.Test)15 ValidationDiagnostic (com.opensimulationplatform.core.validation.ValidationDiagnostic)14 Variable (com.opensimulationplatform.core.model.modeldescription.Variable)13 ModelDescription (com.opensimulationplatform.core.model.modeldescription.ModelDescription)9 LinearMechanicalPort (com.opensimulationplatform.core.model.modeldescription.variablegroup.linearmechanicalport.LinearMechanicalPort)6 Force (com.opensimulationplatform.core.model.modeldescription.variablegroup.force.Force)5 LinearVelocity (com.opensimulationplatform.core.model.modeldescription.variablegroup.linearvelocity.LinearVelocity)5 VariableGroup (com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup)3 Simulator (com.opensimulationplatform.core.model.systemstructure.Simulator)3 SystemStructure (com.opensimulationplatform.core.model.systemstructure.SystemStructure)3 Unit (com.opensimulationplatform.core.model.modeldescription.Unit)2 AngularAcceleration (com.opensimulationplatform.core.model.modeldescription.variablegroup.angularacceleration.AngularAcceleration)2 AngularDisplacement (com.opensimulationplatform.core.model.modeldescription.variablegroup.angulardisplacement.AngularDisplacement)2 AngularMechanicalPort (com.opensimulationplatform.core.model.modeldescription.variablegroup.angularmechanicalport.AngularMechanicalPort)2 AngularMechanicalQuasiPort (com.opensimulationplatform.core.model.modeldescription.variablegroup.angularmechanicalquasiport.AngularMechanicalQuasiPort)2 AngularVelocity (com.opensimulationplatform.core.model.modeldescription.variablegroup.angularvelocity.AngularVelocity)2 AzimuthAngle (com.opensimulationplatform.core.model.modeldescription.variablegroup.azimuthangle.AzimuthAngle)2 AzimuthThrusterFeedback (com.opensimulationplatform.core.model.modeldescription.variablegroup.azimuththrusterfeedback.AzimuthThrusterFeedback)2 AzimuthThrusterSetpoint (com.opensimulationplatform.core.model.modeldescription.variablegroup.azimuththrustersetpoint.AzimuthThrusterSetpoint)2