{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "bad 1e-10\n"
     ]
    }
   ],
   "source": [
    "import CoolProp, matplotlib.pyplot as plt, numpy as np\n",
    "\n",
    "import CoolProp.CoolProp as CP, json\n",
    "\n",
    "jj = json.loads(CP.get_config_as_json_string())\n",
    "jj['ALTERNATIVE_REFPROP_PATH'] = '/opt/refprop'\n",
    "CP.set_config_as_json_string(json.dumps(jj))\n",
    "    \n",
    "p = 2.28e5 # 2.28 bar\n",
    "\n",
    "RP = CoolProp.AbstractState(\"REFPROP\",\"R438A.MIX\")\n",
    "RP.update(CoolProp.PQ_INPUTS, p, 0)\n",
    "sL = RP.smolar()\n",
    "TL = RP.T()\n",
    "RP.update(CoolProp.PQ_INPUTS, p, 1)\n",
    "sV = RP.smolar()\n",
    "TV = RP.T()\n",
    "\n",
    "BICU = CoolProp.AbstractState(\"BICUBIC&REFPROP\",\"R438A.MIX\")\n",
    "BICU.update(CoolProp.PQ_INPUTS, p, 0)\n",
    "for ds in np.linspace(1e-10, 3):\n",
    "    try:\n",
    "        BICU.update(CoolProp.PSmolar_INPUTS, p, sL-ds)\n",
    "    except:\n",
    "        print 'bad',ds\n",
    "for ds in np.linspace(1e-10, 3):\n",
    "    try:\n",
    "        BICU.update(CoolProp.PSmolar_INPUTS, p, sV+ds)\n",
    "    except:\n",
    "        print 'bad',ds"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
