Document ID: EPA-HQ-OPPT-2012-0725-0055
Agency: epa
Document Type: Supporting & Related Material
Title: 
Posted Date: 2013-11-14T05:00Z

Preface to "A PK/PBPK MODEL QUALITY ASSURANCE ASSESSMENT FOR THE TSCA WORKPLAN RISK ASSESSMENT OF N-Methylpyrrolidone"
                                       
                       Prepared by Paul Schlosser, Ph.D.
                     U.S. Environmental Protection Agency
                 National Center for Environmental Assessment
                                       
Poet et al. (2010) developed a PBPK model to reduce uncertainty associated with extrapolating findings from animal toxicity studies to humans. These authors initially developed the model for adult non-pregnant rats and then extrapolated it to pregnancy.  The U.S. EPA regularly reviews not only the primary publications describing PBPK models, but performs a quality assurance (QA) review, as described by (McLanahan et al., 2012).  Since the model as described by Poet et al. (2010) appeared to be of sufficient scientific quality, the model code was obtained from the principle author, Dr. Torka Poet.  The QA process involves checking that the published tables and figures can be reproduced, that the parameters used in the code match those listed in the publication (or at a minimum, are consistent between model simulations and appropriate for the chemical and animal species and/or humans being simulated), and that the equations in the code are correct and match those listed or indicated in the published paper.  This review has been conducted by members of the U.S. EPA National Center for Environmental Assessment (NCEA) Pharmacokinetics Workgroup (PKWG), with technical support through an external contract.  The contractor's report and further details from the PKWG NMP team lead (Paul Schlosser) follow.
The initial QA review conducted in the fall of 2012 found several code errors and parameter inconsistencies in the model and the EPA was not able to reproduce all of the figures in Poet et al. (2010) as well as should be possible.   At that point the model was not considered to be of sufficient quality for use in a risk assessment.  Subsequently Dr. Torka Poet corrected the model errors originally found by the U.S. EPA and created a set of scripts to aid in reproducing her results (for the NMP Producers Group).  As these changes substantially changed some of the model predictions, the revised model results were described in a report that was submitted to the U.S. EPA in April, 2013.
Overall quality:  The U.S. EPA then treated this revised model report (Poet, 2013) and code as a new publication and again conducted a QA review.  Several more coding and parameter errors were found, as described below in this preface, in the contractor's report which follows, and in EPA's appendix to that report.  In this case, however, correcting the errors caused only modest changes in the model predictions (fits to data) used to calibrate the model and determine its suitability for risk prediction, subsequent to the changes and corrections described here, in the QA report, and appendix.  Since the fits of the model to the various data sets evaluated appears adequate and the parameter values are appropriate and consistent, the model is now deemed to be of sufficient quality for use in this risk assessment.
Dermal absorption of NMP vapor:  One parameter inconsistency that results in differences in predictions for human exposure scenarios is the assumed surface area (SA) of skin through which vapor can be absorbed.  The human model calibration for inhalation was conducted by Poet (2013) with a SA of 6700 cm[2], presumed to be face, neck, lower arms, and hands, through which vapor was absorbed, accounting for about 45% of the uptake when exposure is by inhalation only.   Since these skin areas would also be exposed to vapors for individuals working with NMP, the model code and parameter files were revised to include this route and SA as base assumptions for human exposures, which can occur simultaneous with dermal liquid absorption.
Oral absorption kinetics in rats:  While the oral exposure is not of concern for human workplace and residential scenarios being evaluated by OPPT, the rat PBPK model includes oral dosimetry and calibration to rat oral data was shown by Poet et al. (2010).  In order to evaluate possible internal dose metrics for their ability to predict developmental effects, oral bioassay data for rats is also evaluated in the dose-response analysis.  Hence the ability of the rat model to correctly predict internal doses after oral exposure is also important.  However, since this calibration was not carried forward from Poet et al. (2010) to Poet (2013), it was not evaluated in the contractor's report which follows.  
When the otherwise revised model was tested by the U.S. EPA for its ability to reproduce the oral absorption kinetics shown in Figure 5 or Poet et al. (2010) for rats, an error in the coding (revised version provided with Poet (2013)) gave a significant discrepancy between the predictions with the revised model and that figure.  In particular, the total mass of NMP available for oral uptake was not reduced to reflect the oral bioavailability (FRACOR = 68%) reported by Poet et al. (2010) and instead the rate constant for absorption, KAS, was effectively reduced by this extent.  Since any material deposited in the model's stomach lumen compartment is eventually absorbed, irrespective of the value of KAS, the effective bioavailability was therefore erroneously treated as being 100%.  When the code was corrected to reduce the mass deposited to the stomach lumen compartment to 68% and KAS also reduced to 0.92/h (68% of the value in the provided code, 1.36/h), and the incorrect multiplication of KAS and FRACOR removed from the code, fits to the plasma NMP data for rat oral exposures were of a similar quality to that shown in Figure 5 of Poet et al. (2010), first figure below.  
Fits to the corresponding data for urinary clearance of 5HNMP in the second plot below (not shown by Poet et al., 2010) are also considered adequate, given that the metabolite is not considered to be the proximate toxicant.  That the NMP plasma levels (middle curve in first plot) observed by Ghantous (1995) for a dose of 57 mg/kg are roughly 50% of those observed by Midgley et al. (1992) for a 112 mg/kg exposur while the 5HNMP levels observed by Ghantous (1995) were 80% of those reported by Midgley et al. (1992) suggests either an experimental discrepancy or a nonlinearity in 5HNMP clearance that is not well captured by the model.  It should be noted that the model does describe well the urinary clearance of 5HNMP after a range of IV and inhalation exposures, as validated in the following QA report.  Since the U.S. EPA is not using 5HNMP levels as an internal dose metric, this particular discrepancy in the oral data is not considered severe enough to preclude the PBPK model for use.
                                       
Revised PBPK Model Simulations vs. Data for Oral Gavage Exposures of NMP to Rats
                                        
                                       

Additional references (not included in following contractor's report)
Ghantous, H. 1995. In Oral, Dermal, and Inhalation Pharmacokinetics and Disposition of [2-14 C] NMP in the Rat. Report for E.I. du Pont de Nemours and Company, Haskell Laboratory for Toxicology and Industrial Medicine, Wilmington, DE.
McLanahan, E.D., El-Masri, H.A., Sweeney, L.M., Kopylev, L.Y., Clewell, H.J., Wambaugh, J.F., Schlosser, P.M. 2012. Physiologically based pharmacokinetic model use in risk assessment--why being published is not enough. Toxicol Sci 126, 5-15.

Midgley, I., Hood, A. J., Chasseaud, L. F., Brindley, C. J., Baughman, S., and Allan, G. 1992. Percutaneous-absorption of co-administered N-methyl-2-[C-14]pyrrolidinone and 2-[C-14]pyrrolidinone in the rat. Food Chem. Toxicol. 30, 57 - 64.

A PK/PBPK MODEL QUALITY ASSURANCE ASSESSMENT FOR THE TSCA WORKPLAN RISK ASSESSMENT OF N-Methylpyrrolidone
                                       
                               (CAS RN 872-50-4)
                                       
                                       
                  Under Battelle Prime Contract EP-C-09-006:
    Physiologically-Based Pharmacokinetic (PBPK) Modeling Technical Support
                            Work Assignment WA 4-01
                                       
                                 Prepared By:
                        Michael H. Lumpkin, Ph.D., DABT
                        P. Robinan Gentry, Ph.D., DABT
                       ENVIRON International Corporation
                               Monroe, Louisiana
                                       
                                 Prepared for:
                             Paul Schlosser, Ph.D.
                            Work Assignment Manager
                     U.S. Environmental Protection Agency
                 National Center for Environmental Assessment
                                       
                              Submitted through:
                                  Rena Thomas
                          Battelle Memorial Institute
                                       
                           Prime Contractor Address
                                505 King Avenue
                              Columbus, OH  43201
                                       
                              September 11, 2013
                                       
                               TABLE OF CONTENTS
1	QUALITY ASSURANCE ASSESSMENT	3
2	QA OF NMP MODEL (POET ET AL. 2010)	3
2.1	QA of NMP Model Parameters	3
2.2	QA and Modification of NMP Model Equations	4
3	NMP MODEL OUTPUT	5
4	CONCLUSIONS	6
5	REFERENCES	7
APPENDIX A.  Modified AcslXtreme CSL and M Files Used for the QA Assessment	17
APPENDIX B.	64
                                       
                                LIST OF TABLES
Table 1. Differences between NMP PBPK model parameter values found in the provided model computer code and Poet et al. (2010)	8
                                       
                                LIST OF FIGURES
Figure 1. Reproduction of Wells and Digenis (1988) and Payan et al. (2002) IV NMP exposures: Plasma profiles	9
Figure 2. Reproduction of Payan et al. (2002) IV NMP exposures	10
Figure 3. Reproduction of Payan et al. (2003) dermal NMP exposure	11
Figure 4. Reproduction of Poet et al. (2010) inhalation NMP exposures: Blood profiles	12
Figure 5. Reproduction of Poet et al. (2010) inhalation NMP exposures: Urine profiles	13
Figure 6. Reproduction of Akesson and Paulsson (1997) inhalation NMP exposures	14
Figure 7. Reproduction of Akesson et al. (2004) dermal NMP exposures	15
Figure 8. Comparison of Akesson and Paulsson (1997) dermal with inhalation NMP exposures	16
QUALITY ASSURANCE ASSESSMENT
A quality assurance (QA) assessment was conducted for a modified physiologically based pharmacokinetic (PBPK) model for orally ingested, inhaled, or dermally absorbed n-methylpyrrolidone (NMP) in rats and humans reported by Poet et al. (2010).  The evaluation was conducted to insure that the model structure and parameter values presented by Poet et al. (2010) are accurately reflected in the computer code implementation.  Changes to the model code that would more accurately represent the physiology/biology of NMP pharmacokinetics were discussed and implemented.  Simulations of rat and human exposures that were presented by Poet (2013) were performed and shown here to demonstrate the ability of the current model code to replicate experimental observations.  
QA OF NMP MODEL (POET ET AL. 2010)
The initial PBPK model computer code relied upon for the QA assessment was supplied by Battelle/ Pacific Northwest National Laboratories.  The model code was written in the ACSL programming language and was modified/assessed using the acslXtreme software package (version 3.0.2.1, Aegis Technologies, Inc.).  Separate code files were provided for the rat and human models.
QA of NMP Model Parameters
The NMP model parameter values in the provided model code were checked against the values published in Poet et al. (2010), as well as with Brown et al. (1997) for physiological values and Gentry et al. (2002) for pregnancy-related growth rates.  Rat and human model parameter values were assigned in acsl command files (m files), which set parameter values (including exposure conditions), invoke simulation runs, and plot the resulting simulations.  Several rat model parameter values included in the acsl model code were different from the values provided in Tables 1, 2, and 5 of Poet et al. (2010).  Differences in rat model parameters included the molecular weight for the modeled metabolite, 5-hydroxy-N-methyl-2-pyrrolidone (5-HNMP), fractional blood flow to the mammary glands, uterus, and skin, lung tissue volume, first order urinary elimination rate of 5-HNMP, and equilibrium tissue:blood partition coefficients for NMP in the lung and slowly-perfused lumped tissues compartments (Table 1).  The reference for the rat tissue:blood partition coefficients for NMP used in the model code for the placenta (0.309) and for 5-HNMP for placenta and rest-of-body (1.07 and 0.73, respectively) were not provided in the model code or cannot be estimated based on the information provided in Table 5 of the Poet et al. (2010) paper.   
Similarly, the human model command files assigned parameter values that were different from published values for molecular weight for NMP, fractional blood flow to the skin and uterus, NMP vapor permeability constant, and fat:blood partition coefficient for 5-HNMP (Table 1).  Additionally, source references for tissue:blood partition coefficient values for NMP in the placenta and rapidly-perfused tissues (0.31 and 0.94) and 5-HNMP in the rapidly- and slowly-perfused tissues and rest-of-body (6.5 and 1.0) were not provided in the model code or cannot be determined based on the information provided in Table 5 of Poet et al. (2010) paper.
QA and Modification of NMP Model Equations
The equations used in the model code to calculate rates of change, amounts, concentrations, and area-under-the-curve (concentration x time) of NMP and 5-HNMP absorption, distribution, metabolism, and elimination in blood and tissues were examined to assure that they accurately represented the model structure and relationships described by Poet et al. (2010).  Poet et al. (2010) implemented equations for pregnancy-related changes in body weight, tissues volumes, pulmonary ventilation, and cardiac output used by Gentry et al. (2002).  The only differences identified in the pregnancy-related growth equations were for the fetal compartment in rats.  Gentry et al. (2002) described fetal growth as having three different phases beginning on the gestation days 0, 11, and 18, whereas the provided NMP model code implemented these changes in fetal growth rates on gestation days 0, 10, and 17.  It was not clear if these differences in modeled fetal growth phases may be due to differences between the Poet et al. (2010) and Gentry et al. (2002) in defining time for onset of gestation in rats.  
Two modifications were made by EPA staff to the code prior to the QA assessment and included:
   a) Changing the body weight scaling exponent from 0.74 to 0.75  for all allometrically-scaled parameters, and 
   b) Correcting the rate equation for dermal absorption of liquid NMP (RADL and RASL for rat and human models, respectively) of NMP from
                  RADL = ((KPL x SA / 1000) x CSURF) - (CSK/PSK)
                                         to
                  RADL = (KPL x SA / 1000) x (CSURF - (CSK/PSK))
      in the rat model, and from
                   RASL = ((PVL x SA/1000) x CSURF)-(CVSK/PSKL)
                                         to
                   RASL = (PVL x SA/1000) x (CSURF-(CVSK/PSKL))
      in the human model.
In addition, several errors in parameters for skin volumes (total body skin or exposed skin only) and equations calculating tissue-specific NMP concentrations in the human model were identified by the EPA WAM, Paul Schlosser, and were corrected.  The corrections include selection of an exposure-specific skin volume to use in calculating NMP vapor absorption, introducing a term in the vapor absorption rate that accounts for evaporative NMP loss from the skin (after exposure cessation), corrections in calculating NMP concentration leaving the skin and entering the venous circulation, correction in the calculation of cardiac output and tissue volume of the slowly-perfused compartment by removing the skin volume term, and introduction of spray-on NMP dermal exposures.  Also, the human model code was modified to remove discontinuities in placental blood flow at time zero (causing the model to crash) and fat, mammary, and uterine volumes.  Pregnancy-related cardiac output and volume growth changes for 5-HNMP in fat were not properly reflected in the slowly-perfused compartment. This resulted in a blood flow mismatch and an artificial loss of 5-HNMP.  A detailed description of all of these changes is provided in Appendix B. 
In the human NMP model, the parameter for rate of daily NMP ingestion in drinking water (DRINK, mg/kg/day) is included in the equation for rate of NMP change in the liver (RALiv), but should more appropriately be placed in the equation for rate of NMP change in the stomach (RSTOM).  As a practical matter, the differences in NMP dose metrics from average daily drinking water doses being introduced in the liver compartment versus the stomach are likely to be negligible.  
NMP MODEL OUTPUT
Select simulations in rats and humans were run using the code with modification as outlined in Section 2 (referred to hereafter as the modified EPA model).  The resulting output was compared with output from the same simulations presented in the Poet (2013) report, which presented a metabolism re-optimized version of the model code relied upon in Poet et al. (2010), as well as experimental observations, where available.  Figure 1 shows the comparative simulations of the Poet (2013) model, the modified EPA model to the concentrations of NMP measured in blood following a single IV injection of 0.1 (Payan et al. 2002) or 45 mg/kg (Wells and Digenis 1988).  Figure 2 provides model estimates of 5-HNMP concentrations in blood and urine, as well as the corresponding measured concentrations, following single IV injections of 0.1  -  500 mg/kg NMP (Payan et al. 2002).  In both Figures, minimal differences were seen between the Poet (2013) and modified EPA models in predicting blood or urine levels of NMP and 5-HNMP.  
Figure 3 shows measured and model estimated concentrations from both the Poet (2013) and modified EPA models of plasma NMP in rats following  a single dermal application of 200 uL neat NMP (Payan et al. 2003). The Poet (2013) and modified EPA models replicated the experimental observations equally well, with slight over- and under-predictions of the plasma profiles, respectively. Thus, the modified EPA NMP model code is capable of reproducing plasma and urine profiles of NMP and 5-HNMP in rats. 
The Poet (2013) and modified EPA models for NMP in humans were used to simulate acute inhalation and dermal exposures.  Figures 4 and 5 provide the measured and model estimated concentrations (for both the Poet and modified EPA models) of NMP or 5-HNMP in blood or urine of volunteers inhaling 10 -80 mg NMP/m[3]for six hours (Poet et al. 2010).  Model-predicted NMP levels in plasma and 5-HNMP levels in plasma and urine using the modified EPA code were slightly closer to experimental observations at 39 and 80 mg/m[3] than were predictions using the Poet (2013) code.  However, the Poet (2013) code predicted NMP in urine levels that were closer to experimental observations than predicted by the modified EPA model. The output from both model codes (Figure 6) produce very similar simulations of plasma NMP in human volunteers inhaling 10  -  53 mg/m[3] NMP (Akesson and Paulsson 1997).  
For human dermal exposure simulations (Figures 7 and 8), the estimated plasma 5-HNMP concentrations from the modified EPA model code replicated the profiles of the experimental observations (Akesson et al. 2004), which was not the case for urinary 5-HNMP, in which model predictions using the modified EPA model for both males and females were approximately 25-30% lower than experimental observations (Figure 7). The lower model predictability of the urinary data may be due to lower urine production in the volunteers, compared to the assumed 2 L/day production used in the model. Lower urine volume in the experimental subjects could result in higher 5-HNMP levels, compared to model predictions.  Finally, the dermal simulations of the Akesson et al. (2004) experiments  using modified EPA code (Figure 9) comport with statements by Akesson et al. (2004) that 6-hour dermal exposures to neat NMP would likely result in similar plasma NMP levels to those seen previously following 10 mg/m[3] inhalation exposures (Akesson and Paulsson 1997).
CONCLUSIONS
The NMP PBPK model code of Poet et al. (2010), as re-optimized by Poet (2013), for rats and humans, was modified by EPA and provided to ENVIRON for use in a QA assessment of the model for use in risk assessment.  The modified EPA model code and the Poet (2013) models generally produced very similar simulations following IV and dermal exposures in rats and inhalation and dermal exposures in humans.  The modified EPA model provides predictions of plasma NMP levels in both species that were closer to experimental observations than were urinary metabolite predictions.  Thus, the modified EPA model code is capable of predicting parent compound and metabolite profiles from multiple data sets providing blood and urine measurements in rodents and humans exposed to NMP by multiple routes of exposure (IV, dermal and inhalation).  

