Search in sources :

Example 1 with Current

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

the class VE_Current_2 method getInvalidObjects.

@Override
protected List<Current> getInvalidObjects() {
    OWLClass validationErrorClass = context.owl.dataFactory.getOWLClass(VE_Current_2, context.owl.prefixManager);
    Set<OWLNamedIndividual> invalidIndividuals = context.invalidIndividuals.get(validationErrorClass);
    return invalidIndividuals.stream().map(individual -> (Current) context.variableGroups.get(individual)).collect(Collectors.toList());
}
Also used : List(java.util.List) OWLNamedIndividual(org.semanticweb.owlapi.model.OWLNamedIndividual) VE_Current_2(com.opensimulationplatform.gen.owl.model.OntologyClasses.VE_Current_2) Set(java.util.Set) Current(com.opensimulationplatform.core.model.modeldescription.variablegroup.current.Current) 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) Current(com.opensimulationplatform.core.model.modeldescription.variablegroup.current.Current)

Example 2 with Current

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

the class VE_Current_3 method getInvalidObjects.

@Override
protected List<Current> getInvalidObjects() {
    OWLClass validationErrorClass = context.owl.dataFactory.getOWLClass(VE_Current_3, context.owl.prefixManager);
    Set<OWLNamedIndividual> invalidIndividuals = context.invalidIndividuals.get(validationErrorClass);
    return invalidIndividuals.stream().map(individual -> (Current) context.variableGroups.get(individual)).collect(Collectors.toList());
}
Also used : List(java.util.List) OWLNamedIndividual(org.semanticweb.owlapi.model.OWLNamedIndividual) VE_Current_3(com.opensimulationplatform.gen.owl.model.OntologyClasses.VE_Current_3) Set(java.util.Set) Current(com.opensimulationplatform.core.model.modeldescription.variablegroup.current.Current) 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) Current(com.opensimulationplatform.core.model.modeldescription.variablegroup.current.Current)

Example 3 with Current

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

the class ElectromagneticPortValidatorTest method valid.

@Test
public void valid() {
    ModelDescription modelDescription = new ModelDescription();
    Variable v1 = new Variable();
    v1.setCausality(Variable.Causality.OUTPUT);
    Voltage voltage = new Voltage();
    voltage.setVariables(Arrays.asList(v1));
    Variable v2 = new Variable();
    v2.setCausality(Variable.Causality.INPUT);
    Current current = new Current();
    current.setVariables(Arrays.asList(v2));
    ElectromagneticPort electromagneticPort = new ElectromagneticPort();
    electromagneticPort.setVoltage(voltage);
    electromagneticPort.setCurrent(current);
    modelDescription.getElectromagneticPorts().add(electromagneticPort);
    ElectromagneticPortValidator electromagneticPortValidator = new ElectromagneticPortValidator();
    List<ValidationDiagnostic<ElectromagneticPort>> diagnostics = electromagneticPortValidator.validate(modelDescription);
    assertTrue(diagnostics.isEmpty());
}
Also used : ElectromagneticPort(com.opensimulationplatform.core.model.modeldescription.variablegroup.electromagneticport.ElectromagneticPort) Variable(com.opensimulationplatform.core.model.modeldescription.Variable) Voltage(com.opensimulationplatform.core.model.modeldescription.variablegroup.voltage.Voltage) ValidationDiagnostic(com.opensimulationplatform.core.validation.ValidationDiagnostic) ModelDescription(com.opensimulationplatform.core.model.modeldescription.ModelDescription) Current(com.opensimulationplatform.core.model.modeldescription.variablegroup.current.Current) Test(org.junit.Test)

Example 4 with Current

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

the class ElectromagneticPortValidatorTest method invalid.

