<div class="text-center"><h1>LIVE VALUES</h1></div>
<div class='row row-flex'>
    <div class='col-xs-4 text-center box-me'>
        <h2>Speed Feedback</h2>
        <div class="gauge-box">
            <div data-labelheight="10" style="height: 170px; background: transparent; margin: 0 auto;" id="gauge-vfdspeedfdbk" data-chart="solidgauge" data-nodename="vfdipp.vfdspeedfdbk" data-units="Hz" data-min="0" data-max="100" data-colors="0.1:#DF5353,0.5:#DDDF0D,0.9:#55BF3B" data-valuefontsize="18px"></div>
            <span data-timeupdate="vfdspeedfdbk"><%= channels["vfdipp.vfdspeedfdbk"].timestamp %></span>
        </div>
    </div>
    <!-- <div class='col-xs-4 text-center box-me'>
        <h2>Speed Reference</h2>
        <div class="gauge-box">
            <div data-labelheight="10" style="height: 170px; background: transparent; margin: 0 auto;" id="gauge2" data-chart="solidgauge" data-nodename="vfdipp.vfdspeedref" data-units="Hz" data-min="0" data-max="100" data-colors="0.1:#DF5353,0.5:#DDDF0D,0.9:#55BF3B" data-decimals="2" data-valuefontsize="18px"></div>
            <span data-timeupdate="vfdspeedref"><%= channels["vfdipp.vfdspeedref"].timestamp %></span>
        </div>
    </div> -->
    <div class='col-xs-4 text-center box-me'>
        <h2>Output Current</h2>
        <div class="gauge-box">
            <div data-labelheight="10" style="height: 170px; background: transparent; margin: 0 auto;" id="gauge-vfdoutputcurrent" data-chart="solidgauge" data-nodename="vfdipp.vfdoutputcurrent" data-units="A" data-min="0" data-max="<%= channels["vfdipp.vfdnameplatefla"].value %>" data-colors="0.1:#DF5353,0.5:#DDDF0D,0.9:#55BF3B" data-valuefontsize="18px"></div>
            <span data-timeupdate="vfdoutputcurrent"><%= channels["vfdipp.vfdoutputcurrent"].timestamp %></span>
        </div>
    </div>
    <div class='col-xs-4 text-center box-me'>
        <h2>Output Voltage</h2>
        <div class="gauge-box">
            <div data-labelheight="10" style="height: 170px; background: transparent; margin: 0 auto;" id="gauge-vfdoutputvoltage" data-chart="solidgauge" data-nodename="vfdipp.vfdoutputvoltage" data-units="V" data-min="0" data-max="600" data-colors="0.1:#DF5353,0.5:#DDDF0D,0.9:#55BF3B" data-valuefontsize="18px"></div>
            <span data-timeupdate="vfdoutputvoltage"><%= channels["vfdipp.vfdoutputvoltage"].timestamp %></span>
        </div>
    </div>
    <div class='col-xs-4 text-center box-me'>
        <h2>DC Bus Voltage</h2>
        <div class="gauge-box">
            <div data-labelheight="10" style="height: 170px; background: transparent; margin: 0 auto;" id="gauge-vfddcbusvoltage" data-chart="solidgauge" data-nodename="vfdipp.vfddcbusvoltage" data-units="V" data-min="0" data-max="700" data-colors="0.1:#DF5353,0.5:#DDDF0D,0.9:#55BF3B" data-valuefontsize="18px"></div>
            <span data-timeupdate="vfddcbusvoltage"><%= channels["vfdipp.vfddcbusvoltage"].timestamp %></span>
        </div>
    </div>
    <div class='col-xs-4 text-center box-me'>
        <h2>VFD Status</h2>
        <div class="gauge-box">
            <table class="table">
                <tbody>
                    <tr>
                        <td>VFD Active</td>
                        <td>
                            <% if (channels["vfdipp.vfdactive"].value == 1){ %>
                                <span class="label label-success">True</span>
                            <% } else { %>
                                <span class="label label-danger">False</span>
                            <% } %>
                        </td>
                    </tr>

                    <tr>
                        <td>VFD Ready</td>
                        <td>
                            <% if (channels["vfdipp.vfdready"].value == 1){ %>
                                <span class="label label-success">True</span>
                            <% } else { %>
                                <span class="label label-danger">False</span>
                            <% } %>
                        </td>
                    </tr>

                    <tr>
                        <td>VFD At Speed</td>
                        <td>
                            <% if (channels["vfdipp.vfdatspeedref"].value == 1){ %>
                                <span class="label label-success">True</span>
                            <% } else { %>
                                <span class="label label-danger">False</span>
                            <% } %>
                        </td>
                    </tr>

                    <tr>
                        <td>VFD Disabled</td>
                        <td>
                            <% if (channels["vfdipp.vfddisabled"].value == 1){ %>
                                <span class="label label-danger">True</span>
                            <% } else { %>
                                <span class="label label-success">False</span>
                            <% } %>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    <div class='col-xs-4 text-center box-me'>
        <h2>VFD Faults</h2>
        <div class="gauge-box">
            <table class="table">
                <tbody>
                <tr>
                    <td>VFD Faulted</td>
                    <td>
                    <% if (channels["vfdipp.vfdfault"].value == 1){ %>
                        <span class="label label-danger">True</span>
                    <% } else { %>
                        <span class="label label-success">False</span>
                    <% } %>
                    </td>
                </tr>

                <tr>
                    <td>VFD Fault Code</td>
                    <td>
                        <% if (channels["vfdipp.vfdfaultcode"].value == 0) { %>
                            <span class="vfdFault">None</span>
                        <% } else if (channels["vfdipp.vfdfaultcode"].value == 2) { %>
                            <span class="vfdFault">Auxiliary Input</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 3 ) { %>
                            <span class="vfdFault">Power Loss</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 4 ) { %>
                            <span class="vfdFault">UnderVoltage</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 5 ) { %>
                            <span class="vfdFault">OverVoltage</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 6 ) { %>
                            <span class="vfdFault">Motor Stalled</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 7 ) { %>
                            <span class="vfdFault">Motor Overload</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 8 ) { %>
                            <span class="vfdFault">Heatsink OverTemp</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 9 ) { %>
                            <span class="vfdFault">Control Module OverTemp</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 12 ) { %>
                            <span class="vfdFault">Hardware OverCurrent</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 13 ) { %>
                            <span class="vfdFault">Ground Fault</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 15 ) { %>
                            <span class="vfdFault">Load Loss</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 21 ) { %>
                            <span class="vfdFault">Output Phase Loss</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 29 ) { %>
                            <span class="vfdFault">Analog Input Loss</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 33 ) { %>
                            <span class="vfdFault">Auto Restart Tries Exceeded</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 38 ) { %>
                            <span class="vfdFault">Phase U Ground Fault</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 39 ) { %>
                            <span class="vfdFault">Phase V Ground Fault</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 40 ) { %>
                            <span class="vfdFault">Phase W Ground Fault</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 41 ) { %>
                            <span class="vfdFault">Phase UV Short</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 42 ) { %>
                            <span class="vfdFault">Phase UW Short</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 43 ) { %>
                            <span class="vfdFault">Phase VW Short</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 48 ) { %>
                            <span class="vfdFault">Parameters Defaulted</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 59 ) { %>
                            <span class="vfdFault">Safety Open</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 63 ) { %>
                            <span class="vfdFault">Software OverCurrent</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 64 ) { %>
                            <span class="vfdFault">Drive Overload</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 70 ) { %>
                            <span class="vfdFault">Power Unit Failure</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 71 ) { %>
                            <span class="vfdFault">DSI Network Loss</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 72 ) { %>
                            <span class="vfdFault">Option Card Network Loss</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 73 ) { %>
                            <span class="vfdFault">Ethernet Network Loss</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 80 ) { %>
                            <span class="vfdFault">Autotune Failure</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 81 ) { %>
                            <span class="vfdFault">DSI Communications Loss</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 82 ) { %>
                            <span class="vfdFault">Option Card Communications Loss</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 83 ) { %>
                            <span class="vfdFault">Ethernet Communications Loss</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 91 ) { %>
                            <span class="vfdFault">Encoder Loss</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 94 ) { %>
                            <span class="vfdFault">Function Loss</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 100 ) { %>
                            <span class="vfdFault">Parameter Checksum Error</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 101 ) { %>
                            <span class="vfdFault">External Storage Failure</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 105 ) { %>
                            <span class="vfdFault">Control Module Connection Error</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 106 ) { %>
                            <span class="vfdFault">Incompatible Control Module</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 107 ) { %>
                            <span class="vfdFault">Replaced Control Module not Recognized</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 109 ) { %>
                            <span class="vfdFault">Mismatched Control Module</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 110 ) { %>
                            <span class="vfdFault">Keypad Membrane Failure</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 111 ) { %>
                            <span class="vfdFault">Safety Hardware Malfunction</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 114 ) { %>
                            <span class="vfdFault">Microprocessor Failure</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 122 ) { %>
                            <span class="vfdFault">IO Board Failure</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 125 ) { %>
                            <span class="vfdFault">Flash Update Required</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 126 ) { %>
                            <span class="vfdFault">Non-recoverable Firmware Error</span>
                		<% } else if (channels["vfdipp.vfdfaultcode"].value == 127 ) { %>
                            <span class="vfdFault">DSI Flash Update Required</span>
                        <% } %>
                    </td>
                </tr>

                </tbody>

            </table>
        </div>
    </div>
