{% extends "layout.html" %} {% set active_page = "method_list" %} {% set help_page = ["methods", _('Methods')] %} {% block title %} - {{_('Method-Builder')}}{% endblock %} {% block head %} {% if current_user.theme in ['cyborg', 'darkly', 'slate', 'superhero'] %} {% endif %} {% endblock %} {% block body %}
{% include 'flash_messages.html' %} {%- set method_setpoint = [] -%} {%- for each_method_line in method_data if each_method_line.method_id == method.id and each_method_line.setpoint_start != None -%} {%- do method_setpoint.append(1) -%} {%- endfor -%} << {{_('Back to Method Management')}}
{{_('Method-Builder')}} ({{method.method_type}} {{_('Method ID')}}: {{method.id}})
{{form_mod_method.csrf_token}} {{form_mod_method.method_id(class_='form-control', value=method.id)}}
{{form_mod_method.name.label(class_='control-label')}}
{{form_mod_method.name(class_='form-control', value=method.name)}}
{{form_mod_method.rename(class_='form-control btn btn-default')}}
{{form_add_method.csrf_token}} {{form_add_method.method_id(class_='form-control', value=method.id)}}
{%- if method.method_type == "Duration" -%}
{{form_add_method.duration.label(class_='control-label')}}
{{form_add_method.duration(class_='form-control')}}
{%- endif -%} {%- if method.method_type == "Date" -%}
{{_('Define the setpoint over a period of time based on specific times/dates.')}}
{{_("The new entry's start time may be equal to the last entry's end time, but it cannot overlap. The default setpoint for the PID will be used if there is any unaccounted time.")}}
{{form_add_method.time_start.label(class_='control-label')}}
{{form_add_method.time_start(class_='form-control', value=last_end_time)}}
{{form_add_method.time_end.label(class_='control-label')}}
{{form_add_method.time_end(class_='form-control')}}
{%- elif method.method_type == "Daily" -%}
{{_('Define the setpoint over a period of time based on specific times of the day. This method will repeat daily. Start the first entry at midnight (00:00) if you wish to fill the entire day.')}}
{{_("The new entry's start time may be equal to the last entry's end time, but it cannot overlap. The default setpoint for the PID will be used if there is any unaccounted time.")}}
{{form_add_method.daily_time_start.label(class_='control-label')}}
{{form_add_method.daily_time_start(class_='form-control', value=last_end_time)}}
{{form_add_method.daily_time_end.label(class_='control-label')}}
{{form_add_method.daily_time_end(class_='form-control')}}
{%- elif method.method_type == "DailySine" -%}
{{_('Define the setpoint over the day based on a sinusoidal wave defined by y = [A * sin(B * x + C)] + D, where A is amplitude, B is frequency, C is the angle shift, and D is the y-axis shift. This method will repeat daily.')}}
{{form_add_method.amplitude.label(class_='control-label')}}
{{form_add_method.amplitude(class_='form-control', value=last_sine_method.amplitude)}}
{{form_add_method.frequency.label(class_='control-label')}}
{{form_add_method.frequency(class_='form-control', value=last_sine_method.frequency)}}
{{form_add_method.shift_angle.label(class_='control-label')}}
{{form_add_method.shift_angle(class_='form-control', value=last_sine_method.shift_angle)}}
{{form_add_method.shiftY.label(class_='control-label')}}
{{form_add_method.shiftY(class_='form-control', value=last_sine_method.shift_y)}}
{%- elif method.method_type == "DailyBezier" -%}
{{_('Define the setpoint over the day based on a cubic Bezier curve. If unfamiliar with a Bezier curve, it is recommended you use the graphical Bezier curve generator and use the 8 variables it creates for 4 points (each a set of x and y). The x-axis start (x3) and end (x0) will be automatically stretched or skewed to fit within a 24-hour period and this method will repeat daily.')}}
{{form_add_method.x0.label(class_='control-label')}}
{{form_add_method.x0(class_='form-control', value=last_bezier_method.x0)}}
{{form_add_method.y0.label(class_='control-label')}}
{{form_add_method.y0(class_='form-control', value=last_bezier_method.y0)}}
{{form_add_method.x1.label(class_='control-label')}}
{{form_add_method.x1(class_='form-control', value=last_bezier_method.x1)}}
{{form_add_method.y1.label(class_='control-label')}}
{{form_add_method.y1(class_='form-control', value=last_bezier_method.y1)}}
{{form_add_method.x2.label(class_='control-label')}}
{{form_add_method.x2(class_='form-control', value=last_bezier_method.x2)}}
{{form_add_method.y2.label(class_='control-label')}}
{{form_add_method.y2(class_='form-control', value=last_bezier_method.y2)}}
{{form_add_method.x3.label(class_='control-label')}}
{{form_add_method.x3(class_='form-control', value=last_bezier_method.x3)}}
{{form_add_method.y3.label(class_='control-label')}}
{{form_add_method.y3(class_='form-control', value=last_bezier_method.y3)}}
{{form_add_method.shift_angle.label(class_='control-label')}}
{{form_add_method.shift_angle(class_='form-control', value=last_bezier_method.shift_angle)}}
{%- elif method.method_type == "Duration" -%}
{{_('Define the setpoint over a period of time, based on specific durations of time.')}}
{{_('Duration here is defined as the amount of time after the previous duration. If this is the first duration added, this will be the beginning of the method. If this is not the first duration added, it will execute after the last duration already in the method.')}}
{%- endif -%}
{%- if method.method_type in ['Date', 'Duration', 'Daily'] -%}
{{form_add_method.setpoint_start.label(class_='control-label')}}
{{form_add_method.setpoint_start(class_='form-control', value=last_setpoint)}}
{{form_add_method.setpoint_end.label(class_='control-label')}}
{{form_add_method.setpoint_end(class_='form-control')}}
OR
{%- if method.method_type == "Date" -%}
{{_('Relay')}}
{{_('Activate or deactivate a relay within this method at a specific time/date.')}}
{{form_add_method.relay_time.label(class_='control-label')}}
{{form_add_method.relay_time(class_='form-control')}}
{%- elif method.method_type == 'Daily' -%}
{{_('Relay')}}
{{_('Activate or deactivate a relay at a specific time of day. Hour and minute (HH:MM) here is defined as the time of day. For example, 3:05 PM would be "15:05".')}}
{{form_add_method.relay_daily_time.label(class_='control-label')}}
{{form_add_method.relay_daily_time(class_='form-control')}}
{%- elif method.method_type == "Duration" -%}
{{_('Relay')}}
{{_('Activate or deactivate a relay within this method at a specific duration. Duration here is defined as the amount of time since the beginning of the method. For example, 60 seconds would execute the relay modulation 60 seconds after the start of the method.')}}
{%- endif -%}
{{form_add_method.relay_id.label(class_='control-label')}}
{{form_add_method.relay_state.label(class_='control-label')}}
{{form_add_method.relay_state(class_='form-control')}}
{{form_add_method.relay_duration.label(class_='control-label')}}
{{form_add_method.relay_duration(class_='form-control')}}
{{form_add_method.save(class_='form-control btn btn-default')}}
{%- elif method.method_type in ['DailySine', 'DailyBezier'] -%}
{{form_add_method.save(class_='form-control btn btn-default', value=_('Save'))}}
{%- endif -%}
{%- if method_setpoint or method.method_type in ["DailySine", "DailyBezier"] -%}
{%- endif -%} {%- if method_setpoint -%}

