Search in sources :

Example 1 with Pressure

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

the class VE_Pressure_2 method getInvalidObjects.

@Override
protected List<Pressure> getInvalidObjects() {
    OWLClass validationErrorClass = context.owl.dataFactory.getOWLClass(VE_Pressure_2, context.owl.prefixManager);
    Set<OWLNamedIndividual> invalidIndividuals = context.invalidIndividuals.get(validationErrorClass);
    return invalidIndividuals.stream().map(individual -> (Pressure) context.variableGroups.get(individual)).collect(Collectors.toList());
}
Also used : List(java.util.List) Pressure(com.opensimulationplatform.core.model.modeldescription.variablegroup.pressure.Pressure) OWLNamedIndividual(org.semanticweb.owlapi.model.OWLNamedIndividual) Set(java.util.Set) ValidationError(com.opensimulationplatform.core.validation.ValidationError) Collectors(java.util.stream.Collectors) VE_Pressure_2(com.opensimulationplatform.gen.owl.model.OntologyClasses.VE_Pressure_2) OWLClass(org.semanticweb.owlapi.model.OWLClass) OWLNamedIndividual(org.semanticweb.owlapi.model.OWLNamedIndividual) OWLClass(org.semanticweb.owlapi.model.OWLClass) Pressure(com.opensimulationplatform.core.model.modeldescription.variablegroup.pressure.Pressure)

Example 2 with Pressure

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

the class VE_Pressure_3 method getInvalidObjects.

@Override
protected List<Pressure> getInvalidObjects() {
    OWLClass validationErrorClass = context.owl.dataFactory.getOWLClass(VE_Pressure_3, context.owl.prefixManager);
    Set<OWLNamedIndividual> invalidIndividuals = context.invalidIndividuals.get(validationErrorClass);
    return invalidIndividuals.stream().map(individual -> (Pressure) context.variableGroups.get(individual)).collect(Collectors.toList());
}
Also used : List(java.util.List) VE_Pressure_3(com.opensimulationplatform.gen.owl.model.OntologyClasses.VE_Pressure_3) Pressure(com.opensimulationplatform.core.model.modeldescription.variablegroup.pressure.Pressure) OWLNamedIndividual(org.semanticweb.owlapi.model.OWLNamedIndividual) Set(java.util.Set) ValidationError(com.opensimulationplatform.core.validation.ValidationError) Collectors(java.util.stream.Collectors) OWLClass(org.semanticweb.owlapi.model.OWLClass) OWLNamedIndividual(org.semanticweb.owlapi.model.OWLNamedIndividual) OWLClass(org.semanticweb.owlapi.model.OWLClass) Pressure(com.opensimulationplatform.core.model.modeldescription.variablegroup.pressure.Pressure)

Example 3 with Pressure

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

the class HydraulicPortValidatorTest method invalid.

@Test
public void invalid() {
    ModelDescription modelDescription = new ModelDescription();
    Variable v1 = new Variable();
    v1.setCausality(Variable.Causality.OUTPUT);
    Pressure pressure = new Pressure();
    pressure.setVariables(Arrays.asList(v1));
    Variable v2 = new Variable();
    v2.setCausality(Variable.Causality.OUTPUT);
    VolumeFlowRate volumeFlowRate = new VolumeFlowRate();
    volumeFlowRate.setVariables(Arrays.asList(v2));
    HydraulicPort hydraulicPort = new HydraulicPort();
    hydraulicPort.setPressure(pressure);
    hydraulicPort.setVolumeFlowRate(volumeFlowRate);
    modelDescription.getHydraulicPorts().add(hydraulicPort);
    HydraulicPortValidator hydraulicPortValidator = new HydraulicPortValidator();
    List<ValidationDiagnostic<HydraulicPort>> diagnostics = hydraulicPortValidator.validate(modelDescription);
    assertEquals(1, diagnostics.size());
    assertEquals(hydraulicPort, diagnostics.get(0).getValidatedObject());
}
Also used : Variable(com.opensimulationplatform.core.model.modeldescription.Variable) VolumeFlowRate(com.opensimulationplatform.core.model.modeldescription.variablegroup.volumeflowrate.VolumeFlowRate) ValidationDiagnostic(com.opensimulationplatform.core.validation.ValidationDiagnostic) ModelDescription(com.opensimulationplatform.core.model.modeldescription.ModelDescription) Pressure(com.opensimulationplatform.core.model.modeldescription.variablegroup.pressure.Pressure) HydraulicPort(com.opensimulationplatform.core.model.modeldescription.variablegroup.hydraulicport.HydraulicPort) Test(org.junit.Test)

Example 4 with Pressure

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

the class HydraulicPortValidatorTest method valid.