</div>

<div class="text-center"><h1>TRENDS</h1></div>
<div class="row">
  <div class='col-xs-12' style="padding-top: 1em; margin-bottom: 1em;">
     <div class="input-daterange input-group" id="datepicker">
         <input data-chartid="dynamicChart" id="fromDate" data-daysofhistory="7"  type="text" class="form-control" name="start">
          <span class="input-group-addon">to</span>
         <input class="form-control" data-chartid="dynamicChart" id="toDate" type="text"  name="end">
          <span class='input-group-btn'>
             <a href="#!" data-chartid="dynamicChart" data-otherchartids="statusTimeline" class="btn chart-update btn-theme">Run</a>
          </span>
      </div>
  </div>
  <hr>
  <div class='clearfix col-xs-12' style='height: 300px' id="dynamicChart" data-chart="dynamicchart" data-daysofhistory="7"  data-chartlabel="Data" data-ylabel="" data-xlabel="Date" data-units=""  data-channelnames="vfdipp.vfdspeedref,vfdipp.vfdspeedfdbk,vfdipp.vfdoutputcurrent,vfdipp.vfdoutputcurrent,vfdipp.vfddcbusvoltage"></div>
</div>

<div class="text-center"><h1>CONFIGURATION</h1></div>
<div class="row row-flex">
    <div class="col-md-6 box-me text-center">
        <h2>MOTOR NAMEPLATE DATA</h2>
        <table class="table">
            <tbody>
                <tr>
                    <td>Motor FLA</td>
                    <td><%= channels["vfdipp.vfdnameplatefla"].value %> A</td>
                </tr>

                <tr>
                    <td>Motor HP</td>
                    <td><%= Math.round(channels["vfdipp.vfdnameplatehp"].value * 10) / 10 %> HP</td>
                </tr>

                <tr>
                    <td>Motor RPM</td>
                    <td><%= channels["vfdipp.vfdnameplaterpm"].value %> RPM</td>
                </tr>

                <tr>
                    <td>Motor Frequency</td>
                    <td><%= channels["vfdipp.vfdnameplatehz"].value %> Hz</td>
                </tr>

                <tr>
                    <td>Motor Overload Current</td>
                    <td><%= channels["vfdipp.vfdnameplateolcurrent"].value %> A</td>
                </tr>

                <tr>
                    <td>Motor Volts</td>
                    <td><%= channels["vfdipp.vfdnameplatevolts"].value %> V</td>
                </tr>

                <tr>
                    <td>Motor Poles</td>
                    <td><%= channels["vfdipp.vfdmotorpoles"].value %></td>
                </tr>
            </tbody>
        </table>
    </div>

    <div class="col-md-6 box-me text-center">
        <h2>VFD SETTINGS</h2>
        <table class="table">
            <tbody>
                <tr>
                    <td>Min. Frequency</td>
                    <td><%= channels["vfdipp.vfdminfreq"].value %> Hz</td>
                </tr>

                <tr>
                    <td>Max. Frequency</td>
                    <td><%= channels["vfdipp.vfdmaxfreq"].value %> Hz</td>
                </tr>

                <tr>
                    <td>Accel. Time</td>
                    <td><%= channels["vfdipp.vfdacceltime"].value %> s.</td>
                </tr>

                <tr>
                    <td>Decel. Time</td>
                    <td><%= channels["vfdipp.vfddeceltime"].value %> s.</td>
                </tr>

                <tr>
                    <td>Stop Mode</td>

                    <td>
                        <% if (channels["vfdipp.vfdstopmode"].value == 0){ %>
                            <span class="label label-success">Coast</span>
                        <% } else if (channels["vfdipp.vfdstopmode"].value == 1){ %>
                            <span class="label label-danger">Ramp</span>
                        <% } else if (channels["vfdipp.vfdstopmode"].value == 2){ %>
                            <span class="label label-danger">Ramp to Hold</span>
                        <% } else if (channels["vfdipp.vfdstopmode"].value == 3){ %>
                            <span class="label label-danger">DC Brake</span>
                        <% } else if (channels["vfdipp.vfdstopmode"].value == 4){ %>
                            <span class="label label-danger">DCBrkAutoOff</span>
                        <% } else if (channels["vfdipp.vfdstopmode"].value == 5){ %>
                            <span class="label label-danger">Current Limit</span>
                        <% } else if (channels["vfdipp.vfdstopmode"].value == 6){ %>
                            <span class="label label-danger">Fast Brake</span>
                        <% } %>
                    </td>
                </tr>

                <tr>
                    <td>Torque Perf. Mode</td>
                    <td>
                        <% if (channels["vfdipp.vfdtorqueperfmode"].value == 0){ %>
                            <span class="label label-danger">V/Hz</span>
                        <% } else if (channels["vfdipp.vfdtorqueperfmode"].value == 1){ %>
                            <span class="label label-success">SVC</span>
                        <% } else if (channels["vfdipp.vfdtorqueperfmode"].value == 2){ %>
                            <span class="label label-danger">Economize</span>
                        <% } else if (channels["vfdipp.vfdtorqueperfmode"].value == 3){ %>
                            <span class="label label-danger">Vector</span>
                        <% } %>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</div>

<style>
    .box-me {
        position: relative;
        padding: 0.5em;
        padding-bottom: 1.5em;
        border: 1px solid #eee;
        /*margin: 1em 0;*/
    }
    .box-me .gauge-box {
        margin-top: -0.25em;
    }
    .box-me h2 {
        text-transform: uppercase;
        font-size: 14px;
        color: #666;
        font-weight: 400;
        letter-spacing: 1px;
        z-index: 100;
    }
    .dynamic-chart-form {
        background-color: whiteSmoke;
        padding: 1em 0.5em;
        margin-top: 1em;
    }

    .row-flex {
        display: -webkit-box;
        display: -webkit-flex;
        display: -ms-flexbox;
        display:         flex;
        flex-wrap: wrap;
    }
    .row-flex > [class*='col-'] {
        display: flex;
        flex-direction: column;
    }

    #systemStatusTimelineContainer h2 {
        text-transform: uppercase;
        font-size: 14px;
        color: #666;
        font-weight: 400;
        letter-spacing: 1px;
        z-index: 100;
    }
</style>
