Through row 116

This commit is contained in:
Anna Sidwell 2018-11-24 18:30:58 +00:00
parent 857634d1f1
commit 2fb4f8771c
4 changed files with 43 additions and 45 deletions

View File

@ -329,6 +329,7 @@ class LongCaseStudyForm(BaseCaseStudyForm):
'power_technology', 'power_technology',
'power_technology_other', 'power_technology_other',
'energy_storage_capacity', 'energy_storage_capacity',
'energy_transmission_capacity',
'maximum_power_output', 'maximum_power_output',
'discharge_time', 'discharge_time',
'contractor_or_supplier_of_technology', 'contractor_or_supplier_of_technology',

View File

@ -661,37 +661,22 @@ class CaseStudy(models.Model):
# 2.2.1.4 # 2.2.1.4
power_technology_other = models.CharField( power_technology_other = models.CharField(
verbose_name=_("Other power technology"), verbose_name=_("Further information about power technology"),
help_text=_("Please specify the power technology."),
max_length=128, max_length=128,
blank=True blank=True
) )
# 2.2.2
energy_storage_capacity = models.DecimalField( energy_storage_capacity = models.DecimalField(
verbose_name=_("Energy storage capacity"), verbose_name=_("Total storage capacity (kWh)"),
help_text=_("Enter the total capacity of the energy storage system in kilowatt-hours (kWh)."),
max_digits=20, max_digits=20,
decimal_places=3, decimal_places=3,
blank=True, blank=True,
null=True, null=True,
) )
# 2.2.2.1 energy_transmission_capacity = models.DecimalField(
maximum_power_output = models.DecimalField( verbose_name=_("Total transmission capacity (kW)"),
verbose_name=_('Maximum power output'), max_digits=20,
help_text=_('Enter the maximum power output of the storage system in kilowatts (kW).'),
max_digits=12,
decimal_places=3,
blank=True,
null=True,
)
# 2.2.2.2
discharge_time = models.DecimalField(
verbose_name=_('Time for discharge from full capacity'),
help_text=_('Enter the time it takes to discharge from full capacity at maximum power output (in hours).'),
max_digits=6,
decimal_places=3, decimal_places=3,
blank=True, blank=True,
null=True, null=True,
@ -700,7 +685,7 @@ class CaseStudy(models.Model):
# 2.2.3 # 2.2.3
contractor_or_supplier_of_technology = models.CharField( contractor_or_supplier_of_technology = models.CharField(
verbose_name=_('Contractor and/or supplier of technology'), verbose_name=_('Contractor and/or supplier of technology'),
help_text=_('List companies that act as contractors or suppliers of technology related to energy storage.'), help_text=_('List companies that act as contractors or suppliers  e.g. Siemens Gamesa, GE, Alstom, Vestas, Hanwha Q CELLS, Mitsubishi, First Solar, Jinko Solar, Trina Solar, Suzlon Energy, Statkraft, Shanghai Electric, Ballard Power Systems, Panasonic, etc'),
max_length=256, max_length=256,
blank=True blank=True
) )
@ -715,10 +700,12 @@ class CaseStudy(models.Model):
) )
# 2.2.5 # 2.2.5
additional_technical_details = models.CharField( additional_technical_details = models.TextField(
verbose_name=_("Additional technical or economic details"), verbose_name=_("Additional technical or economic details"),
help_text=_("Add any additional details such as: length, from-to, voltage, substations etc"), help_text=_("Add any additional details such as: length, from-to, voltage, \
max_length=512, substations, power output, (dis)charge rates, how this technology or \
project interacts with the energy system (e.g. provides reactive power \
to ensure power supply in phase etc.)"),
blank=True blank=True
) )

View File

@ -301,16 +301,10 @@ dd ul { padding-left: 0; margin-left: 0; }
{{ case_study.energy_storage_capacity }} TODO UNITS? {{ case_study.energy_storage_capacity }} TODO UNITS?
{% endif %} {% endif %}
{% if case_study.maximum_power_output %} {% if case_study.energy_transmission_capacity %}
<dt>{% trans "Maximum power output" %}: <dt>{% trans "Energy transmission capacity" %}:
<dd id="maximum_power_output"> <dd id="energy_transmission_capacity">
{{ case_study.maximum_power_output | intcomma }} W {{ case_study.energy_transmission_capacity }} TODO UNITS?
{% endif %}
{% if case_study.discharge_time %}
<dt>{% trans "Time for discharge from full capacity" %}:
<dd id="discharge_time">
{{ case_study.discharge_time | intcomma }} {% trans "seconds" %}
{% endif %} {% endif %}
{% if case_study.contractor_or_supplier_of_technology %} {% if case_study.contractor_or_supplier_of_technology %}

View File

@ -40,6 +40,14 @@
<!-- Conditional logic for hiding and un-hiding fields. --> <!-- Conditional logic for hiding and un-hiding fields. -->
<script> <script>
function showIf(thingToShow, whetherToShowIt) {
if (whetherToShowIt) {
$(thingToShow).show()
} else {
$(thingToShow).hide()
}
}
// Here we define the fields we need to conditionally toggle. // Here we define the fields we need to conditionally toggle.
// TODO: Move this knowledge out of the template // TODO: Move this knowledge out of the template
var conditionalFields = [ var conditionalFields = [
@ -102,13 +110,25 @@
name: "power_technology", name: "power_technology",
redraw: function() { redraw: function() {
const other = document.getElementById('id_id_power_technology_0_4') const other = document.getElementById('id_id_power_technology_0_4')
const showHide = document.getElementById('div_id_power_technology_other') const panel = document.getElementById('div_id_power_technology_other')
if (other.checked) { showIf(panel, other.checked)
$(showHide).show(); }
} else { },
$(showHide).hide();
} {
name: "power_technology",
redraw: function() {
const group = document.forms['case-study-form'].power_technology
// Storage / other
let showStorage = ['ES', 'OT'].includes(group.value)
// Transmission / heat / other
let showTransmission = ['PT', 'HN', 'OT'].includes(group.value)
showIf('#div_id_energy_storage_capacity', showStorage)
showIf('#div_id_energy_transmission_capacity', showTransmission)
} }
}, },
@ -134,11 +154,7 @@
const input = document.getElementById(option.input) const input = document.getElementById(option.input)
const section = document.getElementById(option.section) const section = document.getElementById(option.section)
if (input.checked) { showIf(section, input.checked)
$(section).show();
} else {
$(section).hide();
}
} }
} }
} }