Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FixedStepSizeFMU encountered an unknown problem during operation #7

Open
zzlonggg opened this issue Feb 5, 2023 · 0 comments
Open

Comments

@zzlonggg
Copy link

zzlonggg commented Feb 5, 2023

In the process of using the FixedStepSizeFMU example, when my code runs here (` fmu.defineRealOutputs( outputs, n_outputs )`  ), the kernel will die and 'the process has ended, exit code - 1073741819 (0xC0000005)'. After checking for a long time, I still can't find the cause of the problem. 
The python version I use is `python 3.10`  and the fmipp version I use is `fmipp 2.1.0`. Maybe there is something wrong with the version I use or with my configuration?

sine_standalone_fmu.zip

`import os.path
import fmipp
import math

uri_to_extracted_fmu = os.path.split(os.path.abspath(file))[0] # define working directory

model_name = 'sine_standalone_fmu' # define FMU model name
logging_on = False
fmu = fmipp.FixedStepSizeFMU( uri_to_extracted_fmu, model_name, logging_on )

n_init = 1 # number of parameter to be initialzed

init_vars = fmipp.new_string_array( n_init ) # construct string array for init parameter names
fmipp.string_array_setitem( init_vars, 0, 'omega' )

init_vals = fmipp.new_double_array( n_init ) # construct double array for init parameter values
fmipp.double_array_setitem( init_vals, 0, 0.1 * math.pi )

n_outputs = 1 # number of outputs

outputs = fmipp.new_string_array( n_outputs ) # construct string array with output names
fmipp.string_array_setitem( outputs, 0, 'x' )

fmu.defineRealOutputs( outputs, n_outputs ) # define real output names

start_time = 0.
stop_time = 5.
fmu_step_size = 1. # fixed step size enforced by FMU
sim_step_size = 0.2 # step size of simulation
time = start_time

status = fmu.init( "test_sine", init_vars, init_vals, n_init, start_time, fmu_step_size )
assert status == 1

while ( time <= stop_time ):
fmu.sync( time, time + sim_step_size )
time += sim_step_size
result = fmu.getRealOutputs()`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant