Ebsilon: Macros, Kernelscripting and Programmable Component
Ebsilon: Macros, Kernelscripting and Programmable Component
Macros, KernelScripting
and Programmable component
1. Creation of Macros
• Pipes
• Specification values
• Charlines
• Inner topology
• EbsScript before / after simulation
• Result values
4. Fluid types
• Water/steam
• Air and fluegas
• Combustibles
• User defined
• 2-phase fluid
• Universal fluid
„outer“ view
„inner“ view
Definition of charlines
• Identifier
• Name
• Points (obsolete)
• x-Description and x-Quantity
• y-Description and y-Quantity
• Optionally define multi-dimensional charlines
Create a Macro :
• The outlet temperature should be a function of the inlet mass flow and
should be defined using a charline
• The difference of inlet- and outlet energy flow should be defined as a result
value
Embedded script
component 93
uses @KernelScripting;
At the beginning of the EbsScript. The „@“ marks the unit as a so-called
interface unit
function ksGetComp:ebsComp93;
returns the actual instance of the component
function ksGetMode:Mode;
returns the actual calculation mode of the Ebsilon calculation kernel :
initializing (Initialization phase)
calculating (during iteration)
finishing (at end of iteration)
These result values are predefined as „enums“ of type „Mode“
function ksGetItNo:Integer;
Returns the number of the actual iteration step
function ksGetFPROG:Integer;
Returns the program-index, i.e. the value of the specification value FPROG.
For outlet pipes, which are not connected to other components of the model, no
values have to be initialized. In case these pipes are connected, all values must be
initialized, also for logical, electrical and mechanical pipes/lines. For such pipes
pressure and massflow should be initialized with 1. To initialize the value of the
energy flow, the enthalpy H must be initialized with the value of the energy flow.
Please take note that calculations are done in the Ebsilon standard unit
system (bar, °C, kg/s, kJ/kg, kW, …).
From the EbsScript defined in the KernelScripting component all objects of the
Ebsilon model can be accessed (read), in particular all pipe values of massflow,
pressure and enthalpy. Pipe values are accessed for the actual iteration step.
The print-function can be used inside the KernelScripting for debugging and
diagnostic purposes. The printout is displayed at the end of the simulation in the
EbsKernel toolbar. In the EbsKernel toolbar one page for each KernelScripting
component is used.
type FluidAnalysis =
array [Substance_First .. Substance_Last] of Real;
type FluidTypeEnum =
(
FluidTypeUndefined = -1, // undefined Value
FluidTypeSteam = 0, // No composition required
FluidTypeFluegas, // Fluegas or Air
FluidTypeGas, // Gas
FluidTypeCoal, // Coal
FluidTypeCrudegas, // Crudegas
FluidTypeOil, // Oil
FluidTypeUser, // User
FluidType2Phase, // 2phase
FluidTypeSaltwater, // Saltwater
FluidTypeBinaryMixture, // BinaryMixture
FluidTypeUniversalFluid, // UniversalFluid
FluidTypeThermoLiquid, // ThermoLiquid
FluidType_Size,
FluidType_UpperBound = FluidType_Size - 1,
);
type CompositionDefinedByEnum =
(
CompositionDefinedByNone = -1,
CompositionDefinedByMass,
CompositionDefinedByVolume,
CompositionDefinedByCoalRaw,
CompositionDefinedByCoalWaterAndAshFree,
CompositionDefinedByCoalWaterFree,
CompositionDefinedByCoalAshFree,
CompositionDefinedBy_Size,
CompositionDefinedBy_UpperBound = CompositionDefinedBy_Size - 1,
);
type CoalTypeEnum =
(
CoalTypeGeneral, // old mode
CoalTypeHard, // hard coal
CoalTypeBrown, // brown coal
CoalType_Size,
CoalType_UpperBound = CoalType_Size - 1,
);
type SubstanceEnum =
(
SubstanceNone, // no Substance
Substance_First=1, // first substance-index
SubstanceN2=1, // 1 Nitrogen (N2)
SubstanceO2, // 2 Oxygen (O2)
SubstanceCO2, // 3 Carbon dioxide (CO2)
SubstanceH2OG, // 4 Water (gaseous)
SubstanceSO2, // 5 Sulphur dioxide (SO2)
SubstanceAR, // 6 Argon (AR)
SubstanceCO, // 7 Carbon monoxide (CO)
SubstanceCOS, // 8 Carbon monoxide sulfide (COS)
SubstanceH2, // 9 Hydrogen (H2)
SubstanceH2S, // 10 Hydrogen sulphide (H2S)
SubstanceCH4, // 11 Methane (CH4)
SubstanceHCL, // 12 Hydrogen chloride (HCl)
SubstanceETH, // 13 Ethane (C2H6)
SubstancePROP, // 14 Propane (C3H8)
SubstanceBUT, // 15 Butane (C4H10)
SubstancePENT, // 16 Pentane
SubstanceHEX, // 17 Hexane
SubstanceHEPT, // 18 Heptane
SubstanceACET, // 19 Acetylene
SubstanceBENZ, // 20 Benzole
SubstanceC, // 21 Elementary carbon (C)
SubstanceH, // 22 Elementary hydrogen (H)
SubstanceO, // 23 Elementary oxygen (O)
SubstanceN, // 24 Elementary nitrogen (N)
SubstanceS, // 25 Elementary sulphur (S)
SubstanceCL, // 26 Elementary chlorine (Cl)
SubstanceASH, // 27 Ash
SubstanceLIME, // 28 Lime
SubstanceH2OL, // 29 Water (liquid)
SubstanceH2OB, // 30 Water (chemical bound)
SubstanceASHG, // 31 Ash
SubstanceNO, // 32 NO
SubstanceNO2, // 33 NO2
SubstanceNH3G, // 34 NH3G
SubstanceNH3L, // 35 NH3L
SubstanceCO2L, // 36 CO2L
SubstanceMETHL, // 37 Methanol
Substance_Last = SubstanceMETHL,
Substance_Size,
Substance_UpperBound = Substance_Size - 1,
);
Macros, KernelScripting and Programmable component 27
KernelScripting, important datatypes
(defined in @System)
type UniversalSubstancePart =
record
substance : UniversalSubstanceEnum;
fraction : Real;
end;
• One outlet flow should consist of pure CO2 at the temperature of the inlet
massflow
• The other outlet flow should contain the remaining constituents of the
fluegas and of the CO2 which was not extracted
associated Source-code
(Programming language C/C++)
component 65
When the DLL is called, data from the Ebsilon model is transferred to the DLL
where the data can be processed and then transferred back to the Ebsilon
model.
The path to the DLL can now be specified directly in component 65. Previously
only in the general settings of Ebsilon a path could be specified which then was
global for all Ebsilon models and all components 65. Therefore now it is
possible to use more than 1 DLL per model.
Normally under :
C:\Programme\Ebsilon\EBSILONProfessional 10\Data\
Examples\Programmable or a similar path
Execute a simulation
Open the Visual C/C++ project (if you have MS Visual Studio)
Execute the simulation. Check if the maximum pressure is written to the outlet
pipes.
Macros, KernelScripting and Programmable component 38
combination of macro, Kernelscripting
and Fluidtypes
• One outlet flow should have the temperature of the inlet massflow
• The other outlet flow should have the temperature given as specification
value