REFERENCES

Akesson, B., Carnerup, M. A. and Jonsson, B. A. (2004). Evaluation of exposure biomarkers from percutaneous absorption of N-methyl-2-pyrrolidone. Scand.J.Work Environ.Health 30, 306-312. 

Akesson, B. and Paulsson, K. (1997). Experimental exposure of male volunteers to N-methyl-2-pyrrolidone (NMP): acute effects and pharmacokinetics of NMP in plasma and urine. Occup.Environ.Med. 54, 236-240. 
Brown, R. P., Delp, M. D., Lindstedt, S. L., Rhomberg, L. R., Beliles, R. P. (1997). Physiological parameter values for physiologically based pharmacokinetic models. Toxicol Ind Health 13, 407-484.
Gentry, P. R., Covington, T. R., Andersen, M. E., and Clewell, H. J. III. (2002). Application of physiologically based pharmacokinetic model for Isopropanol in the derivation of a reference dose and reference concentration. Reg Toxicol Pharm 36, 51-68. 
Payan, J. P., Beydon, D., Fabry, J. P., Boudry, I., Cossec, B., and Ferrari, E. (2002). Toxicokinetics and metabolism of N-[14C]methylpyrrolidone in male Sprague-Dawley rats. A saturable NMP elimination process. Drug Metab. Dispos. 30, 1418 - 1424.

Payan, J. P., Boudry, I., Beydon, D., Fabry, J. P., Grandclaude, M. C., Ferrari, E. and Andre, J. C. (2003). Toxicokinetics and metabolism of N-[(14)C]N-methyl-2-pyrrolidone in male Sprague-Dawley rats: in vivo and in vitro percutaneous absorption. Drug Metab Dispos. 31, 659-669. 
Poet, T. S., Kirman, C. R., Bader, M., van Thriel, C., Gargas, M. L. and Hinderliter, P. M. (2010). Quantitative Risk Analysis for N-Methyl Pyrrolidone Using Physiologically Based Pharmacokinetic and Benchmark Dose Modeling. Toxicol Sci 113, 468-482. 
Poet. (2013).  Internal Dose, as Derived from Updated PBPK Model, Should Be Basis for NMP Toxicity Assessment. Battelle Memorial Institute Pacific Northwest Division.

Wells, D. A., and Digenis, G. A. (1988). Disposition and metabolism of double-labeled [3h and 14c] N-methyl-2-pyrrolidinone in the rat. Drug Metab. Dispos. 16, 243 - 249.
Table 1. Differences between NMP PBPK model parameter values found in the provided model computer code and Poet et al. (2010) 
Species
Parameter
Parameter 
name
Value provided in 
model computer code
Value published by 
Poet et al. (2010)
                                      Rat
Molecular weight for 
5-HNMP
                                     MWHP
                                    116.14
                                    115.13
                                      Rat
Percent cardiac output to skin
                                     QSKNC
                                      5.8
                                      1.0
                                      Rat
Percent cardiac output to mammary gland
                                     QMAMC
                                      0.1
                                      0.2
                                      Rat
Percent cardiac output to uterus
                                     QUTRC
                                      0.1
                                      0.5
                                      Rat
First-order urinary elimination rate of NMP (L/hr)
                                      KLC
                                      3.9
                                      4.9
                                      Rat
Slowly-perfused tissue:blood NMP partition coefficient
                                      PS
                                     0.74
                                     0.57
                                      Rat
Lung tissue:blood NMP partition coefficient
                                      PLU
                                     0.10
                                     0.13
                                     Human
Molecular weight for 
5-HNMP (g/mol)
                                     MWHP
                                    116.14
                                    115.13
Human
Percent cardiac output to skin
                                     QSKNC
                                      5.8
                                      3.0
                                     Human
Percent cardiac output to uterus
                                     QUTRC
                                      0.5
                                     0.62
                                     Human
NMP vapor permeability coefficient (cm/hr)
                                      PV
                                      32
                                      23

Figure 1. Reproduction of Wells and Digenis (1988) and Payan et al. (2002) IV NMP exposures: Plasma profiles

Figure 2. Reproduction of Payan et al. (2002) IV NMP exposures

Figure 3. Reproduction of Payan et al. (2003) dermal NMP exposure

Figure 4. Reproduction of Poet et al. (2010) inhalation NMP exposures: Blood profiles

Figure 5. Reproduction of Poet et al. (2010) inhalation NMP exposures: Urine profiles

Figure 6. Reproduction of Akesson and Paulsson (1997) inhalation NMP exposures

Figure 7. Reproduction of Akesson et al. (2004) dermal NMP exposures

Figure 8. Comparison of Akesson and Paulsson (1997) dermal with inhalation NMP exposures

 APPENDIX A.  Modified AcslXtreme CSL and M Files Used for the QA Assessment

NMPPREG_RAT.CSL
PROGRAM NMP.ACSL
!PBPK MODEL FOR N-METHYL PYRROLIDONE
!FINAL RAT MODEL (5/09)
!T.S. POET,P HINDERLITER. CHEMICAL DOSIMETRY GROUP, PNNL, RICHLAND, WA 
!MODEL TRANSFERRED FROM SIMUSOLV TO ACSLXTREME FORMAT IN 08
!MODEL CONFIGURED FOR INHALATION (OPEN, WHOLE BODY/NOSE ONLY)
!   IV, ORAL,  DERMAL, AND IP  ROUTES OF ADMINISTRATION.                   
!MODEL TRACKS DISPOSITION OF NMP AND 5-HNMP.                   
!ASSUMPTIONS:                                                    
!    (1) FLOW-LIMITED (ALL COMPARTMENTS)                         
!    (2) METABOLISM OF NMP BY A SAT PATHWAY TO FORM 5HNP 
!    (3) METABOLISM OF HNP BY SATURABLE PATHWAY TO ETC.  
!    (5) METABOLISM OCCURS ONLY IN THE LIVER                     
!    (6) TISSUE:BLOOD PART. COEFF.   = HUMAN = KRISHNAN EQN 
!UPDATED IN CMD FILE TO MEASURED IN-HOUSE
!    (7) 5HNP ELIMIN FROM MIXED VENOUS - 1ST ORDER
!THIS DIFFERS FROM 02: URINE BY *GFR CLEARANCE FROM KIDNEY
!   METAB RATE CONST. FROM REPORT - UPDATED WITH LIT VALUES IN CMD FILE
!   PREG ADDED - OTHER PARAMETERS CHANGED NOMINALLY TO HARMONIZE WITH FETAL IPA MODEL OF 
!     GENTRY ET AL. REGU TOX PHARM 36:51-68, 2002
INITIAL
! MODEL UNITS
! CONCENTRATION, MG/L
! FLOW, L/HR
! BODY WT, KG
 CONSTANT  BWINIT=0.    ! PRE-PREGNANCY BODY WEIGHT (KG)
 CONSTANT  RATS=1.         !NUMBER OF ANIMALS IN EXPT. NOT USED IN HUMAN MODEL
 CONSTANT  MWNMP=99.13      !MOL. WT. NMP, MG/MMOL
 CONSTANT  MWHP= 116.14     !MOL. WT. 5-HNP, MG/MMOL
 
!BLOOD FLOWS
!FROM BROWN ET AL TOX IND HEALTH 97 
!AND/OR FROM IPA MODEL OF GENTRY ET AL., 
! BLOOD FLOWS (FRACTION OF CARDIAC OUTPUT)
  CONSTANT     QCC = 0        ! CARDIAC OUTPUT (L/HR FOR 1 KG ANIMAL)
  CONSTANT     QPC = 0      ! ALVEOLAR VENT. RATE
  
  CONSTANT   QFATC = 0        ! FAT (NON-PREGNANT)
  CONSTANT   QLIVC = 0        ! LIVER
  CONSTANT   QMAMC = 0        ! MAMMARY TISSUE (NON-PREGNANT)
  CONSTANT   QSKNC = 0        ! SKIN
  CONSTANT   QUTRC = 0        ! UTERUS (NON-PREGNANT)
  CONSTANT   QRAPC = 0        ! RAPID USE STATIC RAPID FOR RATS (MUST BE CHANGED FOR HUMAN)
  
! PERMEABILITY-AREA PRODUCT (L/HR)
  CONSTANT    PAFC = 0.1          ! DIFFUSION ON FETAL SIDE OF PLACENTA
! NOTE 0.1 IS THE VALUE SUPPLIED BY ENVIRON AND USED FOR IPA, IT IS UNSURE WHERE THE VALUE COMES FROM
! GRAPHING OUT TRANSPORT TO FETUS, 0.1 RESULTS IN A MAX FOR NMP, MAYBE FOR IPA AS WELL
! TISSUE VOLUMES (FRACTION OF BODY WEIGHT)
!FROM BROWN ET AL TOX IND HEALTH 97 FOR RATS
!OR FROM GENTRY ET AL
  CONSTANT    VLUC = 0        ! LUNG
  CONSTANT   VFATC = 0         ! FAT (NON-PREGNANT)
  CONSTANT   VLIVC = 0        ! LIVER
  CONSTANT   VMAMC = 0         ! MAMMARY TISSUE (NON-PREGNANT)
  CONSTANT   VRAPC = 0        ! RAPIDLY PERFUSED
  CONSTANT   VUTRC = 0        ! UTERUS (NON-PREGNANT)
  CONSTANT    VBLC = 0      ! TOTAL BLOOD
    ! FOR PARENT MODEL, SKIN COMPARTMENT IS ONLY DEFINED AS DOSED SKIN
  CONSTANT    VSKC = 0.19  ! SKIN     
  CONSTANT      SA = 0.01         !SURFACE AREA EXPOSED, SQ.CM
       TSA = 906.*BWINIT**(2./3.)   !TOTAL BODY SURFACE AREA, SQ.CM.
                      !MCDOUGAL ET AL. T.A.P. 85(1996)286
   IF (CONCL.GT.0.0) THEN
VSKCC = VSKC*SA/TSA
    QSKCC = QSKNC*SA/TSA
   ELSE
VSKCC = VSKC*SA/TSA
    QSKCC = QSKNC*SA/TSA
   ENDIF
! SLOWLY PERFUSED (DEFINED AS BALANCE OF TISSUES AND FLOWS)
 VSC = 0.91 - (VLUC + VFATC + VLIVC + VMAMC + VRAPC + VUTRC + VBLC + VSKCC)
 ! NOTE: 0.91 IS APPROX WHOLE BODY LESS BONE
 QSC = 1. - (QFATC + QLIVC + QMAMC + QRAPC + QUTRC + QSKCC)
 
! SCALED BLOOD FLOWS (L/HR)
    QCINIT = QCC * (BWINIT**0.75)! CHANGED 0.74 TO 0.75; PMS 8-19-13
     QFATI = QFATC * QCINIT
      QLIV = QLIVC * QCINIT
     QMAMI = QMAMC * QCINIT
      QRAP = QRAPC * QCINIT
      QSKN = QSKCC * QCINIT
      QSLW = QSC * QCINIT
     QUTRI = QUTRC * QCINIT
! SCALED TISSUE VOLUMES (L)
       VLU = VLUC * BWINIT
     VFATI = VFATC * BWINIT
      VLIVI = VLIVC * BWINIT
      VRAP = VRAPC * BWINIT
      VSLW = VSC * BWINIT
     VMAMI = VMAMC * BWINIT
     VUTRI = VUTRC * BWINIT
       VSK = VSKCC * BWINIT
       VBL = VBLC * BWINIT     ! TOTAL BLOOD
  VA = 0.25*VBL          !ARTERIAL BLOOD
      VV = 0.75*VBL          !VENOUS BLOOD
! PREGNANCY PARAMETERS
  CONSTANT  NUMFET = 7.0          ! NUMBER OF FETUSES (NOT USED FOR HUMAN, ASSUME 1)
  CONSTANT   PUPBW = 4500.        ! BIRTH WEIGHT (MG)
  CONSTANT VFETD18 = 1051.254     ! VOLUME OF  FETUS AT DAY 18 ( ) OF PREGNANCY
! CONVERSION FACTORS
  CONSTANT    MGKG = 1.0E6        ! CONVERSION FACTOR FROM MG TO KG
!PARTITION COEFFICIENTS
!EXPERIMENTALLY MEASURED VALUES
   CONSTANT PB=0.         !NMP BLOOD:AIR
   CONSTANT PF=0!NMP FAT:BLOOD - MEASURED
   CONSTANT PL=0!MEASURED
   CONSTANT PR=0!MEASURED LIVER
   CONSTANT PS=0!NOT MEASURED MUSCLE - CORRECTED FOR FILTER ERROR USING SKIN PROPORTIONALITY
   CONSTANT PSKL=0!MEASURED
   CONSTANT PLU=0        !NMP LUNG:BLOOD
   CONSTANT PSKA= 0      !NMP SKIN:AIR 
CONSTANT PSKB=0! NMP SKIN:BLOOD
! CODE FOR SKIN-AIR TRANSFER IS COMMENTED OUT BELOW, HENCE PSKA IS NOT USED; PAUL SCHLOSSER, U.S. EPA 5-17-13
!   CONSTANT PSKL=0!MEASURED
   CONSTANT PM=0!MAMMARY, ESTIMATED FORM LIVER
   CONSTANT PPLA=0
   CONSTANT PUTR=0
      
!EXPERIMENTALLY MEASURED VALUES
   CONSTANT PLHNP=0   ! LIVER MEASURED
   CONSTANT PBHNP=0       !ESTIMATED AVG OF "OTHER" TISSUES
   CONSTANT PFHNP=0   !MEASURED
   CONSTANT PPLHNP=0
  
!METABOLIC RATE CONSTANTS
!**THESE ARE FROM PAYAN ET AL
  !NMP TO 5HNP
     CONSTANT  KM=0!MICHAELIS CONSTANT, MG/L
     CONSTANT  VMAXC=0!MAX. ENZ. ACT., MG/HR/L
     VMAX1 = VMAXC*BWINIT**0.75
  
  !5HNP TO OTHER METABS
     CONSTANT  KM2=0     !MICHAELIS CONSTANT, MG/L
     CONSTANT  VMAX2C=0      !MAX. ENZ. ACT., MG/HR/L
     VMAX2 = VMAX2C*BWINIT**0.75
  
!URINARY ELIMINATION OF 5-HNMP - CLEARED FROM BLOOD
!NOTE FIRST ORDER RATE COMMENTED OUT, SATURABLE FITS BETTER
  CONSTANT KLC=0
  KL=KLC/(BWINIT**0.25)
 CONSTANT KLNC=0!URINARY LOSS OF NMP, L/HR
 KLN=KLNC/(BWINIT**0.25)
 
!FRACTIONAL ABSORPTION    
    CONSTANT  FRACIN = 1     !FRACTIONAL UPTAKE OF NMP BY INHAL,START AT 65%
                !OF ALVEOLAR - AS IN AKESSON ET AL 1997
    CONSTANT  FRACOR = 1.0      !FRACTION ABSORBED ORALLY, INITALLY 100%
    CONSTANT FRACF=1
! INITIAL CONDITIONS FOR CLOSED CHAMBER INHALATION
  CONSTANT    VCHC = 9E9   ! VOLUME OF CLOSED CHAMBER (L),START LARGE FOR OPEN
  CONSTANT   KLOSS = 0.0   ! CHAMBER LOSS RATE /HR
  
  
!TIMING COMMANDS
  
 CONSTANT  TCHNG=6.0    !END OF INHAL EXPOSURE, HR
    CONSTANT  TSTOP=24.0    !END OF EXPERIMENT/SIMULATION, HR
    CONSTANT MAXT=0.01!MAXIMUM STEP SIZE, HR THIS MAY NEED SET LOWER FOR NEW VERSION OF ACSL TO RUN
      CONSTANT MINT=1E-7
   CONSTANT CINT = 0.2!DATA LOGGING RATE /HR
    CONSTANT  GDDAYS=0.0   ! OFFSET FOR GESTATIONAL DAY SIMULATION
    CONSTANT  GDMONTHS=0.0  !OFFSET FOR HUMAN GD SIMULATION
!INITIAL EXPOSURE CONDITIONS
  ! EXPOSURE CONDITIONS BASED ON USER DEFINED INITIAL AMOUNTS OF CHEMICAL (MG)
    CONSTANT  CONCPPM = 0.0                  !AIR CONCENTRATION IN PPM!
CONSTANT CONCMGS = 0.0! USED TO SET AIR CONC'N AS MG/M3, PMS, 8-13-13
          VCH = VCHC-(RATS*BWINIT)         !VOLUME OF OCCUPIED CHAMBER
          CONCMG = CONCMGS/1000 + CONCPPM*MWNMP/24451.    !CONVERT PPM TO MG/LITER!
          CONSTANT   DOSEINTERVAL=24!TIME BETWEEN DAILY DOSES
