{% extends "layout.html" %} {% set active_page = "pid" %} {% set help_page = ["pids", _('PID Controllers')] %} {% block title %} - {{_('PID')}}{% endblock %} {% block head %} {% endblock %} {% block body %}
{% include 'flash_messages.html' %}

{{_('PID Controllers')}}

{{_('PID controllers couple an input with a device connected to an output to regulate an environmental condition. For example, this could be a heater and a temperature sensor, allowing the regulation of temperature.')}}

{{form_add_pid.hidden_tag()}}
{{form_add_pid.numberPIDs(class_='form-control', value=1, type="number")}}
{{form_add_pid.pidAddSubmit(class_='form-control btn btn-default')}}
{%- if displayOrder -%} {%- for order in displayOrder -%} {%- for each_pid in pid if each_pid.id == order -%}
{{form_mod_pid_base.csrf_token}} {{form_mod_pid_base.pid_id(value=each_pid.id)}}
{{form_mod_pid_base.name(class_='form-control', value=each_pid.name, **{'title':_('Name for this PID controller.')})}}
{%- if each_pid.is_activated %}
{{form_mod_pid_base.deactivate(class_='form-control btn btn-default')}}
{%- if each_pid.is_paused or each_pid.is_held %}
{{form_mod_pid_base.resume(class_='form-control btn btn-default')}}
{%- else %}
{{form_mod_pid_base.pause(class_='form-control btn btn-default')}}
{{form_mod_pid_base.hold(class_='form-control btn btn-default')}}
{%- endif -%} {%- else %}
{{form_mod_pid_base.activate(class_='form-control btn btn-default')}}
{%- endif -%}
{{form_mod_pid_base.save(class_='form-control btn btn-default')}}
{{form_mod_pid_base.delete(class_='form-control btn btn-default',**{'onclick':'return confirm("Are you sure you want to delete this PID controller?")'})}}
{{form_mod_pid_base.reorder_up(class_='form-control btn btn-default')}}
{{form_mod_pid_base.reorder_down(class_='form-control btn btn-default')}}
{{form_mod_pid_base.measurement.label(class_='control-label')}}
{{form_mod_pid_base.direction.label(class_='control-label')}}
{{form_mod_pid_base.period.label(class_='control-label')}}
{{form_mod_pid_base.period(class_='form-control', value=each_pid.period, **{'title':_('The duration between calculating a new PID output to power the raise and lower relays.')})}}
{{form_mod_pid_base.max_measure_age.label(class_='control-label')}}
{{form_mod_pid_base.max_measure_age(class_='form-control', value=each_pid.max_measure_age, **{'title':_('Maximum allowable sensor measurement age (to allow the PID controller to manipulate relays, the sensor measurement must have occurred in the past x seconds)')})}}
{{form_mod_pid_base.setpoint.label(class_='control-label')}}
{{form_mod_pid_base.setpoint(class_='form-control', value=each_pid.setpoint, **{'title':_('This is the desired state of a perticular environmental condition. For instance, this could be the desired temperature in Celsius.')})}}
{{form_mod_pid_base.k_p.label(class_='control-label')}}
{{form_mod_pid_base.k_p(class_='form-control', value=each_pid.p, **{'title':_('Proportional gain')})}}
{{form_mod_pid_base.k_i.label(class_='control-label')}}
{{form_mod_pid_base.k_i(class_='form-control', value=each_pid.i, **{'title':_('Integral gain')})}}
{{form_mod_pid_base.k_d.label(class_='control-label')}}
{{form_mod_pid_base.k_d(class_='form-control', value=each_pid.d, **{'title':_('Derivative gain')})}}
{{form_mod_pid_base.integrator_max.label(class_='control-label')}}
{{form_mod_pid_base.integrator_max(class_='form-control', value=each_pid.integrator_min, **{'title':_('Limit the integrator minimum, for calculating Ki_total: (Ki_total = Ki * integrator; and PID output = Kp_total + Ki_total + Kd_total)')})}}
{{form_mod_pid_base.integrator_min.label(class_='control-label')}}
{{form_mod_pid_base.integrator_min(class_='form-control', value=each_pid.integrator_max, **{'title':_('Limit the integrator maximum, for calculating Ki_total: (Ki_total = Ki * integrator; and PID output = Kp_total + Ki_total + Kd_total)')})}}
{{form_mod_pid_base.raise_relay_id.label(class_='control-label')}}
{% for each_relay in relay if each_pid.raise_relay_id == each_relay.id %} {% if each_relay.relay_type == 'pwm' %} {% include 'pages/pid_options/pwm_raise.html' %} {% else %} {% include 'pages/pid_options/relay_raise.html' %} {% endif %} {% endfor %}
{{form_mod_pid_base.lower_relay_id.label(class_='control-label')}}
{% for each_relay in relay if each_pid.lower_relay_id == each_relay.id %} {% if each_relay.relay_type == 'pwm' %} {% include 'pages/pid_options/pwm_lower.html' %} {% else %} {% include 'pages/pid_options/relay_lower.html' %} {% endif %} {% endfor %}
{{form_mod_pid_base.method_id.label(class_='control-label')}}
{%- endfor -%}
{%- endfor -%} {%- endif -%}
{% endblock %}