{"id":31922919,"url":"https://github.com/gkeiel/ups_simulation","last_synced_at":"2025-10-13T23:27:07.624Z","repository":{"id":311021717,"uuid":"1041776061","full_name":"gkeiel/ups_simulation","owner":"gkeiel","description":"MATLAB-PSIM simulation and control of UPS systems","archived":false,"fork":false,"pushed_at":"2025-08-21T15:34:38.000Z","size":46,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-21T18:23:00.882Z","etag":null,"topics":["inverter","matlab","psim","simulation","ups"],"latest_commit_sha":null,"homepage":"","language":"MATLAB","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gkeiel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-21T01:58:25.000Z","updated_at":"2025-08-21T15:34:42.000Z","dependencies_parsed_at":"2025-08-21T18:26:02.230Z","dependency_job_id":"f68916dd-3087-4386-a8f5-1739fccdc8f5","html_url":"https://github.com/gkeiel/ups_simulation","commit_stats":null,"previous_names":["gkeiel/ups_simulation"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/gkeiel/ups_simulation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkeiel%2Fups_simulation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkeiel%2Fups_simulation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkeiel%2Fups_simulation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkeiel%2Fups_simulation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gkeiel","download_url":"https://codeload.github.com/gkeiel/ups_simulation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkeiel%2Fups_simulation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017241,"owners_count":26086015,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["inverter","matlab","psim","simulation","ups"],"created_at":"2025-10-13T23:27:01.692Z","updated_at":"2025-10-13T23:27:07.612Z","avatar_url":"https://github.com/gkeiel.png","language":"MATLAB","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UPS simulation and analysis\n\nA program for simulation and analysis of uninterruptible power supply (UPS) systems. Considering an output stage consisting of a half-bridge voltage source inverter (VSI) and output LC filter, it allows evaluating the operation of such electronic device for high-frequency switching and under different load conditions.\n\n\u003cimg width=\"1609\" height=\"636\" alt=\"ups\" src=\"https://github.com/user-attachments/assets/82600272-e3f4-4b00-b8b2-e3fdac74765d\"/\u003e\n\nThe program contains the following file types:\n- **MATLAB** scripts for general settings and controller design\n- **Simulink** implementation for digital-control simulation\n- **PSIM** implementation for power-electronics simulation\n\nMain file named as 'run_ups.m'.\n\n## Voltage regulation\n\nThe voltage regulator in UPSs aims to maintain the supplied output-voltage at quality levels accepted by standards such as IEC 62040-3. One solution for designing such output-voltage regulators are controllers based on the internal model principle (IMP), which in case of UPSs yield to the multi-resonant and repetitive controllers.\n\nConsider a closed-loop in the form\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg width=\"769\" height=\"236\" alt=\"voltage_regulator_closed_loop\" src=\"https://github.com/user-attachments/assets/23107e33-0cbd-4483-be62-2840eb0f80d0\" /\u003e\n\u003c/div\u003e\n\nemploying a proportional-multiple-resonant (PMR) controller with transfer function\n\n$$C(s) = \\frac{u_v(s)}{e(s)} = k_{e} +\\sum_{i=1,3,\\dots}^{h}\\frac{k_{{2i-1}} +k_{{2i}}s}{s^{2} +2\\xi_{i}\\omega_{r_i} s +\\omega_{r_i}^{2}}$$\n\nwhere $k_{e}$, $k_{{2i-1}}$, and $k_{{2i}}$ are gains to be determined, $\\xi_{i}$ is the damping factor of the $i$-th resonant mode and $\\omega_{r_i}$ the $i$-th multiple of the fundamental frequency $\\omega_0$.\n\nAn appropriate design of $C(s)$, considering a sufficient number of resonant modes, results in UPS controllers allowing to perfectly follow a sinusoidal voltage reference and reject disturbances at harmonic frequencies caused by the connection of non-linear loads.\n\nThe control law shown can be rewritten as\n\n$$u(t) = Kx_{a}(t) +k_{e}r(t)$$\n\nwhere $x_{a}(t) = [x'(t)\\ x_{r}'(t)]' \\in \\mathbb{R}^{2+2h}$ is the augmented state where $x(t) = [i_L(t)\\ v_o(t)]'$, $x_r(t)$ contains the resonant states and\n\n$$K = [k_{c}\\ -k_{e}\\quad k_{1}\\quad k_{2}\\quad \\cdots\\quad k_{2h-1}\\quad k_{2h}].$$\n\n## Experimental results\n\nAn improved version of this program was used to design/analyze efficient digital controllers before implementing them in real UPS systems. In this context, the experimental result presented below aims to validate the applicability of such simulation enviroment.\n\nConsider a desired sinusoidal output voltage with $V_{rms} = 127$ V, $\\omega_0 = 2\\pi 60$ rad/s. Assuming a PMR controller with 4 resonant modes presenting the transfer function\n\n$$C(s) = k_{e} +\\frac{k_{{1}} +k_{{2}}s}{s^{2} +2\\xi_{1}\\omega_{r_1} s +\\omega_{r_1}^{2}} +\\frac{k_{{5}} +k_{{6}}s}{s^{2} +2\\xi_{3}\\omega_{r_3} s +\\omega_{r_3}^{2}} +\\frac{k_{{9}} +k_{{10}}s}{s^{2} +2\\xi_{5}\\omega_{r_5} s +\\omega_{r_5}^{2}} +\\frac{k_{{13}} +k_{{14}}s}{s^{2} +2\\xi_{7}\\omega_{r_7} s +\\omega_{r_7}^{2}}\n$$\n\nwhere $\\omega_{r_1} = \\omega_0$, $\\omega_{r_3} = 3\\omega_0$, $\\omega_{r_5} = 5\\omega_0$, $\\omega_{r_7} = 7\\omega_0$ and $\\xi_{1,3,5,7} = 0$. For this occasion, after tuning gains through a desired criteria and applying the Tustin approximation with $T = 0.998\\ \\mu s$, the following discrete-time transfer function was obtained\n\n$$C(z)\n=\\frac{6.9976 (z-0.9659) (z-0.9239)}{(z^2 - 1.999z + 1)}\n+\\frac{(z^2 - 1.945z + 0.9533)}{(z^2 - 1.987z + 1)}\n+\\frac{(z^2 - 1.938z + 0.9669)}{(z^2 - 1.965z + 1)}\n+\\frac{(z^2 - 1.913z + 0.9753)}{(z^2 - 1.931z + 1)}.\n$$\n\nThe figures in sequence show the UPS output voltage, $v_o(t)$, and output current, $i_o(t)$, measured waveforms considering the above internal model principle (IMP) controller in a real UPS. The following response was obtained for (a) linear and (b) non-linear load:\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg width=\"400\" height=\"320\" alt=\"ups_h4_lin\" src=\"https://github.com/user-attachments/assets/7ac7fb53-5727-496b-afc3-b964aec5bdd8\"/\u003e\n\u003cimg width=\"400\" height=\"320\" alt=\"ups_h4_nlin\" src=\"https://github.com/user-attachments/assets/3c69d625-a854-43f9-887c-3efc26e1bac3\"/\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgkeiel%2Fups_simulation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgkeiel%2Fups_simulation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgkeiel%2Fups_simulation/lists"}