CONSTANT CONCCHPPM0 = 0! INITIAL PPM IN CLOSED CHAMBER
CONCHMG0= CONCCHPPM0*MWNMP/24451.
          ACHO = CONCHMG0 * VCH              !INIT. AMT IN CHAMBER, MG! 
   !ORAL
      CONSTANT  KAS=1.0          !1ST ORDER RATE CONST FOR ORAL ABS,HR-1
      CONSTANT  DOSE=0.0         !ORAL DOSE IN MG/KG BW
      ODOSE = DOSE*BWINIT        !CONVERT MG/KG BW TO MG TOTAL(ORAL)
     !**NOTE - CONSIDER ADDING ZERO ORDER FOR HUMAN HED
CONSTANTDOSE2=0.0! ORAL DOSE IN MG/KG BW, BUT TOTAL DOSE INCREASES W/ BW
   !FEED
      CONSTANT  KASF=1.0          !1ST ORDER RATE CONST FOR ORAL ABS,HR-1
      CONSTANT  DOSEF=0.0         !ORAL DOSE IN MG/KG BW
  !    TABLE FEEDDOSE 1 ,10 /10*24.,10*1./
   !IV     
      CONSTANT IVDOSE=0.0        !IV DOSE, MG/KG NMP
      CONSTANT  TINF=0.01        !DURATION OF IV INFUSION, HR, SET TCHNG=TINF
   !DERMAL
      CONSTANT CONCL = 0.0       !CONC OF NMP IN LIQUID, MG/L
      CONSTANT KPL = 0.0    !PERM COEFF FOR LIQUID, CM/HR
      CONSTANT VLIQ = 1.0E-99 !INITIAL VOLUME APPLIED, L
      CONSTANT DENSITY=1.03
CONSTANT DSK=0.0! INITIAL AMOUNT (MG/KG BW) RUBBED INTO SKIN; PMS 8-14-13
ASKO=DSK*BWINIT! PMS, 8-14-13
CONSTANT TWASH=8.0! WASH TIME IN BECCI ET AL. (1982) EXPOSURES
  !CONSTANT RESID=0         !AMOUNT STICKING TO EXPOSURE SYSTEM, MG
     ! DDN = CONCL*VLIQ
CONSTANT FAD=0.222  !FRAC NO ABSORBED IN PAYAN ET AL
    !IN VITRO HUMAN VAN DYK ET AL. AIHA J 56: 651-660
        !START WITH SMALL SA SO VSKE IS NON-ZERO (USED IN DENOMINATOR OF CSK CALCULATION)
  
    !IP
      CONSTANT IPDOSE = 0.0    !IP DOSE, MG/KG NMP
      CONSTANT KIP=1.0    !1ST ORDER RATE OF ABS, HR-1
      PDOSE = IPDOSE*BWINIT!TOTAL IP DOSE, MG
!DOSING SCHEDULE
IF (DSK.GT.0.0) THEN
SCHEDULE SKWASH.AT.TWASH
ENDIF
     SCHEDULE OFFD.AT.TCHNG     !TURN OFF EXPOSURE AT TCHNG
     CIZONE = 1.0               !START WITH INHALATION ON
     IVZONE = 1.0               !START WITH IV ON
IF (CONCL.GT.0.0) THEN
     DZONE = 1.0            !START WITH DERMAL ON
ELSE
DZONE = 0.0
ENDIF
CONSTANT TSTART=0.2! OFFSET START-TIME FOR GAVAGE DOSING
SCHEDULE GAVD.AT.TSTART
     ALGORITHM IALG=2        !GEAR ALGORITHM     
  
END
DYNAMIC
  
DERIVATIVE
!===============FETAL AND BW CHANGES W/PREGNANCY=======================
    GDMONTH=GDMONTHS/0.64!TO WAG HUMAN GROWTH, THIS SETS HUMAN FETAL
!AT BIRTH ~3.5 KG AND MOTHER GAINING ~ 8.7 KG
!ACTUAL HUMAN AT BIRTH AVERAGE IS 3.5 KG
!MOTHER AT BIRTH GAINS 13.6 KG
     HOURS = T
   MINUTES = T * 60.0
      DAYS = T / 24.0 + GDDAYS +GDMONTH
! VOLUME OF FAT (L)
      VFAT = VFATI * (1.0 + (0.0165 * DAYS))
! VOLUME OF FETUS (KG)
! ADDED 1.0E-8 TO VARIOUS VOLUMES TO AVOID DIVIDE-BY-ZERO PROBLEMS; PMS 8-13-13
     IF (DAYS.LT.10.0) THEN
         VFET = (1.0E-8 + NUMFET * ((0.1206 * DAYS)**4.53)) / MGKG
     ELSE IF (DAYS.LT.17.0) THEN
         VFET = (1.0E-8 + NUMFET * ((1.5 * (DAYS - 9))**2.8)) / MGKG
     ELSE
         VFET = (1.0E-8 + NUMFET * (VFETD18 + (((PUPBW - VFETD18) / 4.0) * (DAYS - 17)))) / MGKG
     ENDIF
! VOLUME OF   MAMMARY TISSUE (L)
      VMAM = VMAMI * (1.0 + (0.27 * DAYS))
! VOLUME OF   PLACENTA (L)
     IF (DAYS.LT.6.0) THEN
         VPLA = 1.0E-8
     ELSE IF (DAYS.LT.10.0) THEN
         VPLA = (1.0E-8 + NUMFET * (8. * (DAYS - 6.))) / MGKG
     ELSE 
         VPLA = (1.0E-8 + NUMFET * ((32 * EXP(-0.23 * (DAYS - 10)))+ (40 * (EXP(0.28 * (DAYS - 10)) - 1)))) / MGKG
     ENDIF
! VOLUME OF   UTERUS (L)
     IF (DAYS.LE.3.0) THEN
         VUTR = VUTRI
     ELSE
         VUTR = VUTRI * (1.0 + (0.077 * ((DAYS - 3.)**1.6)))
     ENDIF
!VOLUME OF LIVER INCREASE   !CORLEY ET AL CRC 03,BUELKE-SAM ET AL '82 AND OTHERS
IF (DAYS.LT.5.0) THEN
VLIV=VLIVI
ELSE 
VLIV= VLIVI * (1.0 + (0.0455 * ((DAYS - 5.0))))
ENDIF
! INCREASE IN   BODY WEIGHT (KG)
     !  WATER=(0.0033*DAYS)+(9.2E-5*(DAYS**2))  !CORLEY ET AL CRC 03, 
    BW = BWINIT + (VFAT - VFATI) + VFET + (VMAM - VMAMI) + VPLA + (VUTR - VUTRI)+(VLIV - VLIVI)
        
! SCALED   ALVEOLAR VENTILATION (L/HR)
        QP = QPC * ((BW-VFET-VPLA)**0.75)! CHANGED 0.74 TO 0.75; PMS 8-19-13
      
! INCREASE IN   BLOOD FLOWS (L/HR)
      QFAT = QFATI * (VFAT / VFATI)
      QMAM = QMAMI * (VMAM / VMAMI)
      QUTR = QUTRI * (VUTR / VUTRI)
!!!!!! NOTE THAT THE BLOOD FLOWS NO LONGER BALANCE. QP HAS INCREASED BY THE ADDITIONAL 
!!!!!! FETAL AND PLACENTAL VOLUMES BUT THE COMPARTMENTAL FLOWS HAVE NOT CHANGED. 
!!!!!! QRECOV WILL START AT 100 AND DECREASE THRU PREGNANCY (PMH 25-APR-2007)
! TOTAL BODY FOR HNMP
       QB = QRAP+QSLW+QSKN+QMAM+QUTR ! +QPLA ! PLACENTA IS A SEPARATE COMPARTMENT; PMS 8-19-13
     VB = VRAP+VSLW+VLU+VSK+VMAM+VUTR ! +VPLA ! DITTO; PMS 8-19-13
!   BLOOD FLOW TO PLACENTA (L/HR)
     IF (DAYS.LT.6.0) THEN
         QPLA = 0.0
     ELSE IF (DAYS.LT.10.0) THEN
         QPLA = (NUMFET * (0.55 * (DAYS - 6.0))) / 24
     ELSE IF (DAYS.LE.12.0) THEN
         QPLA = (NUMFET * (2.2 * EXP(-0.23 * (DAYS - 10)))) / 24
     ELSE 
         QPLA = (NUMFET * ((2.2 * EXP(-0.23 * (DAYS - 10)))+ ((0.1207 * (DAYS - 12.0))**4.36))) / 24
     ENDIF
! INCREASED   CARDIAC OUTPUT (L/HR)
        !QC = QCINIT + (QFAT - QFATI) + (QMAM - QMAMI) + QPLA+ (QUTR - QUTRI)
        QC = QFAT+QLIV+QSLW+QRAP+QSKN+QMAM+QPLA+QUTR! PMS, 8-13-13
! SCALED PERMEABILITY-AREA PRODUCT
       PAF = PAFC * (VFET**0.75)
!==================FIRST MODEL FOR TRACKING NMP=========================
!EQUATIONS FOR ORAL GAVAGE DOSING 
    RAO = KAS * AO*FRACOR
     AO = INTEG(-RAO,ODOSE)  !AMT REMAINING TO BE ABS, MG!
        OABS = INTEG(RAO,0.0) 
!ODOSE - AO     !AMT ABSORBED ORALLY, MG!
!EQUATIONS FOR FEED DOSING 
      FDOSE = DOSEF*BW        !CONVERT MG/KG BW TO MG TOTAL(ORAL)
    RAF = KASF * AF*FRACF
     AF = FDOSE - INTEG(RAF,0.0)  !AMT REMAINING TO BE ABS, MG!
   FABS = INTEG(RAF,0.0) 
!AL = AMOUNT NMP IN LIVER COMPARTMENT (MG) 
      RAL = QLIV*(CA - CVL)+ RAIP + RAO + RAF - RAML
       AL = INTEG(RAL, 0.0)
      CVL = AL/(VLIV*PL)
  
     RAML = (VMAX1*CVL)/(KM+CVL)  !SATURABLE METABOLISM, MG/HR
      AML = INTEG(RAML,0.0)     !AMT NMP METAB BY SATURABLE PATH, MG
    AML1B = RATS*AML*MWHP/MWNMP  !TOT AMT HNP PRODUCED IN LIVER, MG
!EQUATIONS FOR IP DOSING 
    RAIP = KIP * AIP
     AIP = INTEG(-RAIP,PDOSE)  !AMT REMAINING TO BE ABS, MG!
  IPABS = INTEG(RAIP,0.0) 
    
!EQUATIONS FOR IV INFUSION 
    IVR = IVZONE*IVDOSE*BW/TINF  !RATE OF INFUSION, MG/HR
    TIV = INTEG(IVR,0.0)         !TOTAL AMOUNT INJECTED, MG
! ARTERIAL BLOOD 
     RAAB = (QC * (CVLU - CA))-RAUNP
      AAB = INTEG(RAAB, 0.0) !AMOUNT, MG
       CA = AAB / VA        !CONCENTRATION, MG/L
    AAUCB = INTEG(CA, 0.0)   !AUC, HR*MG/L
RAUNP = KLN*CA*VV!FIRST ORDER RATE OF LOSS (URINE
AUNP = INTEG(RAUNP,0.0)
! CHAMBER CONCENTRATION (MG/L)
     RACH = (RATS * QP * CLEX) - (FRACIN * RATS * QP * CI) - (KLOSS * ACH)
      ACH = INTEG(RACH, ACHO)
  
 
! THE FOLLOWING CALCULATION YIELDS AN AIR CONCENTRATION EQUAL TO 
! THE CLOSED CHAMBER VALUE IF A CLOSED CHAMBER RUN IS IN PLACE AND
! A SPECIFIED CONSTANT AIR CONCENTRATION IF AN OPEN CHAMBER RUN IS IN PLACE
      CCH = (ACH / VCH)! * CIZONE) + (CONCMG * (1.0 - CLON))
  
    CCPPM = CCH *24451/MWNMP
    CLOSS = INTEG(KLOSS * ACH,0.0)
CI = CCH*PULSE(0., DOSEINTERVAL,TCHNG) + CIZONE*CONCMG   ! MG/L ! ADDED CIZONE*CONCMG, PMS, 8-13-13
! LUNGS
    !RALU = (QP * ((FRACIN * CI) - CLEX)) + (QC * (CV - CVLU))
    RALU = (QP * ((FRACIN * CI) - CLEX)) + RVV - (QC * CVLU)! PMS, 8-13-13
  ALU = INTEG(RALU, 0.0)
      CLU = ALU / VLU!CONCENTRATION, MG/L
     CVLU = CLU / PLU           !EXITING CONCENTRATION, MG/L
!  AMOUNT INHALED 
     RINH = FRACIN * QP * CCH *CIZONE
     AINH = INTEG(RINH, 0.0)   ! MG PER      AINHC = AINH * RATS        ! MG FOR A GROUP OF RATS
!  AMOUNT EXHALED 
     CLEX = CV / PB           ! CONCENTRATION, MG/L
     RAEX = QP * CLEX
      AEX = INTEG(RAEX, 0.0)   ! AMOUNT, MG PER  
     AEXC = AEX * RATS   ! AMOUNT, MG, FOR A GROUP OF RATS
 
!ASK = AMOUNT NMP IN SKIN TISSUES (MG) AND DERMAL DOSING 
      RASK = QSKN*(CA - CSKV) + RADL! NOW MINUS CSKV, NOT CSK; PMS 8-21-13
       ASK = INTEG(RASK,ASKO)! INITIAL VALUE, ASKO, ADDED FOR BECCI ET AL. (1982) EXPOSURES; PMS 8-14-13
       CSK = ASK/VSK          !'NMP IN SKIN, MG/L'
CSKV = CSK/PSKB! NMP IN VENOUS BLOOD, PMS 8-22-13
     CVSK3 = CSK*1000/MWNMP     !'NMP IN CVSK, MICROMOL/L'
    ! RADL = (KPL*SA/1000)*(CONC2 - (CSK/PSKA))*DZONE !REPLACE CONCL W CONC2 IF LIQUID ABSORPTION NEEDED
     !  ADL = INTEG(RADL,0.0)  !'AMT NMP ABSORBED DERMAL,MG'
     ! DDA=DDN-RESID!'LESS AMT NMP RECOVERED ON PATCH
  ! ADLA = INTEG(-RADL,DDA)
      ! ADL2 = ADL*1000/MWNMP      !'AMT ABSORBED, MICROMOLES'
 ! CONC2=RSW(VLIQABS1.LE.VLIQ,ADLA/(VLIQ-VLIQABS1),0.01)
     ! VLIQABS1=ADL/1000/DENSITY/1000
CONCL2=CONCL*FAD
CSURF=(CONCL2-(ADL/VLIQ))*DZONE!RADL=((KPL*SA/1000)*CSURF)-(CSK/PSK) ! INCORRECT FORM; PMS 8-13-13
RADL=(KPL*SA/1000.0)*((CSURF-(CSK/PSKL))*DZONE - (1.0-DZONE)*(CSK/PSKA))  ! CORRECT FORM; PMS 8-13-13
! 2ND TERM, (1.0-DZONE)*(CSK/PSKA), ALLOWS FOR EVAPORATIVE LOSS WHEN DZONE=0; PMS 8-14-13
ADL=INTEG(RADL,0.0)
 ! NOTE - NO LOSS TERM. TRY WITHOUT OR ADD LOSS UP-FRONT BY SUBTRACTING
 ! AMOUNT RECOVERED FOR EACH STUDY WITH AMOUNT (CONC) ORIGINALLY APPLIED
 ! "LOSS" OR STICKING PROBABLY ESSENTIALLY IMMEDIATE AND NOT KINETIC
 ! REPORTS OF ~11-24% STICKING TO DRESSING
 
! AMOUNT IN FAT (MG)
     RAFAT = QFAT * (CA - CVFAT)
      AFAT = INTEG(RAFAT, 0.0)
      CFAT = AFAT / VFAT
     CVFAT = CFAT / PF
! AMOUNT IN FETUSES (MG)
     RAFET = PAF * (CPLA - CFET)
      AFET = INTEG(RAFET, 0.0)
     !IF (DAYS.GT.6.0) CFET = AFET / VFET
CFET = AFET / VFET! PMS, 8-13-13
   AUCCFET = INTEG(CFET, 0.0)
! AMOUNT IN UTERUS (MG)
     RAUTR = QUTR * (CA - CVUTR)
      AUTR = INTEG(RAUTR, 0.0)
      CUTR = AUTR / VUTR
     CVUTR = CUTR / PUTR
! AMOUNT IN MAMMARY TISSUE (MG)
     RAMAM = QMAM * (CA - CVMAM)
      AMAM = INTEG(RAMAM, 0.0)
      CMAM = AMAM / VMAM
     CVMAM = CMAM / PM
  
! AMOUNT IN PLACENTA (MG)
     RAPLA = (QPLA * (CA - CVPLA)) + (PAF * (CFET - CPLA))
      APLA = INTEG(RAPLA, 0.0)
     ! IF (DAYS.GT.6.0) CPLA = APLA / VPLA
CPLA = APLA / VPLA ! PMS, 8-13-13
     CVPLA = CPLA / PPLA
!AS = AMOUNT IN SLOWLY PERFUSED TISSUES (MG) 
       RAS = QSLW*(CA - CVS)
        AS = INTEG(RAS, 0.0)
       CVS = AS/(VSLW*PS)
        CS = AS/VSLW
!AR = AMOUNT IN RAPIDLY PERFUSED TISSUES (MG) 
       RAR = QRAP*(CA - CVR)
        AR = INTEG(RAR, 0.0)
       CVR = AR/(VRAP*PR)
        CR = AR/VRAP
