- edited description
Error - SetTable and GetDataTable
Hello,
I am trying to automate the import of csv files into MODSIM to run the model. I want to set time series data contained in a csv file and assign it to a non-storage node as input.
I saw in the custom Modsim help manual that SetTable method in TimeSeries class "assigns the given [data]table into the time series table." I also saw that GetTable method in TimeSeries class "gets a table ".
I am unsure which method is the correct one to use in this case but when I try to compile the following custom code, it gives me the following error messages:
'SetTable' is not a member of 'Csu.Modsim.ModsimModel.TimeSeries'. (BC30456) 'GetDataTable' is not a member of 'Csu.Modsim.ModsimModel.TimeSeries'. (BC30456)
The portion of code where I am getting an error is as follows:
Private Sub OnInitialize()
Dim m_StephenNode As Node
Dim csvTable As DataTable
m_StephenNode = myModel.FindNode("NonStorage")
'getcsvFiles() is a function that I made which returns a datatable containing csv file content
'I have check this function already in visual basic that it returns datatable with correct content
csvTable = getcsvFiles()
m_StephenNode.m.adaInflowsM.SetTable(csvTable)
'or trying the following line it still gives an error that it's not a member of the timeseries class
m_StephenNode.m.adaInflowsM.GetDataTable()=csvTable
End Sub
Are these two methods no longer part of Modsim functionality? Please advise how to best proceed.
Thank you
Comments (3)
-
reporter -
Su Jin - the GetDataTable function got discontinued at some point. use the DataTable object directly to get and set the datatable for the time series. I.e., use the following: Dim m_TSTable As DataTable = m_StephenNode.m.adaInflowsM.DataTable()
-
reporter Hello Dr. Triana,
Thank you very much for your help. The custom code now compiles properly and runs however I am still getting blanks for inflow to nonstorage. Is there a particular format that the DataTable must be set up (ie. has to have "date", "Inflow" headers or no headers)? Currently DataTable is something like this:
Date Inflow
2000/01/01 1000
2000/01/02 1200
The dataseries begins and ends with specified simulation duration in the MODSIM. Could I just set Dim m_TSTable As DataTable = m_StephenNode.m.adaInflowsM.DataTable()
Or do I also need to somehow reference time index/steps? (Or does it not matter since I have set those in MODSIM project setup, not in the custom code).
Thank you very much
- Log in to comment