Generated Code

The following is f77 code generated by the CellML API from this CellML file. (Back to language selection)

The raw code is available.

C
C There are a total of 9 entries in the algebraic variable array.
C There are a total of 7 entries in each of the rate and state variable arrays.
C There are a total of 26 entries in the constant variable array.
C
C
C VOI is time in component Environment (second).
C ALGBRC(1) is P_L in component PluralPressureFunction (mmHg).
C ALGBRC(2) is dP_Ldt in component PluralPressureFunction (mmHg_per_second).
C CONSTS(1) is P_m in component PluralPressureFunction (mmHg).
C CONSTS(24) is R in component PluralPressureFunction (mmHg_second_per_litre).
C CONSTS(2) is omega in component PluralPressureFunction (radian_per_second).
C CONSTS(3) is V_T in component PluralPressureFunction (litre).
C CONSTS(4) is E in component PluralPressureFunction (mmHg_per_second).
C CONSTS(5) is P_m in component lungMechanics (mmHg).
C STATES(1) is V_A in component lungMechanics (litre).
C CONSTS(6) is E in component lungMechanics (mmHg_per_second).
C STATES(2) is P_A in component lungMechanics (mmHg).
C CONSTS(7) is R in component lungMechanics (mmHg_second_per_litre).
C ALGBRC(7) is Q_A in component gasExchange (litre_per_second).
C ALGBRC(4) is q in component lungMechanics (litre_per_second).
C CONSTS(8) is D_o in component gasExchange (mole_per_second_mmHg).
C STATES(3) is f_o in component gasExchange (dimensionless).
C ALGBRC(8) is f_oi in component gasExchange (dimensionless).
C CONSTS(9) is D_c in component gasExchange (mole_per_second_mmHg).
C STATES(4) is f_c in component gasExchange (dimensionless).
C ALGBRC(9) is f_ci in component gasExchange (dimensionless).
C CONSTS(10) is P_w in component gasExchange (mmHg).
C ALGBRC(5) is p_ao in component gasExchange (mmHg).
C STATES(5) is p_o in component gasTransport (mmHg).
C ALGBRC(6) is p_ac in component gasExchange (mmHg).
C CONSTS(11) is f_om in component gasExchange (dimensionless).
C CONSTS(12) is f_cm in component gasExchange (dimensionless).
C STATES(6) is p_c in component gasTransport (mmHg).
C CONSTS(13) is V_D in component gasExchange (litre).
C CONSTS(14) is V_T in component gasExchange (litre).
C ALGBRC(3) is df_satdp in component gasTransport (dimensionless).
C CONSTS(15) is L in component gasTransport (dimensionless).
C CONSTS(16) is K_T in component gasTransport (litre_per_mole).
C CONSTS(17) is K_R in component gasTransport (litre_per_mole).
C CONSTS(18) is sigma in component gasTransport (mole_per_litre_mmHg).
C CONSTS(19) is V_c in component gasTransport (litre).
C CONSTS(20) is T_h in component gasTransport (mole_per_litre).
C CONSTS(25) is delta in component gasTransport (dimensionless).
C CONSTS(26) is h in component gasTransport (mole_per_litre).
C CONSTS(21) is l_2 in component gasTransport (litre_per_second_mole).
C CONSTS(22) is r_2 in component gasTransport (per_second).
C CONSTS(23) is sigma_c in component gasTransport (mole_per_litre_mmHg).
C STATES(7) is z in component gasTransport (dimensionless).
C RATES(2) is d/dt P_A in component lungMechanics (mmHg).
C RATES(1) is d/dt V_A in component lungMechanics (litre).
C RATES(3) is d/dt f_o in component gasExchange (dimensionless).
C RATES(4) is d/dt f_c in component gasExchange (dimensionless).
C RATES(5) is d/dt p_o in component gasTransport (mmHg).
C RATES(6) is d/dt p_c in component gasTransport (mmHg).
C RATES(7) is d/dt z in component gasTransport (dimensionless).
C
      SUBROUTINE initConsts(CONSTS, RATES, STATES)
      REAL CONSTS(*), RATES(*), STATES(*)
      CONSTS(1) = 760
      CONSTS(2) = 1.256637
      CONSTS(3) = 0.41
      CONSTS(4) = 2.5
      CONSTS(5) = 760
      STATES(1) = 1
      CONSTS(6) = 2.5
      STATES(2) = 760
      CONSTS(7) = 1
      CONSTS(8) = 0.0000156
      STATES(3) = 0.1368
      CONSTS(9) = 0.0000316
      STATES(4) = 0.05263
      CONSTS(10) = 47
      STATES(5) = 40
      CONSTS(11) = 0.21
      CONSTS(12) = 0
      STATES(6) = 46
      CONSTS(13) = 0.151
      CONSTS(14) = 0.41
      CONSTS(15) = 171200000
      CONSTS(16) = 10000
      CONSTS(17) = 3600000
      CONSTS(18) = 0.0000014
      CONSTS(19) = 0.071
      CONSTS(20) = 0.002
      CONSTS(21) = 164000
      CONSTS(22) = 0.12
      CONSTS(23) = 0.000033
      STATES(7) = 0.00000044219
      CONSTS(24) = ( 2.00000* 3.14159265358979*1.00000)/5.00000
      CONSTS(25) = 10.0000 ** 1.90000
      CONSTS(26) =  1.00000*10.0000 ** - 7.40000
      RETURN
      END
      SUBROUTINE computeRates(VOI, CONSTS,  RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      RATES(7) = ( CONSTS(25)*CONSTS(22)*CONSTS(23)*STATES(6))/1.00000 -  CONSTS(25)*CONSTS(21)*CONSTS(26)*STATES(7)
      ALGBRC(1) = (CONSTS(1) -  (( CONSTS(24)*CONSTS(2)*CONSTS(3))/2.00000)* sin(( CONSTS(2)*VOI)/1.00000)) -  CONSTS(4)*(2.50000 -  (( CONSTS(3)*1.00000)/2.00000)*cos(( CONSTS(2)*VOI)/1.00000))
      RATES(1) = ((CONSTS(5) - ALGBRC(1)) - ( STATES(1)*CONSTS(6))/1.00000)/CONSTS(7)
      ALGBRC(3) = ( ( CONSTS(15)*1.00000+ CONSTS(16)*CONSTS(18)*STATES(5) ** 4.00000+1.00000+ CONSTS(17)*CONSTS(18)*STATES(5) ** 4.00000)*( 3.00000*CONSTS(15)*CONSTS(16) ** 2.00000*CONSTS(18) ** 2.00000*STATES(5)*1.00000*1.00000+ CONSTS(16)*CONSTS(18)*STATES(5) ** 2.00000+ CONSTS(15)*CONSTS(16)*CONSTS(18)*1.00000*1.00000+ CONSTS(16)*CONSTS(18)*STATES(5) ** 3.00000+ 3.00000*CONSTS(17) ** 2.00000*CONSTS(18) ** 2.00000*STATES(5)*1.00000*1.00000+ CONSTS(17)*CONSTS(18)*STATES(5) ** 2.00000+ CONSTS(17)*CONSTS(18)*1.00000*1.00000+ CONSTS(17)*CONSTS(18)*STATES(5) ** 3.00000) -  ( CONSTS(15)*CONSTS(16)*CONSTS(18)*STATES(5)*1.00000+ CONSTS(16)*CONSTS(18)*STATES(5) ** 3.00000+ CONSTS(17)*CONSTS(18)*STATES(5)*1.00000+ CONSTS(17)*CONSTS(18)*STATES(5) ** 3.00000)*( 4.00000*CONSTS(15)*CONSTS(16)*CONSTS(18)*1.00000*1.00000+ CONSTS(16)*CONSTS(18)*STATES(5) ** 3.00000+ 4.00000*CONSTS(17)*CONSTS(18)*1.00000*1.00000+ CONSTS(17)*CONSTS(18)*STATES(5) ** 3.00000))/ CONSTS(15)*1.00000+ CONSTS(16)*CONSTS(18)*STATES(5) ** 4.00000+1.00000+ CONSTS(17)*CONSTS(18)*STATES(5) ** 4.00000 ** 2.00000
      RATES(5) =  (CONSTS(8)/( CONSTS(18)*CONSTS(19)))*1.00000+ (( 4.00000*CONSTS(20))/CONSTS(18))*ALGBRC(3) ** - 1.00000*( STATES(3)*(STATES(2) - CONSTS(10)) - STATES(5))
      ALGBRC(6) =  STATES(4)*(STATES(2) - CONSTS(10))
      RATES(6) = ( (CONSTS(9)/( CONSTS(23)*CONSTS(19)))*(ALGBRC(6) - STATES(6))+ (( 1.00000*CONSTS(25)*CONSTS(21))/CONSTS(23))*CONSTS(26)*STATES(7)) -  CONSTS(25)*CONSTS(22)*STATES(6)
      ALGBRC(2) =  (( - CONSTS(24)*CONSTS(2) ** 2.00000*CONSTS(3))/( 2.00000*1.00000))*cos(( CONSTS(2)*VOI)/1.00000) -  CONSTS(4)*(2.50000 -  (CONSTS(3)/2.00000)* sin(( CONSTS(2)*VOI)/1.00000))
      ALGBRC(4) = (CONSTS(5) - STATES(2))/CONSTS(7)
      ALGBRC(5) =  STATES(3)*(STATES(2) - CONSTS(10))
      ALGBRC(7) = ALGBRC(4)+ 1.00000*CONSTS(9)*(STATES(6) - ALGBRC(6))+ 1.00000*CONSTS(8)*(STATES(5) - ALGBRC(5))
      RATES(2) = ( CONSTS(5)*CONSTS(6)*ALGBRC(7))/( STATES(2)*1.00000)+ALGBRC(2)
      ALGBRC(8) = TERNRY(CONSTS(14).GE.CONSTS(13), ( STATES(3)*CONSTS(13)+ CONSTS(11)*(CONSTS(14) - CONSTS(13)))/CONSTS(14), STATES(3))
      RATES(3) =  (1.00000/STATES(1))*(( 1.00000*CONSTS(8)*(STATES(5) - ALGBRC(5))+ (ALGBRC(8) - STATES(3))*ALGBRC(4)) -  STATES(3)*( 1.00000*CONSTS(9)*(STATES(6) - ALGBRC(6))+ 1.00000*CONSTS(8)*(STATES(5) - ALGBRC(5))))
      ALGBRC(9) = TERNRY(CONSTS(14).GE.CONSTS(13), ( STATES(4)*CONSTS(13)+ CONSTS(12)*(CONSTS(14) - CONSTS(13)))/CONSTS(14), STATES(4))
      RATES(4) =  (1.00000/STATES(1))*(( 1.00000*CONSTS(9)*(STATES(6) - ALGBRC(6))+ (ALGBRC(9) - STATES(4))*ALGBRC(4)) -  STATES(4)*( 1.00000*CONSTS(8)*(STATES(5) - ALGBRC(5))+ 1.00000*CONSTS(9)*(STATES(6) - ALGBRC(6))))
      RETURN
      END
      SUBROUTINE computeVariables(VOI, CONSTS, RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      ALGBRC(1) = (CONSTS(1) -  (( CONSTS(24)*CONSTS(2)*CONSTS(3))/2.00000)* sin(( CONSTS(2)*VOI)/1.00000)) -  CONSTS(4)*(2.50000 -  (( CONSTS(3)*1.00000)/2.00000)*cos(( CONSTS(2)*VOI)/1.00000))
      ALGBRC(3) = ( ( CONSTS(15)*1.00000+ CONSTS(16)*CONSTS(18)*STATES(5) ** 4.00000+1.00000+ CONSTS(17)*CONSTS(18)*STATES(5) ** 4.00000)*( 3.00000*CONSTS(15)*CONSTS(16) ** 2.00000*CONSTS(18) ** 2.00000*STATES(5)*1.00000*1.00000+ CONSTS(16)*CONSTS(18)*STATES(5) ** 2.00000+ CONSTS(15)*CONSTS(16)*CONSTS(18)*1.00000*1.00000+ CONSTS(16)*CONSTS(18)*STATES(5) ** 3.00000+ 3.00000*CONSTS(17) ** 2.00000*CONSTS(18) ** 2.00000*STATES(5)*1.00000*1.00000+ CONSTS(17)*CONSTS(18)*STATES(5) ** 2.00000+ CONSTS(17)*CONSTS(18)*1.00000*1.00000+ CONSTS(17)*CONSTS(18)*STATES(5) ** 3.00000) -  ( CONSTS(15)*CONSTS(16)*CONSTS(18)*STATES(5)*1.00000+ CONSTS(16)*CONSTS(18)*STATES(5) ** 3.00000+ CONSTS(17)*CONSTS(18)*STATES(5)*1.00000+ CONSTS(17)*CONSTS(18)*STATES(5) ** 3.00000)*( 4.00000*CONSTS(15)*CONSTS(16)*CONSTS(18)*1.00000*1.00000+ CONSTS(16)*CONSTS(18)*STATES(5) ** 3.00000+ 4.00000*CONSTS(17)*CONSTS(18)*1.00000*1.00000+ CONSTS(17)*CONSTS(18)*STATES(5) ** 3.00000))/ CONSTS(15)*1.00000+ CONSTS(16)*CONSTS(18)*STATES(5) ** 4.00000+1.00000+ CONSTS(17)*CONSTS(18)*STATES(5) ** 4.00000 ** 2.00000
      ALGBRC(6) =  STATES(4)*(STATES(2) - CONSTS(10))
      ALGBRC(2) =  (( - CONSTS(24)*CONSTS(2) ** 2.00000*CONSTS(3))/( 2.00000*1.00000))*cos(( CONSTS(2)*VOI)/1.00000) -  CONSTS(4)*(2.50000 -  (CONSTS(3)/2.00000)* sin(( CONSTS(2)*VOI)/1.00000))
      ALGBRC(4) = (CONSTS(5) - STATES(2))/CONSTS(7)
      ALGBRC(5) =  STATES(3)*(STATES(2) - CONSTS(10))
      ALGBRC(7) = ALGBRC(4)+ 1.00000*CONSTS(9)*(STATES(6) - ALGBRC(6))+ 1.00000*CONSTS(8)*(STATES(5) - ALGBRC(5))
      ALGBRC(8) = TERNRY(CONSTS(14).GE.CONSTS(13), ( STATES(3)*CONSTS(13)+ CONSTS(11)*(CONSTS(14) - CONSTS(13)))/CONSTS(14), STATES(3))
      ALGBRC(9) = TERNRY(CONSTS(14).GE.CONSTS(13), ( STATES(4)*CONSTS(13)+ CONSTS(12)*(CONSTS(14) - CONSTS(13)))/CONSTS(14), STATES(4))
      RETURN
      END
      REAL FUNCTION TERNRY(TEST, VALA, VALB)
      LOGICAL TEST
      REAL VALA, VALB
      IF (TEST) THEN
        TERNRY = VALA
      ELSE
        TERNRY = VALB
      ENDIF
      RETURN
      END