Search in sources :

Example 1 with PCMRandomVariable

use of org.palladiosimulator.pcm.core.PCMRandomVariable in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddHDDProcessingResourceSpecification method getWriteProcessingRate.

private PCMRandomVariable getWriteProcessingRate() {
    final PCMRandomVariable pcmRandomVariable = CoreFactory.eINSTANCE.createPCMRandomVariable();
    pcmRandomVariable.setSpecification("");
    final StochasticExpressionEditDialog dialog = new StochasticExpressionEditDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), TypeEnum.DOUBLE, pcmRandomVariable);
    dialog.setDisplayTitle(SET_WRITE_PROCESSING_RATE);
    dialog.open();
    if (dialog.getResult() == null) {
        return null;
    }
    pcmRandomVariable.setSpecification(dialog.getResultText());
    return pcmRandomVariable;
}
Also used : StochasticExpressionEditDialog(org.palladiosimulator.editors.commons.dialogs.stoex.StochasticExpressionEditDialog) PCMRandomVariable(org.palladiosimulator.pcm.core.PCMRandomVariable)

Example 2 with PCMRandomVariable

use of org.palladiosimulator.pcm.core.PCMRandomVariable in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddLinkingResourceAction method execute.

@Override
public void execute(final Collection<? extends EObject> selections, final Map<String, Object> parameters) {
    final Object parameter = parameters.get(NEW_COMMUNICATION_LINK_RESOURCE_SPECIFICATION);
    if (parameter == null || !(parameter instanceof CommunicationLinkResourceSpecification)) {
        return;
    }
    final CommunicationLinkResourceSpecification communicationLinkResourceSpecification = (CommunicationLinkResourceSpecification) parameter;
    // latency
    final PCMRandomVariable latency = getRandomVariableFromStoExDialog(LATENCY_DISPLAY_TITLE);
    if (latency == null) {
        return;
    }
    communicationLinkResourceSpecification.setLatency_CommunicationLinkResourceSpecification(latency);
    // throughput
    final PCMRandomVariable throughput = getRandomVariableFromStoExDialog(THROUGHPUT_DISPLAY_TITLE);
    if (throughput == null) {
        return;
    }
    communicationLinkResourceSpecification.setThroughput_CommunicationLinkResourceSpecification(throughput);
    // Communication Link
    Session session = SessionManager.INSTANCE.getSession(communicationLinkResourceSpecification);
    URI uri = URI.createURI("pathmap://PCM_MODELS/Palladio.resourcetype");
    Resource palladioResources = SiriusCustomUtil.getResourceByURI(uri, session);
    if (palladioResources != null) {
        ResourceRepository rep = (ResourceRepository) palladioResources.getContents().iterator().next();
        for (EObject o : rep.eContents()) {
            if ((o instanceof CommunicationLinkResourceType) && ((CommunicationLinkResourceType) o).getEntityName().equals("LAN")) {
                communicationLinkResourceSpecification.setCommunicationLinkResourceType_CommunicationLinkResourceSpecification((CommunicationLinkResourceType) o);
                break;
            }
        }
    }
}
Also used : CommunicationLinkResourceSpecification(org.palladiosimulator.pcm.resourceenvironment.CommunicationLinkResourceSpecification) EObject(org.eclipse.emf.ecore.EObject) CommunicationLinkResourceType(org.palladiosimulator.pcm.resourcetype.CommunicationLinkResourceType) Resource(org.eclipse.emf.ecore.resource.Resource) EObject(org.eclipse.emf.ecore.EObject) ResourceRepository(org.palladiosimulator.pcm.resourcetype.ResourceRepository) URI(org.eclipse.emf.common.util.URI) PCMRandomVariable(org.palladiosimulator.pcm.core.PCMRandomVariable) Session(org.eclipse.sirius.business.api.session.Session)

Example 3 with PCMRandomVariable

use of org.palladiosimulator.pcm.core.PCMRandomVariable in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddProcessingResourceSpecification method getProcessingRate.

private PCMRandomVariable getProcessingRate() {
    final PCMRandomVariable pcmRandomVariable = CoreFactory.eINSTANCE.createPCMRandomVariable();
    pcmRandomVariable.setSpecification("");
    final StochasticExpressionEditDialog dialog = new StochasticExpressionEditDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), TypeEnum.DOUBLE, pcmRandomVariable);
    dialog.setDisplayTitle(SET_PROCESSING_RATE);
    dialog.open();
    if (dialog.getResult() == null) {
        return null;
    }
    pcmRandomVariable.setSpecification(dialog.getResultText());
    return pcmRandomVariable;
}
Also used : StochasticExpressionEditDialog(org.palladiosimulator.editors.commons.dialogs.stoex.StochasticExpressionEditDialog) PCMRandomVariable(org.palladiosimulator.pcm.core.PCMRandomVariable)

Example 4 with PCMRandomVariable

use of org.palladiosimulator.pcm.core.PCMRandomVariable in project Palladio-Editors-Sirius by PalladioSimulator.

the class ClosedWorkloadThinkTimeAction method getRandomVariable.

@Override
public RandomVariable getRandomVariable(EObject element) {
    ClosedWorkload workload = (ClosedWorkload) element;
    PCMRandomVariable rv = workload.getThinkTime_ClosedWorkload();
    return rv;
}
Also used : ClosedWorkload(org.palladiosimulator.pcm.usagemodel.ClosedWorkload) PCMRandomVariable(org.palladiosimulator.pcm.core.PCMRandomVariable)

