Skip to content

Commit

Permalink
Merge pull request #1 from malamalca/TSS
Browse files Browse the repository at this point in the history
Sprememba sistema TSS
  • Loading branch information
malamalca authored Jun 11, 2023
2 parents 8f32dcd + 87cec37 commit 2ecc3ef
Show file tree
Hide file tree
Showing 32 changed files with 1,143 additions and 347 deletions.
4 changes: 2 additions & 2 deletions config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ function echo_exception_handler($e) {
if (Configure::read('debug')) {
error_reporting(E_ALL);
ini_set('display_errors', true);
set_exception_handler('echo_exception_handler');
// set_exception_handler('echo_exception_handler');
}


// Handle php error logs with monolog
$logger = Log::getInstance()->getLogger();
ErrorHandler::register($logger);
//ErrorHandler::register($logger);

/**
* Set server timezone to UTC. You can change it to another timezone of your
Expand Down
32 changes: 32 additions & 0 deletions config/funcs.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,38 @@ function ar($a) {
return '|' . implode(' | ', array_map(fn($v) => str_pad(number_format(round($v, 2), 2, '.', ''), 8, ' ', STR_PAD_LEFT), $a)) . '|' . PHP_EOL;
}

/**
* Array sum values
*
* @param array &$a Destination array
* @param array $b Array of elements to be sumed to $a
* @return array
*/
function array_sum_values(&$a, $b) {
$ret = $a;
foreach ($b as $k => $v) {
$ret[$k] = ($ret[$k] ?? 0) + $v;
}

return $ret;
}

/**
* Array subtract values
*
* @param array &$a Destination array
* @param array $b Array of elements to be subtracted from $a
* @return array
*/
function array_subtract_values(&$a, $b) {
$ret = $a;
foreach ($b as $k => $v) {
$ret[$k] = ($ret[$k] ?? 0) - $v;
}

return $ret;
}

/**
* Return the first element in an array passing a given truth test.
*
Expand Down
90 changes: 43 additions & 47 deletions projects/TestniProjekt/podatki/TSS/ogrevanje.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,24 @@
"idCone": "Cona1",
"vrsta": "toplovodni",
"energent": "elektrika",
"rezim": "40/30",

"ogrevanje": {
"rezim": "40/30",
"generatorji": ["TC"],
"razvodi": ["ogrevanje"],
"prenosniki": ["TALNO"]
},
"tsv": {
"rezim": "55/45",
"generatorji": ["TC"],
"razvodi": ["TSV"],
"hranilniki": ["TSV"]
},
"_hlajenje": {
"generatorji": ["TC"],
"razvodi": ["ogrevanje"],
"prenosniki": ["TALNO"]
},

"generatorji": [
{
Expand All @@ -17,22 +34,6 @@
}
],

"prenosniki": [
{
"id": "TALNO",
"vrsta": "ploskovnaOgrevala",

"sistem": "talno_mokri",
"izolacija": "100%",

"hidravlicnoUravnotezenje": "staticnoDviznihVodov",
"regulacijaTemperature": "referencniProstor",

"mocRegulatorja": 1,
"steviloRegulatorjev": 1
}
],

"razvodi": [
{
"vrsta": "dvocevni",
Expand All @@ -47,49 +48,44 @@
},
"ceviPrikljucniVodi": {
}
},
{
"vrsta": "toplavoda",
"id": "TSV",
"crpalka": {},
"ceviHorizontaliVodi": {
},
"ceviDvizniVodi": {
},
"ceviPrikljucniVodi": {
}
}
]
},
{
"id": "STV",
"idCone": "Cona1",
"vrsta": "toplovodni",
"energent": "elektrika",
"rezim": "55/45",
"namen": "TSV",
],

"generatorji": [
"prenosniki": [
{
"id": "TC",
"vrsta": "TC_zrakvodaSTV",
"nazivnaMoc": 6,
"nazivniCOP": 3,
"elektricnaMocNaPrimarnemKrogu": 6,
"elektricnaMocNaSekundarnemKrogu": 6
"id": "TALNO",
"vrsta": "ploskovnaOgrevala",

"sistem": "talno_mokri",
"izolacija": "100%",

"hidravlicnoUravnotezenje": "staticnoDviznihVodov",
"regulacijaTemperature": "referencniProstor",

"mocRegulatorja": 1,
"steviloRegulatorjev": 1
}
],

"hranilniki": [
{
"id": "TSV",
"vrsta": "posrednoOgrevan",
"volumen": 250,
"istiProstorKotGrelnik": true,
"vOgrevanemProstoru": true
}
],

"razvodi": [
{
"vrsta": "toplavoda",
"id": "TSV",
"crpalka": {},
"ceviHorizontaliVodi": {
},
"ceviDvizniVodi": {
},
"ceviPrikljucniVodi": {
}
}
]
}
]
26 changes: 0 additions & 26 deletions src/Calc/TSS/EnergentFactory.php

This file was deleted.

33 changes: 0 additions & 33 deletions src/Calc/TSS/Energenti/Elektrika.php

This file was deleted.

8 changes: 0 additions & 8 deletions src/Calc/TSS/Energenti/Energent.php

This file was deleted.

30 changes: 24 additions & 6 deletions src/Calc/TSS/Generatorji/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ abstract class Generator

public float $nazivnaMoc;

public array $toplotneIzgube;
public array $vneseneIzgube;
public array $potrebnaEnergija;
public array $potrebnaElektricnaEnergija;
public array $obnovljivaEnergija;
public array $vracljiveIzgube;

/**
* Class Constructor
Expand Down Expand Up @@ -44,16 +45,33 @@ public function parseConfig($config)
}

/**
* Izračun toplotnih izgub
* Analiza podsistema
*
* @param array $potrebnaEnergija Potrebna energija predhodnih TSS
* @param \App\Calc\TSS\OgrevalniSistemi\OgrevalniSistem $sistem Podatki sistema
* @param \stdClass $cona Podatki cone
* @param \stdClass $okolje Podatki okolja
* @param array $params Dodatni parametri za izračun
* @return void
*/
public function analiza($potrebnaEnergija, $sistem, $cona, $okolje, $params = [])
{
$this->potrebnaEnergija($potrebnaEnergija, $sistem, $cona, $okolje, $params);
$this->potrebnaElektricnaEnergija($potrebnaEnergija, $sistem, $cona, $okolje, $params);
$this->obnovljivaEnergija($potrebnaEnergija, $sistem, $cona, $okolje, $params);
}

/**
* Izračun potrebne energije
*
* @param array $vneseneIzgube Vnešene izgube predhodnih TSS
* @param \App\Calc\TSS\OgrevalniSistemi\OgrevalniSistem $sistem Podatki sistema
* @param \stdClass $cona Podatki cone
* @param \stdClass $okolje Podatki okolja
* @param array $params Dodatni parametri za izračun
* @return array
* @return void
*/
abstract public function toplotneIzgube($vneseneIzgube, $sistem, $cona, $okolje, $params = []);
abstract public function potrebnaEnergija($vneseneIzgube, $sistem, $cona, $okolje, $params = []);

/**
* Izračun potrebne električne energije
Expand All @@ -63,7 +81,7 @@ abstract public function toplotneIzgube($vneseneIzgube, $sistem, $cona, $okolje,
* @param \stdClass $cona Podatki cone
* @param \stdClass $okolje Podatki okolja
* @param array $params Dodatni parametri za izračun
* @return array
* @return void
*/
abstract public function potrebnaElektricnaEnergija($vneseneIzgube, $sistem, $cona, $okolje, $params = []);

Expand All @@ -75,7 +93,7 @@ abstract public function potrebnaElektricnaEnergija($vneseneIzgube, $sistem, $co
* @param \stdClass $cona Podatki cone
* @param \stdClass $okolje Podatki okolja
* @param array $params Dodatni parametri za izračun
* @return array
* @return void
*/
abstract public function obnovljivaEnergija($vneseneIzgube, $sistem, $cona, $okolje, $params = []);
}
Loading

0 comments on commit 2ecc3ef

Please sign in to comment.