diff --git a/deploy/runtime/macros/MEwave/ME Wave Report Export Table.lk b/deploy/runtime/macros/MEwave/ME Wave Report Export Table.lk new file mode 100644 index 0000000000..9aec074634 --- /dev/null +++ b/deploy/runtime/macros/MEwave/ME Wave Report Export Table.lk @@ -0,0 +1,1426 @@ +//Marine Energy (ME) Model Macro + +//Mar 2020 + +/*@ +This macro generates a report summary for the system modeled in the existing Marine Energy Wave case. The additional user inputs are used to provide a description of the device and to inform a capture width ratio calculation.

+ + +
Instructions:
+
    +
  1. Using the interface at the right, enter the company name, device name, device model, and device model year.
    +
  2. Select the device type from the dropdown that best describes the modeled device.
    +
  3. Select the technology readiness level (TRL) that best describes the modeled device.
    +
  4. Select the power take-off (PTO) that best describes the modeled device.
    +
  5. Select the foundation type that best describes the modeled device.
    +
  6. Enter the structural mass of the device in metric tonnes. The structural mass includes:
    + +
  7. Select the primary structural material of the device.
    +
  8. Enter the WEC's characteristic dimension in meters. + +
  9. Select an option for device scale. + +
  10. Click 'Run macro' to generate the report that will open in your browser. If "Other" is selected for any input, you will be prompted to enter a custom description or value when the macro runs.To save the report, use the browser's print to PDF feature. +
