use of org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification in project iobserve-analysis by research-iobserve.
the class ModelHelper method createResourceContainerFromVMType.
/**
* Creates a new resource container from a specific {@link VMType}, including an entry in the
* cost repository.
*
* @param environment
* the resource environment in which to create the container
* @param costRepository
* the cost repository in which to create the costs for the container
* @param cloudVM
* the type of vm this container is an instance of
* @param containerName
* the name of this container
* @return the newly created resource container
* @throws ModelHandlingErrorException
* model handling error
*/
public static ResourceContainerCloud createResourceContainerFromVMType(final ResourceEnvironment environment, final CostRepository costRepository, final VMType cloudVM, final String containerName) throws ModelHandlingErrorException {
final ResourceContainerCloud container = ResourceEnvironmentCloudFactory.createResourceContainer(environment, containerName);
container.setId(EcoreUtil.generateUUID());
container.setResourceEnvironment_ResourceContainer(environment);
container.setInstanceType(cloudVM);
// Connect container to internet
final LinkingResource linkingResource = ModelHelper.getInternetLinkingResource(environment);
linkingResource.getConnectedResourceContainers_LinkingResource().add(container);
final int nrOfCores = ModelHelper.getNrOfCores(cloudVM);
final float processingRate = ModelHelper.getProcessingRate(cloudVM);
// Create processing resource and costs
final ProcessingResourceSpecification processor = ResourceEnvironmentCloudFactory.createProcessingResource(nrOfCores, processingRate, container);
container.getActiveResourceSpecifications_ResourceContainer().add(processor);
// TODO HDD is not used by peropteryx?
CostModelFactory.createFixedProcessingResourceCost(costRepository, 0.0, cloudVM.getPricePerHour(), processor);
return container;
}
Aggregations