Simulation Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CSafetyValveEnumVariables.f90 2.7 KiB

1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. module CSafetyValveEnumVariables
  2. use CVoidEventHandlerCollection
  3. implicit none
  4. integer :: SafetyValve = 0
  5. integer :: operation = 0
  6. public
  7. type(VoidEventHandlerCollection) :: OnSafetyValveChange
  8. enum, bind(c)
  9. enumerator SAFETY_VALVE_NEUTRAL
  10. enumerator SAFETY_VALVE_REMOVE
  11. enumerator SAFETY_VALVE_INSTALL
  12. end enum
  13. private :: SafetyValve
  14. contains
  15. subroutine Set_Operation(i)
  16. implicit none
  17. integer, intent (in) :: i
  18. operation = i
  19. end subroutine
  20. subroutine Set_SafetyValve(v)
  21. implicit none
  22. integer , intent(in) :: v
  23. #ifdef ExcludeExtraChanges
  24. if(SafetyValve == v) return
  25. #endif
  26. SafetyValve = v
  27. #ifdef deb
  28. if(SafetyValve == SAFETY_VALVE_NEUTRAL) then
  29. print*, 'SafetyValve=SAFETY_VALVE_NEUTRAL'
  30. else if (SafetyValve == SAFETY_VALVE_INSTALL) then
  31. print*, 'SafetyValve=SAFETY_VALVE_INSTALL'
  32. else if (SafetyValve == SAFETY_VALVE_INSTALL) then
  33. print*, 'SafetyValve=SAFETY_VALVE_REMOVE'
  34. endif
  35. #endif
  36. call OnSafetyValveChange%RunAll()
  37. end subroutine
  38. integer function Get_SafetyValve()
  39. implicit none
  40. Get_SafetyValve = SafetyValve
  41. end function
  42. subroutine Set_SafetyValve_WN(v)
  43. !DEC$ ATTRIBUTES DLLEXPORT :: Set_SafetyValve_WN
  44. !DEC$ ATTRIBUTES ALIAS: 'Set_SafetyValve_WN' :: Set_SafetyValve_WN
  45. implicit none
  46. integer , intent(in) :: v
  47. call Set_SafetyValve(v)
  48. end subroutine
  49. integer function Get_SafetyValve_WN()
  50. !DEC$ ATTRIBUTES DLLEXPORT :: Get_SafetyValve_WN
  51. !DEC$ ATTRIBUTES ALIAS: 'Get_SafetyValve_WN' :: Get_SafetyValve_WN
  52. implicit none
  53. Get_SafetyValve_WN = SafetyValve
  54. end function
  55. subroutine Set_SafetyValve_Install()
  56. implicit none
  57. call Set_SafetyValve(SAFETY_VALVE_INSTALL)
  58. end subroutine
  59. subroutine Set_SafetyValve_Remove()
  60. implicit none
  61. call Set_SafetyValve(SAFETY_VALVE_REMOVE)
  62. end subroutine
  63. logical function Get_RemoveSafetyValve()
  64. !DEC$ ATTRIBUTES DLLEXPORT :: Get_RemoveSafetyValve
  65. !DEC$ ATTRIBUTES ALIAS: 'Get_RemoveSafetyValve' :: Get_RemoveSafetyValve
  66. implicit none
  67. Get_RemoveSafetyValve = .false. ! SafetyValve == REMOVE_SAFETY_VALVE
  68. end function
  69. logical function Get_InstallSafetyValve()
  70. !DEC$ ATTRIBUTES DLLEXPORT :: Get_InstallSafetyValve
  71. !DEC$ ATTRIBUTES ALIAS: 'Get_InstallSafetyValve' :: Get_InstallSafetyValve
  72. implicit none
  73. Get_InstallSafetyValve = .false. ! SafetyValve == INSTALL_SAFETY_VALVE
  74. end function
  75. end module CSafetyValveEnumVariables