!MIXED VENOUS BLOOD
!RV=(QFAT*CVFAT+QLIV*CVL+QSLW*CVS+QRAP*CVR+QSKN*CSK+CVMAM*QMAM+CVPLA*QPLA+QUTR*CVUTR+IVR)-QC*CV
RVV = QC*CV! PMS, 8-13-13
RV=(QFAT*CVFAT+QLIV*CVL+QSLW*CVS+QRAP*CVR+QSKN*CSKV+CVMAM*QMAM+CVPLA*QPLA+QUTR*CVUTR+IVR)-RVV! PMS, 8-13-13
AV=INTEG(RV,0.0)
CV=AV/VV
AUCBB=INTEG(CV,0.0)!AUC, HR*MG/L
!-----------MASS BALANCE NMP --------------
  BODY = (AFAT+AR+AS+AL+ASK+AV+ALU+AAB+APLA+AMAM+AUTR)
  TMASS = RATS*(BODY + AML + AEX+AUNP+AFET)!COMPARE TO 
                                 !AINH FOR OC MASS BAL
                                 !OR OABS FOR ORAL MASS BAL
                                 !OR TIV FOR IV MASS BAL
                                 !OR ADL FOR DERMAL LIQUID
 MASBAL=TMASS/(AINH+OABS+TIV+ADL+1E-9)
! CHECK BLOOD FLOWS
      QTOT = QFATI + QLIV + QRAP + QSKN + QSLW + QUTRI +QMAM+QPLA
    QRECOV = 100.0 * (QTOT / QC)
!===============SECOND MODEL FOR TRACKING HNP=====================
!ALHP = AMOUNT HNMP IN LIVER COMPARTMENT (MG) 
  RALHP = QLIV*(CAHP-CVLHP)+ RAML1 - RAMLH
  RAML1=RAML*MWHP/MWNMP
  AML2B=INTEG(RAML1,0.0)
   ALHP = INTEG(RALHP,0.0)!AMT IN MG HNMP, CORRECTED FOR MW
  CVLHP = ALHP/(VLIV*PLHNP)!TOTAL HNMP
    
    RAMLH = (VMAX2*CVLHP)/(KM2+CVLHP)!SATURABLE METABOLISM, MG/HR
     AMLH = INTEG(RAMLH,0.0)!AMT HNMP METAB BY SATURABLE PATH, MG
RDOSE=RAMLH/(BW**0.75)
TDOSE=INTEG(RDOSE,0.0)
!ABHP = AMOUNT HNMP IN TISSUES (MG) 
  RABHP = QB*(CAHP - CBSHP)
   ABHP = INTEG(RABHP,0.0)
  CBSHP = ABHP/(VB*PBHNP)
  
!AFHP = AMOUNT HNMP IN FAT (MG) 
    RFSHP = QFAT*(CAHP - CVFHP)
     AFHP = INTEG(RFSHP,0.0)
  CVFHP = AFHP/(VFAT*PFHNP)
!CVHP = MIXED VENOUS BLOOD CONC TOTAL HNMP (MG/L) 
  CRHP = (QLIV*CVLHP + QB*CBSHP + QFAT*CVFHP + QPLA*CVPLHP)-QC*CVHP-RAUHP
! ** ADDED QPLA*CVPLHP TO ABOVE; PMS 8-19-13
  AVHP = INTEG (CRHP,0.0)
  CVHP = AVHP/VBL
  CAHP = CVHP
  CVHP2 = CVHP*1000/MWHP      !VENOUS BLOOD TOT CONC HNMP IN MICROM
  AUCVHP = INTEG(CVHP2,0.0)!AUC HNMP VEN. BLOOD, MICROMOL*HR/L
  
  ! AMOUNT IN PLACENTA (MG)
     RAPLHP = (QPLA * (CAHP - CVPLHP)) + (PAF * (CFETHP - CPLHP))
      APLHP = INTEG(RAPLHP, 0.0)
     !IF (DAYS.GT.6.0) CPLHP = APLHP / VPLA
CPLHP = APLHP / VPLA! PMS, 8-13-13
     CVPLHP = CPLHP / PPLHNP
     
  ! AMOUNT IN FETUSES (MG)
      RAFETHP = PAF * (CPLHP - CFETHP)
             AFETHP = INTEG(RAFETHP, 0.0)
           ! IF (DAYS.GT.6.0) CFETHP = AFETHP / VFET
CFETHP = AFETHP / VFET! PMS, 8-13-13
        AUCFETHP = INTEG(CFETHP, 0.0)
 
 
 !RATE OF ELIM IN THE URINE, RAUHP, FROM MIXED BLOOD
   RAUHP = KL*CAHP*VA!FIRST ORDER RATE
      AUHP = INTEG(RAUHP,0.0)    !CUMULATIVE AMT HNMP IN URINE (MG), NOT MGEQ
                            
!-----------MASS BALANCE--------------
!-----------MASS BALANCE 5-HNMP SUBMODEL--------------
!COMMENT OUT EQUATIONS WHEN NOT USING TO ELIM. UNESSESARY INTEG
  BODYHP = (AFHP+ABHP+ALHP+AVHP+AFETHP+APLHP)*RATS!+AABH
  TMASHP = RATS*(AUHP + BODYHP +AMLH)!COMPARE TO AML1B
! CHECK BLOOD FLOWS 5HNMP COMPARTMENT
      QTOTH = QLIV + QFAT + QB+QPLA
    QRECOVH = 100.0 * (QTOTH / QC)
TERMT(T .GE. TSTOP)    !----STATEMENT TO STOP EXECUTION---
END     !END OF DERIVATIVE
DISCRETE GAVD
AO = AO + DOSE2*BW
SCHEDULE GAVD .AT. (T+24.0)
END
!EXPOSURE CONTROL
DISCRETE SKWASH! PMS, 8-14-13
ASK = 0.0! ASSUME SKIN WASHING IN BECCI ET AL. (1982) REMOVES ALL NMP FROM SKIN
IF (DAYS.LT.15.0) SCHEDULE REAPPLY.AT.(T+DOSEINTERVAL-TWASH)
END
DISCRETE REAPPLY! PMS, 8-14-13
IF (ROUND(DAYS).EQ.9.0)ASKO=DSK*BW
IF (ROUND(DAYS).EQ.12.0)ASKO=DSK*BW
IF (ROUND(DAYS).EQ.15.0)ASKO=DSK*BW
ASK = ASK+ASKO
SCHEDULE SKWASH.AT.(T+TWASH)
END
DISCRETE OFFD  IVZONE=0.0!TURN IV OFF
  CIZONE=0.0!TURN INHAL EXPOSURE OFF
  DZONE=0.0!TURN OFF DERMAL
SCHEDULE OND.AT.(T+DOSEINTERVAL-TCHNG)! PMS, 8-13-13
END
DISCRETE OND! PMS, 8-13-13
  CIZONE=1.0!TURN INHAL EXPOSURE ON
SCHEDULE OFFD.AT.(T+TCHNG)
END
END     !END OF DYNAMIC
END     !END OF PROGRAM
HUMPREGRETRIEVE_RESTORED_1.CSL
PROGRAM NMPHUMPG.ACSL
!PBPK MODEL FOR N-METHYL PYRROLIDONE IN PREGNANT WOMEN
!T.S. POET,P HINDERLITER. CHEMICAL DOSIMETRY GROUP, PNNL, RICHLAND, WA 
!FIRST CREATED 8.8.08
!FINAL REPORT FROM INITIAL RAT MODEL DEVELOPMENT SUBMITTED 9.02
!MODEL CONFIGURED FOR INHALATION (OPEN, WHOLE BODY/NOSE ONLY)
!   IV, ORAL,  DERMAL, AND IP  ROUTES OF ADMINISTRATION.                   
!MODEL TRACKS DISPOSITION OF NMP AND 5-HNMP.                   
!ASSUMPTIONS:                                                    
!    (1) FLOW-LIMITED (ALL COMPARTMENTS)                         
!    (2) METABOLISM OF NMP BY A SAT PATHWAY TO FORM 5HNP 
!    (3) METABOLISM OF HNP BY SATURABLE PATHWAY TO ETC.  
!    (5) METABOLISM OCCURS ONLY IN THE LIVER                     
!    (6) TISSUE:BLOOD PART. COEFF. RAT = HUMAN = KRISHNAN EQN 
!UPDATED IN CMD FILE TO MEASURED IN-HOUSE
!    (7) 5HNP ELIMIN FROM MIXED VENOUS - 1ST ORDER
!THIS DIFFERS FROM 02: URINE BY *GFR CLEARANCE FROM KIDNEY
!   METAB RATE CONST. FROM REPORT - UPDATED WITH LIT VALUES IN CMD FILE
!   OTHER PARAMETERS CHANGED NOMINALLY TO HARMONIZE WITH FETAL IPA MODEL OF 
!     GENTRY ET AL. REGU TOX PHARM 36:51-68, 2002
! GENTRY MODEL NOTES:
! -CODING FOR PREGNANCY IS FROM MEHGFAT.CSL WITH SOME MINOR CHANGES
! -PHYSIOLOGICAL PARAMETERS ARE FROM MEHGFAT.CSL (AJUSTED AS NEEDED)
! -NON-PREGNANT MAMMARY TISSUE AND UTERINE VOLUME IS FROM ICRP
! -NON-PREGNANT MAMMARY TISSUE AND UTERINE BLOOD FLOWS ARE BASED ON THE
! - RATIOS OF MAMMARY AND UTERINE TISSUE VOLUMES TO RAPIDLY PERFUSED
! - TISSUE VOLUME AND BLOOD FLOW TO RAPIDLY PERFUSED TISSUE WHERE RAPIDLY
! - PERFUSED TISSUE INCLUDES LIVER, LUNG, ETC.
! - ((VMAMC/VRAPC)*QRAPC) AND ((VUTRC/VRAPC)*QRAPC)
! -DATA USED TO FIT CURVE FOR GROWING RAPIDLY PERFUSED TISSUE IN
! - MEHGFAT.CSL WAS REFIT SEPARATELY TO FIT CURVES FOR GROWING UTERUS
! - AND MAMMARY TISSUE IN THIS MODEL
! -BODY WEIGHT AND CARDIAC OUTPUT ARE CALCULATED AS THE INITIAL VALUES
! - PLUS THE CHANGE IN THE GROWING COMPARTMENTS
! -INCREASE IN BLOOD FLOW TO FAT, MAMMARY TISSUE, AND UTERUS ARE MODELED
! - AS BEING PROPORTIONAL TO THE INCREASE IN VOLUME IN THOSE COMPARTMENTS
! - BASED ON THE DATA IN THORESEN AND WESCHE, 1988 (UTERUS AND MAMMARY
! - TISSUE)
INITIAL
TABLE RESLVL, 1, 1441 / 1441*0.0, 1441*0.0 /
! HUMAN TOTAL PULMONARY VENTILATION RATE (L/HR FOR 1 KG ANIMAL)
  CONSTANT     QPC = 27.75
! HUMAN BLOOD FLOWS (FRACTION OF CARDIAC OUTPUT)
  CONSTANT     QCC = 12.9        ! CARDIAC OUTPUT (L/HR FOR 1 KG ANIMAL)
  CONSTANT   QFATC = 0.052        ! FAT (NON-PREGNANT FEMALE)
  CONSTANT   QLIVC = 0.227        ! LIVER
  CONSTANT   QMAMC = 0.027        ! MAMMARY TISSUE (NON-PREGNANT FEMALE)
  CONSTANT   QRAPC = 0.325       ! RAPIDLY PERFUSED
  CONSTANT   QSKC = 0.058        ! SKIN
  CONSTANT   QUTRC = 0.0062       ! UTERUS (NON-PREGNANT FEMALE)
! GENTRY MODEL HAS 0.249, BUT ADDING THESE =0.944, SO BE AWARE CAN REPLACE WITH EQN
! PERMEABILITY-AREA PRODUCT (L/HR)
  CONSTANT    PAFC = 0.01         ! DIFFUSION ON FETAL SIDE OF PLACENTA
   ! NOT SURE WHERE OPTIMIZED PARAMETER COMES FROM VISAVIS GENTRY
! HUMAN TISSUE VOLUMES (FRACTION OF BODY WEIGHT)
  CONSTANT  BWINIT = 67.8        ! PRE-PREGNANCY BODY WEIGHT (KG)
  CONSTANT   VALVC = 0.0079       ! ALVEOLAR BLOOD
  CONSTANT VBLC=0.06
  CONSTANT   VFATC = 0.273        ! FAT (NON-PREGNANT FEMALE)
  CONSTANT   VLIVC = 0.026        ! LIVER
  CONSTANT   VMAMC = 0.0062       ! MAMMARY TISSUE (NON-PREGNANT FEMALE)
  CONSTANT   VRAPC = 0.1044       ! RAPIDLY PERFUSED
  !CONSTANT   VSLWC = 0.35         ! SLOWLY PERFUSED IN GENTRY MODEL, THIS MODEL IS CALCULATED BELOW
  CONSTANT   VUTRC = 0.0014       ! UTERUS (NON-PREGNANT FEMALE)
  CONSTANT VSKC=0.19
 
! HUMAN DERMAL EXPOSURE PARAMETERS
  CONSTANT       P = 0.0016          ! PERMEABILITY CONSTANT (KP) (CM/HR)
  CONSTANT     PV=31.0! PERMEABILITYT CONSTANT (CM/HR) FOR VAPOR
  
  
 !FOR PARENT MODEL, SKIN COMPARTMENT IS ONLY DEFINED AS DOSED SKIN
   CONSTANT      SAL = 0.01         !SURFACE AREA EXPOSED TO LIQUID, SQ.CM
   CONSTANT      SAV = 6700         !SURFACE AREA EXPOSED TO GAS/VAPOR, SQ.CM
   CONSTANTHT=170.0!HEIGHT (OR LENGTH) OF REFERENCE MAN
     TSA = 71.81*(BWINIT**0.425)*(HT**0.725)!FOR HUMANS, DUBOIS AND DUBOIS, 1916, AS REPORTED IN REFERENCE MAN
   VSKLC = VSKC*SAL/TSA
    QSKLC = QSKC*SAL/TSA
   VSKVC = VSKC*SAV/TSA
    QSKVC = QSKC*SAV/TSA
 ! CONSTANT DERM=0  !DERMAL DOSE - MG   (AMOUNT)
! DERM NOT USED IN REST OF CODE; PAUL SCHLOSSER, U.S. EPA (PS), 5-17-2013
CONSTANT FAD = 0.0  !FRACTION ABSORBED - FROM BADER ET AL, CALCULATE FROM AMNT REMAINING ON GAUZE
 CONSTANT PVL=0.0
    
  ! SLOWLY PERFUSED (DEFINED AS BALANCE OF TISSUES AND FLOWS)
   VSLWC = 0.91 - ( VFATC + VLIVC + VMAMC + VRAPC + VUTRC + VSKVC + VSKLC) !VLUC + ! PMS 8-20-13, REMOVED + VALVC
   ! NOTE: 0.91 IS APPROX WHOLE BODY LESS BONE
   VSLWC5=0.91 - (VFATC + VLIVC + VRAPC) ! PMS 8-20-13, REMOVED + VALVC        
    QSLWC = 1.0 - (QFATC + QLIVC + QMAMC + QRAPC + QUTRC + QSKVC + QSKLC)
   QSLWC5 = 1.0 - (QFATC + QLIVC + QRAPC)! + QSKCC)
    
! MOLECULAR WEIGHTS
  CONSTANT  MW=99.13      !MOL. WT. NMP, MG/MMOL
 CONSTANT  MW1= 116.14     !MOL. WT. 5-HNP, MG/MMOL
     STOCH = MW1/MW
! HUMAN NMP/BLOOD PARTITION COEFFICIENTS
!EXPERIMENTALLY MEASURED RATVALUES
  CONSTANT    PB = 450.0        ! BLOOD/AIR
  CONSTANT    PFAT = 0.61         ! FAT
  CONSTANT    PLIV = 1.00         ! LIVER
  CONSTANT    PMAM = 1.0          ! MAMMARY TISSUE, ESTIMATED FROM LIVER
  CONSTANT    PPLA = 0.31         ! PLACENTA
  CONSTANT    PRAP = 1.0         ! RAPIDLY PERFUSED TISSUE, LIVER
  CONSTANT    PSLW = 0.30         ! SLOWLY PERFUSED TISSUE, MUSCLE
  CONSTANT    PUTR = 0.34         ! UTERUS
  CONSTANT    PSKA = 44.5 !450.0  ! USE (BLOOD/AIR)*(RAT SKIN:LIQUID)/(HUMAN BLOOD:LIQUID)
  CONSTANT    PSKL = 0.42  ! MEASURED SKIN;LIQUID (RAT)
CONSTANTPSKB = 0.099! (RAT SKIN:LIQUID)/(HUMAN BLOOD:LIQUID)
  CONSTANT    PLU= 0.1  ! LUNG:BLOOD
  
!METABOLIC RATE CONSTANTS
!**THESE ARE FROM PAYAN ET AL
  !NMP TO 5HNP
     CONSTANT  KM=198.0!MICHAELIS CONSTANT, MG/L
     CONSTANT  VMAXC=2.67!MAX. ENZ. ACT., MG/HR/L
! HUMAN 5HNMP TISSUE/BLOOD PARTITION COEFFICIENTS
!  MEASURED
   CONSTANT PB1=5.0
   CONSTANT PLIV1=3.0   ! LIVER MEASURED
      CONSTANT PFAT1=0.40   !MEASURED
   CONSTANT PRAP1=0.93
   CONSTANT PSLW1=0.40
  !NO FETAL COMPARTMENT FOR METABOLITE, NMP IS CONSIDERED THE ACTIVE MOIETY 
 
!5HNP TO OTHER METABS
     CONSTANT  KM2=22.8     !MICHAELIS CONSTANT, MG/L
     CONSTANT  VMAX2C=1.0      !MAX. ENZ. ACT., MG/HR/L
    
! HUMAN UPTAKE AND CLEARANCE PARAMETERS
  !URINARY ELIMINATION OF 5-HNMP - CLEARED FROM BLOOD
  !NOTE FIRST ORDER RATE COMMENTED OUT, SATURABLE FITS BETTER
      CONSTANT KAS=5.0
    CONSTANT  KME=8.0     !MICHAELIS CONSTANT, MG/L
    CONSTANT  VMAXEC=8.0      !MAX. ENZ. ACT., MG/HR/L
    CONSTANT KMNE=8.0!MICHAELIS CONSTANT FOR NMP IN URINE
    CONSTANT VMXNEC=1.0
    
