示例#1
0

import numpy as np
import fmusim2
from scipy import interpolate

##myfmu = fmu("./Modelica_Mechanics_MultiBody_Examples_Elementary_DoublePendulum.fmu")
##myfmu = fmu("./Modelica_Mechanics_MultiBody_Examples_Elementary_Pendulum.fmu")
##myfmu = fmu("./FMU/Batteriebaustein.fmu")
##myfmu = fmu("./Modelica_Mechanics_Rotational_Examples_First.fmu")
#myfmu = fmu("./efunc.fmu")
#myfmu = fmu("satcomponents_blocks_noise_sampled.fmu", logging = False)
#myfmu = fmu("rosmo_ExternalLibraries.fmu", logging = True)
#myfmu = fmusim.fmu("FMU/iboss_vti.fmu", logging = True)
#with fmusim2.fmi("./FMU/efunc.fmu", loggingOn = True) as myfmu:
myfmu = fmusim2.fmi("./fmu/efunc.fmu", loggingOn = True)
##myfmu.printvarprops()
##print(myfmu.getOutputNames())
#names=list(myfmu.getOutputNames().values())
#names=myfmu.getStateNames()
#names = myfmu.getVariables()
#print(names)
#names=[#'iXp.comm_out.tmp','iXp.comm_out.mi_pos',"set_mi_pos.[1]"]
names=['x', 'der(x)']

def intpl1d(table):
    table = np.array(table)
    return interpolate.interp1d(table[:,0],table[:,1], kind = 0)#‘linear’, ‘nearest’, ‘zero’, ‘slinear’, ‘quadratic, ‘cubic’ where ‘slinear’, ‘quadratic’ and ‘cubic’ 

#simulation with generic solvers
t_end = 10.0
示例#2
0
文件: cosim.py 项目: manasdas17/fmupy
import numpy as np
import fmusim2
from scipy import interpolate

##myfmu = fmu("./Modelica_Mechanics_MultiBody_Examples_Elementary_DoublePendulum.fmu")
##myfmu = fmu("./Modelica_Mechanics_MultiBody_Examples_Elementary_Pendulum.fmu")
##myfmu = fmu("./FMU/Batteriebaustein.fmu")
##myfmu = fmu("./Modelica_Mechanics_Rotational_Examples_First.fmu")
#myfmu = fmu("./efunc.fmu")
#myfmu = fmu("satcomponents_blocks_noise_sampled.fmu", logging = False)
#myfmu = fmu("rosmo_ExternalLibraries.fmu", logging = True)
#myfmu = fmusim.fmu("FMU/iboss_vti.fmu", logging = True)
#with fmusim2.fmi("./FMU/efunc.fmu", loggingOn = True) as myfmu:
#myfmu = fmusim2.fmi("./fmu/satcomponents_AOCS_examples_mission_simulation_ideal.fmu", loggingOn = False)
myfmu = fmusim2.fmi("efunc.fmu", loggingOn=False)
##myfmu.printvarprops()
##print(myfmu.getOutputNames())
#names=list(myfmu.getOutputNames().values())
#names=myfmu.getStateNames()
#names = myfmu.getVariables()
#print(names)
#names=[#'iXp.comm_out.tmp','iXp.comm_out.mi_pos',"set_mi_pos.[1]"]
names = ['body1.r_0[1]']


def intpl1d(table):
    table = np.array(table)
    return interpolate.interp1d(
        table[:, 0], table[:, 1], kind=0
    )  #‘linear’, ‘nearest’, ‘zero’, ‘slinear’, ‘quadratic, ‘cubic’ where ‘slinear’, ‘quadratic’ and ‘cubic’
示例#3
0

import numpy as np
import fmusim2
from scipy import interpolate

##myfmu = fmu("./Modelica_Mechanics_MultiBody_Examples_Elementary_DoublePendulum.fmu")
##myfmu = fmu("./Modelica_Mechanics_MultiBody_Examples_Elementary_Pendulum.fmu")
##myfmu = fmu("./FMU/Batteriebaustein.fmu")
##myfmu = fmu("./Modelica_Mechanics_Rotational_Examples_First.fmu")
#myfmu = fmu("./efunc.fmu")
#myfmu = fmu("satcomponents_blocks_noise_sampled.fmu", logging = False)
#myfmu = fmu("rosmo_ExternalLibraries.fmu", logging = True)
#myfmu = fmusim.fmu("FMU/iboss_vti.fmu", logging = True)
#with fmusim2.fmi("./FMU/efunc.fmu", loggingOn = True) as myfmu:
myfmu = fmusim2.fmi("./fmu/satcomponents_AOCS_examples_mission_simulation_ideal.fmu", loggingOn = False)
##myfmu.printvarprops()
##print(myfmu.getOutputNames())
#names=list(myfmu.getOutputNames().values())
#names=myfmu.getStateNames()
#names = myfmu.getVariables()
#print(names)
#names=[#'iXp.comm_out.tmp','iXp.comm_out.mi_pos',"set_mi_pos.[1]"]
names = ['body1.r_0[1]']

def intpl1d(table):
    table = np.array(table)
    return interpolate.interp1d(table[:,0],table[:,1], kind = 0)#‘linear’, ‘nearest’, ‘zero’, ‘slinear’, ‘quadratic, ‘cubic’ where ‘slinear’, ‘quadratic’ and ‘cubic’ 

#simulation with generic solvers
t_end = 10.0
示例#4
0
文件: cosim.py 项目: yeus/fmupy
import numpy as np
import fmusim2
from scipy import interpolate

##myfmu = fmu("./Modelica_Mechanics_MultiBody_Examples_Elementary_DoublePendulum.fmu")
##myfmu = fmu("./Modelica_Mechanics_MultiBody_Examples_Elementary_Pendulum.fmu")
##myfmu = fmu("./FMU/Batteriebaustein.fmu")
##myfmu = fmu("./Modelica_Mechanics_Rotational_Examples_First.fmu")
#myfmu = fmu("./efunc.fmu")
#myfmu = fmu("satcomponents_blocks_noise_sampled.fmu", logging = False)
#myfmu = fmu("rosmo_ExternalLibraries.fmu", logging = True)
#myfmu = fmusim.fmu("FMU/iboss_vti.fmu", logging = True)
#with fmusim2.fmi("./FMU/efunc.fmu", loggingOn = True) as myfmu:
#myfmu = fmusim2.fmi("./fmu/satcomponents_AOCS_examples_mission_simulation_ideal.fmu", loggingOn = False)
myfmu = fmusim2.fmi("efunc.fmu", loggingOn = False)
##myfmu.printvarprops()
##print(myfmu.getOutputNames())
#names=list(myfmu.getOutputNames().values())
#names=myfmu.getStateNames()
#names = myfmu.getVariables()
#print(names)
#names=[#'iXp.comm_out.tmp','iXp.comm_out.mi_pos',"set_mi_pos.[1]"]
names = ['body1.r_0[1]']

def intpl1d(table):
    table = np.array(table)
    return interpolate.interp1d(table[:,0],table[:,1], kind = 0)#‘linear’, ‘nearest’, ‘zero’, ‘slinear’, ‘quadratic, ‘cubic’ where ‘slinear’, ‘quadratic’ and ‘cubic’ 

#simulation with generic solvers
t_end = 10.0