@Test
public void valid() {
    ModelDescription modelDescription = new ModelDescription();
    Variable v1 = new Variable();
    v1.setCausality(Variable.Causality.OUTPUT);
    Pressure pressure = new Pressure();
    pressure.setVariables(Arrays.asList(v1));
    Variable v2 = new Variable();
    v2.setCausality(Variable.Causality.INPUT);
    VolumeFlowRate volumeFlowRate = new VolumeFlowRate();
    volumeFlowRate.setVariables(Arrays.asList(v2));
    HydraulicPort hydraulicPort = new HydraulicPort();
    hydraulicPort.setPressure(pressure);
    hydraulicPort.setVolumeFlowRate(volumeFlowRate);
    modelDescription.getHydraulicPorts().add(hydraulicPort);
    HydraulicPortValidator hydraulicPortValidator = new HydraulicPortValidator();
    List<ValidationDiagnostic<HydraulicPort>> diagnostics = hydraulicPortValidator.validate(modelDescription);
    assertTrue(diagnostics.isEmpty());
}
Also used : Variable(com.opensimulationplatform.core.model.modeldescription.Variable) VolumeFlowRate(com.opensimulationplatform.core.model.modeldescription.variablegroup.volumeflowrate.VolumeFlowRate) ValidationDiagnostic(com.opensimulationplatform.core.validation.ValidationDiagnostic) ModelDescription(com.opensimulationplatform.core.model.modeldescription.ModelDescription) Pressure(com.opensimulationplatform.core.model.modeldescription.variablegroup.pressure.Pressure) HydraulicPort(com.opensimulationplatform.core.model.modeldescription.variablegroup.hydraulicport.HydraulicPort) Test(org.junit.Test)

Example 5 with Pressure

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

the class VE_HydraulicPort_1_Test method valid.

@Test
public void valid() {
    Variable v1 = new Variable();
    v1.setCausality(Variable.Causality.OUTPUT);
    v1.setUnit(new Unit());
    v1.setType(Variable.Type.REAL);
    Variable v2 = new Variable();
    v2.setCausality(Variable.Causality.OUTPUT);
    v2.setUnit(new Unit());
    v2.setType(Variable.Type.REAL);
    Variable v3 = new Variable();
    v3.setCausality(Variable.Causality.INPUT);
    v3.setUnit(new Unit());
    v3.setType(Variable.Type.REAL);
    Variable v4 = new Variable();
    v4.setCausality(Variable.Causality.INPUT);
    v4.setUnit(new Unit());
    v4.setType(Variable.Type.REAL);
    Pressure pressure = new Pressure();
    pressure.setVariables(Arrays.asList(v1, v2));
    VolumeFlowRate volumeFlowRate = new VolumeFlowRate();
    volumeFlowRate.setVariables(Arrays.asList(v3, v4));
    HydraulicPort hydraulicPort = new HydraulicPort();
    hydraulicPort.setPressure(pressure);
    hydraulicPort.setVolumeFlowRate(volumeFlowRate);
    builder.build(hydraulicPort);
    builder.complete();
    List<ValidationDiagnostic<HydraulicPort>> diagnostics = validationError.validate();
    assertTrue(diagnostics.isEmpty());
}
Also used : Variable(com.opensimulationplatform.core.model.modeldescription.Variable) VolumeFlowRate(com.opensimulationplatform.core.model.modeldescription.variablegroup.volumeflowrate.VolumeFlowRate) ValidationDiagnostic(com.opensimulationplatform.core.validation.ValidationDiagnostic) Unit(com.opensimulationplatform.core.model.modeldescription.Unit) Pressure(com.opensimulationplatform.core.model.modeldescription.variablegroup.pressure.Pressure) HydraulicPort(com.opensimulationplatform.core.model.modeldescription.variablegroup.hydraulicport.HydraulicPort) Test(org.junit.Test)

Aggregations

Pressure (com.opensimulationplatform.core.model.modeldescription.variablegroup.pressure.Pressure)25 Variable (com.opensimulationplatform.core.model.modeldescription.Variable)18 ValidationDiagnostic (com.opensimulationplatform.core.validation.ValidationDiagnostic)16 Test (org.junit.Test)16 Unit (com.opensimulationplatform.core.model.modeldescription.Unit)13 HydraulicPort (com.opensimulationplatform.core.model.modeldescription.variablegroup.hydraulicport.HydraulicPort)8 HydraulicQuasiPort (com.opensimulationplatform.core.model.modeldescription.variablegroup.hydraulicquasiport.HydraulicQuasiPort)8 Volume (com.opensimulationplatform.core.model.modeldescription.variablegroup.volume.Volume)8 VolumeFlowRate (com.opensimulationplatform.core.model.modeldescription.variablegroup.volumeflowrate.VolumeFlowRate)8 ModelDescription (com.opensimulationplatform.core.model.modeldescription.ModelDescription)7 AngularDisplacement (com.opensimulationplatform.core.model.modeldescription.variablegroup.angulardisplacement.AngularDisplacement)3 AngularMechanicalPort (com.opensimulationplatform.core.model.modeldescription.variablegroup.angularmechanicalport.AngularMechanicalPort)3 AngularMechanicalQuasiPort (com.opensimulationplatform.core.model.modeldescription.variablegroup.angularmechanicalquasiport.AngularMechanicalQuasiPort)3 AngularVelocity (com.opensimulationplatform.core.model.modeldescription.variablegroup.angularvelocity.AngularVelocity)3 Charge (com.opensimulationplatform.core.model.modeldescription.variablegroup.charge.Charge)3 Current (com.opensimulationplatform.core.model.modeldescription.variablegroup.current.Current)3 ElectromagneticPort (com.opensimulationplatform.core.model.modeldescription.variablegroup.electromagneticport.ElectromagneticPort)3 ElectromagneticQuasiPort (com.opensimulationplatform.core.model.modeldescription.variablegroup.electromagneticquasiport.ElectromagneticQuasiPort)3 Force (com.opensimulationplatform.core.model.modeldescription.variablegroup.force.Force)3 LinearDisplacement (com.opensimulationplatform.core.model.modeldescription.variablegroup.lineardisplacement.LinearDisplacement)3