! INITIALIZE HUMAN CONCENTRATIONS IN TISSUES (MG/L)
  CONSTANT   ICART = 0.0          ! BLOOD
  CONSTANT   ICFAT = 0.0          ! FAT
  CONSTANT   ICLIV = 0.0          ! LIVER
  CONSTANT   ICRAP = 0.0          ! RAPIDLY PERFUSED
  CONSTANT   ICSKN = 0.0          ! SKIN
  CONSTANT   ICSLW = 0.0          ! SLOWLY PERFUSED
     ICMAM = ICSLW                ! MAMMARY TISSUE
     ICUTR = ICRAP                ! UTERUS
 
! DOSING PARAMETERS
  CONSTANT    CONCPPM = 0.0          ! INHALED CONCENTRATION (PPM)
  CONSTANT   CONCMGM = 0.0! INHALED CONCENTRATION (MG/M3)
  CONSTANT  IVDOSE = 0.0          ! IV DOSE (MG/KG)
  CONSTANT   PDOSE = 0.0          ! ORAL DOSE (MG/KG)
CONSTANT PDOSE2=0.0
CONSTANT PDOSE3=0.0
  CONSTANT  PDRINK = 0.0          ! DRINKING WATER DOSE (MG/KG/DAY)
  CONSTANT   TCHNG = 24.0         ! LENGTH INH. EXPOSURE OR IV INJ.(HRS)
  CONSTANT  DAYSWK = 5.0          ! NUMBER OF EXPOSURE DAYS PER WEEK
  CONSTANT    TMAX = 24.0         ! MAXIMUM TIME FOR EXPOSURES
CONSTANT S2=0.0!INHALATION ON
CONSTANT P2=3.0!INHALATION EXPOSURE
CONSTANT S3=3.16!INHALTION RESUME (HANOVER STUDY)
CONSTANT P3=3.0!SECOND DAILY EXPOSURE PERIOD
CONSTANT ON3=1.0! SET TO ZERO TO TURN OFF 2ND DAILY PULSE; PMS 8-20-13
CONSTANT FULLWEEK=168.0! HRS IN A FULLWEEK; PMS 8-20-13
HRSWEEK=24.0*DAYSWK! HRS/WEEK IN WORKPLACE; PMS 8-20-13
! STARTDS IS ADDED TO TCHNG TO ALLOW FOR DOSING THAT DOES NOT START AT T=0
!INITIAL EXPOSURE CONDITIONS
 !DERMAL
      CONSTANT CONCL = 0.0       !CONC OF NMP IN LIQUID, MG/L
CONSTANT SRATE = 0.0! MG/HR DELIVERED TO SKIN BY SPRAY APPLICATION; PMS 8-20-13
      CONSTANT VLIQ = 1.0E-99 !INITIAL VOLUME APPLIED, L
      CONSTANT DENSITY=1.03
    CONSTANT RESID=0.0         !AMOUNT STICKING TO EXPOSURE SYSTEM, MG
CONSTANT BRUSH=0.0! SET TO 1.0 FOR BRUSH/LIQUID EXPOSURE; PMS 8-20-13
      DDN = CONCL*VLIQ
       !IN VITRO HUMAN VAN DYK ET AL. AIHA J 56: 651-660
        !START WITH SMALL SA SO VSKE IS NON-ZERO (USED IN DENOMINATOR OF CSK CALCULATION)
  ! EXPOSURE CONDITIONS BASED ON USER DEFINED INITIAL AMOUNTS OF CHEMICAL (MG)
     IF (CONCPPM.EQ.0.0) THEN
     CONCMG=CONCMGM/1000.0!CONCERT MG/M3 TO MG/L
  ELSE
       CONCMG = CONCPPM*MW/24451.    !CONVERT PPM TO MG/LITER!
  ENDIF
!CONSTANT CONCMG=0!HANNOVER STUDY UNIT MG/M3 SO CONCMG /1000(L/M3)          
CONSTANT   DOSEINTERVAL=24.0!TIME BETWEEN DAILY DOSES
        
! SIMULATION CONTROL PARAMETERS
  CONSTANT STARTDS = 0.0          ! TIME FIRST DOSE IS GIVEN (HRS)
  CONSTANT   TSTOP = 6480.0       ! RUN SIMULATION FOR ABOUT 9 MONTHS
  CONSTANT   CINTC = 0.1
CONSTANTGDSTART = 0.0! GESTATION DAY ON WHICH SIMULATION STARTS; PMS 8-20-13
! SCALED HUMAN PULMONARY VENTILATION RATE (L/HR)
        QP = QPC * (BWINIT**0.75)
      QALV = 0.67 * QP
! SCALED HUMAN BLOOD FLOWS (L/HR)
    QCINIT = QCC * (BWINIT**0.75)
    QFATI = QFATC * QCINIT
    QLIV = QLIVC * QCINIT
    QMAMI = QMAMC * QCINIT
QPLAI = 58.5 * VPLAI! VALUE FOR 'DAYS'=0 PER CALCULATION BELOW; PMS, 8-20-13
    QRAP = QRAPC * QCINIT
    QSLW = (QSLWC * QCINIT) - QPLAI ! - QSKCC! QSKCC IS ALREADY SUBTRACTED IN SETTING QSLWC ABOVE; PMS 8-20-13
! BUT INITIAL PLACENTAL BLOOD FLOW IS NOT, SO NOW SUBTRACTED HERE; PMS 8-20-13
  !  QSLW5= (QSLWC5* QCINIT)! WILL CALCULATE BY SUBTRACTION IN THE DERIVATIVE SECTION; PMS 8-1913
    QUTRI = QUTRC * QCINIT
    QSKL = QSKLC * QCINIT
    QSKV = QSKVC * QCINIT
! SCALED HUMAN TISSUE VOLUMES (L)
      VALV = VALVC * BWINIT
      !VFATI = VFATC * BWINIT
      VFATI = BWINIT*(VFATC+(0.09*EXP(-12.90995862*EXP(-0.000797*24.0*GDSTART))))      VFETI = 3.50 * (EXP(-16.081*EXP(-5.67E-4*24.0*GDSTART))+ EXP(-140.178*EXP(-7.01E-4*24.0*GDSTART)))
     !VMAMI = VMAMC * BWINIT
      VMAMI = BWINIT*(VMAMC+(0.0065*EXP(-7.444868477*EXP(-0.000678*24.0*GDSTART))))
!VPLAI = 0.85*EXP(-9.434)! VALUE FOR 'DAYS'=0 PER CALCULATION BELOW; PMS 8-19-13
      VPLAI = 0.85*EXP(-9.434*EXP(-5.23E-4*24.0*GDSTART))
     !VUTRI = VUTRC * BWINIT
      VUTRI = BWINIT*(VUTRC+(0.02*EXP(-4.715669973*EXP(-0.000376*24.0*GDSTART))))
      VLIV = VLIVC * BWINIT
      VRAP = VRAPC * BWINIT
     VSKL = VSKLC * BWINIT
     VSKV = VSKVC * BWINIT
       VBL=VBLC * BWINIT
       VSLW = (VSLWC * BWINIT) ! - VSKCC; PMS 8-20-13
   !  VSLW5 = VSLWC5 *BWINIT! NOW CALCULATED BY SUBTRACTION IN DERIVATIVE SECTION; PMS 8-20-13
! SCALED HUMAN METABOLISM PARAMETERS
     VMAXE = VMAXEC*(BWINIT**0.75)!URINE 5HNMP
     VMXNE=VMXNEC*(BWINIT**0.75)!URINE NMP
        VMAX = VMAXC * (BWINIT**0.75)
        VMAX1 = VMAX2C * (BWINIT**0.75)
     
! INITIALIZE HUMAN NMP AMOUNTS IN TISSUES
     IAART = ICART * VALV
     IAFAT = ICFAT * VFATI
     IALIV = ICLIV * VLIV
     IAMAM = ICMAM * VMAMI
     IARAP = ICRAP * VRAP
     IASKL = ICSKN * VSKL! VSKCC ! PMS 8-20-13
     IASKV = ICSKN * VSKV
     IASLW = ICSLW * VSLW
     IAUTR = ICUTR * VUTRI
   INITTOT = IAART + IAFAT + IALIV + IAMAM + IARAP + IASKL + IASKV + IASLW + IAUTR
! INITIALIZE STARTING VALUES
        BW = BWINIT
     DRINK = (PDRINK * BW) / 24.0      ! DRINKING WATER DOSE (MG/HR)
      CINT = CINTC
        IV = 0.0
    DAYEXP = 1.0
      CINH = 0.0
     CONSTANT  FRACIN = 0.97     !FRACTIONAL UPTAKE OF NMP BY INHAL,START AT 65%
                  !OF ALVEOLAR - AS IN AKESSON ET AL 1997
    CONSTANT  FRACOR = 1.0      !FRACTION ABSORBED ORALLY, INITALLY 100%
! CONVERT ORAL DOSE FROM UG/KG TO UMOLES 
! MODIFY DOSE TO ACCOUNT FOR FRACTIONAL ABSORPTION 
ODOSE1= PDOSE * BW * FRACOR    ! UMOLES
ODOSE2= PDOSE2* BW * FRACOR    ! UMOLES
ODOSE3= PDOSE3* BW * FRACOR    ! UMOLES
CONSTANT TIME=0.0
CONSTANT TIME1 = 0.0  ! !'DAILY RAT EXPO (HR)'    
CONSTANT TIME2 = 4.0  ! !'SECOND DAILY EXPOSURE (HR)' 
CONSTANT TIME3 = 4.0  ! !'THIRD DAILY DOSE'
CONSTANT REPTM=720.0! CHANGE TO 24 FOR DAILY DOSING
 
SCHEDULE DOSE1 .AT. TIME1
DZONE = 1.0! START WITH EXPOSURE ON
SCHEDULE OFFD.AT.P2
SCHEDULE OND2.AT.24.0
IF (ON3) SCHEDULE OND3.AT.S3
END                ! END OF INITIAL
DYNAMIC
  ALGORITHM  IALG = 2             ! GEAR STIFF METHOD
 DISCRETE DOSE1
 ODOSE = ODOSE+ODOSE1
 SCHEDULE DOSE2 .AT. (TIME+TIME2)
 END
 
 DISCRETE DOSE2
 ODOSE = ODOSE+ODOSE2
 SCHEDULE DOSE3 .AT. (TIME+TIME3)
 END
 DISCRETE DOSE3
 ODOSE = ODOSE+ODOSE3
 SCHEDULE DOSE1 .AT. (TIME+REPTM-TIME2-TIME3)
 END
DISCRETE DOSEON    ! START DOSING
  INTERVAL DOSEINT = 24.0         ! INTERVAL TO REPEAT DOSING
  SCHEDULE DOSEOFF .AT. T + TCHNG
  IF ((T.GE.STARTDS) .AND. (T.LT.TMAX)) THEN
IF (T.LE.(STARTDS+TCHNG)) THEN
IF (IVDOSE.GT.0.0) CINT = MIN(CINTC, (TCHNG/10.0))
      IV = (IVDOSE*BW) / TCHNG    ! RATE OF INTRAVENOUS DOSING (MG/HR)
ENDIF
ENDIF
END ! DOSEON
DISCRETE DOSEOFF
  CINH = 0.0
  CINT = CINTC
  IV = 0.0
END
DISCRETE OND2
DZONE=1.0
SCHEDULE OND2.AT.(T+24.0)
SCHEDULE OFFD.AT.(T+P2)
END
DISCRETE OND3
DZONE=1.0
SCHEDULE OND3.AT.(T+24.0)
SCHEDULE OFFD.AT.(T+P3)
END
!EXPOSURE CONTROL
DISCRETE OFFDDZONE=0.0!TURN OFF DERMAL
END
DERIVATIVE
     HOURS = T
   MINUTES = T * 60.0
      DAYS = T / 24.0 + GDSTART! PMS 8-20-13, ADDED GDSTART
GTIME = T + GDSTART*24.0! PMS 8-20-13, REPLACES "T" IN TISSUE VOLUME CALCS BELOW
! VOLUME OF HUMAN FAT (L)
      VFAT = BWINIT*(VFATC+(0.09*EXP(-12.90995862*EXP(-0.000797*GTIME))))
! VOLUME OF HUMAN FETUS (L)
      VFET = 3.50 * (EXP(-16.081*EXP(-5.67E-4*GTIME))+ EXP(-140.178*EXP(-7.01E-4*GTIME)))
! VOLUME OF HUMAN MAMMARY TISSUE (L)
      VMAM = BWINIT*(VMAMC+(0.0065*EXP(-7.444868477*EXP(-0.000678*GTIME))))
! VOLUME OF HUMAN PLACENTA (L)
      VPLA = 0.85*EXP(-9.434*EXP(-5.23E-4*GTIME))
! VOLUME OF HUMAN UTERUS (L)
      VUTR = BWINIT*(VUTRC+(0.02*EXP(-4.715669973*EXP(-0.000376*GTIME))))
! INCREASE IN HUMAN BODY WEIGHT (KG)
        BW = BWINIT + (VFAT - VFATI) + VFET + (VMAM - VMAMI) + VPLA + (VUTR - VUTRI)
! SCALED HUMAN ALVEOLAR VENTILATION (L/HR)
        QP = QPC * (BW**0.75)
      QALV = 0.67 * QP
! INCREASE IN HUMAN BLOOD FLOWS (L/HR)
      QFAT = QFATI * (VFAT / VFATI)
      QMAM = QMAMI * (VMAM / VMAMI)
      QUTR = QUTRI * (VUTR / VUTRI)
! HUMAN BLOOD FLOW TO PLACENTA (L/HR)
      QPLA = 58.5 * VPLA
! INCREASED HUMAN CARDIAC OUTPUT (L/HR)
       ! QC = QCINIT + (QFAT - QFATI) + (QMAM - QMAMI) + (QPLA) + (QUTR - QUTRI) 
        QC = QCINIT + (QFAT - QFATI) + (QMAM - QMAMI) + (QPLA - QPLAI) + (QUTR - QUTRI) 
! NOW SUBTRACTING QPLAI ABOVE; PMS 8-20-13
QSLW5 = QC - (QFAT + QLIV + QRAP)! PMS, 8-20-13
VSLW5 = BW - (VFAT + VLIV + VRAP)! PMS, 8-20-13
! SCALED PERMEABILITY-AREA PRODUCT
       PAF = PAFC * (VFET**0.75)
! ------------------ HUMAN NMP MODEL -------------------------
! AMOUNT EXHALED (MG)
     RAEXH = QALV * CALV
      AEXH = INTEG(RAEXH, 0.0)
CI = CONCMG*CZONE + RESLVL(T)
! FOR A 5 DAY/WK EXPOSURE, CHANGE FIRST PULSE TO PULSE(0,7*24,5*24)
! FOR DAILY, PULSE(0,1E6,24)
TORAL= ODOSE1 - AO     !AMT ABSORBED ORALLY, MG!
RSTOM = -KAS*AO
RAO = KAS*AO    ! CHANGE IN STOMACH (UMOLE/HR) 
AO=ODOSE1+INTEG(RSTOM,0.0)    ! AMT IN STOMACH (UMOLE) 
! AMOUNT IN FAT (MG)
     RAFAT = QFAT * (CART - CVFAT)
      AFAT = INTEG(RAFAT, IAFAT)
      CFAT = AFAT / VFAT
     CVFAT = CFAT / PFAT
! AMOUNT IN FETUS (MG)
     RAFET = PAF * (CPLA - CFET)
      AFET = INTEG(RAFET, 0.0)
      CFET = AFET / VFET
   AUCCFET = INTEG(CFET, 0.0)
   
! AMOUNT IN LIVER (MG)
     RALIV = (QLIV * (CART - CVLIV)) + RAO + DRINK - RAMET1
      ALIV = INTEG(RALIV, IALIV)
      CLIV = ALIV / VLIV
     CVLIV = CLIV / PLIV
! AMOUNT METABOLISED IN LIVER -- SATURABLE (MG)
    RAMET1 = (VMAX * CVLIV) / (KM + CVLIV)
     AMET1 = INTEG(RAMET1, 0.0)
! AMOUNT IN MAMMARY TISSUE (MG)
     RAMAM = QMAM * (CART - CVMAM)
      AMAM = INTEG(RAMAM, IAMAM)
      CMAM = AMAM / VMAM
     CVMAM = CMAM / PMAM
  
! AMOUNT IN PLACENTA (MG)
     RAPLA = (QPLA * (CART - CVPLA)) + (PAF * (CFET - CPLA))
      APLA = INTEG(RAPLA, 0.0)
      CPLA = APLA / VPLA
     CVPLA = CPLA / PPLA
  
! AMOUNT IN RAPIDLY PERFUSED TISSUE (MG)
     RARAP = QRAP * (CART - CVRAP)
      ARAP = INTEG(RARAP, IARAP)
      CRAP = ARAP / VRAP
     CVRAP = CRAP / PRAP
!ASKL = AMOUNT NMP IN LIQUID-EXPOSED SKIN TISSUES (MG) AND DERMAL DOSING (FROM VAPOR)
! EQUATIONS BELOW SET FOR LIQUID-EXPOSED SKIN, PMS 8-21-13
      RASKL = QSKL*(CART - CVSKL) + RADVL+RASL
       ASKL = INTEG(RASKL,0.0)
     ! CVSKL = ASKL/VSKL!(VSKCC) ! PMS 8-20-13
      ! CSKL = CVSKL/PSKL         !'NMP IN SKIN, MG/L'
      CSKL = ASKL/VSKL!(VSKCC) ! CALCULATION OF VENOUS BLOOD AND TISSUE CONCN'S WAS REVERSED; PMS 8-21-13
       CVSKL = CSKL/PSKB         !'NMP IN SKIN, MG/L'
     !CVSK3 = CVSK*1000/MWNMP     !'NMP IN CVSK, MICROMOL/L'
