use of com.opensimulationplatform.core.model.modeldescription.variablegroup.current.Current in project osp-validator by open-simulation-platform.
the class VE_Current_1_Test method invalid.
@Test
public void invalid() {
Current current = new Current();
Variable v1 = new Variable();
v1.setCausality(Variable.Causality.INPUT);
v1.setType(Variable.Type.REAL);
v1.setUnit(new Unit());
Variable v2 = new Variable();
v2.setCausality(Variable.Causality.OUTPUT);
v2.setType(v1.getType());
v2.setUnit(v1.getUnit());
current.setVariables(Arrays.asList(v1, v2));
builder.build(current);
builder.complete();
List<ValidationDiagnostic<Current>> diagnostics = validationError.validate();
assertEquals(1, diagnostics.size());
Current invalidObject = diagnostics.get(0).getValidatedObject();
List<Variable> variables = invalidObject.getVariables();
assertTrue(variables.contains(v1));
assertTrue(variables.contains(v2));
}
use of com.opensimulationplatform.core.model.modeldescription.variablegroup.current.Current in project osp-validator by open-simulation-platform.
the class VE_Current_1_Test method valid.
@Test
public void valid() {
Current current = new Current();
Variable v1 = new Variable();
v1.setCausality(Variable.Causality.INPUT);
v1.setType(Variable.Type.REAL);
v1.setUnit(new Unit());
Variable v2 = new Variable();
v2.setCausality(v1.getCausality());
v2.setType(v1.getType());
v2.setUnit(v1.getUnit());
current.setVariables(Arrays.asList(v1, v2));
builder.build(current);
builder.complete();
List<ValidationDiagnostic<Current>> diagnostics = validationError.validate();
assertTrue(diagnostics.isEmpty());
}
use of com.opensimulationplatform.core.model.modeldescription.variablegroup.current.Current in project osp-validator by open-simulation-platform.
the class VE_Current_3_Test method invalid.
@Test
public void invalid() {
Current current = new Current();
Variable v1 = new Variable();
v1.setCausality(Variable.Causality.INPUT);
v1.setType(Variable.Type.REAL);
v1.setUnit(new Unit());
Variable v2 = new Variable();
v2.setCausality(v1.getCausality());
v2.setType(v1.getType());
Unit u = new Unit();
u.setExponent(Unit.Exponent.KILOGRAM, 1);
v2.setUnit(u);
current.setVariables(Arrays.asList(v1, v2));
builder.build(current);
builder.complete();
List<ValidationDiagnostic<Current>> diagnostics = validationError.validate();
assertEquals(1, diagnostics.size());
Current invalidObject = diagnostics.get(0).getValidatedObject();
List<Variable> variables = invalidObject.getVariables();
assertTrue(variables.contains(v1));
assertTrue(variables.contains(v2));
}
use of com.opensimulationplatform.core.model.modeldescription.variablegroup.current.Current 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;
}
use of com.opensimulationplatform.core.model.modeldescription.variablegroup.current.Current in project osp-validator by open-simulation-platform.
the class ElectromagneticPortTypeConverter method convert.
@Override
public ElectromagneticPort convert(ElectromagneticPortType electromagneticPortType) {
ElectromagneticPort electromagneticPort = new ElectromagneticPort();
Voltage voltage = context.voltageTypeConverter.convert(electromagneticPortType.getVoltage());
Current current = context.currentTypeConverter.convert(electromagneticPortType.getCurrent());
context.modelDescription.getVoltages().add(voltage);
context.modelDescription.getCurrents().add(current);
electromagneticPort.setName(electromagneticPortType.getName());
electromagneticPort.setVoltage(voltage);
electromagneticPort.setCurrent(current);
return electromagneticPort;
}
Aggregations