Nodes of different colours represent the following:
Solid arrows point from a parent (sub)module to the submodule which is descended from it. Dashed arrows point from a module being used to the module or program unit using it. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | recordIndex | |||
integer, | intent(in) | :: | timeIndex | |||
real(kind=r64), | intent(in) | :: | value | |||
integer, | intent(in), | optional | :: | reportingInterval | ||
real(kind=r64), | intent(in), | optional | :: | minValue | ||
integer, | intent(in), | optional | :: | minValueDate | ||
real(kind=r64), | intent(in), | optional | :: | maxValue | ||
integer, | intent(in), | optional | :: | maxValueDate | ||
integer, | intent(in), | optional | :: | minutesPerTimeStep |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
SUBROUTINE CreateSQLiteReportVariableDataRecord (recordIndex, timeIndex, value, reportingInterval, &
minValue, minValueDate, maxValue, maxValueDate, minutesPerTimeStep)
! SUBROUTINE INFORMATION:
! AUTHOR Greg Stark
! DATE WRITTEN July 2008
! MODIFIED January 2010, Kyle Benne
! Naming cleanup and add reference to EnvironmentPeriod
! table.
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine writes an .eso data record to the SQL database
! METHODOLOGY EMPLOYED:
! Standard SQL92 queries and commands via the Fortran SQLite3 API
! REFERENCES:
! na
! USE STATEMENTS:
USE ISO_C_FUNCTION_BINDING
USE DataPrecisionGlobals, ONLY: r64
USE General, ONLY: DecodeMonDayHrMin
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: recordIndex
INTEGER, INTENT(IN) :: timeIndex
REAL(r64), INTENT(IN) :: value
INTEGER, INTENT(IN), OPTIONAL :: reportingInterval
REAL(r64), INTENT(IN), OPTIONAL :: maxValue
INTEGER, INTENT(IN), OPTIONAL :: maxValueDate
REAL(r64), INTENT(IN), OPTIONAL :: minValue
INTEGER, INTENT(IN), OPTIONAL :: minValueDate
INTEGER, INTENT(IN), OPTIONAL :: minutesPerTimeStep
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
CHARACTER(len=MaxMessageSize) :: mesaageBuffer
INTEGER MinMonth, MinDay, MinHour, MinMinute, MaxMonth, MaxDay, MaxHour, MaxMinute
INTEGER, SAVE :: extendedDataIndex = 0
INTEGER, SAVE :: OID = 0
INTEGER :: result
OID = OID + 1
result = SQLiteBindInteger (ReportVariableDataInsertStmt, 1, timeIndex)
result = SQLiteBindInteger (ReportVariableDataInsertStmt, 2, recordIndex)
result = SQLiteBindDouble (ReportVariableDataInsertStmt, 3, value)
result = SQLiteBindInteger (ReportVariableDataInsertStmt, 4, OID)
IF (PRESENT(reportingInterval)) THEN
CALL DecodeMonDayHrMin(minValueDate, MinMonth, MinDay, MinHour, MinMinute)
CALL DecodeMonDayHrMin(maxValueDate, MaxMonth, MaxDay, MaxHour, MaxMinute)
CALL AdjustReportingHourAndMinutes(MinHour, MinMinute)
CALL AdjustReportingHourAndMinutes(MaxHour, MaxMinute)
extendedDataIndex = extendedDataIndex + 1
IF (PRESENT(minutesPerTimeStep)) THEN ! This is for data created by a 'Report Meter' statement
SELECT CASE (reportingInterval)
CASE(LocalReportHourly, LocalReportDaily, LocalReportMonthly, LocalReportSim)
result = SQLiteBindInteger (ReportVariableExtendedDataInsertStmt, 1, extendedDataIndex)
result = SQLiteBindDouble (ReportVariableExtendedDataInsertStmt, 2, maxValue)
result = SQLiteBindInteger (ReportVariableExtendedDataInsertStmt, 3, maxMonth)
result = SQLiteBindInteger (ReportVariableExtendedDataInsertStmt, 4, maxDay)
result = SQLiteBindInteger (ReportVariableExtendedDataInsertStmt, 5, maxHour)
result = SQLiteBindInteger (ReportVariableExtendedDataInsertStmt, 6, maxMinute - minutesPerTimeStep + 1)
result = SQLiteBindInteger (ReportVariableExtendedDataInsertStmt, 7, maxMinute)
result = SQLiteBindDouble (ReportVariableExtendedDataInsertStmt, 8, minValue)
result = SQLiteBindInteger (ReportVariableExtendedDataInsertStmt, 9, minMonth)
result = SQLiteBindInteger (ReportVariableExtendedDataInsertStmt, 10, minDay)
result = SQLiteBindInteger (ReportVariableExtendedDataInsertStmt, 11, minHour)
result = SQLiteBindInteger (ReportVariableExtendedDataInsertStmt, 12, minMinute - minutesPerTimeStep + 1)
result = SQLiteBindInteger (ReportVariableExtendedDataInsertStmt, 13, minMinute)
result = SQLiteStepCommand (ReportVariableExtendedDataInsertStmt)
result = SQLiteResetCommand (ReportVariableExtendedDataInsertStmt)
CASE(LocalReportTimeStep)
extendedDataIndex = extendedDataIndex - 1 ! Reset the data index to account for the error
result = SQLiteBindNULL (ReportVariableDataInsertStmt, 4)
CASE DEFAULT
extendedDataIndex = extendedDataIndex - 1 ! Reset the data index to account for the error
result = SQLiteBindNULL (ReportVariableDataInsertStmt, 4) ! don't report the erroneous data
Write(mesaageBuffer,'(A,I5)') 'Illegal reportingInterval passed to CreateSQLiteReportVariableDataRecord: ', &
reportingInterval
CALL SQLiteWriteMessageMacro (mesaageBuffer)
END SELECT
ELSE ! This is for data created by a 'Report Variable' statement
SELECT CASE (reportingInterval)
CASE(LocalReportDaily, LocalReportMonthly, LocalReportSim)
result = SQLiteBindInteger (ReportVariableExtendedDataInsertStmt, 1, extendedDataIndex)
result = SQLiteBindDouble (ReportVariableExtendedDataInsertStmt, 2, maxValue)
result = SQLiteBindInteger (ReportVariableExtendedDataInsertStmt, 3, maxMonth)
result = SQLiteBindInteger (ReportVariableExtendedDataInsertStmt, 4, maxDay)
result = SQLiteBindInteger (ReportVariableExtendedDataInsertStmt, 5, maxHour)
result = SQLiteBindNULL (ReportVariableExtendedDataInsertStmt, 6)
result = SQLiteBindInteger (ReportVariableExtendedDataInsertStmt, 7, maxMinute)
result = SQLiteBindDouble (ReportVariableExtendedDataInsertStmt, 8, minValue)
result = SQLiteBindInteger (ReportVariableExtendedDataInsertStmt, 9, minMonth)
result = SQLiteBindInteger (ReportVariableExtendedDataInsertStmt, 10, minDay)
result = SQLiteBindInteger (ReportVariableExtendedDataInsertStmt, 11, minHour)
result = SQLiteBindNULL (ReportVariableExtendedDataInsertStmt, 12)
result = SQLiteBindInteger (ReportVariableExtendedDataInsertStmt, 13, minMinute)
result = SQLiteStepCommand (ReportVariableExtendedDataInsertStmt)
result = SQLiteResetCommand (ReportVariableExtendedDataInsertStmt)
CASE DEFAULT
extendedDataIndex = extendedDataIndex - 1 ! Reset the data index to account for the error
result = SQLiteBindNULL (ReportVariableDataInsertStmt, 4) ! don't report the erroneous data
Write(mesaageBuffer,'(A,I5)') 'Illegal reportingInterval passed to CreateSQLiteReportVariableDataRecord: ', &
reportingInterval
CALL SQLiteWriteMessageMacro (mesaageBuffer)
END SELECT
END IF
ELSE
result = SQLiteBindNULL (ReportVariableDataInsertStmt, 4)
END IF
result = SQLiteStepCommand (ReportVariableDataInsertStmt)
result = SQLiteResetCommand (ReportVariableDataInsertStmt)
END SUBROUTINE CreateSQLiteReportVariableDataRecord