Example 5 with PCMRandomVariable

use of org.palladiosimulator.pcm.core.PCMRandomVariable in project iobserve-analysis by research-iobserve.

the class UsageModelProviderTest method createThenUpdateThenReadUpdated.

@Override
@Test
public void createThenUpdateThenReadUpdated() {
    final ModelProvider<UsageModel> modelProvider = new ModelProvider<>(UsageModelProviderTest.graph);
    final TestModelBuilder testModelBuilder = new TestModelBuilder();
    final UsageModel writtenModel = testModelBuilder.getUsageModel();
    final UsageModel readModel;
    final UsageScenario writtenUsageScenarioGroup0 = testModelBuilder.getUsageScenarioGroup0();
    final ScenarioBehaviour writtenBuyBookScenarioBehaviour = testModelBuilder.getBuyBookScenarioBehaviour();
    final EntryLevelSystemCall writtenGetQueryCall = testModelBuilder.getGetQueryCall();
    final EntryLevelSystemCall writtenGetPriceCall = testModelBuilder.getGetPriceCall();
    modelProvider.createComponent(writtenModel);
    // Update the model by adding a loop for choosing several books
    final Loop shoppingLoop = UsagemodelFactory.eINSTANCE.createLoop();
    final PCMRandomVariable loopIteration = CoreFactory.eINSTANCE.createPCMRandomVariable();
    final ScenarioBehaviour chooseBookBehaviour = UsagemodelFactory.eINSTANCE.createScenarioBehaviour();
    chooseBookBehaviour.setEntityName("Choose a book");
    chooseBookBehaviour.getActions_ScenarioBehaviour().add(writtenGetQueryCall);
    chooseBookBehaviour.getActions_ScenarioBehaviour().add(writtenGetPriceCall);
    writtenUsageScenarioGroup0.setEntityName("Updated " + writtenUsageScenarioGroup0.getEntityName());
    writtenBuyBookScenarioBehaviour.getActions_ScenarioBehaviour().remove(writtenGetQueryCall);
    writtenBuyBookScenarioBehaviour.getActions_ScenarioBehaviour().remove(writtenGetPriceCall);
    writtenBuyBookScenarioBehaviour.getActions_ScenarioBehaviour().add(shoppingLoop);
    writtenGetQueryCall.setScenarioBehaviour_AbstractUserAction(chooseBookBehaviour);
    writtenGetPriceCall.setScenarioBehaviour_AbstractUserAction(chooseBookBehaviour);
    shoppingLoop.setEntityName("Shopping loop");
    shoppingLoop.setScenarioBehaviour_AbstractUserAction(writtenBuyBookScenarioBehaviour);
    shoppingLoop.setBodyBehaviour_Loop(chooseBookBehaviour);
    shoppingLoop.setLoopIteration_Loop(loopIteration);
    loopIteration.setLoop_LoopIteration(shoppingLoop);
    loopIteration.setSpecification("2");
    modelProvider.updateComponent(UsageModel.class, writtenModel);
    readModel = modelProvider.readOnlyRootComponent(UsageModel.class);
    Assert.assertTrue(this.equalityHelper.equals(writtenModel, readModel));
}
Also used : Loop(org.palladiosimulator.pcm.usagemodel.Loop) UsageScenario(org.palladiosimulator.pcm.usagemodel.UsageScenario) EntryLevelSystemCall(org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall) ScenarioBehaviour(org.palladiosimulator.pcm.usagemodel.ScenarioBehaviour) UsageModel(org.palladiosimulator.pcm.usagemodel.UsageModel) PCMRandomVariable(org.palladiosimulator.pcm.core.PCMRandomVariable) Test(org.junit.Test)

Aggregations

PCMRandomVariable (org.palladiosimulator.pcm.core.PCMRandomVariable)28 ScenarioBehaviour (org.palladiosimulator.pcm.usagemodel.ScenarioBehaviour)15 Loop (org.palladiosimulator.pcm.usagemodel.Loop)14 UsageModel (org.palladiosimulator.pcm.usagemodel.UsageModel)11 UsageScenario (org.palladiosimulator.pcm.usagemodel.UsageScenario)11 AbstractUserAction (org.palladiosimulator.pcm.usagemodel.AbstractUserAction)10 EntryLevelSystemCall (org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall)10 Start (org.palladiosimulator.pcm.usagemodel.Start)10 Stop (org.palladiosimulator.pcm.usagemodel.Stop)10 EntryCallEvent (org.iobserve.stages.general.data.EntryCallEvent)6 StochasticExpressionEditDialog (org.palladiosimulator.editors.commons.dialogs.stoex.StochasticExpressionEditDialog)5 EntryCallSequenceModel (org.iobserve.analysis.data.EntryCallSequenceModel)4 UserSessionCollectionModel (org.iobserve.analysis.data.UserSessionCollectionModel)4 ReferenceElements (org.iobserve.analysis.test.userbehavior.ReferenceElements)4 ReferenceElements (org.iobserve.analysis.userbehavior.ReferenceElements)4 Correspondent (org.iobserve.model.correspondence.Correspondent)4 OperationSignature (org.palladiosimulator.pcm.repository.OperationSignature)4 BranchTransition (org.palladiosimulator.pcm.usagemodel.BranchTransition)4 ClosedWorkload (org.palladiosimulator.pcm.usagemodel.ClosedWorkload)3 ArrayList (java.util.ArrayList)2