Git Product home page Git Product logo

Comments (7)

rwcarlsen avatar rwcarlsen commented on May 28, 2024

Matt - The reason messages don't actually carry the resource themselves is because the markets adjust the offer quantity (splitting, etc.) and we don't want them to actually change resource inventory. Each model keeps its actual resources under tight control and never passes references to them outside object. When the actual material is sent, however, the sent and received resource is the same object in memory. So to summarize:

  • The resources carried by message objects are just copies.
  • The resources that are transacted (via the approveTransfer, removeResource, addResource trio) are one and the same - IDs are consistent.

We moved all transaction/resource bookkeeping into the approveTransfer method in the Message class - this is where you will want to put your table book-keeping.

from cyclus.

gidden avatar gidden commented on May 28, 2024

That's where the transaction row insertion occurs, but you're suggesting that the resource row insertion should occur there as well?

from cyclus.

rwcarlsen avatar rwcarlsen commented on May 28, 2024

yes-it has to occur there - or at least close by.

from cyclus.

rwcarlsen avatar rwcarlsen commented on May 28, 2024

The resources you want to boo-keep are the ones that are returned by the removeResource call in the approveTransfer method.

from cyclus.

rwcarlsen avatar rwcarlsen commented on May 28, 2024
void Message::define_table(){
  // declare the table columns
  column sender("SenderID","INTEGER");
  column receiver("ReceiverID","INTEGER");
   column resource("ResourceID","INTEGER");
  column time("Time","INTEGER");
  column price("Price","REAL");
  // declare the table's primary key
  primary_key pk;
  pk.push_back("SenderID"), pk.push_back("ReceiverID"),
    pk.push_back("ResourceID"), pk.push_back("Time");

The primary key (created above) doesn't work because there can be multiple resource objects per transaction. And I can envision multiple transactions during a single timestep that have the same sender and receiver. Basically, this means that the primary key for the transaction table needs to be a transaction ID. The transaction table will contain transID (pk), senderID (fk), receiverID (fk), Time, and Price. The Resource state table will contain stateID (pk), materialID (fk), transID (fk), quality, quantity, etc. We will also need a resource table that will contain resourceID (pk), date created, creatorID (fk), date destroyed, destroyerID (fk), etc. And of course the composition table containing stateID (fk), isotope #, quantity.

from cyclus.

gidden avatar gidden commented on May 28, 2024

Thanks, Robert. This is not a finished product.

On Mon, Feb 20, 2012 at 8:11 AM, Robert Carlsen <
[email protected]

wrote:

void Message::define_table(){
 // declare the table columns
 column sender("SenderID","INTEGER");
 column receiver("ReceiverID","INTEGER");
  column resource("ResourceID","INTEGER");
 column time("Time","INTEGER");
 column price("Price","REAL");
 // declare the table's primary key
 primary_key pk;
 pk.push_back("SenderID"), pk.push_back("ReceiverID"),
   pk.push_back("ResourceID"), pk.push_back("Time");

The primary key (created above) doesn't work because there can be multiple
resource objects per transaction. And I can envision multiple transactions
during a single timestep that have the same sender and receiver.
Basically, this means that the primary key for the transaction table needs
to be a transaction ID. The transaction table will contain transID (pk),
senderID (fk), receiverID (fk), Time, and Price. The Resource state table
will contain stateID (pk), materialID (fk), transID (fk), quality,
quantity, etc. We will also need a resource table that will contain
resourceID (pk), date created, creatorID (fk), date destroyed, destroyerID
(fk), etc. And of course the composition table containing stateID (fk),
isotope #, quantity.


Reply to this email directly or view it on GitHub:
https://github.com/cyclus/core/issues/41#issuecomment-4054156

from cyclus.

gidden avatar gidden commented on May 28, 2024

The database system currently works as intended, so I'm closing this issue. However, we should note the following:

  • in the simulation, when a material is split, a NEW material is made (with a new id, etc.)
  • in the database, when a material is split, we still want to reference the original material -- accordingly resource objects now have an originalID_ member.
  • a new material is registered in the database when its setOriginatorID is called. Facilities must call this function when they want the simulation to know that a new resource has entered the sim. It is analogous to the setParentID function.
  • the flow of material information is maintained through the Transactions table. The Resources table notes the initial quantity when a resource enters the simulation and the Transactions table records who has how much of that resource as the simulation progresses, referencing the resources' originalID_ to keep track of isotopics (i.e. a resource state). Much documentation writing to come.

from cyclus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.