The name convention of power-related API functions are slightly different in Python. Please find a small snippet below illustrating the usage. The script has not been carefully tested.
[font=courier][color=blue]
import sys, os
sys.path.append('C:\\Program Files\\DHI\\2017\\FEFLOW 7.1\\bin64')
import ifm
import pandas as pd
try:
#Get current working directory
cwd = os.getcwd()
#Definition of files
FEM_FILE_IN = cwd + "\\..\\femdata\\feflow_file.fem"
FEM_FILE_OUT = cwd + "\\..\\femdata\\feflow_file_OUT.fem"
TS_FILE = cwd + "\\..\\import+export\\TS_IN.csv"
print "Input: " + FEM_FILE_IN
print "Output: " + FEM_FILE_OUT
print "Input TS: " + TS_FILE
#Read TS-file and create new Data Frame
if TS_FILE.endswith(".xlsx"):
df=pd.read_excel(TS_FILE)
elif TS_FILE.endswith(".csv"):
df=pd.read_table(TS_FILE, sep=";")
#Load FEFLOW document
doc=ifm.loadDocument(FEM_FILE_IN)
#Loop through columns in Data Frame
for nPOWID, column in enumerate(df):
if nPOWID > 0:
#Make new TS
doc.powerCreateCurve(nPOWID)
#Set type of interpolation: ConstantSteps=1, Linear=2, AKIMA1=3, AKIMA2=4
InterpolationKind=2
doc.powerSetInterpolationKind(nPOWID,InterpolationKind)
#Set power mode: Linear=0, Cyclic=1 (cyclic must have identical start and end values)
PowerMode=0
doc.powerSetCyclic(nPOWID,PowerMode)
#Get time and value by looping through row of each column
for index_val, series_val in df[column].iteritems():
time = df.Time[index_val]
doc.powerSetPoint(nPOWID, time, series_val)
doc.powerSetComment(nPOWID, column)
#Save FEFLOW document
doc.saveDocument(FEM_FILE_OUT)
except Exception as err:
print>>sys.stderr,'Error: '+str(err)+'!'
sys.exit(-1);
[/color][/font]