Giter Site home page Giter Site logo

maxschalz / flexicamore Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 361 KB

Legacy repository (feat. issues and PRs) https://git.rwth-aachen.de/nvd/fuel-cycle/flexicamore

License: BSD 3-Clause "New" or "Revised" License

CMake 7.56% Python 2.84% C++ 89.60%
cpp cyclus nuclear-fuel-cycle

flexicamore's Introduction

Flexible Cycamore

This repository contains Cyclus archetypes, strongly based on Cyclus' Cycamore library. These archetypes are designed to be more versatile by allowing input variables to be time-dependent, e.g., the SWU capacity of an enrichment facility can be configured to change during the simulation. This behaviour is implemented for few cases in Cycamore, and the goal of this repository is to facilite the expansion of this behaviour to other variables.

This repository is developed by the Nuclear Verification and Disarmament group from RWTH Aachen University, Germany.

How to use Flexicamore

Installing flexicamore

  1. Make sure you have Cyclus installed.
  2. Clone this repository.
  3. Run the install-script: $ python3 install.py.
  4. Done! You can run the unittests using $ flexicamore_unit_tests which should result in all tests passing successfully. Currently, there are 96 tests from 14 test cases and 3 disabled tests.

Hands on: example input file

An input file and the corresponding output using all flexicamore archetypes can be found in the input directory. The input file has been tested successfully on Fedora35 using the following versions:

$ cyclus --version
Cyclus Core 1.5.5 (1.5.5-57-gc1910b90)

Dependencies:
   Boost    1_74
   Coin-Cbc 2.9.9
   Coin-Clp 1.16.11
   Hdf5     1.10.6-
   Sqlite3  3.35.5
   xml2     2.9.10
   xml++    2.40.1

A bit more in-depth

The underlying class, FlexibleInput, can be used in two ways:

  1. Define a std::vector of values and a std::vector<int> containing the changing times, or,
  2. Define a std::vector containing values for all timesteps.

In addition, one always has to pass a pointer to the agent in question. Explained in code:

// Consider a uranium mine with a production rate that increases every three
// timesteps by 1, s.t.:
// Simulation timestep: 0  1  2  3  4  5  6  7  8
// Production rate:     1  1  1  2  2  2  3  3  3

// Method 1
std::vector<int> change_times({0, 3, 6});
std::vector<double> new_throughputs({1, 2, 3});
FlexibleInput<double> flexible_production(&my_source, new_throughputs, change_times);

// Method 2, more verbose
std::vector<double> throughputs({1, 1, 1, 2, 2, 2, 3, 3, 3});
FlexibleInput<double> flexible_production(&my_source, throughputs);

Important note: All changing times are defined relative to the facility's simulation entry time. Consider for example a uranium mine entering the simulation at time t = 5 with the following FlexibleInput:

std::vector<int> change_times({0, 3, 6});
std::vector<double> new_throughputs({1, 2, 3});
FlexibleInput<double> flexible_production(&my_source, new_throughputs, change_times);

This would result in the following production rates:

// Facility entering at simulation time t = 5
// Simulation timestep: 0  1  2  3  4  5  6  7  8  9 10 11 12 13
// Production rate:     0  0  0  0  0  1  1  1  2  2  2  3  3  3

FlexibleEnrichment

Flexible variables:

  • SWU capacity. To use method 2, set swu_capacity_times to -1 and indicate all SWU values in swu_capacity_vals.
  • Multiple feed commodities can be specified (at the same time, including preferences). See the example input file in input/.
  • Note: currently, order_prefs should be set to false if feed commodity preferences are used due to a possible bug, see issue 4. Due to this, the unit tests also show two disabled tests.

FlexibleSource

Flexible variables:

  • Throughput (the production rate). Currently allows using both methods, similar to FlexibleEnrichment.

FlexibleStorage

Flexible variables:

  • inventory size: total amount of material present in the facility at a given moment.

FlexibleSink

Flexible variables:

  • Throughput: maximum amount of material requested and (if available) accepted per timestep.

flexicamore's People

Contributors

maxschalz avatar

Watchers

 avatar  avatar

flexicamore's Issues

Enrichment: does not always register in specific AgentState table

Sometimes, flexicamore:FlexibleEnrichment does not register in AgentState_flexicamore_FlexibleEnrichmentInfo. Specifically, the 'pre-simulation' facilities do appear in the database but the actual, deployed facility does not. However, it does get deployed and enriches material etc., as should be the case.

I noticed this while running simulations with different timesteps ({"control": {"dt": ...}}). However, this bug only appears for FlexibleEnrichment, not in the source, sink or storage facilities...

Before fixing this bug I need to find out where and when facilities register in this database.

Fix behaviour for (product or feed inventory?) TimeSeries

The following lines indicate how much feed is present in the enrichment's feed ivnentory.
However, they add that information to a potentially wrong timeseries.

for (int i = 0; i < feed_commods.size(); ++i) {
RecordTimeSeries<double>("supply" + feed_commods[i], this,
feed_inv[i].quantity());

One possibility to fix this would be to add a pre- or suffix to the TimeSeries name, to get something like this

 for (int i = 0; i < feed_commods.size(); ++i) { 
   RecordTimeSeries<double>("supply" + feed_commods[i] + "feed_inv",
                            this, feed_inv[i].quantity());

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.