acwk commited on
Commit
7b520d7
·
verified ·
1 Parent(s): ff6c3a6

Add 2 files

Browse files
Files changed (2) hide show
  1. index.html +278 -0
  2. prompts.txt +1 -0
index.html CHANGED
@@ -6,6 +6,7 @@
6
  <title>MV Cable & Transformer Sizing Tool</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
 
9
  <script>
10
  tailwind.config = {
11
  theme: {
@@ -45,6 +46,11 @@
45
  .input-highlight {
46
  border-left: 4px solid #00B4D8;
47
  }
 
 
 
 
 
48
  </style>
49
  </head>
50
  <body class="bg-gray-50 font-sans">
@@ -196,6 +202,74 @@
196
  </div>
197
  </div>
198
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  </div>
200
 
201
  <div class="bg-white rounded-xl shadow-md overflow-hidden">
@@ -560,6 +634,9 @@
560
  // Show results
561
  document.getElementById('cable-results').classList.remove('hidden');
562
 
 
 
 
563
  // Scroll to results
564
  document.getElementById('cable-results').scrollIntoView({ behavior: 'smooth' });
565
  }
@@ -604,6 +681,207 @@
604
  // Scroll to results
605
  document.getElementById('transformer-results').scrollIntoView({ behavior: 'smooth' });
606
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
607
  </script>
608
  <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=acwk/test" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
609
  </html>
 
6
  <title>MV Cable & Transformer Sizing Tool</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
10
  <script>
11
  tailwind.config = {
12
  theme: {
 
46
  .input-highlight {
47
  border-left: 4px solid #00B4D8;
48
  }
49
+ .chart-container {
50
+ position: relative;
51
+ height: 400px;
52
+ width: 100%;
53
+ }
54
  </style>
55
  </head>
56
  <body class="bg-gray-50 font-sans">
 
202
  </div>
203
  </div>
204
  </div>
205
+
206
+ <!-- Interactive Power Loss Diagram -->
207
+ <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8 result-card">
208
+ <div class="p-6">
209
+ <h3 class="text-xl font-bold text-darkblue mb-4 flex items-center">
210
+ <i class="fas fa-chart-line text-electric mr-3"></i> Power Loss Analysis
211
+ </h3>
212
+
213
+ <div class="mb-6">
214
+ <div class="flex flex-col md:flex-row gap-4 mb-4">
215
+ <div class="w-full md:w-1/3">
216
+ <label class="block text-gray-700 font-medium mb-2" for="chart-type">
217
+ Chart Type
218
+ </label>
219
+ <select id="chart-type" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-electric focus:border-transparent input-highlight">
220
+ <option value="length">Power Loss vs Cable Length</option>
221
+ <option value="current">Power Loss vs Load Current</option>
222
+ <option value="voltage">Power Loss vs System Voltage</option>
223
+ </select>
224
+ </div>
225
+ <div class="w-full md:w-1/3">
226
+ <label class="block text-gray-700 font-medium mb-2" for="cable-size-chart">
227
+ Cable Size (mm²)
228
+ </label>
229
+ <select id="cable-size-chart" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-electric focus:border-transparent input-highlight">
230
+ <option value="35">35 mm²</option>
231
+ <option value="50">50 mm²</option>
232
+ <option value="70">70 mm²</option>
233
+ <option value="95">95 mm²</option>
234
+ <option value="120">120 mm²</option>
235
+ <option value="150">150 mm²</option>
236
+ <option value="185">185 mm²</option>
237
+ <option value="240">240 mm²</option>
238
+ </select>
239
+ </div>
240
+ <div class="w-full md:w-1/3">
241
+ <label class="block text-gray-700 font-medium mb-2" for="chart-method">
242
+ Installation Method
243
+ </label>
244
+ <select id="chart-method" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-electric focus:border-transparent input-highlight">
245
+ <option value="buried">Buried Direct</option>
246
+ <option value="duct">In Duct</option>
247
+ <option value="tray">Cable Tray</option>
248
+ <option value="air">In Air</option>
249
+ </select>
250
+ </div>
251
+ </div>
252
+
253
+ <button onclick="updatePowerLossChart()" class="gradient-bg text-white px-6 py-2 rounded-full font-semibold hover:opacity-90 transition flex items-center">
254
+ <i class="fas fa-sync-alt mr-2"></i> Update Chart
255
+ </button>
256
+ </div>
257
+
258
+ <div class="chart-container">
259
+ <canvas id="powerLossChart"></canvas>
260
+ </div>
261
+
262
+ <div class="mt-6 bg-gray-50 p-4 rounded-lg">
263
+ <h4 class="font-semibold text-gray-700 mb-2">Key Observations:</h4>
264
+ <ul class="list-disc pl-5 text-gray-600 space-y-1">
265
+ <li>Power losses increase <span class="font-semibold">quadratically</span> with current (P = I²R)</li>
266
+ <li>Higher voltage systems show <span class="font-semibold">lower percentage</span> power losses</li>
267
+ <li>Larger cable sizes reduce losses but increase <span class="font-semibold">initial cost</span></li>
268
+ <li>Buried cables typically have <span class="font-semibold">better cooling</span> than tray installations</li>
269
+ </ul>
270
+ </div>
271
+ </div>
272
+ </div>
273
  </div>
274
 
275
  <div class="bg-white rounded-xl shadow-md overflow-hidden">
 
634
  // Show results
635
  document.getElementById('cable-results').classList.remove('hidden');
636
 
637
+ // Initialize power loss chart
638
+ initializePowerLossChart();
639
+
640
  // Scroll to results
641
  document.getElementById('cable-results').scrollIntoView({ behavior: 'smooth' });
642
  }
 
681
  // Scroll to results
682
  document.getElementById('transformer-results').scrollIntoView({ behavior: 'smooth' });
683
  }
684
+
685
+ // Power Loss Chart Variables
686
+ let powerLossChart;
687
+
688
+ // Initialize Power Loss Chart
689
+ function initializePowerLossChart() {
690
+ const ctx = document.getElementById('powerLossChart').getContext('2d');
691
+
692
+ // Destroy previous chart if it exists
693
+ if (powerLossChart) {
694
+ powerLossChart.destroy();
695
+ }
696
+
697
+ // Create new chart
698
+ powerLossChart = new Chart(ctx, {
699
+ type: 'line',
700
+ data: {
701
+ labels: generateChartLabels(),
702
+ datasets: [{
703
+ label: 'Power Loss (kW)',
704
+ data: generatePowerLossData(),
705
+ backgroundColor: 'rgba(0, 180, 216, 0.2)',
706
+ borderColor: 'rgba(0, 180, 216, 1)',
707
+ borderWidth: 2,
708
+ tension: 0.4,
709
+ fill: true
710
+ }]
711
+ },
712
+ options: {
713
+ responsive: true,
714
+ maintainAspectRatio: false,
715
+ plugins: {
716
+ title: {
717
+ display: true,
718
+ text: getChartTitle(),
719
+ font: {
720
+ size: 16,
721
+ weight: 'bold'
722
+ }
723
+ },
724
+ tooltip: {
725
+ callbacks: {
726
+ label: function(context) {
727
+ return `Power Loss: ${context.parsed.y.toFixed(2)} kW`;
728
+ }
729
+ }
730
+ },
731
+ legend: {
732
+ display: false
733
+ }
734
+ },
735
+ scales: {
736
+ x: {
737
+ title: {
738
+ display: true,
739
+ text: getXAxisLabel(),
740
+ font: {
741
+ weight: 'bold'
742
+ }
743
+ }
744
+ },
745
+ y: {
746
+ title: {
747
+ display: true,
748
+ text: 'Power Loss (kW)',
749
+ font: {
750
+ weight: 'bold'
751
+ }
752
+ },
753
+ min: 0
754
+ }
755
+ }
756
+ }
757
+ });
758
+ }
759
+
760
+ // Update Power Loss Chart
761
+ function updatePowerLossChart() {
762
+ if (!powerLossChart) {
763
+ initializePowerLossChart();
764
+ return;
765
+ }
766
+
767
+ // Update chart data
768
+ powerLossChart.data.labels = generateChartLabels();
769
+ powerLossChart.data.datasets[0].data = generatePowerLossData();
770
+ powerLossChart.options.plugins.title.text = getChartTitle();
771
+ powerLossChart.options.scales.x.title.text = getXAxisLabel();
772
+
773
+ // Update chart
774
+ powerLossChart.update();
775
+ }
776
+
777
+ // Generate chart labels based on selected chart type
778
+ function generateChartLabels() {
779
+ const chartType = document.getElementById('chart-type').value;
780
+
781
+ if (chartType === 'length') {
782
+ return Array.from({length: 10}, (_, i) => (i + 1) * 100); // 100m to 1000m in 100m steps
783
+ } else if (chartType === 'current') {
784
+ return Array.from({length: 10}, (_, i) => (i + 1) * 25); // 25A to 250A in 25A steps
785
+ } else { // voltage
786
+ return [3.3, 6.6, 11, 22, 33]; // Common MV voltages
787
+ }
788
+ }
789
+
790
+ // Generate power loss data based on current inputs
791
+ function generatePowerLossData() {
792
+ const chartType = document.getElementById('chart-type').value;
793
+ const cableSize = parseFloat(document.getElementById('cable-size-chart').value);
794
+ const installationMethod = document.getElementById('chart-method').value;
795
+ const baseCurrent = parseFloat(document.getElementById('load-current').value) || 100;
796
+ const baseLength = parseFloat(document.getElementById('cable-length').value) || 100;
797
+ const baseVoltage = parseFloat(document.getElementById('system-voltage').value) || 11;
798
+
799
+ // Get resistance per km based on cable size (simplified)
800
+ const resistancePerKm = getResistanceForSize(cableSize);
801
+
802
+ // Get derating factor based on installation method
803
+ const deratingFactor = getDeratingFactor(installationMethod);
804
+
805
+ return generateChartLabels().map(value => {
806
+ let current, length, voltage;
807
+
808
+ if (chartType === 'length') {
809
+ current = baseCurrent;
810
+ length = value;
811
+ voltage = baseVoltage;
812
+ } else if (chartType === 'current') {
813
+ current = value;
814
+ length = baseLength;
815
+ voltage = baseVoltage;
816
+ } else { // voltage
817
+ current = baseCurrent;
818
+ length = baseLength;
819
+ voltage = value;
820
+ }
821
+
822
+ // Calculate power loss (P = I²R)
823
+ const resistance = (resistancePerKm * length / 1000) * deratingFactor;
824
+ const powerLoss = Math.pow(current, 2) * resistance / 1000; // in kW
825
+
826
+ return powerLoss;
827
+ });
828
+ }
829
+
830
+ // Get resistance for cable size (Ω/km)
831
+ function getResistanceForSize(size) {
832
+ // Simplified resistance values for copper conductors at 20°C
833
+ const resistances = {
834
+ 35: 0.524,
835
+ 50: 0.387,
836
+ 70: 0.268,
837
+ 95: 0.193,
838
+ 120: 0.153,
839
+ 150: 0.124,
840
+ 185: 0.099,
841
+ 240: 0.075
842
+ };
843
+
844
+ return resistances[size] || 0.524;
845
+ }
846
+
847
+ // Get derating factor for installation method
848
+ function getDeratingFactor(method) {
849
+ const factors = {
850
+ 'buried': 1.0,
851
+ 'duct': 1.1,
852
+ 'tray': 1.2,
853
+ 'air': 1.15
854
+ };
855
+
856
+ return factors[method] || 1.0;
857
+ }
858
+
859
+ // Get chart title based on selected type
860
+ function getChartTitle() {
861
+ const chartType = document.getElementById('chart-type').value;
862
+ const cableSize = document.getElementById('cable-size-chart').value;
863
+
864
+ if (chartType === 'length') {
865
+ return `Power Loss vs Cable Length (${cableSize}mm²)`;
866
+ } else if (chartType === 'current') {
867
+ return `Power Loss vs Load Current (${cableSize}mm²)`;
868
+ } else {
869
+ return `Power Loss vs System Voltage (${cableSize}mm²)`;
870
+ }
871
+ }
872
+
873
+ // Get X-axis label based on selected type
874
+ function getXAxisLabel() {
875
+ const chartType = document.getElementById('chart-type').value;
876
+
877
+ if (chartType === 'length') {
878
+ return 'Cable Length (m)';
879
+ } else if (chartType === 'current') {
880
+ return 'Load Current (A)';
881
+ } else {
882
+ return 'System Voltage (kV)';
883
+ }
884
+ }
885
  </script>
886
  <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=acwk/test" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
887
  </html>
prompts.txt CHANGED
@@ -0,0 +1 @@
 
 
1
+ Please add an interactive Diagramm to show the indivial loses based on different cable lengths and Adel Load and different voltages