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;
}
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;
}
}
}
}
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;
}
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;
}
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));
}
Aggregations