Setpoint Tracking

{%- for each_method in method_data if each_method.method_id == method.id and not each_method.relay_id -%}
{{form_mod_method.csrf_token}} {{form_mod_method.method_id(class_='form-control', value=method.id)}} {{form_mod_method.method_data_id(class_='form-control', value=each_method.id)}} {% if method.method_type == "Date" -%}
{{form_mod_method.time_start.label(class_='control-label')}}
{{form_mod_method.time_start(class_='form-control', value=each_method.time_start)}}
{{form_mod_method.time_end.label(class_='control-label')}}
{{form_mod_method.time_end(class_='form-control', value=each_method.time_end)}}
{% elif method.method_type == "Daily" -%}
{{form_mod_method.daily_time_start.label(class_='control-label')}}
{{form_mod_method.daily_time_start(class_='form-control', value=each_method.time_start)}}
{{form_mod_method.daily_time_end.label(class_='control-label')}}
{{form_mod_method.daily_time_end(class_='form-control', value=each_method.time_end)}}
{% elif method.method_type == "Duration" -%}
{{form_mod_method.duration.label(class_='control-label')}}
{{form_mod_method.duration(class_='form-control', value=each_method.duration_sec)}}
{% endif -%}
{{form_mod_method.setpoint_start.label(class_='control-label')}}
{{form_mod_method.setpoint_start(class_='form-control', value=each_method.setpoint_start)}}
{{form_mod_method.setpoint_end.label(class_='control-label')}}
{{form_mod_method.setpoint_end(class_='form-control', value=each_method.setpoint_end)}}
{{form_mod_method.save(class_='form-control btn btn-default')}}
{{form_mod_method.Delete(class_='form-control btn btn-default',**{'onclick':'return confirm("Are you sure you want to delete this method line?")'})}}
{%- endfor -%}
{%- endif -%} {%- set method_relay = [] -%} {%- for each_method in method_data if each_method.method_id == method.id and each_method.relay_id -%} {%- do method_relay.append(1) -%} {%- endfor -%} {%- if method_relay -%}

{{_('Relay Modulation')}}

{{_('Note: This feature is currently not implemented. These relays will NOT be modulated if applied to a PID. This will be implemented soon.')}}
{%- endif -%} {%- for each_method in method_data if each_method.method_id == method.id and each_method.relay_id -%}
{{form_mod_method.csrf_token}} {{form_mod_method.method_id(class_='form-control', value=method.id)}} {{form_mod_method.method_data_id(class_='form-control', value=each_method.id)}} {% if method.method_type == "Date" -%}
{{form_mod_method.relay_time.label(class_='control-label')}}
{{form_mod_method.relay_time(class_='form-control', value=each_method.time_start)}}
{% elif method.method_type == "Daily" -%}
{{form_mod_method.relay_daily_time.label(class_='control-label')}}
{{form_mod_method.relay_daily_time(class_='form-control', value=each_method.time_start)}}
{% elif method.method_type == "Duration" -%}
{{form_mod_method.duration.label(class_='control-label')}}
{{form_mod_method.duration(class_='form-control', value=each_method.duration_sec)}}
{% endif -%}
{{form_mod_method.relay_id.label(class_='control-label')}}
{{form_mod_method.relay_state.label(class_='control-label')}}
{{form_mod_method.relay_duration.label(class_='control-label')}}
{{form_mod_method.relay_duration(class_='form-control', value=each_method.relay_duration)}}
{{form_mod_method.save(class_='form-control btn btn-default')}}
{{form_mod_method.Delete(class_='form-control btn btn-default',**{'onclick':'return confirm("Are you sure you want to delete this method line?")'})}}
{%- endfor -%}
{% endblock %}