+@*/ + +// Macro user interface widgets +//@ name=companyName;type=text;label=Company Name;value= +//@ name=deviceName;type=text;label=Device Name;value= +//@ name=deviceModel;type=text;label=Device Model;value= +//@ name=deviceModelYear;type=number;label=Device Model Year;value= +//@ name=deviceType;type=combo;value=Attenuator,Point Absorber,Oscillating Wave Surge,Oscillating Water Column,Overtopping/Terminator,Submerged Pressure Differential,Bulge Wave,Rotating Mass,Flexible Material,Other;label=Device Type +//@ name=deviceTRL;type=combo;value=1,2,3,4,5,6,7,8,9;label=TRL +//@ name=ptoType;type=combo;value=Synchronous,Permanent Magnet Synchronous,Induction,Doubly Fed Induction,Other;label=PTO Type +//@ name=foundationType;type=combo;value=Floating: Taut Mooring,Floating: Semi-Taut Mooring,Floating: Catenary Mooring,Floating: Dynaminc Positioning,Bottom Fixed: Gravity Based,Bottom Fixed: Pile Foundation,Other;label=Foundation Type +//@ name=deviceMass;type=number;label=Structural Mass (t);value= +//@ name=deviceMaterial;type=combo;value=Steel A-36,Steel Reinforced Concrete,High-density Polyethylene (HDPE),Coated Fabric,Aluminum - 5083,Fiberglass (E-Glass/Epoxy),Filament Wound Fiberglass,Other;label=Primary Structural Material +//@ name=charDia;type=number;label=Characteristic Dimension (m);value= +//@ name=deviceScale;type=combo;value=Full Scale,Other;label=Device Scale; + + +//check that the MEwave System and LCOE model are used, and that there is an active case + +if ( typeof(macro) == 'unknown' ) +{ + msgbox('This macro must be run from within a case.'); + + exit; +} +case = active_case(); + +if (case == '') + +{ + + msgbox('You must set an active case, MEwave/LCOE Calculator.'); + + exit; + +} + +config = configuration(); + +if (config[0] != 'MEwave') + +{ + + msgbox('The ME Wave report macro only works with MEwave System selected as the technology model.'); + + exit; + +} + +if (config[1] != 'LCOE Calculator') + +{ + + msgbox('The ME Wave report macro only works with the LCOE Calculator selected as the financial model.'); + + exit; + +} +//run the simulation and show the results page + +simulate('', true); + +//show_page('results'); +currentCase = case_name(); + +//get user inputs for device characteristics not required in SAM + +// get device related user inputs +companyName = macro.companyName; +//outln(companyName); + +deviceName = macro.deviceName; +//outln(deviceName); + +deviceMake = macro.deviceMake; +//outln(deviceMake); + +deviceModel = macro.deviceModel; +//outln(deviceModel); + +deviceModelYear = macro.deviceModelYear; +//outln(deviceModelYear); + +//get the device type + +deviceType = macro.deviceType; + +if (deviceType=='Other') + +{ + deviceType = in('Enter the device type that best describes the wave energy converter.','','Enter Value'); +} + +//outln('Device Type = '+ deviceType); +// get device TRL +deviceTRL = macro.deviceTRL; + +//get the PTO type + +ptoType = macro.ptoType; + +if (ptoType=='Other') + +{ + ptoType = in('Enter the PTO type of the device.','','Enter Value'); +} + +//outln('Device PTO Type = ' + ptoType); + +//get the device scale + +deviceScale = macro.deviceScale; + +if (deviceScale=='Other') + +{ + deviceScale = in('Enter the scale for the device modeled in the existing ME Wave case as a fraction.','','Enter Value'); +} + +//outln('Device Scale = ' + deviceScale); + +// get foundation and mooring type + +foundationType = macro.foundationType; + +if (foundationType=='Other') + +{ + foundationType = in('Enter the foundation or mooring type for the device modeled in the existing ME Wave case.','','Enter Value'); +} +//outln('Foundation/Mooring type = ' + foundationType); + +// get the structural mass + +deviceMass = macro.deviceMass; + +if (deviceMass==0) + +{ + deviceMass = 'N/A'; +} +else +{ +deviceMass = macro.deviceMass + " tonnes"; +} +//outln('Device Mass = ' + deviceMass); + +//Get the device material + +deviceMaterial = macro.deviceMaterial; + +if (deviceMaterial=='Other') + +{ + deviceMaterial = in('Enter the primary structural material for the device modeled in the existing ME Wave case.','','Enter Value'); +} + +//Table construction +csv_table = [[]]; +//csv_table[0] = ["companyName", "-", companyName]; +/* +file_name = choose_file(); +check = csvwrite(file_name, csv_table); +outln(check); +*/ +/* +csv_table[0][0] = "Company_Name"; +csv_table[0][1] = "WEC_Name"; +csv_table[0][2] = "Device_Model"; +csv_table[0][3] = "Device_Model_Year"; +csv_table[0][4] = "WEC_Type"; +csv_table[0][5] = "TRL"; +csv_table[0][6] = "PTO_Type"; +csv_table[0][7] = "Foundation_Type"; +csv_table[0][7] = "Structural_Mass"; +csv_table[0][7] = "Primary_Structural_Material"; +csv_table[0][7] = "Characteristic_Dimension"; +csv_table[0][7] = "Device_Scale"; +csv_table[0][7] = "Device_Rated_Power"; +csv_table[0][7] = "Device_Average_Power"; +csv_table[0][7] = "Capacity_Factor"; +csv_table[0][7] = "AEP"; +csv_table[0][7] = "Resource_type"; +csv_table[0][7] = "Resource_Name"; +*/ +csv_table_rows = ["Company_Name","WEC_Name","Device_Model","Device_Model_Year","WEC_Type", + "TRL","PTO_Type","Foundation_Type","Structural_Mass","Primary_Structural_Material","Characteristic_Dimension","Device_Scale","Device_Rated_Power", + "Device_Average_Power","Capacity_Factor","AEP","Resource_type","Resource_Name", + "Location","Latitude","Longitude","Buoy_Number", "Bathymetry","Seabed", "Avg_Power_Flux","Rated_Array_Capacity", + "Number_of_Devices","Distance_to_Shore","Depth","Device_Spacing","Row_Spcaing","Total_Assumed_Losses", + "CAPEX","OPEX","LCOE","FCR","Structural_Assembly","Power_Take_off","Mooring_Foundation_and_Subsystem", + "Development","Engineering_and_Management", "Electrical_Infrastructure","Plant_Commissioning","Site_Access","Assembly_and_Install", + "Other_Infrastructure","Project_Contingency_Budget","Insurance_during_Construction","Reserve_Accounts", "Operations", "Maintenance"]; + +//outln('Device Material = ' + deviceMaterial); + + +//get outputs for result summary from MEwave SAM run +//get performance and financial outputs + +aep = get('annual_energy'); + +//outln('AEP = ' + aep); + +lcoe = get('lcoe_fcr'); +//outln('LCOE = ' + lcoe); + +fcr = get('fixed_charge_rate'); +//outln('FCR = ' + fcr); + +capacityFactor = get('capacity_factor'); +//outln('Capacity Factor = ' + capacityFactor); + +totalLoss = get('loss_total'); +//outln('Total Losses assumed = ' + totalLoss); + +//get wave resource info + +waveResourceAvg = get('average_power_flux'); +//outln('Wave Resource Average = '+ waveResourceAvg); + +if (get('use_specific_wf_wave')==1) +{ + resourceName = 'Custom Resource'; + //outln(resourceName); + + resourceLocation = 'N/A'; + //outln('Location = ' + resourceLocation); + + latitude = 'N/A'; + + longitude = 'N/A'; + + buoyNumber = 'N/A'; + + bathymetry = 'N/A'; + + seabed = 'N/A'; + +} + +else +{ + resourceName = get('name'); + + + resourceLocation = get('city') + (', ') + get('state') + (', ') + get('country'); + + + latitude = get('lat'); + + + longitude = get('lon'); + + + buoyNumber = get('nearby_buoy_number'); + + + bathymetry = get('bathymetry'); + + + seabed = get('sea_bed'); + +} + +resource_type = get('wave_resource_model_choice'); +if (resource_type == 0) resourceType = "Frequency of Occurence"; +else resourceType = "Time Series"; +//get device info + +deviceRatedPower = get('device_rated_power'); +//outln('Device Rated Power = ' + deviceRatedPower); + +deviceMeanPower = get('device_average_power'); +//outln('Device mean power = '+ deviceMeanPower); + +// get the characteristic diameter of the device + +charDia = macro.charDia; + +// Capture width calculation CW = P/J + +captureWidth = (deviceMeanPower/waveResourceAvg); +//outln('CW = ' + captureWidth); + +if (charDia>0) +{ + captureWidthRatio = sprintf("%.1f",(captureWidth/charDia*100))+"%"; + charDia = macro.charDia + " m"; + //outln('Characteristic Diameter = ' + charDia); + //outln('CWR = ' + captureWidthRatio); +} +else +{ + captureWidthRatio = 'N/A'; + charDia = 'N/A'; + //outln('Characteristic Diameter = ' + charDia); + //outln('CWR = ' + captureWidthRatio); +} + + +//get array info + +arrayRatedPower = get('system_capacity'); +//outln('Array Rated Power = ' + arrayRatedPower); + +deviceCount = get('number_devices'); +//outln('Number of devices in array = ' + deviceCount); + +distanceToShore = get('distance_to_shore'); +//outln('Distance to Shore = ' + distanceToShore/1000); + +waterDepth = get('water_depth'); +//outln('Water Depth = ' + waterDepth); + +deviceSpacing = get('device_spacing_in_row'); +//outln('Device Spacing = ' + deviceSpacing); + +rowSpacing = get('row_spacing'); +//outln('Row Spacing = ' + rowSpacing); + +devicesPerRow = get('devices_per_row'); +//outln('Devices per row= ' + devicesPerRow); + +numberOfRows = get('number_rows'); +//outln('Number of Rows = ' + numberOfRows); + +arrayWidth = (devicesPerRow-1)*deviceSpacing; +arrayLength = (numberOfRows-1)*rowSpacing; +arrayArea = ((arrayWidth*arrayLength)/1000); +//outln('Array Area= '+ arrayArea); + +//get costs for the charts + +capex = round(get('ui_capital_cost_reference')); +//outln('Total CapEx = ' + capex); + +//get device costs + +mecTotalCost = get('device_costs_total'); + +structure = get('structural_assembly_cost'); +//outln('Structural Assembly Cost = '+ structure); + +pto = get('power_takeoff_system_cost'); +//outln('Total Power Take-off Costs = ' + pto); + +foundation = get('mooring_found_substruc_cost'); +//outln('Mooring, Foundation, and Substructure Costs = ' + foundation); + +//get balance of system costs + +bosTotalCost = get('balance_of_system_cost_total'); + +development = get('development_cost'); +//outln('Development Costs = ' + development); + +engmanag = get('eng_and_mgmt_cost'); +//outln('Engineering and Management Costs = ' + engmanag); + +elecinfrast = get('elec_infras_cost'); +//outln('Electrical Infrastructure Costs = ' + elecinfrast); + +commissioning = get('plant_commissioning_cost'); +//outln('Plant Commissioning Costs = ' + commissioning); + +access = get('site_access_port_staging_cost'); +//outln('Site Access, Port, and Staging Costs = ' + access); + +install = get('assembly_and_install_cost'); +//outln('Assembly and Installation Costs = ' + install); + +otherinfras = get('other_infrastructure_cost'); +//outln('Other Infrastructure Costs = ' + otherinfras); + +//get financial costs + +projectContingency = get('project_contingency_budget_cost'); +//outln('Project Contingency = ' + projectContingency); + +insurance = get('insurance_during_construction_cost'); +//outln('Insurance costs = ' + insurance); + +reserveAccounts = get('reserve_accounts_cost'); +//outln('Reserve Accounts + ' + reserveAccounts); + +financial = get('financial_cost_total'); +//outln('Total Financial Costs = ' + financial); + +//get Opex related costs + +//get total Opex + +opex = get('total_operating_cost'); +//outln('Total OpEx = ' + opex); + +//get operation costs + +operations = get('operations_cost'); + +//get maintenance cost + +maintenance = get('maintenance_cost'); +//outln('maintenance = ' + maintenance); + +//Determine if costs are modeled or input from user + +//Structural cost + +if (get('structural_assembly_cost_method') != 2) +{ + costTypeStructure = 'user defined'; +} +else +{ + costTypeStructure = 'modeled'; +} + +//outln('Structural cost is a ' + costTypeStructure + ' value.'); + +//get PTO cost type + +if (get('power_takeoff_system_cost_method') != 2) +{ + costTypePto = 'user defined'; +} +else +{ + costTypePto = 'modeled'; +} + +//outln('Power Take-off costs are a ' + costTypePto + ' value.'); + +//get foundation and mooring cost type + +if (get('mooring_found_substruc_cost_method') !=2) +{ + costTypeFoundation = 'user defined'; +} +else +{ + costTypeFoundation = 'modeled'; +} + +//outln('Foundation and mooring costs are a ' + costTypeFoundation + ' value.'); + +//get development cost type + +if (get('development_cost_method') !=2) +{ + costTypeDevelopment = 'user defined'; +} +else +{ + costTypeDevelopment = 'modeled'; +} + +//outln('Development costs are a ' + costTypeDevelopment + ' value.'); + +//get engineering and management cost type + +if (get('eng_and_mgmt_cost_method') != 2) +{ + costTypeEngmanag = 'user defined'; +} + +else +{ + costTypeEngmanag = 'modeled'; +} + +//outln('Engineering & management costs are a ' + costTypeEngmanag + ' value.'); + +//get commissioning cost type + +if (get('plant_commissioning_cost_method') != 2) +{ + costTypeCommissioning = 'user defined'; +} + +else +{ + costTypeCommissioning = 'modeled'; +} + +//outln('Commissioning costs are a ' + costTypeCommissioning + ' value.'); + +//get site access cost type + +if (get('site_access_port_staging_cost_method') != 2) + +{ + costTypeAccess = 'user defined'; +} + +else +{ + costTypeAccess = 'modeled'; +} + +//outln('Site access, port, and staging costs are a ' + costTypeAccess + ' value.'); + + +// get installation cost type + +if (get('assembly_and_install_cost_method') != 2) + +{ + costTypeInstall = 'user defined'; +} + +else +{ + costTypeInstall = 'modeled'; +} + +//outln('Assembly and Installation costs are a ' + costTypeInstall + ' value.'); + +//get other infrastructure cost type + +if (get('other_infrastructure_cost_method') != 2) + +{ + costTypeOtherinfras = 'user defined'; +} + +else +{ + costTypeOtherinfras = 'modeled'; +} + +//outln('Other Infrastructure costs are a ' + costTypeOtherinfras + ' value.'); + +//get financial cost type + +//get project contingency cost type + +if (get('project_contingency_cost_method') != 2) + +{ + costTypeProjCont = 'user defined'; +} + +else +{ + costTypeProjCont = 'modeled'; +} + +//outln('Project contingency costs are a ' + costTypeProjCont + ' value.'); + +//get insurance cost type + +if (get('insurance_during_construction_method') != 2) + +{ + costTypeInsur = 'user defined'; +} + +else +{ + costTypeInsur = 'modeled'; +} + +//outln('Insurance costs are a ' + costTypeInsur + ' value.'); + +//get reserve account cost type + +if (get('reserve_accounts_cost_method') != 2) + +{ + costTypeResAcct = 'user defined'; +} + +else +{ + costTypeResAcct = 'modeled'; +} + +//outln('Reserce account costs are a ' + costTypeResAcct + ' value.'); + +//Electrical costs + +//Array cable cost type + +if (get('array_cable_system_cost_method') != 2) + +{ + costTypeElect = 'user defined'; +} + +// Export cable cost type + +if (get('export_cable_system_cost_method') != 2) + +{ + costTypeElect = 'user defined'; +} + +//Onshore substation cost type + +if (get('onshore_substation_cost_method') != 2) + +{ + costTypeElect = 'user defined'; +} + +//Offshore substation cost type + +if (get('offshore_substation_cost_method') != 2) + +{ + costTypeElect = 'user defined'; +} +//other electrical infrastructure cost type + +if (get('other_elec_infra_cost_method') != 2) + +{ + costTypeElect = 'user defined'; +} + +else +{ + costTypeElect = 'modeled'; +} + +//outln('Electrical costs are a ' + costTypeElect + ' value.'); + +//Get O&M cost type +// get operation cost type + +if (get('operations_cost_method') != 2) + +{ + costTypeOperate = 'user defined'; +} + +else +{ + costTypeOperate = 'modeled'; +} + +//outln('Operation costs are a ' + costTypeOperate + ' value.'); + +// get maintenance costs + +if (get('maintenance_cost_method') != 2) + +{ + costTypeMaint = 'user defined'; +} + +else +{ + costTypeMaint = 'modeled'; +} + +//outln('Maintenance costs are a ' + costTypeMaint + ' value.'); + + +//function to determine the $ contribution to LCOE of a given capital cost + +/*function lcoe_fraction(cost) + +{ + + return (fcr * cost )/ aep; + +}*/ +powerMatrix = get('wave_power_matrix'); +//outln(powerMatrix); +/* +xValuesPower = '[0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5]'; +xValuesPower = "'"+ xValuesPower+"'"; +outln(xValuesPower); + + +//yValuesPower = alloc(0,20); +//for (i=0; i < 20; i++) +//{ + //yValuesPower[0][i] = sprintf("%.2f",(powerMatrix[i+1][0])); +//} + +yValuesPower = '[0.25, 0.75, 1.25, 1.75, 2.25, 2.75, 3.25, 3.75, 4.25, 4.75, 5.25, 5.75, 6.25, 6.75, 7.25, 7.75, 8.25, 8.75, 9.25, 9.75]'; +//yValuesPower = "'"+ yValuesPower+"'"; +outln(yValuesPower); +*/ + +zValuesPower = alloc(20,21); +for (i=1; i < 21; i++) +for (j=1; j < 22; j++) + +{ + zValuesPower[i-1][j-1] = sprintf("%.2f",(powerMatrix[i][j])); +} +//outln(zValuesPower); + +resourceMatrix = get('wave_resource_matrix'); +//outln(resourceMatrix); +zValuesResource = alloc(20,21); +for (i=1; i < 21; i++) +for (j=1; j < 22; j++) + +{ + zValuesResource[i-1][j-1] = sprintf("%.2f",(resourceMatrix[i][j])); +} +//outln(zValuesResource); + +aepMatrix = get('annual_energy_distribution'); +//outln(aepMatrix); + +zValuesAep = alloc(20,21); +for (i=1; i < 21; i++) +for (j=1; j < 22; j++) +{ + zValuesAep[i-1][j-1] = round(aepMatrix[i][j]); +} +//outln(zValuesAep); + +csv_table_rows = ["Company_Name","WEC_Name","Device_Model","Device_Model_Year","WEC_Type", + "TRL","PTO_Type","Foundation_Type","Structural_Mass","Primary_Structural_Material","Characteristic_Dimension","Device_Scale","Device_Rated_Power", + "Device_Average_Power","Capacity_Factor","AEP","Resource_type","Resource_Name", + "Location","Latitude","Longitude","Buoy_Number", "Bathymetry","Seabed", "Avg_Power_Flux","Rated_Array_Capacity", + "Number_of_Devices","Distance_to_Shore","Depth","Device_Spacing","Row_Spcaing","Total_Assumed_Losses", + "CAPEX","OPEX","LCOE","FCR","Structural_Assembly","Power_Take_off","Mooring_Foundation_and_Subsystem", + "Development","Engineering_and_Management", "Electrical_Infrastructure","Plant_Commissioning","Site_Access","Assembly_and_Install", + "Other_Infrastructure","Project_Contingency_Budget","Insurance_during_Construction","Reserve_Accounts", "Operations", "Maintenance"]; +csv_table_units = ["Unitless","Unitless","Unitless","Year","Unitless","Unitless","Unitless","Unitless","Mg","Unitless","m","Unitless", + "kW","kW","%","kWh","Unitless","Unitless","Unitless","Unitless","Unitless", + "Unitless","Unitless","Unitless","kW/m","kW","Unitless","m","m","m","m","%", + "$","$","$/kWh","%","$","$","$","$","$","$","$","$","$","$","$","$", + "$","$","$"]; +csv_table_results = [companyName, deviceName, deviceModel, deviceModelYear, deviceType, + deviceTRL,ptoType,foundationType,deviceMass,deviceMaterial,charDia,deviceScale,deviceRatedPower, + deviceMeanPower,capacityFactor,aep,resourceType,resourceName,resourceLocation,latitude,longitude,buoyNumber,bathymetry,seabed,waveResourceAvg,arrayRatedPower, + deviceCount,distanceToShore,waterDepth,deviceSpacing,rowSpacing,totalLoss,capex,opex,lcoe,fcr, + structure,pto,foundation,development,engmanag,elecinfrast,commissioning,access,install,otherinfras,projectContingency, + insurance,reserveAccounts,operations,maintenance]; +final_table = [[]]; +final_table[0] = csv_table_rows; +final_table[1] = csv_table_units; +final_table[2] = csv_table_results; +fn = choose_file('','open data file', 'CSV Files(*.csv)|*.csv'); +csvwrite(fn, final_table); + +reportCode = +'' +'' + '' + + '' + '' + + '' + '' + + '' + '' + '' + + 'SAM ME Wave Energy Report' + +'' + +'' + '

