<commit_before>var optimize = require('./optimize');
var utils = require('./utils');

function RefineryModel(data, collection, initialRor) {
    this.ROR = initialRor || 0.10;
    this.years = 20;
    this.poplarPrice = 24;
    this.maxPastureLandAdoption = 0.25;

    this.update = function() {
      this.setCRF();
      this.setMWP();
    }

    this.setRor = function(ror) {
        this.ROR = ror;
        this.update();
    }

    this.optimize = function(options, callback) {
        optimize(collection, options, callback);
    }

    this.setCRF = function() {
        //this.crf = (this.ROI * Math.pow(1+this.ROI, this.years)) / (Math.pow(1+this.ROI, this.years) - 1); 
        this.crf = (this.ROR * Math.pow(1+this.ROR, this.years)) / (Math.pow(1+this.ROR, this.years) - 1); 
    }

    // maximum willingness to pay 
    this.setMWP = function(productPrice, productYield, crf, capitalCost, operatingCost, feedstock) {
        this.maxWillingToPay = this.product.price * this.yield.value - (this.crf * this.capitalCost + this.operatingCost.value) / this.feedstockCapacity.value;
        this.maxWillingToPay = parseFloat(this.maxWillingToPay.toFixed(2));
    }

    // get current ROI based on poplar price
    this.currentRoi = function(poplarYield) {<commit_msg>adding pasture land adjustment<commit_after>var optimize = require('./optimize');
var utils = require('./utils');

function RefineryModel(data, collection, initialRor) {
    this.ROR = initialRor || 0.10;
    this.years = 20;
    this.poplarPrice = 24;
    this.maxPastureLandAdoption = 0.25;

    this.update = function() {
      this.setCRF();
      this.setMWP();
    }

    this.setRor = function(ror) {
        this.ROR = ror;
        this.update();
    }

    this.setMaxPastureLand = function(maxPastureLand) {
        this.maxPastureLandAdoption = maxPastureLand;
    }

    this.optimize = function(options, callback) {
        optimize(collection, options, callback);
    }

    this.setCRF = function() {
        //this.crf = (this.ROI * Math.pow(1+this.ROI, this.years)) / (Math.pow(1+this.ROI, this.years) - 1); 
        this.crf = (this.ROR * Math.pow(1+this.ROR, this.years)) / (Math.pow(1+this.ROR, this.years) - 1); 
    }

    // maximum willingness to pay 
    this.setMWP = function(productPrice, productYield, crf, capitalCost, operatingCost, feedstock) {
        this.maxWillingToPay = this.product.price * this.yield.value - (this.crf * this.capitalCost + this.operatingCost.value) / this.feedstockCapacity.value;
        this.maxWillingToPay = parseFloat(this.maxWillingToPay.toFixed(2));
    }

    // get current ROI based on poplar price
    this.currentRoi = function(poplarYield) {
{'fraction_non_alphanumeric': 0.14184661206254653, 'fraction_numerical': 0.012658227848101266, 'mean_word_length': 2.899854862119013, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '897868', 'n_tokens_mistral': 968, 'n_tokens_neox': 906, 'n_words': 165}