BEGIN
TEXT _vectorName = "vector.test"
INT _vectorId = 1000000
INT _errorCode
TEXT _funcBody
TIME _precalcBt, _precalcEt, _readBt, _readEt
RECORD NOALIAS (SD.EDA_Arr_Obj) _data
RECORD NOALIAS (SD.EDA_CreateVector_Params_V1) _createParams
RECORD NOALIAS (SD.EDA_SetFunction_Params_V1) _funcParams
RECORD NOALIAS (SD.EDA_PredPrepocitaj_Params_V1) _precalcParams
RECORD NOALIAS (SD.EDA_ReadValuesFromVektor_Params_V1) _readParams
; vytvori vektor
_createParams[1]^structVersion := 1
_createParams[1]^periodBeginTime := %TimeFromItems(2015, 1, 1, 0, 0, 0, 0)
_createParams[1]^periodStepBase := 1
_createParams[1]^periodStepCount := 3600
_funcParams[1]^structVersion := 1
CALL %EDA_CreateVectorRec(_vectorName, _vectorId, _vectorName, 13, _createParams, _errorCode)
IF _errorCode != 0 THEN
RETURN
ENDIF
; nastavi mu predpis
_funcBody := "VEKTOR _v;" + %Chr(10)
_funcBody := _funcBody + "INT _i;" + %Chr(10)
_funcBody := _funcBody + "%CreateVektor(_v, _BT, _ET, _STEP);" + %Chr(10)
_funcBody := _funcBody + "FOR _i = 1 TO %ValuesNr(_v) LOOP" + %Chr(10)
_funcBody := _funcBody + " _v[_i] := _i;" + %Chr(10)
_funcBody := _funcBody + "END LOOP;" + %Chr(10)
_funcBody := _funcBody + "RETURN _v;"
CALL %EDA_SetFunctionRec(_vectorId, 1, _funcBody, _funcParams, _errorCode)
IF _errorCode != 0 THEN
RETURN
ENDIF
; predpocita vektor
_precalcParams[1]^structVersion := 1
_precalcBt := %TimeFromItems(2015, 7, 11, 0, 0, 0, 0)
_precalcEt := %TimeFromItems(2015, 7, 12, 0, 0, 0, 0) - 1
CALL %EDA_PredPrepocitajRec(_vectorName, @TRUE, _precalcBt, _precalcEt, _precalcParams, _errorCode)
IF _errorCode != 0 THEN
RETURN
ENDIF
; nacita vektor - predpocitanu a nepredpocitanu cast
_readParams[1]^structVersion := 1
_readBt := %TimeFromItems(2015, 7, 10, 0, 0, 0, 0)
_readEt := %TimeFromItems(2015, 7, 13, 0, 0, 0, 0) - 1
CALL %EDA_ReadValuesFromVektorRec(_vectorName, _readBt, readEt, 0, _readParams, _data, 1, _errorCode)
IF _errorCode != 0 THEN
RETURN
ENDIF
END
0 komentárov