Search in sources :

Example 1 with VariableGroup

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

the class Validator method addHydraulicPort.

private void addHydraulicPort(ModelDescription modelDescription, Map<Object, Object> map, HydraulicPortType element) {
    VariableGroup variableGroup = ModelDescriptionUtil.getVariableGroupByName(modelDescription, element.getName());
    if (variableGroup != null) {
        map.put(variableGroup, element);
        addPressure(modelDescription, map, element.getPressure());
        addVolumeFlowRate(modelDescription, map, element.getVolumeFlowRate());
    }
}
Also used : VariableGroup(com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup)

Example 2 with VariableGroup

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

the class Validator method addGeneric.

private void addGeneric(ModelDescription modelDescription, Map<Object, Object> map, GenericType element) {
    VariableGroup variableGroup = ModelDescriptionUtil.getVariableGroupByName(modelDescription, element.getName());
    if (variableGroup != null) {
        map.put(variableGroup, element);
        addVariables(modelDescription, map, element.getVariable());
        element.getGeneric().forEach(vg -> addGeneric(modelDescription, map, vg));
        element.getAngularDisplacement().forEach(vg -> addAngularDisplacement(modelDescription, map, vg));
        element.getAngularMechanicalPort().forEach(vg -> addAngularMechanicalPort(modelDescription, map, vg));
        element.getAngularMechanicalQuasiPort().forEach(vg -> addAngularMechanicalQuasiPort(modelDescription, map, vg));
        element.getAngularVelocity().forEach(vg -> addAngularVelocity(modelDescription, map, vg));
        element.getCharge().forEach(vg -> addCharge(modelDescription, map, vg));
        element.getCurrent().forEach(vg -> addCurrent(modelDescription, map, vg));
        element.getElectromagneticPort().forEach(vg -> addElectromagneticPort(modelDescription, map, vg));
        element.getElectromagneticQuasiPort().forEach(vg -> addElectromagneticQuasiPort(modelDescription, map, vg));
        element.getForce().forEach(vg -> addForce(modelDescription, map, vg));
        element.getHydraulicPort().forEach(vg -> addHydraulicPort(modelDescription, map, vg));
        element.getHydraulicQuasiPort().forEach(vg -> addHydraulicQuasiPort(modelDescription, map, vg));
        element.getLinearDisplacement().forEach(vg -> addLinearDisplacement(modelDescription, map, vg));
        element.getLinearMechanicalPort().forEach(vg -> addLinearMechanicalPort(modelDescription, map, vg));
        element.getLinearMechanicalQuasiPort().forEach(vg -> addLinearMechanicalQuasiPort(modelDescription, map, vg));
        element.getLinearVelocity().forEach(vg -> addLinearVelocity(modelDescription, map, vg));
        element.getPressure().forEach(vg -> addPressure(modelDescription, map, vg));
        element.getTorque().forEach(vg -> addTorque(modelDescription, map, vg));
        element.getVoltage().forEach(vg -> addVoltage(modelDescription, map, vg));
        element.getVolume().forEach(vg -> addVolume(modelDescription, map, vg));
        element.getVolumeFlowRate().forEach(vg -> addVolumeFlowRate(modelDescription, map, vg));
    }
}
Also used : VariableGroup(com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup)

Example 3 with VariableGroup

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

the class VariableGroupOwlBuilder method setVariableGroups.

private void setVariableGroups(VariableGroup variableGroup, OWLNamedIndividual variableGroupIndividual) {
    OWLObjectProperty hasVariableGroup = context.owl.dataFactory.getOWLObjectProperty(op_has_variable_group, context.owl.prefixManager);
    List<VariableGroup> variableGroups = variableGroup.getVariableGroups();
    for (VariableGroup vg : variableGroups) {
        vg.getName().setId(() -> variableGroup.getName().getId().get().replace("." + variableGroup.getName().get(), ".") + vg.getName().get());
        OWLNamedIndividual vgIndividual = this.build(vg);
        OWLAxiom axiom = context.owl.dataFactory.getOWLObjectPropertyAssertionAxiom(hasVariableGroup, variableGroupIndividual, vgIndividual);
        context.axioms.add(axiom);
    }
}
Also used : VariableGroup(com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup) VariableGroup(com.opensimulationplatform.gen.owl.model.OntologyClasses.VariableGroup) OWLNamedIndividual(org.semanticweb.owlapi.model.OWLNamedIndividual) OWLAxiom(org.semanticweb.owlapi.model.OWLAxiom) OWLObjectProperty(org.semanticweb.owlapi.model.OWLObjectProperty)

