{"action":"created","comment":{"url":"https://api.github.com/repos/cyclus/cycamore/pulls/comments/43435812","id":43435812,"diff_hunk":"@@ -0,0 +1,226 @@\n+#ifndef CYCLUS_STORAGES_STORAGE_H_\n+#define CYCLUS_STORAGES_STORAGE_H_\n+\n+#include <string>\n+#include <list>\n+#include <vector>\n+\n+#include \"cyclus.h\"\n+\n+// forward declaration\n+namespace storage {\n+class Storage;\n+} // namespace storage\n+\n+\n+namespace storage {\n+/// @class Storage\n+///\n+/// This Facility is intended to hold materials for a user specified\n+/// amount of time in order to model a storage facility with a certain\n+/// residence time or holdup time.\n+/// The Storage class inherits from the Facility class and is\n+/// dynamically loaded by the Agent class when requested.\n+///\n+/// @section intro Introduction\n+/// This Agent was initially developed to support the fco code-to-code \n+/// comparison.\n+/// It's very similar to the \"NullFacility\" of years \n+/// past. Its purpose is to hold materials and release them only  \n+/// after some period of delay time.\n+///\n+/// @section agentparams Agent Parameters\n+/// in_commods is a vector of strings naming the commodities that this facility receives\n+/// out_commods is a string naming the commodity that in_commod is stocks into\n+/// residence_time is the minimum number of timesteps between receiving and offering\n+/// in_recipe (optional) describes the incoming resource by recipe\n+/// \n+/// @section optionalparams Optional Parameters\n+/// max_inv_size is the maximum capacity of the inventory storage\n+/// throughput is the maximum processing capacity per timestep\n+///\n+/// @section detailed Detailed Behavior\n+/// \n+/// Tick:\n+/// Nothing really happens on the tick. \n+///\n+/// Tock:\n+/// On the tock, any material that has been waiting for long enough (delay \n+/// time) is placed in the stocks buffer.\n+///\n+/// Any brand new inventory that was received in this timestep is placed into \n+/// the processing queue to begin waiting. \n+/// \n+/// Making Requests:\n+/// This facility requests all of the in_commod that it can.\n+///\n+/// Receiving Resources:\n+/// Anything of the in_commod that is received by this facility goes into the \n+/// inventory.\n+///\n+/// Making Offers:\n+/// Any stocks material in the stocks buffer is offered to the market.\n+///\n+/// Sending Resources:\n+/// Matched resources are sent immediately.\n+class Storage \n+  : public cyclus::Facility,\n+    public cyclus::toolkit::CommodityProducer {\n+ public:  \n+  /// @param ctx the cyclus context for access to simulation-wide parameters\n+  Storage(cyclus::Context* ctx);\n+  \n+  #pragma cyclus decl\n+\n+  #pragma cyclus note {\"doc\": \"A storage facility converts from one \" \\\n+                              \"commodity to another, with an optional delay.\"}\n+\n+  /// A verbose printer for the Storage Facility\n+  virtual std::string str();\n+\n+  // --- Facility Members ---\n+  \n+  // --- Agent Members ---\n+  /// Sets up the Storage Facility's trade requests\n+  virtual void EnterNotify();\n+\n+  /// The handleTick function specific to the Storage.\n+  virtual void Tick();\n+\n+  /// The handleTick function specific to the Storage.\n+  virtual void Tock();\n+\n+  /* --- Storage Members --- */\n+\n+  /// @brief the minimum processing time required for a full process\n+  inline void residence_time_(int t) { residence_time = t; }\n+  inline int residence_time_() const { return residence_time; }\n+\n+  /// @brief the maximum amount allowed in inventory\n+  inline void max_inv_size_(double c) { max_inv_size = c; }\n+  inline double max_inv_size_() const { return max_inv_size; }\n+\n+  /// @brief the maximum amount processed per timestep\n+  inline void throughput_(double c) { throughput = c; }\n+  inline double throughput_() const { return throughput; }\n+\n+  /// @brief the in commodity\n+  inline void in_commods_(std::string c) { in_commods.push_back(c); }\n+  inline std::vector<std::string> in_commods_() const { return in_commods; }\n+\n+  /// @brief the in commodity preferences\n+  inline void in_commod_prefs_(double c) { in_commod_prefs.push_back(c); }\n+  inline double in_commod_prefs_() const { return in_commod_prefs.front(); }\n+\n+  /// @brief the out commodity\n+  inline void out_commods_(std::string c) { out_commods.push_back(c); }\n+  inline std::string out_commods_() const {\n+    if (out_commods.size() == 0){\n+      return \"out_commod\";\n+    }\n+     return out_commods.front(); }\n+\n+  /// @brief the in recipe\n+  inline void in_recipe_(std::string c) { in_recipe = c; }\n+  inline std::string in_recipe_() const { return in_recipe; }\n+\n+  /// @brief current maximum amount that can be added to processing\n+  inline double current_capacity() const { \n+    return (max_inv_size - processing.quantity() - stocks.quantity()); }\n+\n+  /// @brief the batch handling identifier\n+  inline void batch_handling_(bool c) { batch_handling = c; }\n+  inline bool batch_handling_() const { return batch_handling; }\n+\n+  /// @brief returns the time key for ready materials\n+  int ready_time(){ return context()->time() - residence_time; }\n+\n+ protected:\n+  ///   @brief adds a material into the incoming commodity inventory\n+  ///   @param mat the material to add to the incoming inventory.\n+  ///   @throws if there is trouble with pushing to the inventory buffer.\n+  void AddMat_(cyclus::Material::Ptr mat);\n+\n+  /// @brief Move all unprocessed inventory to processing\n+  void BeginProcessing_();\n+\n+  /// @brief Move as many ready resources as allowable into stocks\n+  /// @param cap current throughput capacity \n+  void ProcessMat_(double cap);\n+\n+  /// @brief any ready resources remaining in processing get pushed off to next timestep\n+  /// @param time the timestep whose buffer remains unprocessed \n+  // void AdvanceUnconverted_(int time);\n+\n+  /// @brief move ready resources from processing to ready at a certain time\n+  /// @param time the time of interest\n+  void ReadyMatl_(int time);\n+\n+  /* --- Module Members --- */\n+\n+  #pragma cyclus var {\"tooltip\":\"input commodity\",\\\n+                      \"doc\":\"commodity accepted by this facility\"}\n+  std::vector<std::string> in_commods;\n+\n+  #pragma cyclus var {\"default\": [1]}\n+  std::vector<double> in_commod_prefs;\n+\n+  #pragma cyclus var {\"tooltip\":\"output commodity\",\\\n+                      \"doc\":\"commodity produced by this facility\"}\n+  std::vector<std::string> out_commods;\n+\n+  #pragma cyclus var {\"default\":\"\",\\\n+                      \"tooltip\":\"input recipe\",\\\n+                      \"doc\":\"recipe accepted by this facility\"}\n+  std::string in_recipe;\n+\n+  #pragma cyclus var {\"default\": 0,\\\n+                      \"tooltip\":\"residence time (timesteps)\",\\\n+                      \"doc\":\"the minimum holding time for a received commodity (timesteps).\"}","path":"src/storage.h","position":179,"original_position":179,"commit_id":"ab4f654b09b11182ab75e0d5412e63a747eae91b","original_commit_id":"ab4f654b09b11182ab75e0d5412e63a747eae91b","user":{"login":"rwcarlsen","id":1351242,"avatar_url":"https://avatars.githubusercontent.com/u/1351242?v=3","gravatar_id":"","url":"https://api.github.com/users/rwcarlsen","html_url":"https://github.com/rwcarlsen","followers_url":"https://api.github.com/users/rwcarlsen/followers","following_url":"https://api.github.com/users/rwcarlsen/following{/other_user}","gists_url":"https://api.github.com/users/rwcarlsen/gists{/gist_id}","starred_url":"https://api.github.com/users/rwcarlsen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwcarlsen/subscriptions","organizations_url":"https://api.github.com/users/rwcarlsen/orgs","repos_url":"https://api.github.com/users/rwcarlsen/repos","events_url":"https://api.github.com/users/rwcarlsen/events{/privacy}","received_events_url":"https://api.github.com/users/rwcarlsen/received_events","type":"User","site_admin":false},"body":"\"...holding time for received material\"\r\n\r\nand add a ``\"units\": \"time steps\"`` annotation","created_at":"2015-10-29T19:53:51Z","updated_at":"2015-10-29T19:53:51Z","html_url":"https://github.com/cyclus/cycamore/pull/390#discussion_r43435812","pull_request_url":"https://api.github.com/repos/cyclus/cycamore/pulls/390","_links":{"self":{"href":"https://api.github.com/repos/cyclus/cycamore/pulls/comments/43435812"},"html":{"href":"https://github.com/cyclus/cycamore/pull/390#discussion_r43435812"},"pull_request":{"href":"https://api.github.com/repos/cyclus/cycamore/pulls/390"}}},"pull_request":{"url":"https://api.github.com/repos/cyclus/cycamore/pulls/390","id":49178980,"html_url":"https://github.com/cyclus/cycamore/pull/390","diff_url":"https://github.com/cyclus/cycamore/pull/390.diff","patch_url":"https://github.com/cyclus/cycamore/pull/390.patch","issue_url":"https://api.github.com/repos/cyclus/cycamore/issues/390","number":390,"state":"open","locked":false,"title":"Merge storage facility with cleaned up commit history","user":{"login":"jlittell","id":8877701,"avatar_url":"https://avatars.githubusercontent.com/u/8877701?v=3","gravatar_id":"","url":"https://api.github.com/users/jlittell","html_url":"https://github.com/jlittell","followers_url":"https://api.github.com/users/jlittell/followers","following_url":"https://api.github.com/users/jlittell/following{/other_user}","gists_url":"https://api.github.com/users/jlittell/gists{/gist_id}","starred_url":"https://api.github.com/users/jlittell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlittell/subscriptions","organizations_url":"https://api.github.com/users/jlittell/orgs","repos_url":"https://api.github.com/users/jlittell/repos","events_url":"https://api.github.com/users/jlittell/events{/privacy}","received_events_url":"https://api.github.com/users/jlittell/received_events","type":"User","site_admin":false},"body":"Most recent version of storage facility with updated commit history","created_at":"2015-10-29T18:15:16Z","updated_at":"2015-10-29T19:53:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8cdda3bdd29b0948621551dfd6241a5bd17a5152","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cyclus/cycamore/pulls/390/commits","review_comments_url":"https://api.github.com/repos/cyclus/cycamore/pulls/390/comments","review_comment_url":"https://api.github.com/repos/cyclus/cycamore/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cyclus/cycamore/issues/390/comments","statuses_url":"https://api.github.com/repos/cyclus/cycamore/statuses/ab4f654b09b11182ab75e0d5412e63a747eae91b","head":{"label":"jlittell:cleanstore","ref":"cleanstore","sha":"ab4f654b09b11182ab75e0d5412e63a747eae91b","user":{"login":"jlittell","id":8877701,"avatar_url":"https://avatars.githubusercontent.com/u/8877701?v=3","gravatar_id":"","url":"https://api.github.com/users/jlittell","html_url":"https://github.com/jlittell","followers_url":"https://api.github.com/users/jlittell/followers","following_url":"https://api.github.com/users/jlittell/following{/other_user}","gists_url":"https://api.github.com/users/jlittell/gists{/gist_id}","starred_url":"https://api.github.com/users/jlittell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlittell/subscriptions","organizations_url":"https://api.github.com/users/jlittell/orgs","repos_url":"https://api.github.com/users/jlittell/repos","events_url":"https://api.github.com/users/jlittell/events{/privacy}","received_events_url":"https://api.github.com/users/jlittell/received_events","type":"User","site_admin":false},"repo":{"id":34280467,"name":"cycamore","full_name":"jlittell/cycamore","owner":{"login":"jlittell","id":8877701,"avatar_url":"https://avatars.githubusercontent.com/u/8877701?v=3","gravatar_id":"","url":"https://api.github.com/users/jlittell","html_url":"https://github.com/jlittell","followers_url":"https://api.github.com/users/jlittell/followers","following_url":"https://api.github.com/users/jlittell/following{/other_user}","gists_url":"https://api.github.com/users/jlittell/gists{/gist_id}","starred_url":"https://api.github.com/users/jlittell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlittell/subscriptions","organizations_url":"https://api.github.com/users/jlittell/orgs","repos_url":"https://api.github.com/users/jlittell/repos","events_url":"https://api.github.com/users/jlittell/events{/privacy}","received_events_url":"https://api.github.com/users/jlittell/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jlittell/cycamore","description":"The CYClus Additional Module REpository","fork":true,"url":"https://api.github.com/repos/jlittell/cycamore","forks_url":"https://api.github.com/repos/jlittell/cycamore/forks","keys_url":"https://api.github.com/repos/jlittell/cycamore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jlittell/cycamore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jlittell/cycamore/teams","hooks_url":"https://api.github.com/repos/jlittell/cycamore/hooks","issue_events_url":"https://api.github.com/repos/jlittell/cycamore/issues/events{/number}","events_url":"https://api.github.com/repos/jlittell/cycamore/events","assignees_url":"https://api.github.com/repos/jlittell/cycamore/assignees{/user}","branches_url":"https://api.github.com/repos/jlittell/cycamore/branches{/branch}","tags_url":"https://api.github.com/repos/jlittell/cycamore/tags","blobs_url":"https://api.github.com/repos/jlittell/cycamore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jlittell/cycamore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jlittell/cycamore/git/refs{/sha}","trees_url":"https://api.github.com/repos/jlittell/cycamore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jlittell/cycamore/statuses/{sha}","languages_url":"https://api.github.com/repos/jlittell/cycamore/languages","stargazers_url":"https://api.github.com/repos/jlittell/cycamore/stargazers","contributors_url":"https://api.github.com/repos/jlittell/cycamore/contributors","subscribers_url":"https://api.github.com/repos/jlittell/cycamore/subscribers","subscription_url":"https://api.github.com/repos/jlittell/cycamore/subscription","commits_url":"https://api.github.com/repos/jlittell/cycamore/commits{/sha}","git_commits_url":"https://api.github.com/repos/jlittell/cycamore/git/commits{/sha}","comments_url":"https://api.github.com/repos/jlittell/cycamore/comments{/number}","issue_comment_url":"https://api.github.com/repos/jlittell/cycamore/issues/comments{/number}","contents_url":"https://api.github.com/repos/jlittell/cycamore/contents/{+path}","compare_url":"https://api.github.com/repos/jlittell/cycamore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jlittell/cycamore/merges","archive_url":"https://api.github.com/repos/jlittell/cycamore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jlittell/cycamore/downloads","issues_url":"https://api.github.com/repos/jlittell/cycamore/issues{/number}","pulls_url":"https://api.github.com/repos/jlittell/cycamore/pulls{/number}","milestones_url":"https://api.github.com/repos/jlittell/cycamore/milestones{/number}","notifications_url":"https://api.github.com/repos/jlittell/cycamore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jlittell/cycamore/labels{/name}","releases_url":"https://api.github.com/repos/jlittell/cycamore/releases{/id}","created_at":"2015-04-20T19:04:41Z","updated_at":"2015-04-21T22:56:46Z","pushed_at":"2015-10-29T18:07:43Z","git_url":"git://github.com/jlittell/cycamore.git","ssh_url":"git@github.com:jlittell/cycamore.git","clone_url":"https://github.com/jlittell/cycamore.git","svn_url":"https://github.com/jlittell/cycamore","homepage":"","size":5240,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"cyclus:develop","ref":"develop","sha":"2c908401aac4f72f8e40ac7703227b1c4a3beeac","user":{"login":"cyclus","id":1355686,"avatar_url":"https://avatars.githubusercontent.com/u/1355686?v=3","gravatar_id":"","url":"https://api.github.com/users/cyclus","html_url":"https://github.com/cyclus","followers_url":"https://api.github.com/users/cyclus/followers","following_url":"https://api.github.com/users/cyclus/following{/other_user}","gists_url":"https://api.github.com/users/cyclus/gists{/gist_id}","starred_url":"https://api.github.com/users/cyclus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyclus/subscriptions","organizations_url":"https://api.github.com/users/cyclus/orgs","repos_url":"https://api.github.com/users/cyclus/repos","events_url":"https://api.github.com/users/cyclus/events{/privacy}","received_events_url":"https://api.github.com/users/cyclus/received_events","type":"Organization","site_admin":false},"repo":{"id":4973784,"name":"cycamore","full_name":"cyclus/cycamore","owner":{"login":"cyclus","id":1355686,"avatar_url":"https://avatars.githubusercontent.com/u/1355686?v=3","gravatar_id":"","url":"https://api.github.com/users/cyclus","html_url":"https://github.com/cyclus","followers_url":"https://api.github.com/users/cyclus/followers","following_url":"https://api.github.com/users/cyclus/following{/other_user}","gists_url":"https://api.github.com/users/cyclus/gists{/gist_id}","starred_url":"https://api.github.com/users/cyclus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyclus/subscriptions","organizations_url":"https://api.github.com/users/cyclus/orgs","repos_url":"https://api.github.com/users/cyclus/repos","events_url":"https://api.github.com/users/cyclus/events{/privacy}","received_events_url":"https://api.github.com/users/cyclus/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cyclus/cycamore","description":"The CYClus Additional Module REpository","fork":false,"url":"https://api.github.com/repos/cyclus/cycamore","forks_url":"https://api.github.com/repos/cyclus/cycamore/forks","keys_url":"https://api.github.com/repos/cyclus/cycamore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cyclus/cycamore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cyclus/cycamore/teams","hooks_url":"https://api.github.com/repos/cyclus/cycamore/hooks","issue_events_url":"https://api.github.com/repos/cyclus/cycamore/issues/events{/number}","events_url":"https://api.github.com/repos/cyclus/cycamore/events","assignees_url":"https://api.github.com/repos/cyclus/cycamore/assignees{/user}","branches_url":"https://api.github.com/repos/cyclus/cycamore/branches{/branch}","tags_url":"https://api.github.com/repos/cyclus/cycamore/tags","blobs_url":"https://api.github.com/repos/cyclus/cycamore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cyclus/cycamore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cyclus/cycamore/git/refs{/sha}","trees_url":"https://api.github.com/repos/cyclus/cycamore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cyclus/cycamore/statuses/{sha}","languages_url":"https://api.github.com/repos/cyclus/cycamore/languages","stargazers_url":"https://api.github.com/repos/cyclus/cycamore/stargazers","contributors_url":"https://api.github.com/repos/cyclus/cycamore/contributors","subscribers_url":"https://api.github.com/repos/cyclus/cycamore/subscribers","subscription_url":"https://api.github.com/repos/cyclus/cycamore/subscription","commits_url":"https://api.github.com/repos/cyclus/cycamore/commits{/sha}","git_commits_url":"https://api.github.com/repos/cyclus/cycamore/git/commits{/sha}","comments_url":"https://api.github.com/repos/cyclus/cycamore/comments{/number}","issue_comment_url":"https://api.github.com/repos/cyclus/cycamore/issues/comments{/number}","contents_url":"https://api.github.com/repos/cyclus/cycamore/contents/{+path}","compare_url":"https://api.github.com/repos/cyclus/cycamore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cyclus/cycamore/merges","archive_url":"https://api.github.com/repos/cyclus/cycamore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cyclus/cycamore/downloads","issues_url":"https://api.github.com/repos/cyclus/cycamore/issues{/number}","pulls_url":"https://api.github.com/repos/cyclus/cycamore/pulls{/number}","milestones_url":"https://api.github.com/repos/cyclus/cycamore/milestones{/number}","notifications_url":"https://api.github.com/repos/cyclus/cycamore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cyclus/cycamore/labels{/name}","releases_url":"https://api.github.com/repos/cyclus/cycamore/releases{/id}","created_at":"2012-07-10T12:41:38Z","updated_at":"2015-05-08T17:15:47Z","pushed_at":"2015-10-29T18:15:16Z","git_url":"git://github.com/cyclus/cycamore.git","ssh_url":"git@github.com:cyclus/cycamore.git","clone_url":"https://github.com/cyclus/cycamore.git","svn_url":"https://github.com/cyclus/cycamore","homepage":"","size":11348,"stargazers_count":8,"watchers_count":8,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":20,"mirror_url":null,"open_issues_count":33,"forks":20,"open_issues":33,"watchers":8,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/cyclus/cycamore/pulls/390"},"html":{"href":"https://github.com/cyclus/cycamore/pull/390"},"issue":{"href":"https://api.github.com/repos/cyclus/cycamore/issues/390"},"comments":{"href":"https://api.github.com/repos/cyclus/cycamore/issues/390/comments"},"review_comments":{"href":"https://api.github.com/repos/cyclus/cycamore/pulls/390/comments"},"review_comment":{"href":"https://api.github.com/repos/cyclus/cycamore/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cyclus/cycamore/pulls/390/commits"},"statuses":{"href":"https://api.github.com/repos/cyclus/cycamore/statuses/ab4f654b09b11182ab75e0d5412e63a747eae91b"}}}}