8 Space missions would not be possible without an available, reliable, autonomous, 9 and resilient power system. Space-based power systems are different than Earth’s 10 grid in terms of generation sources, needs, structure, and controllability. This re- 11 search paper introduces a groundbreaking approach employing digital twin techno- 12 logy to emulate and enhance the performance of a physical nanogrid plant repres- 13 enting such a space-based power system. The proposed system encompasses three 14 DC converters, a DC source, and a modular battery storage unit feeding a variable 15 load. Rigorous testing across diverse operating points establishes the digital twin’s 16 high-fidelity real-time representation, with root mean square error (RMSE) values 17 consistently below 5%. The principal innovation lies in leveraging this digital twin to 18 fortifysystemresilienceagainstunforeseenevents, beyondthecapabilitiesofexisting 19 controllers and autonomy levels. By simulating scenarios that the current system 20 may not be primed for, the digital twin provides operators with the tools to proact- 21 ively respond to disruptions. Importantly, the approach offers an invaluable tool for 22 scenarios where physical access to components is limited. This research introduces 23 a modular battery storage solution as a key augmentation, capable of seamlessly 24 compensating for power shortages at the source end that might arise from the dust 25 effect on the Lunar surface or unexpected faults in the system. The proposed hol- 26 istic approach not only validates the fidelity of the digital twin but also underscores 27 its potential to revolutionize system operation, safeguard against uncertainties, and 28 expedite response strategies in the face of unexpected contingencies. The proposed 29 approach also paves the way for future development. 30 Keywords : Digital Twin, Resilience, Space Power Stations 31 1 1. Introduction 32 The advent of intelligent systems followed by the Fourth Industrial Revolution or Industry 33 4.0, made digital twin (DT) platforms a feasible alternative to analyze and evaluate the 34 performance of dynamical systems enabling critical decision-making. To be more specific, 35 the emergence of artificial intelligence (AI) techniques, the Internet of Things (IoT), and 36 cyber-physical systems (CPSs) has a significantly vital role to play in this area Bazmo- 37 hammadi et al., 2022; Ebrahimi, Ullah, Ferdowsi & Barati, 2022. 38 Although twinning originated in NASA’s Apollo program in the 1960s Allen, 2021 and 39 later on appeared in aerospace and aviation sectorsShafto et al., 2012, it quickly found use 40 cases in various fields ranging from manufacturing Qi & Tao, 2018; Yang et al., 2022 to 41 healthcare and remote surgery systems Laaki et al., 2019; Y. Liu et al., 2019. At a larger 42 scale, in Deren et al., 2021, for instance, the authors discuss applications and features of 43 digital twin-based smart cities. To date, numerous DT applications have been deployed 44 in many industries which named DT one of the Top 10 Strategic Technology Trends in 45 2018 by Gartner Garfinkel, 2018. Furthermore, the DT market is expected to increase 46 from USD 3.8 billion in 2019 to USD 35.8 billion by 2025 due to the rising use of new 47 technologies such as IoT and cloud computing Eirinakis et al., 2020. 48 According to the report provided by the US Department of Energy DoE, 2003, modern 49 power grids are one of the most complicated engineering systems which makes the North 50 American power grids the pinnacle of twentieth-century engineering achievement. In 51 addition, increased installation of renewable energy systems along with Inverter-Based 52 Resources(IBR)ismakingpowergridssubstantiallycomplexEbrahimi, Ullah&Ferdowsi, 53 2024. This perplexity makes traditional computer simulations unable to provide accurate 54 analysis and evaluation of the systems, especially in situations where model fidelity is 55 important. 56 To build a virtual representation of a physical system (PS), an advanced high-precision 57 modeling platform is required. Various software and tools can be used to develop a 58 DT model of a PS. In Beguery et al., 2019, a Matlab GUI toolbox is utilized to build 59 an MGDT to address some specific customer requests using a real Energy Management 60 System (EMS) algorithm. In a 2019 study Pileggi et al., 2019, python is used to develop 61 a DT model of a battery system to find and detect anomalies for CPS purposes. 62 In addition, each DT model can be developed based on two fundamental principles 63 including physics-based or data-driven. A Physics-based DT model is built based on 64 principal standard assumptions of physics and mathematics. A data-driven DT model, 65 however, is based on statistical techniques to derive an architectural arrangement of a 66 case study model from its data. Each DT fundamental principle has its advantages 67 and disadvantages. To name a few, physics-based models are frequently applied when 68 fundamental principles of case studies are digested. Even though they have been applied 69 for many years, they are restricted led by an insufficient understanding of the underlying 70 2 architecture of case studies caused by mathematical constraints. Data-driven models, 71 nevertheless, seem to be more flexible since they rely on ample data available from case 72 studies. Theyalsosufferfromascarcityofagoodunderstandingoffundamentalprinciples 73 for case studies. 74 Eventually, both physics-based and data-driven DT model have their own merits and 75 demerits, and they can be selected based on available knowledge of a case study and 76 the application. In Hong & Apolinario, 2022, the digital twin concept is utilized at 77 the system level. Networked microgrids are represented by neural networks where the 78 generated power of different units such as solar, fuel cell, battery, and diesel generators 79 arepredicted. TyphoonHardware-in-the-Loop(HIL)softwareisusedinEbrahimi,Safayet 80 Ullah & Ferdowsi, 2022 to build a physics-based DT model of an IEEE 4-bus to enhance 81 the PV system performance via mitigating voltage violation and fluctuation. 82 The beauty of DT models is their ability to mimic the behavior of PS accurately. 83 The PS, however, has a vital role to play in developing the DT model since without the 84 presence of a PS, the DT model is nonsensical. In other words, a DT model should be a 85 virtual replica of an existing system to be claimed as a digital twin. Otherwise, there is no 86 difference between conventional computer simulations where the model is built based on 87 certain assumptions and imaginary actual systems, or IEEE standard systems. In a 2020 88 study H. Pan et al., 2020, a DT model of a power substation system, Cai-Lun station, is 89 built. Although authors in Yuan & Xie, 2023 present an RL-based DT model to address 90 load commitment issues, there is no actual existing microgrid system represented as the 91 PS. In a 2019 study Béguery et al., 2019, the DiSiPl platform is used to develop a DT 92 model to tackle energy management system issues. It lacks, however, the presence of an 93 actual microgrid to build the DT model based on. 94 The same research gap, the lack of PS, is also observed in Li, Cui, Cai, Su & Wang, 95 2023 where authors propose an AI-driven algorithm for digital twinning to address de- 96 mand response issues for microgrids comprised of renewable sources. In M. Pan et al., 97 2023, an RL-driven DT model is developed to schedule batteries for optimum energy man- 98 agement. The paper, however, lacks information about sensors, synchronization, and even 99 the specifications of components within the physical plant. Cheng et al., 2023 presents 100 a digital twinning framework for a microgrid where a physical plant exists; however, the 101 communication between the digital model and the plant is not discussed. Additionally, 102 it is not well discussed to what extent the digitalized microgrid mimics the behavioral 103 dynamics of the physical plant. 104 Another gap found in the digital twinning studies is the lack of model fidelity as- 105 sessment. In other words, the accuracy of DT models with respect to the PS’s behavior 106 has not been well discussed. The fidelity of a DT model can be assessed by applying 107 standard measurement metrics such as Root Mean Square Error (RMSE), Mean Absolute 108 Percentage Error (MAPE), or R-squared error. Ebrahimi, Safayet Ullah et al., 2024. By 109 assessing the output results of the DT and PS via standard measurement metrics, sys- 110 3 tems operators can ensure the performance of the DT is close enough to the PS. Thus, 111 validation is fundamental for the appraisal of DT models. This has a vital role to play in 112 case studies where the PS is far away from its control center like space applications. 113 Several studies present DT models with the presence of PS, but they suffer from a lack 114 of fidelity assessment. In Padmawansa et al., 2023, a DT model is developed to predict 115 the required cycle count and stress levels of a battery energy storage system. Neither 116 the DT model is built based on an actual battery system, nor the fidelity of the DT 117 performance is assessed. In another 2023 study Li, Cui, Cai & Su, 2023, AI-driven and 118 a heuristic algorithm are applied to develop a DT model of smart homes connected to 119 renewables. The DT model, however, lacks a fidelity assessment test. In Saad et al., 2020, 120 the implementation of energy cyber-physical systems(ECPSs) utilizing two DT models to 121 cover high-bandwidth and the low bandwidth applications is presented. The DT models, 122 however, are not evaluated with the results of an actual system. In a 2022 study Lopez 123 et al., 2022, a fault identification framework is presented for low-level components of a 124 DT to ensure the dynamic stability of the components. The presented framework consists 125 of a Self Organized Map (SOM) Neural Network to measure the faults within a Real-time 126 model. Like other DT studies, the scarcity of fidelity assessment tests for the DT model 127 is observed in this research work. 128 Pursuing NASA’s universe exploration plans, the Artemis program aims to take hu- 129 mans to the Moon by 2025 and establish a sustainable presence on the lunar surface 130 Artemis, 2022. Unlike terrestrial microgrids (MGs), the design of the non-terrestrial MG 131 system is quite different. Due to the dusty atmosphere of the Moon NASA, 2023, solar 132 panels’ deliverable power can substantially be impacted and reduced. Therefore, a backup 133 source, commonly a battery storage system (BSS) is required to support solar PV. The 134 program aims to land the first woman and next man on the Lunar surface by 2025, to 135 establish sustainable exploration and utilization of the Moon by the end of the decade. 136 Also, this program is expected to pave the way for human exploration of Mars and other 137 destinations in the solar system. A space-based resilient power system is critical for al- 138 most all aspects of future Lunar exploration endeavors, and the design of such a power 139 system requires extensive research. Cost, safety, and flexibility have been always the three 140 main concerns for research in the power system area. Utilization of a digital twin will 141 accelerate research tasks while maintaining a high level of fidelity. 142 In this study, DT is utilized to mimic the actual MG system representing a Lunar- 143 type MG, Fig.1. The prototype for this case study is designed and developed by the 144 power systems Control Advancement and Resilience Enhancement (CARE) team at the 145 University of Louisiana at Lafayette. To address the above-mentioned issues in the DT 146 area, the research team leveraged DT as an effective tool that yields significant benefits in 147 augmenting the control of space-based power systems. Once the DT model is developed, 148 the DT will be undergoing fidelity assessment tests in phase I. In these tests, the output 149 voltage of the DT model is logged via measurement devices and compared with the PS. 150 4 Figure 1: The concept of the MGDT system for Lunar MG systems Rootmeansquareerror(RMSE)isafundamentalmeasurementunitthatiscalculatedand 151 monitored to be consistently below 5 %. After the DT model is successfully validated, 152 the DT model is utilized to perform certain real-time what-if scenarios instead of the 153 PS. The outcomes of the scenarios can substantially help decision-makers have a better 154 understanding of the performance of the PS in real situations. Thus, operators can 155 provide solid solutions during emergencies or for critical decision-making beyond expected 156 situations. The technical contributions of this research study are summarized below. 157 •Development of a High-Fidelity Real-Time Model: This study pioneers the 158 creation of a high-fidelity, real-time model representing an authentic space-based 159 power system. This model stands as a crucial advancement in accurately simulating 160 such systems. 161 •Introduction of Fidelity Assessment for Power System Digital Twins: Sig- 162 nificantly, this research introduces the concept of fidelity assessment for power sys- 163 tem digital twins, emphasizing the necessity for standardized evaluation criteria. 164 This marks a pioneering step towards establishing benchmarks in this field. 165 •Validation of Real-Time Decision Making using Digital Twins: The re- 166 search proposes and validates the concept of real-time decision-making within di- 167 gitaltwinsforpowersystems. Thisbreakthroughfacilitatescriticaldecision-making, 168 particularly in scenarios where physical access to the system is constrained. 169 In this paper, System Description and Modeling are explained in section II along with 170 a detailed description of each control mode including their mathematical formulations. 171 Establishing the Digital Twin Model is discussed in section III. In this section, DT de- 172 velopment is discussed in subsection A, and PS is described in subsection B. Eventually, 173 section IV covers the results and discussion followed by the conclusion section. 174 5 2. System Description and Modeling 175 The overview of the MGDT system is shown in Fig. 2. As can be seen, the solar PV 176 system plays a key role in space-based power systems. Due to the dusty atmosphere of 177 the Moon, the battery system will discharge to support the solar PV to meet the demand. 178 In normal operation, since the solar PV system is able to supply the load demand, the 179 battery will be charged through the bi-directional DC-DC converter. 180 Figure 2: The overview of a Lunar MG system In this case study, the control unit has a vital role to play in accurate system operation 181 due to supplying load demand. The performance of the control during each mode of 182 operation for the PV system and the battery system is illustrated in Fig. 3. 183 According to the flowchart, the total amount of the solar PV system’s available power 184 is calculated in every sample time after measuring voltages and currents. If the available 185 power from the solar PV can meet the load demand, the controller checks the state of 186 charge (SOC) of the Lithium-ion battery. In case the battery is fully charged, the control 187 system will go to mode 0 representing the normal operation. In this mode the battery 188 system is disconnected from the MG and only the solar PV is responsible for supplying 189 the loads. 190 If the SOC is below the predefined value (like 80%), the control system will go to mode 191 1 which is constant current (CC) charging for the battery. When the SOC of the battery 192 reaches 80%, the control system switches to mode 2 and the battery is charged under 193 constant voltage (CV) until it is fully charged. Eventually, mode 3 happens when the 194 solar PV does not have sufficient power to meet the load demand. Thus, the PV system 195 is immediately disconnected from the load bus and the battery is connected to the supply 196 load demand. Each control mode of operation will be explained further in the following 197 sections. 198 6 Figure 3: MGDT Flowchart of Control strategy for each Mode Fig. 4 depicts the Bi-directional buck-boost DC-DC battery converter. In charging 199 modes, the buck side of the converter is activated which includes an inductor, L, with the 200 internal resistor, RL, and capacitor, Cbat. This will happen via S1and the antiparallel 201 diode of S2. For discharging modes, however, the boost side will be activated and connec- 202 ted to Cdc. To do so, S2will be triggered and the boosted current will be passed through 203 the antiparallel diode of S1. 204 To continuously meet the load demand, the battery controller should work closely with 205 the Solar PV system. Thus, the control strategy for the battery is comprised of 5 unique 206 modes to have better collaboration with Solar PV. To implement the control strategy 207 for the battery, Model Predictive Control (MPC) is applied to perform operation modes 208 Rajesh et al., 2019. The inductor current is formulated in (1). 209 LdIL(t) dt=Vbat−RLIL(t)−BVdc (1) Where LandRLrepresent the inductance and the inductor’s internal resistor. Vbat 210 andILare the battery voltage and inductor current. B denotes switching states which 211 7 Figure 4: Bi-directional buck-boost indicates S1for charging modes and 1 - S2for discharging modes. 212 On the other hand, the dynamic behavior for the capacitor voltage corresponds to 213 the charging or discharging operational mode. Equations (2) and (3) correspond to the 214 charge and discharge modes respectively. 215 CbatdVbat(t) dt=IL(t)−Ibat (2) CdcdVdc(t) dt= (1−S2)IL(t)−Vdc(t) RLoad(3) Where CbatandCdcare buck side and boost side capacitors, respectively. VdcandIbat 216 are load bus voltage and the current flowing to the battery. RLoadis the impedance of 217 load which in this case study is fully resistive. 218 To analyze the dynamical behavior via MPC, the Euler forward method is applied 219 to approximate the derivatives of the above-mentioned equations for the Bi-directional 220 buck-boost converterRivera et al., 2016. 221 dX(t) dt≃X(k+ 1)−X(k) Ts(4) Where Tsis sample time. Each mode’s dynamic behavior will be discussed in detail 222 along with their equations in the following sections. 223 2.1 Mode 0 - Normal Operation 224 In this mode of operation, solar PV is capable of supplying load demand. Fig. 5 illustrates 225 the block diagram of the current sharing approach applied to control 3 solar PV agents. 226 This method ensures avoiding circulating currents for the three solar PVs mitigating 227 8 Figure 5: Current Sharing Control Diagram the negative impacts of circulating currents Ghanbari & Bhattacharya, 2020. Since the 228 PV system is able to fully supply the load (mode 0), the controller puts the battery in 229 idle mode, Fig. 6. This will isolate the battery from the MG. 230 Figure 6: Configuration of Bi-directional buck-boost Under Normal Operation 9 2.2 Mode 1 - Constant Current (CC) Charging 231 The battery in this mode is charged with a controlled and limited current flow. CC 232 charging provides some benefits like fast charging, balancing cell voltage, and safety. This 233 method of charging, however, is commonly used for certain types of batteries, such as 234 lithium-ion batteries, to ensure safe and efficient charging Brenna et al., 2020. 235 Figure 7: Configuration of Bi-directional buck-boost Under Charging Modes Fig. 7 shows the configuration of the bi-directional buck-boost for this application. 236 Since the direction of the current flow is reversed due to the charging mode, 1 will be 237 updated as: 238 LdIL(t) dt=−Vbat(t)−RLIL(t) +S1Vdc (5) Where S1can be either 1 or 0 depending on the switching status. To calculate ILat 239 time k+ 1 with sample time Ts, forward Euler approximation is applied to discretize the 240 derivative of the inductor current. So, by applying 4 to 5, (6) is formed. 241 IL(k+ 1) =S1(k)Ts LVdc(k) + 1−RLTs L IL(k)−Ts LVbat(k)(6) The goal is to minimize the error between the predicted ILat the time k+ 1 and the 242 reference current to charge the battery in CC mode. Thus, the cost function is considered 243 as follows: 244 Gcc(k+ 1) = |I∗ L(k)−IL(k+ 1)| +λcc|S1(k)−S1(k−1)|(7) 10 Where I∗ L(k)is the inductor reference current and λccis a weighting factor for CC 245 charging mode. Unless the battery’s SOC reaches 80%, the battery remains in the CC 246 mode. 247 2.3 Mode 2 - Constant Voltage (CV) Charging 248 To avoid overcharging and ensure desirable performance, durability, and safety of the 249 battery, a resilient integration of charging modes (e.g., CC & CV) is required. Thus, once 250 the SOC of the battery reaches 80%, the battery goes into the CV mode. In this mode, 251 a constant voltage will be held at the battery’s terminal until the SOC reaches 100%. 252 The configuration of the bi-directional buck-boost and direction of the current are the 253 same as in CC mode shown in Fig. 7. For analyzing the dynamics for this mode, the 254 output voltage of the converter and the inductor current are formulated as follows: 255 LdIL(t) dt=−Vbat(t)−RLIL(t) +S1Vdc (8) CbatdVbat(t) dt=IL(t)−Ibat(t) (9) In the next step, the state space representation of (8) and (9),is formed in (11) using 256 (10): 257 ˙X(t) =AX(t) +BU(t, S 1(t)) (10) Thus, the result is: 258" dIL(t) dt dVbat(t) dt# =" −RL L−1 L −1 Cbat0#" IL(t) Vbat(t)# +" −1 L0 0−1 Cbat#" S1Vdc Ibat(t)# (11) To obtain the predicted value of Vbatat time k+ 1 with sample time Ts, the dis- 259 cretization of the state space representation in 10 can be written as follows for a better 260 parameter-varying relevant Toth et al., 2010: 261 X(k+ 1) = AdX(k) +BdU(k, S 1(k)) (12) Where Ad=eATsandBd=A−1(Ad−1)Bin discrete-time arrangement with sample 262 time Ts. Therefore, the discretization of (11) is (13). 263 IL(k+ 1) Vbat(k+ 1) =e −RL L−1 L−1 Cbat0 TsIL(k) Vbat(k) +−RL L−1 L−1 Cbat0−1 (e −RL L−1 L−1 Cbat0 Ts −1)−1 L0 0−1 CbatS1Vdc Ibat(k) (13) 11 To minimize the difference between the predicted value of Vbatat time k+ 1 and the 264 reference battery charging voltage for CV, the cost function is formulated as follows: 265 Gcv(k+ 1) = |V∗ bat(k)−Vbat(k+ 1)| +λcv|S1(k)−S1(k−1)|(14) Where V∗ bat(k)is the battery reference charging voltage and λcvis a weighting factor for 266 CVchargingmode. Thebatteryischargedwithconstantvoltagewithlimitedcurrentuntil 267 the SOC reaches 100%. To limit the charging current in the CV mode, the appropriate 268 reference charging voltage is selected. 269 2.4 Mode 3 - Grid Forming (GF) Discharging 270 Since the PV system is unable to maintain the load bus voltage at the desired value 271 and the solar fails to meet the demand, the battery controller disconnects the main grid 272 from the DC load bus and supplies the load in islanding mode. Therefore, the battery 273 discharges to keep the DC load bus at the desired voltage and serve the demand. 274 Figure 8: Configuration of Bi-directional buck-boost Converter Under Discharging Modes The configuration of the bi-directional buck-boost converter in the GF mode is shown 275 in Fig. 8. In this mode, the battery will form and create the grid in the GF mode. Not 276 only does the battery supply the desired voltage for the DC load bus, but it also delivers 277 the amount of current required for the load through the boost side of the bi-directional 278 buck-boost converter. For analyzing the dynamics in the GF mode, the output voltage 279 of the boost side of the bi-directional buck-boost as well as the inductor current are 280 formulated as follows: 281 LdIL(t) dt=Vbat(t)−RLIL(t)−(1−S2)Vdc(t) (15) 12 CdcdVdc(t) dt= (1−S2)IL(t)−Vdc(t) RLoad(16) To better analyze the impact of parameter variations, the state space representation 282 10 is applied. Thus, the result is: 283 " dIL(t) dt dVdc(t) dt# =" −RL L−1 L −1 Cdc−1 RobsCdc#" (1−S2)IL(t) (1−S2)Vdc(t)# +" 1 L0 0 0#" Vbat(t) Ibat(t)# (17) To obtain the predicted value of Vdcat time k+ 1 with sample time Ts, the discret- 284 ization of the state space representation is formed in 17 using 12 can be formulated as 285 18. 286 IL(k+ 1) Vdc(k+ 1) =e −RL L−1 L−1 Cdc−1 RobsCdc Ts(1−S2)IL(k) (1−S2)Vbat(k) +−RL L−1 L−1 Cdc−1 RobsCdc−1 (e −RL L−1 L−1 Cdc−1 RobsCdc Ts −1)1 L0 0 0Vbat(k) Ibat(k) (18) One of the goals in this mode is to minimize the error between the predicted ILat 287 the time k + 1 and a reference current in GF mode. This reference current is indeed the 288 current demanded from the observed load at that time. Thus, this reference current can 289 be calculated as: 290 Idem=Vdc Robs(19) Where Idemis the current demanded by the load and Robsis the amount of observed 291 load in Ω. In this case study, it is assumed that Robsis known through the loads’ switching 292 states. The second goal is to minimize the difference between the prediction of future Vdc293 at time k + 1 and the reference DC load bus voltage. Therefore, the cost function is 294 determined as follows: 295 Ggf(k+ 1) = |V∗ ref, dc(k)−Vdc(k+ 1)| +|I∗ ref, gf(k)−IL(k+ 1)| +λgf|S2(k)−S2(k−1)|(20) Where V∗ ref,dc(k)is the dc load bus reference voltage and λgfis a weighting factor for 296 the GF discharging mode. I∗ ref,gf(k)is the battery reference current demanded by the 297 load and can be calculated through Eq. 19. The goal in the GF mode, however, is to keep 298 the DC load bus at the desired voltage, V∗ ref,dc(k), in addition to supplying the amount of 299 current required at the load side. 300 13 3. Establishing the Digital Twin Model 301 A DT testbed is designed and developed by the power systems Control Advancement 302 and Resilience Enhancement (CARE) team at the University of Louisiana at Lafayette 303 illustrated in Fig. 9. The testbed is comprised of the physical microgrid plant and 304 a high-fidelity virtual representation developed on the Typhoon HIL simulator. The 305 characteristics of the DT and the actual system are further described in the following 306 sections. 307 Figure 9: DC microgrid live DT 3.1 Design of MG Digital Twin (DT) 308 The real-time DT model of the DC microgrid is developed on the Typhoon HIL 402 309 environment. According to Fig. 9, three DC-DC converters are working in parallel and 310 connected to a common DC source bus fed by a 48V DC source. The load bus is regulated 311 at 24 V DC. The loads are comprised of three identical 50 Ωresistors connected in parallel. 312 The second and third resistive loads are connected through MOSFET switches at 20 and 313 40 seconds during the test, respectively. Since each resistor is 50 Ω, the simulation starts 314 with 50 Ω, and during the test, the total impedance of the load will reduce down to 25 Ω315 and approximately 16 Ωafter connecting the second and third resistors. 316 In the case of a power shortage, a Lithium-Ion battery is connected through a bi- 317 directional DC-DC converter to support the grid. The battery voltage level is set to 12V 318 and it will discharge through the boost side of the bi-directional converter to level the 319 battery output voltage up to 24V for supplying the loads. For charging, however, the 320 battery will be energized through the buck side of the bi-directional converter. To do 321 this, the 24V at the load bus is reduced to 12V by a bi-directional DC-DC converter to 322 14 charge the battery. Fig. 10 illustrates the DT model of the MG in the Typhoon HIL 323 environment. 324 Figure 10: The DT Model in Typhoon HIL Environment 3.2 The MG Physical System (PS) 325 There are three DC-DC converters working in parallel fed by one DC source providing 326 48V DC to the common DC source bus. Their outputs supply constant 24V DC for the 327 common load bus connected to three resistive loads. Fig. 11 illustrates an overview of 328 the PS Model of the MG developed by the CARE team at the University of Louisiana at 329 Lafayette. 330 For the actual system, IT-M3900C Bidirectional Programmable DC Power Supply is 331 used as a main source since it has the capability of solar emulation. Three SPM-FB- 332 KIT converters with the range of 600V | 2.4kW are utilized to supply the load. Since 333 all three converters have the same ratings, converters contribute equally. Table 1 shows 334 rated configurations of different components implemented in the actual MG system. 335 4. Tests and Results 336 The performance of the actual system and its DT model is evaluated in two phases. Phase 337 I aims to ensure the DT model is a high-fidelity virtual replica of the system. Since the 338 DT model is comprised of two components including PV and battery systems, Fig. 10, 339 each component’s behavior should be evaluated and compared to its actual part for a 340 15 Figure 11: The Actual System at the University of Louisiana at Lafayette Table 1: Configuration of the actual microgrid system Position Component Parameter Value Unit 6*Source 3*DC Source I Power +/-12 kW Voltage 10-1500 V Current -720 1020 A 3*DC Sources II, IIIPower 25 W Voltage 25 V Current 1 A 5*Converter 3*Converters I, II, III, IVPower 2.4 kW Voltage 600 V Switching Frequency 50 kHZ 2*Input Capacitor C 2*480 µF RC,in 0.1 Ω 8*Filter 4*buck L 9mH RL,in 0.1 Ω C 1100 µF RC,in 0.1 Ω 4*boost L 15 mH RL,in 0.1 Ω C 2200 µF RC,in 0.1 Ω 5*Load 3*Resistive Load R1 50 Ω R2 50 Ω R3 50 Ω 2*MOSFET Voltage 50 V Current 5 A more accurate fidelity check. Moreover, having a validated DT model can substantially 341 help with critical decision-making in the face of any unforeseen conditions especially if the 342 physical system is on the Moon which is far away from its main control center on Earth. 343 Once the fidelity of the DT model is verified, the DT model can be used instead of the 344 16 actual system to apply different tests in a safer environment. Thus, the goal of phase II is 345 to test different features of the physical system and its control system under 2 scenarios. 346 4.1 Phase I - Assessment Tests 347 To achieve the goal of phase I, the fidelity of the DT model is evaluated under two 348 assessment tests including normal and emergency operations. In the first assessment test, 349 the performance of both DT and PS is evaluated under normal operation (Mode 0). The 350 second assessment test evaluates the performance of the DT and PS under the emergency 351 operation (Mode 3). The simulation starts with one 50 Ωresistive load and then the 352 second and third loads are added to the system after 20 and 40 seconds respectively as 353 shown in Fig. 10), respectively. 354 In addition to the change of load, the DT and PS systems are tested under 3 different 355 voltage configurations. These configurations vary for assessment test I and test II since 356 their circuit models are different. The reason behind this test is to evaluate and compare 357 the performance of the controller under different operating points. As mentioned previ- 358 ously, the main gap in the DT area is how to evaluate the fidelity of a DT model. Thus, 359 the assessment of the DT model in this study is not limited to only change of load. 360 4.1.1 Assessment Test I - Normal Operation 361 The first assessment test evaluates the performance of the DT and PS under normal 362 operation. Both DT and PS are evaluated under three voltage configurations including 363 10-5 V, 24-12 V, and 48-24 V. In these voltage configurations, the first number represents 364 the value of the generation bus and the second one is the rated voltage at the load bus. 365 Fig. 12 depicts collected real-time data of PS and DT output voltages in 48-24 V 366 configuration from the human-machine interface (HMI). According to the Fig. 12, the 367 DT output voltage follows closely the pattern of the PS. It is worth mentioning that the 368 current sharing is performed using averaging-based distributed control. At t=20 Sec and 369 t=40 Sec, the second and third loads are connected in parallel to the first load. The 370 calculated RMSE and MAPE for this test are 2% and 0.2%, respectively which meets the 371 5% IEEE standard Castellani et al., 2020; S. Liu et al., 2023. Moreover, the captured 372 output voltages from the oscilloscope for DT and PS are shown in Fig. 13. 373 Distributed currents in DT and PS as well as the total demand are all shown in Fig. 374 14. Once the second and third resistive loads are connected, the demand current at the 375 load bus goes up. Therefore, the total current provided increases to approximately 1 A 376 and 1.5 A after the second and third loads are connected. 377 The currents for each buck agent are illustrated in Fig. 15, Fig. 16, and Fig. 17. 378 According to the figures, the DT model follows closely the physical testbed. 379 As discussed earlier, the evaluation test is conducted under two other operation points 380 including 10-5 V and 24-12 V. Table 2 shows the RMSE and MAPE calculated for all 381 17 Figure 12: DT model and PS voltage comparison from the HMI in assessment test I Figure 13: DT model and PS voltage comparison from the oscilloscope in assessment test I voltage configurations during the assessment test I. According to Table 2, all calculated 382 RMSE and MAPE for the entire assessment test I are equal to or less than 5% meeting 383 IEEE standards Castellani et al., 2020; S. Liu et al., 2023. 384 Table 2: RMSE and MAPE calculation in assessment test I Voltage Config. (V) 2*RMSE (%) 2*MAPE (%) Source Bus Load Bus 10 5 2.1 0.2 24 12 3.4 0.2 48 24 2.3 0.2 18 Figure 14: DT model and PS all currents comparison in assessment test I Figure 15: DT model and PS agent buck 1 current comparison in assessment test I 4.1.2 Assessment Test II - Emergency Operation 385 The second assessment test evaluates the performance of the DT and PS under emergency 386 operation where a battery storage system supports the microgrid under a power shortage 387 and voltage drop scenario.The battery system includes a boost converter controlled with 388 the MPC method. The battery is expected to respond quickly to unexpected conditions 389 where the PV system is not able to fully meet the load demand. 390 In the emergency operation test, the PV system is disconnected from the DC bus 391 and the controller provides the load in the islanding mode. Unlike the assessment test 392 I, the battery starts serving the R1= 50 Ω load at the beginning. Then, R2= 50 Ω 393 andR3= 50 Ωloads are added in parallel at t=20 Sec and t=40 Sec, respectively. The 394 19 Figure 16: DT model and PS agent buck 2 current comparison in assessment test I Figure 17: DT model and PS agent buck 3 current comparison in assessment test I DT and PS performances are assessed under three voltage configurations of 4-8 V, 8-16 395 V, and 12-24 V. Same as assessment test I, the first number represents the value of the 396 DC source bus and the second one is the value of the DC load bus increased by one 397 DC-DC boost converters. The rated voltage for each battery cell is 4V in our real-time 398 testing environment. Thus, it enables system’s operator to connect the required number 399 of battery cells according to the load demand. This reflects an advantage of using DT for 400 running what-if scenarios before making a decision in the physical plant. 401 Fig. 18 illustrates collected real-time voltage data coming from PS and DT systems 402 in 12-24 V configuration. As can be seen, the DT output voltage chases nearly the 403 pattern of the PS. At t=20 Sec and t=40 Sec, the second and third loads are connected 404 in parallel to the first load. The calculated RMSE and MAPE for this test are 4% and 405 20 0.2%, respectively meeting the IEEE standards Castellani et al., 2020; S. Liu et al., 2023. 406 Furthermore, the captured output voltages from the oscilloscope for DT and PS in the 407 test assessment II are illustrated in 19. 408 Figure 18: DT model and PS voltage comparison from HMI in assessment test II Figure 19: DT model and PS voltage comparison from the oscilloscope in assessment test II The currents from the DT model and PS are all illustrated in Fig. 20. The figure 409 shows how the controllers respond to the change of load and also how DT follows the 410 testbed in real-time. 411 The SOC of the battery during the discharging mode can be seen in Fig. 21. Due to 412 theincreaseinthedischargingcurrent, theSOCofthebatterydecreasesfaster. According 413 to the figure, the slope of battery SOC is sharpened once the second load is added at t=20 414 Sec. The same story is true once the third load is connected at t=40 Sec. 415 21 Figure 20: DT model and PS current comparison in assessment test II Figure 21: The battery SOC during discharging in assessment test II To better evaluate the DT model, three different voltage configurations are tested to 416 check the fidelity of the DT model with respect to the PS. The voltage configurations 417 are 4-8 V and 8-16 V. Table 3 presents the RMSE and MAPE calculated for all voltage 418 configurations during the assessment test II. 419 4.2 Phase II - Performance Tests 420 Once the fidelity of the DT model is verified, the DT can be used instead of the PS to 421 apply emergency tests since the DT mimics the similar behavior of the PS. In addition, 422 analyzing the outcomes of what-if scenario tests can help identify areas that may need 423 improvements. Therefore, by creating solid plans for each outcome, the PS can be better 424 22 Table 3: RMSE and MAPE calculation in assessment test II Voltage Config. (V) 2*RMSE (%) 2*MAPE (%) Source Bus Load Bus 4 8 4.7 0.5 8 16 5.1 0.5 12 24 5.4 0.5 prepared to handle certain unexpected situations that may arise in the future. Thus, the 425 DT has a vital role to play in enhancing the operation of the PS model, especially in 426 applications where the PS is far away from the control center like a Lunar power system. 427 To enhance the planning and operation of the PS model, it is essential to apply some 428 tests on the DT model required for emergency response. Therefore, the goal of phase II 429 is to analyze and assess the performance of the PS using its DT model instead, under 2 430 scenarios to mitigate the effect of any unforeseen issues on the PS model happening on 431 the Moon. Scenario I aims to evaluate the performance of the control unit switching from 432 normal operation mode to islanding mode due to the incapability of solar PV to meet the 433 load demand (Modes 0 & 3). 434 The battery system must be always ready to support the PV system during power 435 shortage scenarios (e.g., dust impact on the Lunar surface). Thus, scenario II tests the 436 battery charging system which starts working once the PV system has enough power to 437 serve loads. A collaborative battery control is designed where a current sharing and an 438 MPC-based controller are involved. The battery starts charging with the CC mode. After 439 the SOC of the battery reaches a predefined value, the charging mode is switched to the 440 CV. Once the SOC reaches 100 %, the system continues working under normal operation. 441 4.2.1 Scenario I - Emergency Support Discharging 442 The first scenario evaluates the performance of the DT under unforeseen emergency condi- 443 tions. In this scenario, the solar PV system starts serving the loads. Due to a disturbance, 444 it is assumed that the solar power is no longer able to meet the load. At this moment, the 445 battery controller enables the battery discharge mode. The reason for the PV system’s 446 power shortage can be either dust on solar panels due to the dusty atmosphere on the 447 Moon or any unexpected issues during the operation. 448 Fig. 22 illustrates voltages at the solar, battery and load side. According to the 449 figure, after roughly 60 seconds while all loads are connected, the voltage of the PV 450 system suddenly drops. Thus, the MPS-based battery controller, promptly disconnects 451 the PV system from the DC load bus and enables the battery’s discharge mode to keep 452 the voltage at the load bus regulated. 453 The currents for the PV , load, and battery are shown in Fig. 23. From t=0 to t=60 454 Sec, thePVsuppliesallthedemand. Inthisscenario, however, thepowerofthePVsystem 455 23 Figure 22: Voltage waveforms in emergency support discharging scenario I is dropped due to unforeseen issues. Then, the PV system is immediately disconnected 456 from the DC load bus and the battery is connected to meet the load demand. Thus, the 457 current of the battery system jumps from zero to roughly 1.5 A to serve the loads. 458 Figure 23: Current waveform in emergency support discharging scenario I Fig. 24 depicts the SOC of the battery during scenario I, the emergency support 459 test. As shown, the SOC stays at (100 %) while the PV system is serving the loads. 460 After approximately 60 seconds, the battery starts discharging to meet the load demand. 461 Therefore, the SOC of the battery decreases since the battery is discharging. 462 24 Figure 24: Battery SOC in emergency support discharging scenario I 4.2.2 Scenario II - Emergency Support Charging 463 The battery modules are expected to be stood by for emergency situations. Therefore, 464 scenario II evaluates the battery charging mechanism, which is activated when the PV 465 system generates sufficient power to support loads and there is a certain amount of excess 466 power. If the SOC of the battery is under a predefined value which in this test is set to 467 78 %, the battery goes to the CC-based charging mode. In case the SOC is equal to or 468 greater than 78 %, the battery is charged under CV charging mode until the SOC reaches 469 100%. After that, the battery system is disconnected from the MG, and the solar PV 470 system will fully supply the load in normal operation (mode 0). 471 Fig. 25 shows the voltages at the solar, battery, and load side. As can be seen, 472 the battery starts charging under CC mode controlled by MPC for approximately five 473 minutes. Once the battery SOC reaches 78%, the charging mode is moved from CC to 474 CV. The battery stays in the charging mode under the CV mode until the SOC reaches 475 100% (after about 8 minutes and 20 seconds). Eventually, the battery is disconnected 476 and the PV stays as the only source serving the loads. During all charging modes and 477 switching back to normal operation, the voltage of the load bus remains steady at 24 V. 478 This is because of a collaboration between the current sharing technique and the MPC 479 control on the battery side. 480 The currents at the load side as well as battery and solar PV are all shown in Fig. 481 26. Since the SOC of the battery is less than 78%, the battery control starts with the CC 482 mode. In this mode the battery is charged with a constant current of 1 A. This charging 483 current is provided by three DC-DC buck converters connected to the PV system. Since 484 the three buck converters are identical, each buck agent, therefore, is responsible for 485 one-third of the charging current as well as one-third of the loads demanded current. 486 Once the SOC reaches 78%, the charging mode is changed to CV. In this charging 487 25 Figure 25: Voltage waveforms in emergency support charging scenario II mode, the MPC regulates the battery’s voltage at 12 V. As the SOC goes up, the charging 488 current decreases. Therefore, the currents provided by the buck converters reduce as 489 well. After the battery is fully charged, the battery is immediately disconnected from 490 the DC load bus and the PV system continues serving the loads. It is worth noting that 491 during both CC and CV charging modes, the loads keep receiving a constant current 492 of approximately 1.5 A which shows a good collaboration between the current sharing 493 technique and the battery MPC controller. 494 Figure 26: Current waveform in emergency support charging scenario II Fig. 27 depicts the SOC of the battery during the scenario II emergency support 495 26 charging test. According to the figure, the SOC is 60% at the beginning of the test. 496 Thus, the MPC starts charging the battery under the CC mode for about five minutes. 497 Once the SOC reaches the predefined value (78%), the battery goes to the CV charging 498 mode. This charging mode takes approximately 500 seconds until the battery is fully 499 charged. 500 Figure 27: Battery SOC in emergency support charging scenario II 5. Conclusion 501 Utilizing digital twin technology for a nanogrid plant, our system demonstrates high- 502 fidelity real-time representation with low root mean square error values. The digital twin’s 503 innovation lies in its ability to simulate scenarios beyond existing controllers, fortifying 504 system resilience against unforeseen events. This approach, particularly valuable where 505 physical access is limited, empowers operators to proactively respond to disruptions. The 506 integration of a modular battery storage solution enhances the system’s capability to 507 address challenges such as the dust effect on the Lunar surface or unexpected faults. 508 Overall, our holistic approach not only validates space-based power system resilience but 509 also lays the foundation for transformative advancements in handling uncertainties during 510 space missions. 511 6. Acknowledgement 512 Authors would like to express their gratitude to NASA’s Stennis Space Center (SSC) and 513 Glenn Research Center (GRC) for valuable insights and feedback during several technical 514 meetings. 515 27