System Advisor Model Wave Energy Project Summary

' + '

Project: '+ currentCase +'

' +'
' + '

Company: '+ companyName +'

' + '

Device Description

' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
Device Description
Device Name'+ deviceName +'
Device Model'+ deviceModel +'
Device Model Year'+ deviceModelYear +'
WEC Type'+ deviceType +'
Device Scale'+ deviceScale +'
Power Take-off Type'+ ptoType +'
Structural Mass'+ deviceMass +'
Primary Structural Material'+ deviceMaterial +'
Foundation and Mooring Type'+ foundationType +'
Characteristic Dimension'+ charDia +'
Technology Readiness Level'+ deviceTRL +'
' + '

Device Performance

' + '' + + '' + + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
*The device average power is calculated using the '+ resourceName +' resource.
Device Performance
Device Rated Power'+ deviceRatedPower + ' kW
*Device Average Power'+ sprintf("%.1f",deviceMeanPower) +' kW
Capture Width Ratio'+ captureWidthRatio +'
' +'
' +'
' + + '
' + '
' + '
' + + + '' + +'
' +'
' + '

Wave Resource

' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + ' ' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
Wave Resource Attributes
Resource Name'+ resourceName +'
Location'+ resourceLocation +'
Latitude'+ latitude +'
Longitude'+ longitude +'
Buoy Number'+ buoyNumber +'
Bathymetry'+ bathymetry +'
Seabed'+ seabed +'
Average Power Flux'+ sprintf("%.1f",waveResourceAvg) +' kW/m
' + + '
' + '
' + '
' + + '' +'
' +'
' + '