CZONE = PULSE(0.0,FULLWEEK,HRSWEEK)*DZONE ! PMS 8-20-13
! FOR A 5 DAY/WK EXPOSURE, USE FULLWEEK=7*24, HRSWEEK=5*24 (DAYSWK=5)
! FOR A SINGLE DAY, FULLWEEK=1E16, HRSWEEK=24 (DAYSWK=1)
SDELIV=SRATE*CZONE! CONSTANT-RATE SPRAY DELIVERY; PMS 8-20-13
! SPRAY-DERMAL EXPOSURES, ASSUMED SIMULTANEOUS WITH INHALATION
     RADVL = (PV*SAL/1000.0)*(CI - (CSKL/PSKA))*(1.0-CZONE)*(SDELIV.EQ.0.0) + SDELIV
! RADV ALLOWS ABSORPTION/DESORPTION FROM AIR WHEN THERE IS NOT SPRAY OR
! BRUSHING DERMAL EXPOSURE, WHEN BOTH SDELIV AND DZONE ARE ZERO; PMS 8-20-13
       ADVL = INTEG(RADVL,0.0)  !'AMT NMP ABSORBED DERMAL,MG'
CONCL2=CONCL*FAD
CSURF=CONCL2-(ADSL/VLIQ)! FOR APPLICATIONS WIH NEAR-CONSTANT CSURF, SET VLIQ=1E9 OR HIGHER; PMS 8-2-13
RASL=(PVL*SAL/1000.0)*(CSURF-(CSKL/PSKL))*CZONE*BRUSH
!RASL=((PVL*SA/1000)*CSURF)-(CVSK/PSKL)
ADSL=INTEG(RASL,0.0)
  
!ASKV = AMOUNT NMP IN VAPOR-EXPOSED SKIN TISSUES (MG) AND DERMAL DOSING (FROM VAPOR); PMS 8-21-13
      RASKV = QSKV*(CART - CVSKV) + RADVV
       ASKV = INTEG(RASKV,0.0)
   !   CVSKV = ASKV/VSKV!(VSKCC) ! PMS 8-20-13
   !    CSKV = CVSKL/PSKV         !'NMP IN SKIN, MG/L'
      CSKV = ASKV/VSKV!(VSKCC) ! PMS 8-20-13
       CVSKV = CSKV/PSKB         !'NMP IN SKIN, MG/L'
!CONCDERM=CONCMG* PULSE(0,1E6,24)*(PULSE(S2,24,P2)+ PULSE(S3,24,P3))
!     RADVV = (PV*SA/1000.0)*(CONCDERM - (CVSKV/PSKA))!*DZONE
     RADVV = (PV*SAV/1000.0)*(CI - (CSKV/PSKA))
       ADVV = INTEG(RADVV,0.0)  !'AMT NMP ABSORBED DERMAL,MG'
! AMOUNT IN SLOWLY PERFUSED TISSUE (MG)
     RASLW = QSLW * (CART - CVSLW)
      ASLW = INTEG(RASLW, IASLW)
      CSLW = ASLW / VSLW
     CVSLW = CSLW / PSLW
! AMOUNT IN UTERUS (MG)
     RAUTR = QUTR * (CART - CVUTR)
      AUTR = INTEG(RAUTR, IAUTR)
      CUTR = AUTR / VUTR
     CVUTR = CUTR / PUTR
! BLOOD VENOUS ARTERIAL (C) 
CVEN=(QFAT*CVFAT + QLIV*CVLIV + QMAM*CVMAM + QPLA*CVPLA + QRAP*CVRAP + QSLW*CVSLW &
           + QUTR*CVUTR + QSKV*CVSKV + QSKL*CVSKL + IV) / QC
!(QFAT + QLIV + QMAM + QPLA + QRAP + QSLW+ QUTR + QSKV + QSKL) / QC
                           ! TOTAL VENOUS BLOOD
!RABL= QC * (CVEN - CART)        ! RATE OF CHANGE IN MIXED BLOOD 
!ABL= INTEG(RABL,0.0)        ! AMOUNT IN MIXED BLOOD 
! ABOVE NOT USED; PMS 8-21-13
! AMOUNT IN ARTERIAL BLOOD (MG)
     RABLD = QALV*(CI*FRACIN - CALV) + QC*(CVEN-CART) - RAUNP
      ABLD = INTEG(RABLD, IAART)
      CART = ABLD / VBL
      CALV = CART / PB
   CALVPPM = CALV * 24450.0 / MW
   AUCCBLD = INTEG(CART, 0.0)