@Test
public void invalid() {
    ModelDescription modelDescription = new ModelDescription();
    Variable v1 = new Variable();
    v1.setCausality(Variable.Causality.OUTPUT);
    Voltage voltage = new Voltage();
    voltage.setVariables(Arrays.asList(v1));
    Variable v2 = new Variable();
    v2.setCausality(Variable.Causality.OUTPUT);
    Current current = new Current();
    current.setVariables(Arrays.asList(v2));
    ElectromagneticPort electromagneticPort = new ElectromagneticPort();
    electromagneticPort.setVoltage(voltage);
    electromagneticPort.setCurrent(current);
    modelDescription.getElectromagneticPorts().add(electromagneticPort);
    ElectromagneticPortValidator electromagneticPortValidator = new ElectromagneticPortValidator();
    List<ValidationDiagnostic<ElectromagneticPort>> diagnostics = electromagneticPortValidator.validate(modelDescription);
    assertEquals(1, diagnostics.size());
    assertEquals(electromagneticPort, diagnostics.get(0).getValidatedObject());
}
Also used : ElectromagneticPort(com.opensimulationplatform.core.model.modeldescription.variablegroup.electromagneticport.ElectromagneticPort) Variable(com.opensimulationplatform.core.model.modeldescription.Variable) Voltage(com.opensimulationplatform.core.model.modeldescription.variablegroup.voltage.Voltage) ValidationDiagnostic(com.opensimulationplatform.core.validation.ValidationDiagnostic) ModelDescription(com.opensimulationplatform.core.model.modeldescription.ModelDescription) Current(com.opensimulationplatform.core.model.modeldescription.variablegroup.current.Current) Test(org.junit.Test)

Example 5 with Current

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

the class VE_ElectromagneticPort_1_Test method invalid.

@Test
public void invalid() {
    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.OUTPUT);
    v3.setUnit(new Unit());
    v3.setType(Variable.Type.REAL);
    Variable v4 = new Variable();
    v4.setCausality(Variable.Causality.OUTPUT);
    v4.setUnit(new Unit());
    v4.setType(Variable.Type.REAL);
    Voltage voltage = new Voltage();
    voltage.setVariables(Arrays.asList(v1, v2));
    Current current = new Current();
    current.setVariables(Arrays.asList(v3, v4));
    ElectromagneticPort electromagneticPort = new ElectromagneticPort();
    electromagneticPort.setVoltage(voltage);
    electromagneticPort.setCurrent(current);
    builder.build(electromagneticPort);
    builder.complete();
    List<ValidationDiagnostic<ElectromagneticPort>> diagnostics = validationError.validate();
    assertEquals(1, diagnostics.size());
    ElectromagneticPort invalidElectromagneticPort = diagnostics.get(0).getValidatedObject();
    assertEquals(electromagneticPort, invalidElectromagneticPort);
}
Also used : ElectromagneticPort(com.opensimulationplatform.core.model.modeldescription.variablegroup.electromagneticport.ElectromagneticPort) Variable(com.opensimulationplatform.core.model.modeldescription.Variable) Voltage(com.opensimulationplatform.core.model.modeldescription.variablegroup.voltage.Voltage) ValidationDiagnostic(com.opensimulationplatform.core.validation.ValidationDiagnostic) Unit(com.opensimulationplatform.core.model.modeldescription.Unit) Current(com.opensimulationplatform.core.model.modeldescription.variablegroup.current.Current) Test(org.junit.Test)

Aggregations

Current (com.opensimulationplatform.core.model.modeldescription.variablegroup.current.Current)20 Variable (com.opensimulationplatform.core.model.modeldescription.Variable)14 ValidationDiagnostic (com.opensimulationplatform.core.validation.ValidationDiagnostic)12 Test (org.junit.Test)12 Unit (com.opensimulationplatform.core.model.modeldescription.Unit)11 ElectromagneticPort (com.opensimulationplatform.core.model.modeldescription.variablegroup.electromagneticport.ElectromagneticPort)8 Voltage (com.opensimulationplatform.core.model.modeldescription.variablegroup.voltage.Voltage)8 ModelDescription (com.opensimulationplatform.core.model.modeldescription.ModelDescription)5 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 ElectromagneticQuasiPort (com.opensimulationplatform.core.model.modeldescription.variablegroup.electromagneticquasiport.ElectromagneticQuasiPort)3 Force (com.opensimulationplatform.core.model.modeldescription.variablegroup.force.Force)3 HydraulicPort (com.opensimulationplatform.core.model.modeldescription.variablegroup.hydraulicport.HydraulicPort)3 HydraulicQuasiPort (com.opensimulationplatform.core.model.modeldescription.variablegroup.hydraulicquasiport.HydraulicQuasiPort)3 LinearDisplacement (com.opensimulationplatform.core.model.modeldescription.variablegroup.lineardisplacement.LinearDisplacement)3 LinearMechanicalPort (com.opensimulationplatform.core.model.modeldescription.variablegroup.linearmechanicalport.LinearMechanicalPort)3 LinearMechanicalQuasiPort (com.opensimulationplatform.core.model.modeldescription.variablegroup.linearmechanicalquasiport.LinearMechanicalQuasiPort)3