Array Design Parameters

' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + + '' + '' + '' + '' + '' + '
Array Design Parameters
Rated Array Capacity'+ sprintf("%,",arrayRatedPower) +' kW
Number of Devices'+ deviceCount +'
Distance to shore'+ distanceToShore/1000 +' km
Water Depth'+ waterDepth +' m
' +'
' +'
' + '

System Cost Breakdown

' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
Cost Category$ Thousands$/kWCost Type
Capital Expenditures'+ sprintf("$%,",round(capex/1000)) +''+ sprintf("$%,",round(capex/arrayRatedPower)) +'
Marine Energy Converter'+sprintf("$%,",round(mecTotalCost/10^3))+''+ sprintf("$%,",round(mecTotalCost/arrayRatedPower)) +'
Structural Assembly'+ sprintf("$%,",round(structure/10^3)) +''+ sprintf("$%,",round(structure/arrayRatedPower)) +''+ costTypeStructure +'
Power Take-off'+ sprintf("$%,",round(pto/10^3)) +''+ sprintf("$%,",round(pto/arrayRatedPower)) +''+ costTypePto +'
Mooring, Foundation, and Sub-structure'+ sprintf("$%,",round(foundation/10^3)) +''+ sprintf("$%,",round(foundation/arrayRatedPower)) +''+ costTypeFoundation +'
Balance of System'+ sprintf("$%,",round(bosTotalCost/10^3)) +''+ sprintf("$%,",round(bosTotalCost/arrayRatedPower)) +'
Development'+ sprintf("$%,",round(development/10^3)) +''+ sprintf("$%,",round(development/arrayRatedPower)) +''+ costTypeDevelopment +'
Engineering and Management'+ sprintf("$%,",round(engmanag/10^3)) +''+ sprintf("$%,",round(engmanag/arrayRatedPower)) +''+ costTypeEngmanag +'
Electrical Infrastructure'+ sprintf("$%,",round(elecinfrast/10^3)) +''+ sprintf("$%,",round(elecinfrast/arrayRatedPower)) +''+ costTypeElect +'
Plant Commissioning'+ sprintf("$%,",round(commissioning/10^3)) +''+ sprintf("$%,",round(commissioning/arrayRatedPower)) +''+ costTypeCommissioning +'
Site Access, Port & Staging'+ sprintf("$%,",round(access/10^3)) +''+ sprintf("$%,",round(access/arrayRatedPower)) +''+ costTypeAccess +'
Assembly & Installation'+ sprintf("$%,",round(install/10^3)) +''+ sprintf("$%,",round(install/arrayRatedPower)) +''+ costTypeInstall +'
Other Infrastructure'+ sprintf("$%,",round(otherinfras/10^3)) +''+ sprintf("$%,",round(otherinfras/arrayRatedPower)) +''+ costTypeOtherinfras +'
Financials'+ sprintf("$%,",round(financial/10^3)) +''+ sprintf("$%,",round(financial/arrayRatedPower)) +'
Project Contingency Budget'+ sprintf("$%,",round(projectContingency/10^3)) +''+ sprintf("$%,",round(projectContingency/arrayRatedPower)) +''+ costTypeProjCont +'
Insurance during Construction'+ sprintf("$%,",round(insurance/10^3)) +''+ sprintf("$%,",round(insurance/arrayRatedPower)) +''+ costTypeInsur +'
Reserve Accounts'+ sprintf("$%,",round(reserveAccounts/10^3)) +''+ sprintf("$%,",round(reserveAccounts/arrayRatedPower)) +''+ costTypeResAcct +'
Operational Expenditures'+ sprintf("$%,",round(opex/10^3)) +''+ sprintf("$%,",round(opex/arrayRatedPower)) +'
Operations'+ sprintf("$%,",round(operations/10^3)) +''+ sprintf("$%,",round(operations/arrayRatedPower)) +''+ costTypeOperate +'
Maintenance'+ sprintf("$%,",round(maintenance/10^3)) +''+ sprintf("$%,",round(maintenance/arrayRatedPower)) +''+ costTypeMaint +'
' +'
' + +'
' + +'