! AMOUNT IN URINE (MG)
    !RAUNP = KLN*CART!FIRST ORDER RATE OF LOSS (URINE
    RAUNP = VMXNE*CART/(KMNE+CART) !SATURABLE ELIMINATION
AUNP = INTEG(RAUNP,0.0)
! -------------------- HUMAN 5HNMP MODEL --------------------------
! AMOUNT EXHALED (MG)
!    RAEXH1 = QALV * CALV1
!     AEXH1 = INTEG(RAEXH1, 0.0)
!  CALVPPM1 = CALV1 * (24450.0 / MW1)
! AMOUNT IN FAT (MG)
    RAFAT1 = QFAT * (CART1 - CVFAT1)
     AFAT1 = INTEG(RAFAT1, 0.0)
     CFAT1 = AFAT1 / VFAT
    CVFAT1 = CFAT1 / PFAT1
! AMOUNT IN LIVER (MG)
    RALIV1 = ((QLIV * (CART1 - CVLIV1)) + (RAMET1*STOCH)) - RAMETM1
     ALIV1 = INTEG(RALIV1, 0.0)
     CLIV1 = ALIV1 / VLIV
    CVLIV1 = CLIV1 / PLIV1
! AMOUNT METABOLISED IN LIVER -- SATURABLE (MG)
   RAMETM1 = (VMAX1 * CVLIV1) / (KM2 + CVLIV1)
    AMETM1 = INTEG(RAMETM1, 0.0)
! AMOUNT IN RAPIDLY PERFUSED TISSUE (MG)
    RARAP1 = QRAP * (CART1 - CVRAP1)
     ARAP1 = INTEG(RARAP1, 0.0)
     CRAP1 = ARAP1 / VRAP
    CVRAP1 = CRAP1 / PRAP1
! AMOUNT IN SLOWLY PERFUSED TISSUE (MG)
    RASLW1 = (QSLW5) * (CART1 - CVSLW1)
     ASLW1 = INTEG(RASLW1,0.0)
     CSLW1 = ASLW1 / VSLW5
    CVSLW1 = CSLW1 / PSLW1
! CONCENTRATION IN MIXED VENOUS BLOOD (MG/L)
     CVEN1 = (QFAT*CVFAT1 + QLIV*CVLIV1 + QRAP*CVRAP1 +QSLW5*CVSLW1)/QC
     RART1 = QC*(CVEN1-CART1)-RAUHP
     ABLD1=INTEG(RART1,0.0)
     CART1 = ABLD1/VBL
! AMOUNT IN ARTERIAL BLOOD (MG)
   !CALV1 = CART1 / PB1
  AUCCBLD1 = INTEG(CART1, 0.0)
! AMOUNT IN URINE (MG)
   RAUHP = VMAXE*CART1/(KME+CART1) !SATURABLE ELIMINATION
!RAUHP=KLC*CART1AUHP = INTEG(RAUHP,0.0)
INHALTOT=INTEG((QALV*(CI*FRACIN - CALV)), 0.0)
IVTOT=INTEG(IV, 0.0)
! ----------------- CHECK MASS BALANCE ------------------------------
  INTOT=INTEG((QALV*CI*FRACIN), 0.0)
! NEW SKIN TERMS ADDED BELOW; PMS 8-21-13
   TDOSE = INTOT  + AO + INITTOT+TORAL+ADSL+ADVL+ADVV !+ INTEG(IV, 0.0)
   NMPTOT = ABLD + AFAT + AFET + ALIV + AMAM + APLA + ARAP + ASKL + ASKV + ASLW + AUTR + AEXH + AUNP + AMET1
      MASSBAL = TDOSE/(NMPTOT+0.000000000001)
  
TERMT(T.GT.TSTOP, 'SIMULATION FINISHED')
END                ! END OF DERIVATIVE
TERMINAL
   DAUCCBLD = (AUCCBLD / TSTOP) * 24.0
   DAUCCBLD1 = (AUCCBLD1 / TSTOP) * 24.0
   DAUCTOT = DAUCCBLD + DAUCCBLD1
   DAUCCFET = (AUCCFET / TSTOP) * 24.0
   DAUCTFET = DAUCCFET
END
END                ! END OF DYNAMIC
END                ! END OF PROGRAM

RATPARAMS.M

WESITG=0; WEDITG=0;
VCHC=1e9, KLOSS=0.0, DOSE=0,TINF=0.01,PDOSE=0,DOSE2=0, CONCCHPPM0 = 0
   CONCL=0, IVDOSE=0, TCHNG=999.0,TSTOP=120,CONCPPM=0,CONCMGS=0,DSK=0
%FAD=0.76 % Value from Payanderm.m; should only effect dermal exposure; PS 5-1-13
FAD=1 % From Poet 5-16-13 Payanderm.m file; PS 5-17-13
   GDDAYS=0, SA=0.00001,DOSEINTERVAL=720,CINT=1, VLIQ=1e-99, 
FRACIN=1 %1E-55 % Changed to 1 to match ghantinahladata.m value; should not change w/ exposure route; PS 5-1-13
NUMFET=0.01 % Added to minimize impact on other volumes; Paul Schlosser (PS), U.S. EPA, 05-01-2103
KAS=1.36,FRACOR=0.68
   % KPL=0.0000016
	%KPL=4.3e-3 % Value from Payanderm.m; should only effect dermal exposure; PS 5-1-13
KPL=4.6e-3 % From Poet 5-16-13 Payanderm.m file; PS 5-17-13
   VLIVC=0.0366
   VLUC=0.005
   VFATC=0.09
   VRAPC=0.071
   QLIVC=0.183
   QPC=16.0
   QCC=16.0
   QFATC=0.07
   QSKNC=0.058
   QMAMC=1e-5
   QUTRC=1e-5
   KM=234
   VMAXC=21.8
   KM2=48
   VMAX2C=2.4
   QSC=0.14
   BWINIT=0.23
   GDDAYS=0
   GDMONTHS=0
   KLC=3.9
   KLNC=0.0019
   PAFC=0
   MAXT=1e-2
   MINT=1E-9

QFATC = 0.072 
QLIVC = 0.183
QMAMC = 0.001
QSKNC = 0.058
QUTRC = 0.001
QRAPC = 0.512
  
VLUC = 0.007
VFATC = 0.10
VLIVC = 0.034 
VMAMC = 0.01
VRAPC = 0.071 
VUTRC = 0.002  
VBLC = 0.067
  
PB=450.0
PF=0.62
PL=1.02
PR=1.02
PS=0.74
PLU=0.10
%PSKA= 450.0 %Air-skin transport equations, where PSKA appears, are commented
%						 out in Poet 5-15-13 NMPpreg_rat.m; PS 5-17-13
%PSK=150
PSKL = 0.42 % MEASURED % 450 % Value for Poet 5-16-13 Payanderm.m file; PS 5-17-13
PSKB = 0.12	% SKIN:SALINE/BLOOD:SALINE
PSKA =	55	% SKIN:SALINE*BLOOD:AIR/BLOOD:SALINE
PM=1.0
PPLA=0.309
PUTR=0.34
PLHNP=3.0
PBHNP=0.73
PFHNP=0.40
PPLHNP=01.07
PREG_RAT_PARAMS.M

% To assure parameter consistency, calling ratparam first below and
% commenting out redundant setting of parameters here.
% Paul Schlosser, U.S. EPA , 05-01-2013

ratparam

% VCHC=1.0E+9, KLOSS=0.0, DOSE=0,TINF=0.01,PDOSE=0 % set in ratparam
%  CONCL=0, IVDOSE=0, TCHNG=999.0,TSTOP=120,CONCPPM=0,CONCMGM=0
%  GDDAYS=6, SA=0.00001,DOSEINTERVAL=720

QUTRC=0.005, %QRAPC=0.512
   VLIVC=0.0366,VLUC=0.005,VFATC=0.09, %VRAPC=0.071, QLIVC= 0.183,
		QPC=15,QCC=15, % These are both 16 in ratparam; PS 5-1-13
		%QFATC=0.07,QSKNC=0.058 % set in ratparam
   % KM=234,VMAXC=21.8, KM2=48, VMAX2C=2.1 % set in ratparam
   BWINIT=0.235,GDDAYS=6, %GDMONTHS=0
   % KLC=3.9,KLNC=0.002, % set in ratparam
		PAFC=0.1,NUMFET=7
NUMFET=14,PUPBW=5670	% Taken from pregparamsoutput.m
   %MAXT=1.0e-4
	%MINT=1E-9,VUTRC=0.002,VMAMC = 0.01 % set in ratparam

%PAFC OF 0.1 IS NEAR MAX TRANSFER SEE GRAPHPAD PAF EFFECT 11 08
FIG_1_WELLS_1988_IV_PLASMA.M

%PROCED WELLS - IV
%WELLS AND DIGENIS 1988
prepare @all @clear

ratparam
DOSE=0,PDOSE=0,TCHNG=0.0083,TINF=0.0083,CINT=0.01
BWINIT=0.35, IVDOSE=45, TSTOP=24,GDDAYS=0

!!start/nc
MASBAL

% DATA WELLS (T,CV,Poet 2013 CV)
DWELLS = [0.08 90 65.59071
0.17 70 65.59071
0.25 60 64.07336
0.33 58 62.9852
0.50 56 60.90279
0.75 58 58.0206
1.00 52 55.2812
1.50 52 50.15439
2.0 50 45.45177
4.0 40 30.32493
6.0 35 19.94611
];

plot(_t, _cv, DWELLS(:,1), DWELLS(:,2), DWELLS(:,1), DWELLS(:,3),'Fig 2 Wells 1988 IV plasma.aps')
FIG_2_PAYAN_2002_IV_PLASMA.M

%PROCED WELLS - IV
%WELLS AND DIGENIS 1988
prepare @all @clear

ratparam
DOSE=0,PDOSE=0,TCHNG=0.0083,TINF=0.0083,CINT=0.01
BWINIT=0.35, IVDOSE=0.1, TSTOP=24,GDDAYS=1

!!start/nc
MASBAL

% DATA PAYAN (T,CV,Poet 2013 CV)
DPAYAN = [0.02	0.155	0.2573098
0.08	0.131	0.1561921
0.17	0.118	0.1433084
0.5	0.115	0.131193
1	0.112	0.1162329
1.5	0.109	0.1030575
2	0.103	0.09138391
3	0.093	0.07185712
4	0.06	0.05650498
];

plot(_t, _cv, DPAYAN(:,1), DPAYAN(:,2), DPAYAN(:,1), DPAYAN(:,3),'Fig 2 Payan 2002 IV plasma.aps')

FIG_3AB_PAYAN_2002_IV_5HNMP_PLASMA_URINE.M

prepare @all @clear

ratparam

% Commenting out items below set identicaly in ratparam; Paul Schlosser, U.S. EPA, 05-01-2013
%VCHC=1.0E+9, KLOSS=0.0, DOSE=0,TINF=0.01
  % CONCL=0, IVDOSE=0, 
	TCHNG=0.01,TSTOP=78
  % GDDAYS=0, SA=0.00001,CONCPPM=0,CONCMGM=0
   BWINIT=0.25,CINT=0.1

  IVDOSE=0.1
  !!START /nc
  holdcvhp=[_t _cvhp];
  holdauhp=[_t _auhp];

  IVDOSE=1
!!START /nc
  holdcvhp=[holdcvhp _cvhp];
  holdauhp=[holdauhp _auhp];

 IVDOSE=10
!!START /nc
  holdcvhp=[holdcvhp _cvhp];
  holdauhp=[holdauhp _auhp];

 IVDOSE=100
!!START /nc
  holdcvhp=[holdcvhp _cvhp];
  holdauhp=[holdauhp _auhp];

IVDOSE=500,BWINIT=0.275
!!START /nc
  holdcvhp=[holdcvhp _cvhp];
  holdauhp=[holdauhp _auhp];

% DATA p5HNMP (T,CVHP,Poet 2013 CVHP)
p5HNMP = [0.01	0.000182	0.001615	0.015095	0.099633	0.207601
5	0.042203	0.422267	4.237931	39.48625	109.9071
10	0.02516	0.252532	2.613575	31.12196	133.5288
20	0.004531	0.045548	0.478971	7.101832	69.10229
30	0.000617	0.006203	0.065172	0.993501	15.54205
40	0.0000752	0.000756	0.007927	0.119737	2.215258
50	0.00000867	0.000087	0.000911	0.013623	0.27038
60	0.000000966	0.00000969	0.000101	0.001503	0.031528
70	0.000000105	0.00000106	0.000011	0.000163	0.0036
];

% DATA u5HNMP (T,AUHP,Poet 2013 AUHP)
u5HNMP = [0.01	1.19E-08	0.00000009	0.00000084	0.00000606	0.0000154
5	0.003922	0.039152	0.384723	3.146931	8.153724
10	0.008028	0.08031	0.804688	7.576738	24.42693
20	0.011128	0.111449	1.130311	11.91568	52.64661
30	0.011648	0.116677	1.185414	12.75838	63.2357
40	0.011719	0.117399	1.19301	12.87606	65.35392
50	0.011729	0.11749	1.193972	12.89082	65.65677
60	0.01173	0.117501	1.194088	12.89259	65.6955
70	0.01173	0.117503	1.194102	12.8928	65.70028
];

% DATA payanPlas (T,CVHP,Payan 2002 CVHP)
payanplas = [1	0.00061	NaN	NaN	NaN	NaN
1.5	0.00055	NaN	NaN	NaN	NaN
2	0.00161	NaN	NaN	NaN	NaN
3	0.00398	NaN	NaN	NaN	NaN
4	0.0251	0.376	3.28	NaN	NaN
6	0.0341	NaN	NaN	NaN	NaN
8	0.0187	NaN	NaN	23.5	NaN
10	0.0095	NaN	NaN	NaN	NaN
24	0.00007	NaN	NaN	NaN	46.9
];

% DATA payanUrin (T,AUHP,Payan 2002 AUHP)
payanurin = [4	0.0009	0.0153	0.164	0.725	4.83
8	0.005	0.0507	0.591	2.473	10.29
24	0.0123	0.1213	1.27	13.62	54.77
48	0.0127	0.12608	1.29	12.22	63.94
72	0.0128	0.12742	1.298	12.35	64.38
];

plot(holdcvhp(:,1),holdcvhp(:,2:6),p5HNMP(:,1), p5HNMP (:,2:6),payanplas(:,1), payanplas (:,2:6),  'Fig 2 Payan 2002 IV plasma 5HNMP.aps')
plot(holdauhp(:,1),holdauhp(:,2:6),u5HNMP(:,1), u5HNMP (:,2:6),payanurin(:,1), payanurin (:,2:6),  'Fig 2 Payan 2002 IV urine 5HNMP.aps')FIG_4_PAYAN_2003_DERMAL_PLASMA.M

prepare @all @clear

%ratparams

ratparam	% Added by Paul Schlosser (PS), U.S. EPA, to assure parameter consistency; 05-01-2013
%preg_rat_params
%payan dermal exposures: Payan et al. DMD 03
  % DOSE=0,PDOSE=0,  % Commented out, PS 5-1-13
	TCHNG=72,TSTOP=54, SA=10,VLIQ=200e-6
BWinit=0.250 % BWinit was 0.275; reset from Poet 5-16-13 Payenderm.m; PS 5-17-13
 % CONCL=1030, FAD=0.76,PSK=150 %FAD - urine+carcas+tissues
CONCL=1050000, CINT=0.5 % from Poet 5-16-13 Payenderm.m; PS 5-17-13
% PSK and FAD (now) set in ratparam to assure cosnsitency; PS 5-1-13
 %KPL=4.3e-3	% Moved to ratparam file, PS 5-1-13
  !!START /nc
 holdauhp=[_t _auhp];
 holdaunp=[_t _aunp];
 holdca=[_t _cv];
holdch=[_t _cvhp];
 holdcsurf=[_t _csurf];

% Commenting out of following lines based on Poet 5-16-13 Payenderm.m; PS 5-17-13
%BWinit=0.275,CONCL=1030,VLIQ=0.000400
% !!START /nc
% holdauhp=[holdauhp _auhp];
%holdaunp=[holdaunp _aunp];
%holdca=[holdca _cv];
%holdch=[holdch _cvhp];
%holdcsurf=[holdcsurf _csurf];
MASBAL

% DATA pNMP (T,Payan 2013 CV)
pNMP = [0.5	128.652
2.5	424.496
5	532.623
7.5	508.955
10	434.405
12.5	346.867
15	263.728
17.5	192.406
20	179.829
22.5	99.759
25	63.993
27.5	34.099
30	17.645
32.5	8.97
35	4.516
37.5	2.262
40	1.13
42.5	0.564
45	0.282
47.5	0.141
50	0.0701
50.5	0.061
51	0.0531
51.5	0.0462
52	0.0402
52.5	0.035
55	0.0175
57.5	0.00874
60	0.00437
];

% DATA PAYAN (T,Payan 2003	 CVHP)
PAYAN = [0.51	160
0.87	260
1.6	330
1.84	410
2.57	440
2.81	490
3.18	510
3.78	550
4.63	540
5.85	540
7.8	530
9.74	490
23.7	100
25.7	110
29.9	60
47.9	0
54.2	0
];

%plot(holdcsurf(:,1),holdcsurf(:,2), 'figcsurf.aps')
%plot(holdauhp(:,1),holdauhp(:,2), 'figDERMALAUHP.aps')
%plot(holdaunp(:,1),holdaunp(:,2), 'figDERMALAUnP.aps')
plot(holdca(:,1),holdca(:,2), pNMP(:,1), pNMP (:,2),PAYAN (:,1), PAYAN (:,2), 'Fig 7 Payan 2003 Dermal plasma.aps')
%plot(holdch(:,1),holdch(:,2), 'figDERMALplasmahp.aps')
HUMAN_PARAMS.M

WESITG=0; WEDITG=0;
SRATE=0; RESLVL=[zeros(1,1441) (0:1440)]';
QPC	=	15;
QLIVC	=	0.25;
QSKC	=	0.058;
BWINIT	=	58;
VFATC	=	0.23;
VRAPC	=	0.042;
P	=	0.0036;
HT	=	180;
KAS	=	1.36;
ICFAT	=	0;
ICSKN	=	0;
CONCMGM	=	0;
PDOSE2	=	0;
TCHNG	=	8;
S2 = 0; P2	=	8;
S3	=	6720; P3	=	6720; ON3=0;
DENSITY	=	1.03; VLIQ	=	1.00e-99; BRUSH=0;
STARTDS	=	0;
FRACIN	=	1;
TIME1	=	8;
REPTM	=	24;
NSTP	=	10;
QCC	=	15;
QMAMC	=	0.027;
QUTRC	=	0.005;
VALVC	=	0.0079;
VLIVC	=	0.031;
VUTRC	=	0.0014;
PV	=	32;
MW	=	99.13;
KM2	=	50.5;
VMAX2C	=	5.9;
VMAXC	=	125;
KM	=	151;
KME	=	80.8;
VMXNEC	=	0.011;
KMNE	=	2.46;
VMAXEC	=	7.3;
ICLIV	=	0;
ICSLW	=	0;
IVDOSE	=	0;
PDOSE3	=	0;
DAYSWK	=	1; % Days per week of exposure, eg 5 for workplace; PMS 8-28-13

CONCL	=	0;
RESID	=	0;
TSTOP	=	24;
FRACOR	=	0.68;
TIME2	=	6720;
CINT	=	0.1;
MAXT	=	0.001;
QFATC	=	0.05;
QRAPC	=	0.48;
PAFC	=	0.1;
VBLC	=	0.06;
VMAMC	=	0.0062;
VSKC	=	0.051;
SAL	=	0.0001;
SAV = 6700;
MW1	=	116.14;
ICRAP	=	0;
CONCPPM	=	0;
PDOSE	=	0;
PDRINK	=	0;
TMAX	=	24;

PVL=2.7e-3; % Added per Poet 5-16-13 human_params.m; Paul Schlosser, U.S. EPA (PMS), 5-17-13
% DOSEINTERVAL	=	24; % Not used, PMS 8-28-13
DOSEINT=999;
CINTC	=	0.1;
TIME	=	0;
TIME3	=	6720;
IALG	=	2;
MINT	=	1.00e-09;
PB	=	450;
PMAM	=	1;
PSLW	=	0.77;
PSKL	=	0.42	% Rat skin:saline, PMS 8-28-13
PSKB  =  0.099	% (Rat skin:saline)/(human blood:saline), PMS 8-28-13
PSKA	=	44.5 %use (blood/air)*(rat skin:liquid)/(human blood:liquid), PMS 8-28-13
	% PSKA = 450 %750; Changed per Poet 5-16-13 human_params.m; PMS 5-17-13
PBHNP	=	0;
PLIV	=	0.82;
PRAP	=	0.94;
PLIV1	=	2.5;
PRAP1	=	6.5;
ICART	=	0;
PSLW1	=	0.08;
PFAT	=	0.49;
PPLA	=	0.31;
PUTR	=	0.1;
PLU	=	0.1;
PB1	=	1;
PFAT1	=	0.23;
%FAD=0.000001
FAD = 1 % Value used in Poet 5-16-13 BADER_DRM.m and AkkesDerm.m; PMS 5-17-13
%DERM=0 % Not used in Poet 5-16-13 'HumPregRetreive Restored 1.csl'; PMS 5-17-13
VCHC=1.0e+9; KLOSS=0.0; % From human simulation scripts; use as default for human; PMS 8-28-13
start @nocallback
POET_2013_FIG_5_AND_6.M

human_params
P2=3; S3=3.169; P3=3; ON3=1; DAYSWK=1;
BWINIT=79; HT=180; TSTOP=48;

% Poet 2013 Inhalation plasma NMP (T, 80mg CVEN, 39mg CVEN, 9.7 mg CVEN)
PLAS_NMP = [1	0.683103	0.332836	0.082749
2	1.024672	0.499001	0.12401
4	1.378491	0.670665	0.166542
6	1.661011	0.807381	0.200346
8	0.870433	0.422351	0.104658
10	0.476452	0.230971	0.057195
12	0.260598	0.126264	0.031254
14	0.14247	0.069009	0.017078
16	0.077869	0.037711	0.009332
18	0.045205	0.02189	0.005416
20	0.024702	0.011961	0.002959
];
 
% Poet 2013 Inhalation plasma NMP (T, 80mg CVEN1, 39mg CVEN1, 9.7 mg CVEN1)
PLAS_5HNMP = [1	0.24528	0.119668	0.02978
2	0.654421	0.319214	0.079424
4	1.63541	0.796202	0.197813
6	2.698992	1.309727	0.324586
8	3.13353	1.511975	0.373107
10	2.989524	1.433702	0.352195
12	2.622757	1.250767	0.306007
14	2.196787	1.042511	0.25417
16	1.78852	0.845258	0.205485
18	1.42952	0.673285	0.163293
20	1.128456	0.530008	0.128301
30	0.316655	0.147623	0.035559
40	0.084532	0.039321	0.009458
];

% Poet 2013 Inhalation plasma NMP (T, 80mg AUNP, 39mg AUNP, 9.7 mg AUNP)
URIN_NMP = [1	0.062401	0.038817	0.012091
2	0.152052	0.100311	0.033677
4	0.322807	0.223295	0.080098
6	0.538127	0.383801	0.144246
8	0.70041	0.501467	0.189331
10	0.83527	0.588113	0.217245
12	0.923142	0.638799	0.231732
14	0.97874	0.668416	0.239602
16	1.006836	0.682649	0.243234
18	1.019841	0.68907	0.244841
20	1.026145	0.692145	0.245604
30	1.031765	0.694865	0.246275
40	1.031889	0.694925	0.24629
];

% Poet 2013 Inhalation urine 5HNMP (T, 80mg AUHP, 39mg AUHP, 9.7 mg AUHP)
URIN_5HNMP = [1	0.275716	0.134652	0.033533
2	1.463359	0.715887	0.178497
4	6.268797	3.0758	0.768508
6	16.61853	8.177778	2.047459
8	16.61853	8.177778	2.047459
10	41.92996	20.65742	5.175538
12	54.71574	26.91465	6.735197
14	66.35912	32.57506	8.13928
16	76.81064	37.62227	9.385295
18	84.24161	41.1902	10.26256
20	90.03312	43.95864	10.94115
30	103.9081	50.54583	12.54824
40	107.083	52.04393	12.91223
];

% Hannover Inhalation plasma NMP (T, 80mg CVEN, 39mg CVEN, 9.7 mg CVEN)
H_PLAS_NMP = [3.096	0.954	3.292	0.458	3.29	0.17
6.241	1.517	6.153	0.649	6.29	0.29
7.358	0.938	7.337	0.417	7.29	0.18
8.251	0.719	8.38	0.361	8.29	0.14
10.11	0.505	10.14	0.258	10.29	0.13
24.358	0.088	24.551	0.027	24.81	0.04
48.641	0.005	47.273	0.017	NaN	NaN
];
 
% Hannover Inhalation plasma NMP (T, 80mg CVEN1, 39mg CVEN1, 9.7 mg CVEN1)
H_PLAS_5HNMP = [3.096	1.44	3.292	0.688	3.29	0.21
6.241	2.94	6.153	1.425	6.29	0.39
7.358	3.19	7.337	1.488	7.29	0.39
8.251	3.14	8.38	1.463	8.29	0.36
10.11	2.91	10.14	1.35	10.29	0.36
24.358	0.61	24.551	0.238	NaN	NaN
];

% Hannover Inhalation plasma NMP (T, 80mg AUNP, 39mg AUNP, 9.7 mg AUNP)
H_URIN_NMP = [3.096	0.23	3.292	0.132	3.29	0.08
7.358	0.67	7.337	0.339	7.29	0.16
10.11	0.86	10.14	0.512	10.29	0.2
24.358	1.03	24.551	0.565	24.81	0.26
48.641	1.07	47.273	0.599	48.37	0.26
];

% Hannover Inhalation urine 5HNMP (T, 80mg AUHP, 39mg AUHP, 9.7 mg AUHP)
H_URIN_5HNMP = [3.096	5.74	3.292	3.72	3.29	2.51
7.358	22.84	7.337	10.81	7.29	5.73
10.11	50.47	10.14	22.22	10.29	8.75
24.358	89.36	24.551	45.11	24.81	18.36
48.641	99.25	47.273	48.87	48.37	20.51
];
prepare @clear T CVEN CVEN1 AUNP AUHP
CONCMGM=80, start @nocallback
  holdcv=[_t _cven];
  holdcvhp=[_t _cven1];
  holdaunp=[_t _aunp];
  holdauhp=[_t _auhp];

for CONCMGM=[39 9.7]
	start @nocallback
  holdcv=[holdcv _cven];
  holdcvhp=[holdcvhp _cven1];
  holdaunp=[holdaunp _aunp];
  holdauhp=[holdauhp _auhp];
end

plot(holdcv(:,1),holdcv(:,2:4), PLAS_NMP(:,1), PLAS_NMP(:,2:4),H_PLAS_NMP(:,1), H_PLAS_NMP(:,2),H_PLAS_NMP(:,3), H_PLAS_NMP(:,4),H_PLAS_NMP(:,5), H_PLAS_NMP(:,6),'Poet 2013 Fig 4 Hannover plasma NMP.APS')
plot(holdcvhp(:,1),holdcvhp(:,2:4),PLAS_5HNMP(:,1), PLAS_5HNMP(:,2:4),H_PLAS_5HNMP(:,1),H_PLAS_5HNMP(:,2),H_PLAS_NMP(:,3), H_PLAS_5HNMP(:,4),H_PLAS_5HNMP(:,5), H_PLAS_5HNMP(:,6),'Poet 2013 Fig 4 Hannover plasma 5HNMP.APS')
plot(holdaunp(:,1),holdaunp(:,2:4),URIN_NMP(:,1), URIN_NMP(:,2:4),H_URIN_NMP(:,1), H_URIN_NMP(:,2),H_URIN_NMP(:,3), H_URIN_NMP(:,4),H_URIN_NMP(:,5), H_URIN_NMP(:,6),'Poet 2013 Fig 4 Hannover urine NMP.APS')
plot(holdauhp(:,1),holdauhp(:,2:4),URIN_5HNMP(:,1), URIN_5HNMP(:,2:4),H_URIN_5HNMP(:,1), H_URIN_5HNMP(:,2),H_URIN_5HNMP(:,3), H_URIN_5HNMP(:,4),H_URIN_5HNMP(:,5), H_URIN_5HNMP(:,6),'Poet 2013 Fig 4 Hannover urine 5HNMP.APS')
POET_2013_FIG_7_PLASMA.M

human_params
P2=8; SA=7500; BWINIT=75; HT=178.5; TSTOP=72
QPC=40,QCC=23,QSKC=0.18 %Andersen et al '87 as work, CORLEY ET AL

% Poet 2013 Inhalation plasma NMP (T, 53mg CVEN, 24mg CVEN, 10mg CVEN)
PLAS_NMP = [1	0.164826	0.395742	0.874626
2	0.246282	0.591566	1.30846
4	0.344082	0.827175	1.832502
6	0.392776	0.944901	2.096089
8	0.416782	1.003176	2.228192
10	0.182521	0.439988	0.979863
12	0.090665	0.218696	0.487648
14	0.045029	0.10865	0.242425
16	0.022361	0.053964	0.120446
18	0.011104	0.026799	0.059824
20	0.005514	0.013307	0.029709
22	0.002738	0.006608	0.014753
24	0.001359	0.003281	0.007326
];

% Akesson adn Paulsson Inhalation plasma NMP (T, 80mg CVEN, 39mg CVEN, 9.7 mg CVEN)
AP_PLAS_NMP = [4	0.3	0.99	1.6
8	0.49	0.82	2.6
9	0.3	0.72	2
10	0.22	0.51	1.28
12	0.12	0.3	0.75
16	0.08	0.2	0.3
24	0.03	0.06	0.08
32	0.01	0.02	0.03
48	0.01	0.01	0.02
];
prepare @clear T CVEN CVEN1 AUNP AUHP
CONCMGM=53; start @nocallback
  holdcv=[_t _cven];
  holdcvhp=[_t _cven1];
  holdaunp=[_t _aunp];
  holdauhp=[_t _auhp];

for CONCMGM=[24 10]
	start @nocallback
	holdcv=[holdcv _cven];
	holdcvhp=[holdcvhp _cven1];
	holdaunp=[holdaunp _aunp];
	holdauhp=[holdauhp _auhp];
end

plot(holdcv(:,1),holdcv(:,2:4),PLAS_NMP(:,1),PLAS_NMP(:,[4 3 2]),AP_PLAS_NMP(:,1), AP_PLAS_NMP(:,[4 3 2]), 'Poet 2013 Fig 5 Akesson and Paulsson plasma')
%plot(holdcvhp(:,1),holdcvhp(:,2:4),'FIGAKinhalcvhp.APS')
%plot(holdauhp(:,1),holdauhp(:,2:4), 'FIGAKinhalaunp.APS')
%plot(holdaunp(:,1),holdaunp(:,2:4),'FIGAKinhalauhp.APS')
POET_2013_FIG 8AB_PLASMA_&_URINE.M

human_params % Uncommented to assure consistent parameters; Paul Schlosser, U.S. EPA (PS), 5-17-2013
SAL=5; SAV=1e-4; BWINIT=67.5; HT=160.0; %Wikipedia - German men weight 82.4 kg, women weigh 67.5kg)
CONCL=1045000; VLIQ=0.0003; BRUSH=1; TSTOP=48; P2=6; WKDAYS=1; CINTC=0.1;
%FAD=1  %most was recovered on pad - 18.6 is "lost" to system. 
% FAD set in human_params.m, PS 5-17-13
%PV=0 % Intrinsic property for skin-air transport should not change from that set in human_params.m ...
			% Since air concentration(s) are set to zero, this should not need to be zeroed here; PS 5-17-13
		% Allowing PV=32 (default value) reduces predicted NMP and 5-HNMP by ~ 6% vs. PV = 0; PS 5-17-13
