if (compartmentsIds != null) {
for (int i = 0; i < compartmentsIds.length; i++) {
Compartment relatedCompartment = model.getCompartment(compartmentsIds[i]);
subModel.addCompartment(relatedCompartment.clone());
processUnitsMap(unitsMap, model, relatedCompartment.getUnits());
// check compartment type
if (relatedCompartment.getCompartmentTypeInstance() != null && subModel.getCompartmentType(relatedCompartment.getCompartmentType()) == null) {
subModel.addCompartmentType(relatedCompartment.getCompartmentTypeInstance().clone());