System Cost Breakdown

' + + '
' + + '
' + +'
' + +'
' + '

System Performance

' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
System Performance
Annual Energy Production'+ sprintf("%,",aep) +' kW/hrs
Capacity Factor'+ sprintf("%.1f",capacityFactor) +'%
Total Assumed Losses'+ totalLoss +'%
' + '
' + '
' + '
' + + '' +'
' +'
' + '

Financials

' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
Financials
Levelized Cost of Energy'+ sprintf("$%.2f",lcoe) +'
Fixed Charge Rate'+ sprintf("%.1f",fcr*100) +'%
' + + '
' + +'
' + +'' +'' + +''; + +report = tempfile('html'); //specify a temporary location to save the plot + +ok = write_text_file(report, reportCode); +if (!ok) + { + msgbox('Report rendering failed.'); + exit; + } +browse(report); + +msgbox('Please save the report opened in your browser as a PDF.'); + +//// Delete temporary chart file + +remove_file(report); + + + + +/* +//option to choose file location to save the html code + +f_path=choose_dir(homedir(),'Save report');//Prompt user to choose file path + +report2 = f_path + '/SamReport.html'; + +ok = write_text_file(report2, reportCode); +browse(report2); +*/ + diff --git a/deploy/runtime/macros/MEwave/ME Wave Report.lk b/deploy/runtime/macros/MEwave/ME Wave Report.lk index d9e6076692..07ba70df50 100644 --- a/deploy/runtime/macros/MEwave/ME Wave Report.lk +++ b/deploy/runtime/macros/MEwave/ME Wave Report.lk @@ -187,6 +187,43 @@ if (deviceMaterial=='Other') deviceMaterial = in('Enter the primary structural material for the device modeled in the existing ME Wave case.','','Enter Value'); } +//Table construction +csv_table = [[]]; +//csv_table[0] = ["companyName", "-", companyName]; +/* +file_name = choose_file(); +check = csvwrite(file_name, csv_table); +outln(check); +*/ +/* +csv_table[0][0] = "Company_Name"; +csv_table[0][1] = "WEC_Name"; +csv_table[0][2] = "Device_Model"; +csv_table[0][3] = "Device_Model_Year"; +csv_table[0][4] = "WEC_Type"; +csv_table[0][5] = "TRL"; +csv_table[0][6] = "PTO_Type"; +csv_table[0][7] = "Foundation_Type"; +csv_table[0][7] = "Structural_Mass"; +csv_table[0][7] = "Primary_Structural_Material"; +csv_table[0][7] = "Characteristic_Dimension"; +csv_table[0][7] = "Device_Scale"; +csv_table[0][7] = "Device_Rated_Power"; +csv_table[0][7] = "Device_Average_Power"; +csv_table[0][7] = "Capacity_Factor"; +csv_table[0][7] = "AEP"; +csv_table[0][7] = "Resource_type"; +csv_table[0][7] = "Resource_Name"; +*/ +csv_table_rows = ["Company_Name","WEC_Name","Device_Model","Device_Model_Year","WEC_Type", + "TRL","PTO_Type","Foundation_Type","Structural_Mass","Primary_Structural_Material","Characteristic_Dimension","Device_Scale","Device_Rated_Power", + "Device_Average_Power","Capacity_Factor","AEP","Resource_type","Resource_Name", + "Location","Latitude","Longitude","Buoy_Number", "Bathymetry","Seabed", "Avg_Power_Flux","Rated_Array_Capacity", + "Number_of_Devices","Distance_to_Shore","Depth","Device_Spacing","Row_Spcaing","Total_Assumed_Losses", + "CAPEX","OPEX","LCOE","FCR","Structural_Assembly","Power_Take_off","Mooring_Foundation_and_Subsystem", + "Development","Engineering_and_Management", "Electrical_Infrastructure","Plant_Commissioning","Site_Access","Assembly_and_Install", + "Other_Infrastructure","Project_Contingency_Budget","Insurance_during_Construction","Reserve_Accounts", "Operations", "Maintenance"]; + //outln('Device Material = ' + deviceMaterial); @@ -258,6 +295,9 @@ else } +resource_type = get('wave_resource_model_choice'); +if (resource_type == 0) resourceType = "Frequency of Occurence"; +else resourceType = "Time Series"; //get device info deviceRatedPower = get('device_rated_power'); @@ -709,7 +749,31 @@ for (j=1; j < 22; j++) } //outln(zValuesAep); - +csv_table_rows = ["Company_Name","WEC_Name","Device_Model","Device_Model_Year","WEC_Type", + "TRL","PTO_Type","Foundation_Type","Structural_Mass","Primary_Structural_Material","Characteristic_Dimension","Device_Scale","Device_Rated_Power", + "Device_Average_Power","Capacity_Factor","AEP","Resource_type","Resource_Name", + "Location","Latitude","Longitude","Buoy_Number", "Bathymetry","Seabed", "Avg_Power_Flux","Rated_Array_Capacity", + "Number_of_Devices","Distance_to_Shore","Depth","Device_Spacing","Row_Spcaing","Total_Assumed_Losses", + "CAPEX","OPEX","LCOE","FCR","Structural_Assembly","Power_Take_off","Mooring_Foundation_and_Subsystem", + "Development","Engineering_and_Management", "Electrical_Infrastructure","Plant_Commissioning","Site_Access","Assembly_and_Install", + "Other_Infrastructure","Project_Contingency_Budget","Insurance_during_Construction","Reserve_Accounts", "Operations", "Maintenance"]; +csv_table_units = ["Unitless","Unitless","Unitless","Year","Unitless","Unitless","Unitless","Unitless","Mg","Unitless","m","Unitless", + "kW","kW","%","kWh","Unitless","Unitless","Unitless","Unitless","Unitless", + "Unitless","Unitless","Unitless","kW/m","kW","Unitless","km","m","m","m","kWh", + "%","%","$","$","$/kWh","%","$","$","$","$","$","$","$","$","$","$","$","$", + "$","$","$"]; +csv_table_results = [companyName, deviceName, deviceModel, deviceModelYear, deviceType, + deviceTRL,ptoType,foundationType,deviceMass,deviceMaterial,charDia,deviceScale,deviceRatedPower, + deviceMeanPower,capacityFactor,aep,resourceType,resourceName,resourceLocation,latitude,longitude,buoyNumber,bathymetry,seabed,waveResourceAvg,arrayRatedPower, + deviceCount,distanceToShore,waterDepth,deviceSpacing,rowSpacing,totalLoss,capex,opex,lcoe,fcr, + structure,pto,foundation,development,engmanag,elecinfrast,commissioning,access,install,otherinfras,projectContingency, + insurance,reserveAccounts,operations,maintenance]; +final_table = [[]]; +final_table[0] = csv_table_rows; +final_table[1] = csv_table_units; +final_table[2] = csv_table_results; +fn = choose_file(); +csvwrite(fn, final_table); reportCode = '' diff --git a/deploy/runtime/reports/mewave.samreport b/deploy/runtime/reports/mewave.samreport index 3e7302d923..10afad20d1 100644 Binary files a/deploy/runtime/reports/mewave.samreport and b/deploy/runtime/reports/mewave.samreport differ diff --git a/deploy/runtime/ui/Marine Costs - BoS.json b/deploy/runtime/ui/Marine Costs - BoS.json index e3b4217c42..4063ac287b 100644 --- a/deploy/runtime/ui/Marine Costs - BoS.json +++ b/deploy/runtime/ui/Marine Costs - BoS.json @@ -5155,7 +5155,7 @@ "\t\t\t[", "\t\t\t\t${plant_commissioning_cost_input} * ${system_capacity},", "\t\t\t\t${plant_commissioning_cost_input},", - "\t\t\t\t${plant_commissioning_cost_modeled_ui},\r", + "\t\t\t\t${plant_commissioning_cost_modeled},\r", "\t\t\t\t(${plant_commissioning_cost_input}*pow(${number_devices},-array_scaling_b_value))*${number_devices}", "\t\t\t];", "};", diff --git a/deploy/runtime/ui/Marine Costs - Site Access, Port & Staging.json b/deploy/runtime/ui/Marine Costs - Site Access, Port & Staging.json index d1b0414686..e71f326f0a 100644 --- a/deploy/runtime/ui/Marine Costs - Site Access, Port & Staging.json +++ b/deploy/runtime/ui/Marine Costs - Site Access, Port & Staging.json @@ -3523,7 +3523,7 @@ "\t\t\t[", "\t\t\t\t${site_access_port_staging_cost_input}*${system_capacity},", "\t\t\t\t${site_access_port_staging_cost_input},", - "\t\t\t\t${site_access_port_staging_cost_modeled_ui},", + "\t\t\t\t${site_access_port_staging_cost_modeled},", "\t\t\t\t${site_access_port_staging_cost_total},\r", "\t\t\t\t(${site_access_port_staging_cost_input}*pow(${number_devices},-array_scaling_b_value))*${number_devices}", "\t\t\t];", diff --git a/src/invoke.cpp b/src/invoke.cpp index 9d681d89b4..09803f8a97 100644 --- a/src/invoke.cpp +++ b/src/invoke.cpp @@ -3024,7 +3024,7 @@ void fcall_wavetoolkit(lk::invoke_t& cxt) SamApp::Settings().Write("wave_data_paths", wxJoin(paths, ';')); } } - if (file_list != "") wxMessageBox("Download complete.\n\nThe following files have been downloaded and added to your solar resource library:\n\n" + file_list, "NREL Hindcast Wave Data Download Message", wxOK); + if (file_list != "") wxMessageBox("Download complete.\n\nThe following files have been downloaded and added to your resource library:\n\n" + file_list, "NREL Hindcast Wave Data Download Message", wxOK); //EndModal(wxID_OK); }