In this chapter we will discuss library components. The V-HAB library contains many precoded subsystems or components that you can simply use in your simulations without having to do the coding yourself. We strive to maintain the library and keep it up to date but sometimes something unexpected happens, so if you encounter any issues with a library component please contact your supervisor so that he may fix the problem.

Library components can come in various types and the exact implementation method depends on the component. However, each component should have a tutorial where you can see how the implementation is supposed to work. Additionally if you type help components.NameOfComponent into the command window you should receive a documentation for the respective component. If the folders are all shaded white and you receive an error that the component was not found, you can enter vhab.init into the command window first to initialize the folder structure. You can try this by typing help components.HX into the command window. Initially the documentation will pop up in the command window but if you click on Reference page for components.HX a new window will open. This is the same as the basic Matlab functionality for all built in Matlab functions (e.g. try typing help plot into the command window). Unfortunatly the documentation is currently an ongoing effort and you may also encounter multiple TO DOs. Please note that this also works for core files of V-HAB, for example help matter.phase will show you the information for the basic V-HAB phase and for example help tools.findSmallestTimeStep will show it for the tool to find the smallest time step in yoiur simulation (more on this in the V-HAB tool documentation soon to come to your V-HAB wiki).

Now on to the implementation of a library component into your simulation. Please note that you actually already implemented quite a few library components because the pipes are also library components. The first one we will implement now is a simple generic heat exchanger. You can find an example of such a heat exchanger in +tutorials/+heat_exchanger. You can add the heat exchanger anywhere in the createMatterStructure() function of the system to which you want to add a heat exchanger by using the following code:

Heat Exchanger
%% Heat Exchanger
sHX_type = 'CounterPlate';       % Heat exchanger type
tHX_Parameters.fBroadness  = 0.2;
tHX_Parameters.fHeight_1   = 1e-2;
tHX_Parameters.fHeight_2   = 1e-2;
tHX_Parameters.fLength     = 1;
tHX_Parameters.fThickness  = 1e-3;
% --> see the HX file for information on the inputs for the different HX types
Conductivity = 15;                          % Conductivity of the Heat exchanger solid material

%defines the heat exchanged object using the previously created properties
components.matter.HX(this, 'HeatExchanger', tHX_Parameters, sHX_type, Conductivity);

In this definition lines 2 to 6 define the input values of the library component, in this case the type of heat exchanger (counter plate), its geometry and the conductivity of the solid material of the heat exchanger. More information on this and the possible inputs can be found with help components.HX

However, this only adds the heat exchanger but does not connect it to anything within your system. The component does not know where it is supposed to be by default, but it automatically creates two F2F procs that you can use to add it to branches in the system. In the heat exchanger case, two F2F procs are created as there are two flow paths for two different fluids that exchange heat (often air and water). The F2Fs are named after the heat exchanger itself. In this case the heat exchanger is simply named HeatExchanger and therefore the F2Fs are called HeatExchanger_1 and HeatExchanger_2. If you change the name of the heat exchanger, the names of the F2Fs will also change. As already mentioned, these things are specific for each library component and you have to read the respective documentation and look at the tutorial for instructions on how to use different components. Now simply add the F2Fs to the branches Cabin_HX_Loop and HX_Coolant_Loop and you should be good to go.

Once you have implemented the heat exchanger and your system is working try adding a condensing heat exchanger and two humans from the library human model as well by yourself. Please note that in an actual spacecraft you only require a condensing heat exchanger, which will maintain the cabin temperature and humidity at the same time. You can find examples showing you how to do this correctly in the V-HAB examples folder under the names condensing_heat_exchanger and DetailedHuman! For the condensing heat exchanger, you have to add an air flow phase to the condensate storage store and let the air flow pass through that phase, as a phace change occurs and water must be removed from the air stream. For the branch flowing into that air phase you can use a manual solver with a volumetric flowrate of 0.1 m³/s and add the outflowing branch to the matter multibranch solver (you do not need to add pipes to this branch). For the coolant of the CHX you have to add a CHX coolant store and phase, where the coolant water has a temperature of 275 K. Also add a constant temperature heat source to this phase!

For the human model all required phases are already defined, but you can adjust the waste phases for feces and urine into mixture and use the now defined compound mass as their initial content. They were initially defined as solid and liquid to showcase the definition of these phase types, but since they will now contain a mixture of solid and liquid substances, they must be changed into mixture phases.

Heat Exchanger
matter.phases.mixture(this.toStores.Waste_Storage, 	'Solid_Waste',  'solid',    struct('Feces', 0.1), 293, 1e5);
matter.phases.mixture(this.toStores.Waste_Storage, 	'Liquid_Waste', 'liquid',   struct('Urine', 0.1), 293, 1e5);

Note that the human model also requires additions to the thermal structure!

To better see the effects of the added subsystems you can adjust the simulated timeframe to 36000 seconds instead of just 3600 seconds. (Adjust the fSimTime property which is set in the setup constructor) The plots below are for 36000 seconds!

While the system would already work if you do not change anything else, you can improve the performance by setting the time step properties for some phases. For example, the mass change in the waste storage and potable water phases is not really of interest to us, but at the moment it would result in very small time steps when urine or feces are added to these phases. If we tell V-HAB that we are not interested in the small scale dynamics of these phases, we can prevent this. In order to do so we can set the allowed maximum percent of mass change in one time step to infinite in the createSolverStructure function using the following code:

Heat Exchanger
tTimeStepProperties.rMaxChange = inf;
            
this.toStores.Water_Supply.toPhases.Water.setTimeStepProperties(tTimeStepProperties);
this.toStores.Waste_Storage.toPhases.Solid_Waste.setTimeStepProperties(tTimeStepProperties);
this.toStores.Waste_Storage.toPhases.Liquid_Waste.setTimeStepProperties(tTimeStepProperties);

Updated Plots


  • Keine Stichwörter