Skip to content

Commit

Permalink
Merge branch 'release/v0.2.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
t-sommer committed May 22, 2018
2 parents ff1c6ce + 1523457 commit 10f2b2f
Show file tree
Hide file tree
Showing 20 changed files with 1,237 additions and 339 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
*.csv
*.html

# Affinity Designer documents
*.afdesign

# compiled files
*.py[cod]

Expand Down
10 changes: 10 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## v0.2.4 (2018-05-22)

- `NEW` Remaining FMI functions added
- `NEW` More options for command line interface
- `NEW` More elements added to SSP parser
- `NEW` Polished GUI
- `FIXED` No more warning when starting GUI


## v0.2.3 (2018-04-11)

- `NEW` Allow simulation of extracted FMUs and pre-loaded model descriptions
Expand All @@ -16,6 +25,7 @@
- `FIXED` Handling of time events
- `FIXED` Conversion of Boolean start values


## v0.2.2 (2018-03-13)

- `NEW` FMI 2.0 state serialization functions added
Expand Down
2 changes: 1 addition & 1 deletion fmpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from ctypes import *
import _ctypes

__version__ = '0.2.3'
__version__ = '0.2.4'


# determine the platform
Expand Down
44 changes: 32 additions & 12 deletions fmpy/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,26 @@ def main():
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
description=textwrap.dedent(description))

parser.add_argument('command', choices=['info', 'simulate', 'compile'], help="Command to execute")
parser.add_argument('command', choices=['info', 'validate', 'simulate', 'compile'], help="Command to execute")
parser.add_argument('fmu_filename', help="filename of the FMU")

parser.add_argument('--solver', choices=['Euler', 'CVode'], default='CVode',
help="solver to use for Model Exchange")
parser.add_argument('--validate', action='store_true', help="validate the FMU")
parser.add_argument('--start-time', type=float, help="start time for the simulation")
parser.add_argument('--stop-time', type=float, help="stop time for the simulation")
parser.add_argument('--solver', choices=['Euler', 'CVode'], default='CVode', help="solver to use for Model Exchange")
parser.add_argument('--step-size', type=float, help="step size for fixed-step solvers")
parser.add_argument('--relative-tolerance', type=float, help="relative tolerance for the 'CVode' solver")
parser.add_argument('--dont-record-events', action='store_true', help="dont't record outputs at events (model exchange only)")
parser.add_argument('--start-values', nargs='+', help="name-value pairs of start values")
parser.add_argument('--apply-default-start-values', action='store_true', help="apply the start values from the model description")
parser.add_argument('--output-interval', type=float, help="interval for sampling the output")
parser.add_argument('--input-file', help="CSV file to use as input")
parser.add_argument('--output-variables', nargs='+', help="Variables to record")
parser.add_argument('--output-file', help="CSV to store the results")
parser.add_argument('--num-samples', default=500, type=int, help="number of samples to record")
parser.add_argument('--step-size', type=float, help="step size for fixed-step solvers")
parser.add_argument('--start-time', type=float, help="start time for the simulation")
parser.add_argument('--stop-time', type=float, help="stop time for the simulation")
parser.add_argument('--show-plot', action='store_true', help="plot the results")
parser.add_argument('--timeout', type=float, help="max. time to wait for the simulation to finish")
parser.add_argument('--start-values', nargs='+', help="name-value pairs of start values")
parser.add_argument('--apply-default-start-values', action='store_true', help="apply the default values from the model description")
parser.add_argument('--debug-logging', action='store_true', help="enable the FMU's debug logging")
parser.add_argument('--fmi-logging', action='store_true', help="enable FMI logging")
parser.add_argument('--show-plot', action='store_true', help="plot the results")

args = parser.parse_args()

Expand All @@ -53,6 +55,22 @@ def main():
from fmpy import dump
dump(args.fmu_filename)

elif args.command == 'validate':

import sys
from fmpy.util import validate_fmu

messages = validate_fmu(args.fmu_filename)

if len(messages) == 0:
print('The validation passed')
else:
print('The following errors were found:')
for message in messages:
print()
print(message)
sys.exit(1)

elif args.command == 'compile':

from fmpy.util import compile_platform_binary
Expand All @@ -78,12 +96,14 @@ def main():
fmi_call_logger = None

result = simulate_fmu(args.fmu_filename,
validate=True,
validate=args.validate,
start_time=args.start_time,
stop_time=args.stop_time,
solver=args.solver,
step_size=args.step_size,
output_interval=None,
relative_tolerance=args.relative_tolerance,
output_interval=args.output_interval,
record_events=not args.dont_record_events,
fmi_type=None,
start_values=start_values,
apply_default_start_values=args.apply_default_start_values,
Expand Down
Loading

0 comments on commit 10f2b2f

Please sign in to comment.