+ lmm_expand(storage_maxmin_system, STORAGE->constraint,
+ GENERIC_LMM_ACTION(action).variable, 1.0);
+ XBT_OUT();
+ return (surf_action_t) action;
+}
+
+static surf_action_t storage_action_sleep (void *storage, double duration)
+{
+ surf_action_storage_t action = NULL;
+
+ if (duration > 0)
+ duration = MAX(duration, MAXMIN_PRECISION);
+
+ XBT_IN("(%s,%g)", surf_resource_name(storage), duration);
+ action = (surf_action_storage_t) storage_action_execute(storage, 1.0);
+ GENERIC_ACTION(action).max_duration = duration;
+ GENERIC_LMM_ACTION(action).suspended = 2;
+ if (duration == NO_MAX_DURATION) {
+ /* Move to the *end* of the corresponding action set. This convention
+ is used to speed up update_resource_state */
+ xbt_swag_remove(action, ((surf_action_t) action)->state_set);
+ ((surf_action_t) action)->state_set =
+ storage_running_action_set_that_does_not_need_being_checked;
+ xbt_swag_insert(action, ((surf_action_t) action)->state_set);
+ }
+
+ lmm_update_variable_weight(storage_maxmin_system,
+ GENERIC_LMM_ACTION(action).variable, 0.0);
+
+ XBT_OUT();
+ return (surf_action_t) action;
+}
+
+static void* storage_create_resource(const char* id, const char* model,const char* type_id)
+{
+ storage_t storage = NULL;
+
+ xbt_assert(!surf_storage_resource_by_name(id),
+ "Storage '%s' declared several times in the platform file",
+ id);
+ storage = (storage_t) surf_resource_new(sizeof(s_storage_t),
+ surf_storage_model, id,NULL);
+
+ storage->state_current = SURF_RESOURCE_ON;
+
+ storage_type_t storage_type = xbt_lib_get_or_null(storage_type_lib, type_id,ROUTING_STORAGE_TYPE_LEVEL);
+ double Bread = atof(xbt_dict_get(storage_type->properties,"Bread"));
+ double Bwrite = atof(xbt_dict_get(storage_type->properties,"Bwrite"));
+ double Bconnexion = atof(xbt_dict_get(storage_type->properties,"Bconnexion"));
+ storage->constraint = lmm_constraint_new(storage_maxmin_system, storage, Bconnexion);
+ storage->constraint_read = lmm_constraint_new(storage_maxmin_system, storage, Bread);
+ storage->constraint_write = lmm_constraint_new(storage_maxmin_system, storage, Bwrite);
+
+ xbt_lib_set(storage_lib, id, SURF_STORAGE_LEVEL, storage);
+
+ XBT_DEBUG("SURF storage create resource\n\t\tid '%s'\n\t\ttype '%s' \n\t\tmodel '%s' \n\t\tproperties '%p'\n\t\tBread '%f'\n",
+ id,
+ model,
+ type_id,
+ storage_type->properties,
+ Bread);
+
+ return storage;