Skip to content

Commit

Permalink
Step as int.
Browse files Browse the repository at this point in the history
  • Loading branch information
rlutes committed Jun 16, 2022
1 parent 19cc14e commit 6d8a789
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion restapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def construct(status, message, payload):
# -----------------------
# ``step`` interface
parser_step = reqparse.RequestParser()
parser_step.add_argument('step', type=float, required=True, help=error_number_input.format('step'))
parser_step.add_argument('step', type=int, required=True, help=error_number_input.format('step'))

# ``initialize`` interface
parser_initialize = reqparse.RequestParser()
Expand Down
6 changes: 3 additions & 3 deletions testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(self, fmupath='models/wrapped.fmu'):
self.input_names = self.fmu.get_model_variables(causality = 2).keys()
self.output_names = self.fmu.get_model_variables(causality = 3).keys()
# Set default communication step
self.set_step(self.config_json['step'])
self.set_step(int(self.config_json['step']))
# Set default forecast parameters
self.set_forecast_parameters(self.config_json['horizon'], self.config_json['interval'])
# Initialize simulation data arrays
Expand Down Expand Up @@ -462,7 +462,7 @@ def set_step(self, step):
status = 200
message = "Control step set successfully."
payload = None
if not isinstance(step, (int, float)):
if not isinstance(step, int):
payload = None
status = 400
message = "parameter 'step' must be an integral number but is {}".format(type(step))
Expand All @@ -474,7 +474,7 @@ def set_step(self, step):
logging.error(message)
return status, message, payload
try:
self.step = float(step)
self.step = step
logging.info(message)
except:
payload = None
Expand Down

0 comments on commit 6d8a789

Please sign in to comment.