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 3 entries in the algebraic variable array. C There are a total of 2 entries in each of the rate and state variable arrays. C There are a total of 15 entries in the constant variable array. C C C VOI is time in component environment (hour). C CONSTS(1) is T_a in component model_parameters (celsius). C CONSTS(2) is T_b in component model_parameters (celsius). C CONSTS(3) is delta_T in component model_parameters (celsius). C CONSTS(4) is kinc in component model_parameters (W_per_kg_C2). C ALGBRC(3) is M_c in component M_c (W_per_kg). C CONSTS(5) is t_day in component M_c (hour). C CONSTS(6) is t_night in component M_c (hour). C ALGBRC(1) is tprime in component M_c (second). C CONSTS(7) is day_length in component M_c (second). C CONSTS(14) is M_day in component M_day (W_per_kg). C CONSTS(15) is M_night in component M_night (W_per_kg). C STATES(1) is M in component M (W_per_kg). C CONSTS(8) is km in component M (per_hour). C STATES(2) is T in component T (celsius). C CONSTS(9) is c in component T (kJ_per_kg_C). C ALGBRC(2) is k in component k (W_per_kg_C). C CONSTS(13) is kb in component kb (W_per_kg_C). C CONSTS(11) is T_day in component T_day (celsius). C CONSTS(12) is T_night in component T_night (celsius). C CONSTS(10) is M_b in component kb (W_per_kg). C RATES(1) is d/dt M in component M (W_per_kg). C RATES(2) is d/dt T in component T (celsius). C SUBROUTINE initConsts(CONSTS, RATES, STATES) REAL CONSTS(*), RATES(*), STATES(*) CONSTS(1) = 21.0 CONSTS(2) = 38.0 CONSTS(3) = 1.57 CONSTS(4) = 0.0258 CONSTS(5) = 17.5 CONSTS(6) = 6.73 CONSTS(7) = 86400 STATES(1) = 3.5 CONSTS(8) = 1.1375 STATES(2) = 38.785 CONSTS(9) = 3.47 CONSTS(10) = 3.0 CONSTS(11) = CONSTS(2)+CONSTS(3)/2.00000 CONSTS(12) = CONSTS(2) - CONSTS(3)/2.00000 CONSTS(13) = CONSTS(10)/(CONSTS(2) - CONSTS(1)) CONSTS(14) = (CONSTS(13)+ CONSTS(4)*(CONSTS(11) - CONSTS(2)))*(CONSTS(11) - CONSTS(1)) CONSTS(15) = (CONSTS(13)+ CONSTS(4)*(CONSTS(12) - CONSTS(2)))*(CONSTS(12) - CONSTS(1)) RETURN END SUBROUTINE computeRates(VOI, CONSTS, RATES, STATES, ALGBRC) REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*) ALGBRC(2) = CONSTS(13)+ CONSTS(4)*(STATES(2) - CONSTS(2)) RATES(2) = CONSTS(9) ** -1.00000*(STATES(1) - ALGBRC(2)*(STATES(2) - CONSTS(1))) ALGBRC(1) = INT(MOD( VOI*3600.00*1.00000, CONSTS(7))) ALGBRC(3) = TERNRY(ALGBRC(1)/3600.00.GE.CONSTS(6).AND.ALGBRC(1)/3600.00.LT.CONSTS(5), CONSTS(15), CONSTS(14)) RATES(1) = - CONSTS(8)*(STATES(1) - ALGBRC(3)) RETURN END SUBROUTINE computeVariables(VOI, CONSTS, RATES, STATES, ALGBRC) REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*) ALGBRC(2) = CONSTS(13)+ CONSTS(4)*(STATES(2) - CONSTS(2)) ALGBRC(1) = INT(MOD( VOI*3600.00*1.00000, CONSTS(7))) ALGBRC(3) = TERNRY(ALGBRC(1)/3600.00.GE.CONSTS(6).AND.ALGBRC(1)/3600.00.LT.CONSTS(5), CONSTS(15), CONSTS(14)) RETURN END REAL FUNCTION TERNRY(TEST, VALA, VALB) LOGICAL TEST REAL VALA, VALB IF (TEST) THEN TERNRY = VALA ELSE TERNRY = VALB ENDIF RETURN END