WSF
WsfThermalSystem.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2003-2015 The Boeing Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef WSFTHERMALSYSTEM_HPP
13#define WSFTHERMALSYSTEM_HPP
14
15#include "wsf_export.h"
16
17#include <vector>
18
19class UtInput;
20#include "UtLog.hpp"
21#include "WsfObjectTypeList.hpp"
22#include "WsfPlatformPart.hpp"
23
24// Nested class ThermalSystem::Component
26{
27public:
29
31 WsfThermalSystemComponent(const std::string& aTypeString,
32 double aSpecificHeatCapacity,
33 double aSpecificHeatCapacityHighTemp = 0.0,
34 double aEnthalpy = 0.0,
35 double aEnthalpyTransitionTemperature = 10000.0);
36
37 bool ProcessInput(UtInput& aInput) override;
38 double TransferHeat(double aHeatTransfer);
39
40 double GetTemperature() { return mTemperature; }
41 void SetTemperature(double aTemperature);
42 void SetMass(double aMass) { mMass = aMass; }
43
44 double GetRequiredHeatForTemperature(double aTemperature) const;
45
46 double GetHeatCapacity() const;
47
48 double GetHeatCapacity(double aTemperature) const;
49
50 double GetSpecificHeatCapacity() const { return mSpecificHeatCapacity; }
51
52 double GetPhaseTransitionTemperature() const { return mEnthalpyTransitionTemperature; }
53
54 double GetPhaseTransitionEnergy() const { return mMass * mEnthalpy; }
55
56 double GetRemainingPhaseTransitionEnergy(bool aIsAddingHeat) const;
57
58 bool InPhaseChange() const { return mInPhaseChange; }
59
60 double GetEnergy(double aLowTemp, double aHighTemp) const;
61
62 double PrintInfo(double aLowTemp, double aHighTemp, ut::log::MessageStream& aMessageStream) const;
63
64 void PrintState(ut::log::MessageStream& aMessageStream) const;
65
66private:
67 double mMass;
68
69 double mSpecificHeatCapacity;
70 double mSpecificHeatCapacityHighTemp; // Above phase change.
71 double mTemperature;
72
75 double mEnthalpy;
76 double mEnthalpyTransitionTemperature;
77 double mTotalTransitionEnergy;
78 double mTransitionEnergy;
79 bool mInPhaseChange;
80};
81
89{
90public:
91 class Component; // Full declaration is below.
92
93 WsfThermalSystem(const WsfScenario& aScenario);
96 ~WsfThermalSystem() override;
97
98 WsfObject* Clone() const override { return new WsfThermalSystem(*this); }
99
100 bool ProcessInput(UtInput& aInput) override;
101 bool Initialize(double aSimTime) override;
102
103 WsfComponent* CloneComponent() const override { return new WsfThermalSystem(*this); }
104
105 const int* GetComponentRoles() const override;
106
107 void* QueryInterface(int aRole) override
108 {
110 {
111 return this;
112 }
113 if (aRole == cWSF_COMPONENT_PLATFORM_PART)
114 {
115 return dynamic_cast<WsfPlatformPart*>(this);
116 }
117 return nullptr;
118 }
119
120 double GetUpdateInterval() const override { return mUpdateInterval; }
121 void SetUpdateInterval(double aUpdateInterval) override { mUpdateInterval = aUpdateInterval; }
122
123 virtual double TransferHeat(double aSimTime, double aHeatTransfer);
124
126 bool IsValid() const { return ((mComponents.size() > 0) || mIsSimple); }
127
129 bool IsSimple() const { return mIsSimple; }
130
131 double GetTemperature() const { return mTemperature; }
132
133 void SetTemperature(double aTemperature);
134
135 double GetHeatSink() const { return mHeatSink; }
136
137 void PrintInfo(double aLowTemp, double aHighTemp) const;
138
139 double GetRequiredHeatForTemperature(double aTemperature) const;
140
141 double GetEnergy(double aLowTemp, double aHighTemp) const;
142
143 // Set the power to be dissipated in a recharge rate interval.
144 void SetPowerDissipated(double aPowerDissipated) { mPowerDissipated = aPowerDissipated; }
145
146 void SetLowTemperature(double aLowTemperature) { mTargetTemperature = aLowTemperature; }
147 double GetLowTemperature() const { return mTargetTemperature; }
148
149 void SetHighTemperature(double aHighTemperature) { mHighTemperature = aHighTemperature; }
150 double GetHighTemperature() const { return mHighTemperature; }
151
152protected:
153private:
154 void CalculateHeatCapacity();
155 double GetHeatTransfer(double aTemperature);
156 double GetTemperature(double aHeatTransfer);
157 bool InitializeSimple();
158
159 bool mDebug;
160 double mTemperature;
161 double mLastTemperature;
162 double mTargetTemperature;
163 double mHighTemperature;
164 double mUpdateInterval;
165 double mLastUpdateTime;
166 double mHeatCapacity;
167 double mHeatSink;
168 bool mIsSimple;
169 double mHeatingTime;
170 double mSimpleRechargeRate;
171 double mPowerDissipated;
172 std::vector<WsfThermalSystemComponent> mComponents;
173
174}; // class WsfThermalSystem
175
177
183
184#endif
#define WSF_DECLARE_COMPONENT_ROLE_TYPE(TYPE, ROLE)
Definition WsfComponentRoles.hpp:44
@ cWSF_COMPONENT_THERMAL_SYSTEM
A 'thermal system' component.
Definition WsfComponentRoles.hpp:114
@ cWSF_COMPONENT_PLATFORM_PART
The component derives from WsfPlatformPart.
Definition WsfComponentRoles.hpp:98
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Definition WsfComponent.hpp:39
WsfObjectTypeList(WsfScenario &aScenario, unsigned int aFlags, const std::string &aBlockName)
Definition WsfObjectTypeList.hpp:76
WsfObject()
This is the constructor for the WsfObject class.
Definition WsfObject.cpp:88
WsfPlatformPart(const WsfScenario &aScenario, int aPartType)
Definition WsfPlatformPart.cpp:62
bool Initialize(double aSimTime) override
Definition WsfPlatformPart.cpp:276
const int * GetComponentRoles() const override
Definition WsfPlatformPart.cpp:137
bool ProcessInput(UtInput &aInput) override
Definition WsfPlatformPart.cpp:347
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
WsfThermalSystemComponentTypes(WsfScenario &aScenario)
Definition WsfThermalSystem.cpp:759
Definition WsfThermalSystem.hpp:26
double GetEnergy(double aLowTemp, double aHighTemp) const
Definition WsfThermalSystem.cpp:578
void PrintState(ut::log::MessageStream &aMessageStream) const
Definition WsfThermalSystem.cpp:746
double GetPhaseTransitionTemperature() const
Definition WsfThermalSystem.hpp:52
double GetHeatCapacity() const
Definition WsfThermalSystem.cpp:570
double PrintInfo(double aLowTemp, double aHighTemp, ut::log::MessageStream &aMessageStream) const
Definition WsfThermalSystem.cpp:708
double GetTemperature()
Definition WsfThermalSystem.hpp:40
double GetPhaseTransitionEnergy() const
Definition WsfThermalSystem.hpp:54
void SetMass(double aMass)
Definition WsfThermalSystem.hpp:42
bool InPhaseChange() const
Definition WsfThermalSystem.hpp:58
double GetSpecificHeatCapacity() const
Definition WsfThermalSystem.hpp:50
WsfThermalSystemComponent()
Definition WsfThermalSystem.cpp:437
void SetTemperature(double aTemperature)
Set the temperature, regardless of heat transfer.
Definition WsfThermalSystem.cpp:609
double GetRemainingPhaseTransitionEnergy(bool aIsAddingHeat) const
Definition WsfThermalSystem.cpp:638
bool ProcessInput(UtInput &aInput) override
Definition WsfThermalSystem.cpp:508
double GetRequiredHeatForTemperature(double aTemperature) const
Definition WsfThermalSystem.cpp:656
double TransferHeat(double aHeatTransfer)
Update based on heat transfer.
Definition WsfThermalSystem.cpp:452
Definition WsfThermalSystem.hpp:89
WsfThermalSystem(const WsfScenario &aScenario)
Definition WsfThermalSystem.cpp:24
void SetUpdateInterval(double aUpdateInterval) override
Definition WsfThermalSystem.hpp:121
WsfThermalSystem & operator=(const WsfThermalSystem &)=delete
double GetHeatSink() const
Definition WsfThermalSystem.hpp:135
WsfComponent * CloneComponent() const override
Definition WsfThermalSystem.hpp:103
bool IsSimple() const
Return whether we are configuring this system with "simple" inputs.
Definition WsfThermalSystem.hpp:129
double GetTemperature() const
Definition WsfThermalSystem.hpp:131
double GetLowTemperature() const
Definition WsfThermalSystem.hpp:147
void * QueryInterface(int aRole) override
Definition WsfThermalSystem.hpp:107
double GetHighTemperature() const
Definition WsfThermalSystem.hpp:150
void SetHighTemperature(double aHighTemperature)
Definition WsfThermalSystem.hpp:149
void SetPowerDissipated(double aPowerDissipated)
Definition WsfThermalSystem.hpp:144
double GetUpdateInterval() const override
Definition WsfThermalSystem.hpp:120
bool IsValid() const
Return whether the system is "valid", i.e., is being utilized.
Definition WsfThermalSystem.hpp:126
void SetLowTemperature(double aLowTemperature)
Definition WsfThermalSystem.hpp:146
WsfObject * Clone() const override
Definition WsfThermalSystem.hpp:98
WsfUncloneableObject()
Definition WsfObject.hpp:148
Copyrights Multiple, All Rights Reserved