Example 4 with VariableGroup

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

the class SystemStructureUtil method getVariableGroupConnectionByPartNames.

public static Optional<VariableGroupConnection> getVariableGroupConnectionByPartNames(SystemStructure systemStructure, String simulatorAName, String variableGroupAName, String simulatorBName, String variableGroupBName) {
    List<VariableGroupConnection> variableGroupConnections = systemStructure.getVariableGroupConnections();
    for (VariableGroupConnection variableGroupConnection : variableGroupConnections) {
        Simulator simulatorA = variableGroupConnection.getSimulatorA();
        VariableGroup variableA = variableGroupConnection.getVariableGroupA();
        Simulator simulatorB = variableGroupConnection.getSimulatorB();
        VariableGroup variableB = variableGroupConnection.getVariableGroupB();
        if (simulatorAName.equals(simulatorA.getName().get()) && variableGroupAName.equals(variableA.getName().get()) && simulatorBName.equals(simulatorB.getName().get()) && variableGroupBName.equals(variableB.getName().get())) {
            return Optional.of(variableGroupConnection);
        }
    }
    return Optional.empty();
}
Also used : VariableGroupConnection(com.opensimulationplatform.core.model.systemstructure.VariableGroupConnection) VariableGroup(com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup) Simulator(com.opensimulationplatform.core.model.systemstructure.Simulator)

Example 5 with VariableGroup

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

the class Validator method addVolumeFlowRate.

private void addVolumeFlowRate(ModelDescription modelDescription, Map<Object, Object> map, VolumeFlowRateType element) {
    VariableGroup variableGroup = ModelDescriptionUtil.getVariableGroupByName(modelDescription, element.getName());
    if (variableGroup != null) {
        map.put(variableGroup, element);
        addVariables(modelDescription, map, element.getVariable());
    }
}
Also used : VariableGroup(com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup)

Aggregations

VariableGroup (com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup)34 OWLNamedIndividual (org.semanticweb.owlapi.model.OWLNamedIndividual)6 VariableGroupConnection (com.opensimulationplatform.core.model.systemstructure.VariableGroupConnection)5 Test (org.junit.Test)5 Simulator (com.opensimulationplatform.core.model.systemstructure.Simulator)4 ValidationDiagnostic (com.opensimulationplatform.core.validation.ValidationDiagnostic)4 Variable (com.opensimulationplatform.core.model.modeldescription.Variable)3 Generic (com.opensimulationplatform.core.model.modeldescription.variablegroup.generic.Generic)3 ValidationError (com.opensimulationplatform.core.validation.ValidationError)3 List (java.util.List)3 Set (java.util.Set)3 Collectors (java.util.stream.Collectors)3 OWLAxiom (org.semanticweb.owlapi.model.OWLAxiom)3 OWLClass (org.semanticweb.owlapi.model.OWLClass)3 OWLObjectProperty (org.semanticweb.owlapi.model.OWLObjectProperty)3 Force (com.opensimulationplatform.core.model.modeldescription.variablegroup.force.Force)1 SystemStructure (com.opensimulationplatform.core.model.systemstructure.SystemStructure)1 VariableConnection (com.opensimulationplatform.core.model.systemstructure.VariableConnection)1 VE_VariableGroup_1 (com.opensimulationplatform.gen.owl.model.OntologyClasses.VE_VariableGroup_1)1 VE_VariableGroup_2 (com.opensimulationplatform.gen.owl.model.OntologyClasses.VE_VariableGroup_2)1