% PVL= 2.9e-003 % If PV=32, this value of PVL gives nearly the same 'cvhp' and 'auhp' simulations; PS 5-17-13

% Poet 2013 Dermal sims plasma NMP: 0.3 ml NMP applied)
PLAS_NMP = [2	0.2704	0.2170
4	0.6709	0.5418
6	1.050	0.8547
8	1.1445	0.9437
10	1.0497	0.8795
12	0.8898	0.7581
14	0.7220	0.6256
16	0.5704	0.5026
18	0.5635	0.4968
20	0.3401	0.3095
22	0.2590	0.2395
24	0.1962	0.1843
30	0.0837	0.0822
40	0.0197	0.0208
];

% Poet 2013 Dermal sims urine NMP: 0.3 ml NMP applied)
URIN_NMP = [2	0.4701	0.4381
4	2.4293	2.2716
6	6.0414	5.6806
8	10.7190	10.1404
10	15.3381	14.6079
12	19.4052	18.6049
14	22.7817	21.9778
16	NaN	24.98211
18	27.6136	26.9195
20	29.2560	28.6418
22	30.5132	29.9812
24	31.4690	31.0154
30	33.1474	32.8825
40	34.0853	33.9834
];

% Akesson 2004 Dermal plasma NMP: 0.3 ml NMP applied)
A_PLAS_NMP = [1.01	0.22	0.07
1.94	0.66	0.49
4.06	1.15	0.85
5.83	1.01	1.03
7.95	1.01	0.97
12.1	0.58	0.73
24	0.18	0.14
30.1	0.07	0.04
47.9	0.02	0.01
];

% Akesson 2004 Dermal urine NMP: 0.3 ml NMP applied)
A_URIN_NMP = [1	0.610509	0.451446
3	5.998437	4.368267
5	13.64819	9.921695
7	21.16922	16.61523
9	26.72265	21.70894
11	30.84175	24.85343
14	36.38598	30.03908
20	41.33442	34.87718
27	42.67313	36.24163
39	42.87835	36.44023
];

prepare @clear T CVEN1 AUHP

% women
start @nocallback	
  holdcvhp=[_t _cven1];
  holdauhp=[_t _auhp];

BWINIT=82.4;	% men
start @nocallback
  holdcvhp=[holdcvhp _cven1];
  holdauhp=[holdauhp _auhp];

 
plot(holdcvhp(:,1),holdcvhp(:,2:3),PLAS_NMP(:,1), PLAS_NMP(:,2:3),A_PLAS_NMP(:,1),A_PLAS_NMP(:,2:3), 'Poet 2013 Fig 8 plasma.APS')
plot(holdauhp(:,1),holdauhp(:,2:3),URIN_NMP(:,1), URIN_NMP(:,2:3),A_URIN_NMP(:,1),A_URIN_NMP(:,2:3), 'Poet 2013 Fig 8 urine.APS')

%ADVL
%AUNP
POET_2013_FIG_9_PLASMA.M

human_params % Uncommented to assure consistent parameters; Paul Schlosser, U.S. EPA (PS), 5-17-2013
  DOSE=0,PDOSE=0,TCHNG=4,DOSINTERVAL=2.93,IVDOSE=0
 CONCMGM=0,SAL=5, SAV=1e-4

CONCL=1045000,VLIQ=0.0003
   BWINIT=79, HT=160, TSTOP=48,TCHNG=6, BRUSH=1, P2=6, ON3=0
%FAD=1  %most was recovered on pad - 18.6 is "lost" to system. 
% FAD set in human_params.m, PS 5-17-13
PV=0 % Intrinsic property for skin-air transport should not change from that set in human_params.m ...
			% Since air concentration(s) are set to zero, this should not need to be zeroed here; PS 5-17-13
		% Allowing PV=32 (default value) reduces predicted NMP and 5-HNMP by ~ 6% vs. PV = 0; PS 5-17-13
% PVL= 2.9e-003 % If PV=32, this value of PVL gives nearly the same 'cvhp' and 'auhp' simulations; PS 5-17-13

% Poet 2013 Dermal sims plasma NMP: 0.3 ml NMP applied)
PLAS_NMP = [2	0.2527079
4	0.4365436
6	0.512324
8	0.338109
10	0.1865714
12	0.1029197
14	0.05676336
16	0.03130336
18	0.01726188
20	0.009518544
22	0.00524862
24	0.002894112
30	0.000485194
40	0.000024731
];

% Akesson and Paulsson 1997 inhalation data 
AP_PLAS_NMP = [4	0.3
8	0.49
9	0.3
10	0.22
12	0.12
16	0.08
24	0.03
32	0.01
48	0.01
];

CINTC=0.1; prepare @clear T CVEN
!!START /NC
  holdcvnp=[_t _cven];
 
plot(holdcvnp(:,1),holdcvnp(:,2),PLAS_NMP(:,1),PLAS_NMP(:,2),AP_PLAS_NMP(:,1),AP_PLAS_NMP(:,2), 'Poet 2013 Fig 9 plasma.APS')

 APPENDIX B.  Corrections and changes in the PBPK models for N-Methylpyrrolidone as described by Poet (2013) (revised by T. Poet from that described in Poet et al., 2010)

Rat PBPK Model
Oral Dosing
While oral exposure is not a route of con
Exposure control
Because both Becci et al. (1982) and Saillenfait et al. (2002) explicitly stated that the animal BWs were measured every 3[rd] day of gestation, and the dermal/oral doses were adjusted accordingly on those days (as BW increases during pregnancy), corresponding conditional (if/then) statements were added to the `GAVD' and `REAPPLY' discrete blocks, to re-calculate the doses on those days.
The code for the dermal discrete blocks follows.  ASK0 is the absolute amount applied on each day; DSK is the dose/kg BW.  Because Becci et al. (1982) rubbed the material into the skin, it is assumed to be added directly into the skin compartment (ASK), rather than as a liquid on top.  Hence the dose is given as an addition of ASK0 (mg/day applied) to ASK.
   DISCRETE SKWASH	! PMS, 8-14-13
   	ASK = 0.0	! Assume skin washing in Becci et al. (1982) removes all NMP from skin
   	if (DAYS.LT.15.0) SCHEDULE REAPPLY.AT.(T+DOSEINTERVAL-TWASH)
   END
   DISCRETE REAPPLY	! PMS, 8-14-13
   	IF (ROUND(DAYS).EQ.9.0)	ASKO=DSK*BW
   	IF (ROUND(DAYS).EQ.12.0)	ASKO=DSK*BW
   	IF (ROUND(DAYS).EQ.15.0)	ASKO=DSK*BW
   	ASK = ASK + ASKO
   	SCHEDULE SKWASH.AT.(T+TWASH)
   END
   
Also, because Becci et al. (1982) washed the skin area exposed to dermal application at the end of a set time interval, a "SKWASH" discrete block was introduced at which time the amount in that patch of skin was assumed to be momentarily reduced to zero.  During periods of dermal application, transport from the liquid to the skin was turned on using the pulse function, DZONE.  After removal of the liquid it was assumed that NMP in the skin patch could volatilize into the otherwise clean air, with the rate defined by the same permeability constants, but using the skin:air partition coefficient.
The rate of transfer to/from the skin area is then defined by:
   RADL=(KPL*SA/1000.0)*((CSURF-(CSK/PSKL))*DZONE - (1.0-DZONE)*(CSK/PSKA))  
   ! 2ND term, (1.0-DZONE)*(CSK/PSKA), allows for evaporative loss when DZONE=0
Finally, a constant, CONCMGS, was introduced so that the air concentration could be set directly in mg/m[3].  This is converted to the concentration in mg/L (CONCMG) in the code and added to the inhalation exposure, turned on and off using the switch, CIZONE, which is turned on and off using SCHEDULE/DISCRETE statements:
   CI = CCH*PULSE(0., DOSEINTERVAL,TCHNG) + CIZONE*CONCMG   ! MG/L ! Added CIZONE*CONCMG, PMS, 8-13-13
Skin compartment
Corrections to the mass balance equations for the rat skin are as indicated in the commented code copied below.   It includes the initial condition, ASK0, for the initial dermal application, but is otherwise now the standard format for PBPK models.  As received the code had multiplied CSK rather than CSKV (skin venous blood concentration) by the blood flow (QSKN) for the rate of efflux in blood, and had not separately calculated CSKV.
   RASK = QSKN*(CA - CSKV) + RADL	! NOW MINUS CSKV, NOT CSK; PMS 8-21-13
   ASK = INTEG(RASK,ASKO)  ! Initial value, ASKO, added for Becci et al. (1982) exposures; pms 8-14-13
   CSK = ASK/VSK          !'NMP IN SKIN, MG/L'
   CSKV = CSK/PSKB	! NMP IN VENOUS BLOOD, PMS 8-22-13
The corresponding flow term for transfer from the skin to the mixed venous blood compartment was also corrected (ie, to use CVSK instead of CSK).
While these changes to the skin compartment equations initially degraded the fits to the dermal exposure considerably, it also appeared that the associated partition coefficients were not consistent with the measured values reported by Poet et al. (2010), Table 5.  They were recalculated as follows:
	Skin:liquid, PSKL = 0.42: value as measured for skin:saline, vs. 450
	Skin:blood, PSKB = 0.12: (skin:saline)/(blood:saline)
	Skin:air, PSKA = 55: (skin:saline)*(blood:air)/(blood:saline) = (skin:blood)*(blood:air)
Blood flows
Since the placenta is a separate compartment for the 5HNMP compartment, its blood-flow and volume were removed from the sums used for the `rest of body' for 5HNMP.  Also, the term for blood flow from the placenta was added to the mixed-venous blood mass balance for 5HNMP.
To assure flow mass balance, instead of calculating cardiac output (QC) as an initial amount plus the change from initial for each compartment, it was just calculated as the sum over all the compartments:
   ! QC = QCINIT + (QFAT - QFATI) + (QMAM - QMAMI) + QPLA+ (QUTR - QUTRI)
   QC = QFAT+QLIV+QSLW+QRAP+QSKN+QMAM+QPLA+QUTR	! pms, 8-13-13
Parameter Consolidation
In the provided files, some physiological and chemical-specific parameter were set in separate scripts; e.g., skin transport parameters in the dermal exposure scripts.  This approach creates the potential for inconsistent parameters between different exposure simulations.  Therefore all parameters are now set in the ratparam.m script except those which are experimental control variables (eg., air concentration, duration of exposure).  The final set of parameters used and any inconsistencies with previous values in ratparam.m that may have differed are noted in that script.

Human PBPK Model
Exposure and Timing Control
A table function, RESLVL, was added as a place-holder for reading in defined (residential) inhalation exposure time-courses; specifically from U.S. EPA exposure assessment modeling.
A constant, GDstart, the day of gestation on which the simulation starts, and a variable Gtime, the hours into gestation, were added to facilitate separating exposure control from gestation timing.
A second set of DISCRETE/SCHEDULE blocks were added to allow for split exposure scenarios (morning/afternoon worker exposure; dual-episode residential exposures).
DZONE, set in the DISCRETE/SCHEDULE blocks, controls the time within a day when discontinuous exposure occurs.  Czone is the product of DZONE and a pulse function used to control for days/week exposure in workplace scenarios:
   Czone = pulse(0.0,fullweek,hrsweek)*DZONE ! pms 8-20-13
   ! for a 5 day/wk exposure, use fullweek=7*24, hrsweek=5*24 (Dayswk=5)
   ! for a single day, fullweek=1e16, hrsweek=24 (Dayswk=1)
A binary constant, BRUSH, was added to set when dermal contact with liquid occurs.  The rate for delivery from a liquid film to the `SKL' skin compartment (also see further below) is then defined by:
   RASL=(PVL*SAL/1000.0)*(CSURF-(CSKL/PSKL))*Czone*BRUSH
A constant SRATE was added for the net rate of delivery by liquid droplets to the skin for workplace spray applications.  This is a net rate delivered into the skin compartment, rather than a liquid layer on the surface, assuming that the exposure modeling already accounts for material that may be temporarily deposited on the surface but not absorbed.  (Absorption from a liquid layer of a defined (possibly changing) concentration was retained for other exposure scenarios, including residential.)  When spray delivery SRATE is non-zero, concentration-driven transport from liquid or vapor is turned off for the spray/liquid exposed skin.  The equations for transfer of vapor (air concentration = CI) to the SKL compartment, which occurs during periods with no liquid/spray contact, and/or spray absorption for the SKL compartment are then:
   Sdeliv = SRATE*Czone	! Constant-rate spray delivery; pms 8-20-13
   	! Spray-dermal exposures, assumed simultaneous with inhalation (unless FRACIN = 0)
   RADVL = (PV*SAL/1000.0)*(CI - (CSKL/PSKA))*(1.0-Czone*BRUSH)*(Sdeliv.eq.0.0) + Sdeliv
   	! RADVL allows absorption/desorption from air when there is NOT spray or
   	! brushing dermal exposure, when both sdeliv and czone are zero; pms 8-20-13
Skin compartment
As for the rat, and noted in the main report, corrections were made to the human skin transport and PK (equations not shown here, but same as for rat).  The partition coefficients were also recalculated as was done for the rat, with rat parameters for skin:saline and blood:air, but human blood:saline.
The original skin compartment which is coded to include uptake from liquid-dermal contact was renamed by adding "L" to the end, SK  SKL, and second skin compartment to account for concurrent vapor-skin uptake, SKV, was added.  This was done because when the human model was calibrated for inhalation exposure, an exposed skin surface area of 6700 cm[2] was used.  When this surface are is reduced to ~ 0, predicted blood levels of NMP shown in the upper panel of Figure 4 in the QA report are reduced ~ 45%.  Thus vapor uptake through the skin is a significant component of inhalation exposure and there is no reason to assume, a priori, that this uptake does not occur through a similar area of exposed skin during workplace and residential exposures, except for any area that would have liquid contact or otherwise be occluded (e.g., by wearing rubber gloves).  So the SKV compartment allows for simultaneous absorption of vapor through skin that does not have liquid contact, and from areas of skin with liquid contact.  The surface area of SKV and SKL are SAV and SAL, respectively, and can be set for different exposure scenarios.  For EPA simulations, SAV was reduced from 6700 cm[2] by the area assumed to have liquid contact or covered by gloves for those scenarios.  To evaluate the impact of this assumption for workplace exposure simulations were also conducted with SAV set to 0.01 cm[2] for a low rate of dermal delivery (600 mg/day).
Tissue and blood-flow mass balances
The model had been previously coded with an alveolar blood compartment (ALV), but this was commented out by the author in the DYNAMIC section.  Therefore this volume fraction should not be subtracted when calculating the slowly-perfused volume.  The fraction of blood-flow to slowly perfused tissue was updated to also account for the SKV compartment; on the other hand a separate skin compartment is not used for 5HNMP, so the skin blood flow is NOT subtracted for the metabolite-slowly-perfused compartment (SLW5).  These have all been corrected.
QSKCC (original fractional flow to the skin) had been subtracted twice, both in calculating QSLWC and then in the calculation of QSLW.  The 2[nd] subtracted created a mass balance error and hence was removed.  On the other hand, placental blood flow is now subtracted, so the total flow to slowly-perfused continues to total cardiac output minus all other tissue/group flows.
For tissues that change with gestation day, the initial values were corrected to match the calculation in the DYNAMIC section, which would apply at the first time-step.
In the dynamic section, the calculation of QC was corrected to include the *increase* in placental flow (QPLA  -  QPLAI) rather than the total placental flow (QPLA), since QCINIT includes QPLAI.  QSLW5 and VSLW5 (5HNMP slow compartment flow and volume) are now calculated in the DYNAMIC section by subtraction.
Oral absorption parameters and equations
The oral absorption rate as a function of the amount in the stomach lumen compartment, AO, had been erroneously written as, RAO = KAS*FRACOR*AO, with the initial amount in the compartment set to be the total administered dose, ODOSE.  Since there is no other route of clearance from the stomach lumen compartment, this approach only reduces the effective absorption rate constant from KAS to KAS*FRACOR without reducing the total amount absorbed.  Using the code as provided and the parameters for absorption listed in Poet et al. (2010) gives a significant over-prediction of the plasma NMP levels, not consistent with the simulations shown in Fig. 5 of Poet et al. (2010), which appear to fit those data well.  Therefore the code was corrected to make 
                          ODOSE = FRACOR*DOSE*BWINIT
(instead of DOSE*BWINIT) and 
                                 RAO = KAS*AO.
When this was done the AUC for plasma NMP appeared to be approximately correct, but the initial rise vs. time was faster and the peak occurred earlier than shown in Fig. 5 of Poet et al. (2010).  When KAS was then reduced by FRACOR (68%), the model simulations shown in the preface for this report were obtained.  The simulations for plasma NMP are quite close to those shown in Figure 5 of Poet et al. (2010) and fit the data fairly well.  Therefore it is assumed that the results of Poet et al. (2010) included the multiplication by FRACOR in computing RAO, but also reduced the oral dose by FRACOR.  The U.S. EA version uses the corrected equations shown just above, to deconvolute the two parameters (FRACOR and KAS) and allow DOSE to simply be set to the applied dose.
Parameter Consolidation
As for the rat model, the human model physiological and biochemical parameters are now all set in a single script, human_params.m.  Only constants which define specific exposure scenarios (include skin areas exposed) are defined in the specific simulation scripts.