Commit b187d4d3 authored by yo3770's avatar yo3770

new cleaned version of the conversion tool.For the latest input-models in...

new cleaned version of the conversion tool.For the latest input-models in GitHub, are with this version, new output generated. New models are in the subdirectory "Output" of the "Main" Folder
parent 5dfd3720
<?xml version="1.0" encoding="utf-8"?>
<!-- XSLT-Stylesheet to Generate a List of all Properies and a List of duplicate Properties -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.lbl.gov/namespaces/Sim/Model" xmlns:simcore="http://www.lbl.gov/namespaces/Sim/SimModelCore" xmlns:simres="http://www.lbl.gov/namespaces/Sim/ResourcesGeneral" xmlns:simgeom="http://www.lbl.gov/namespaces/Sim/ResourcesGeometry" xmlns:simbldg="http://www.lbl.gov/namespaces/Sim/BuildingModel" xmlns:simmep="http://www.lbl.gov/namespaces/Sim/MepModel" xmlns:ifc="http://www.buildingsmart-tech.org/ifcXML/IFC4/Add1" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
exclude-result-prefixes="xsl ifc msxsl">
<xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template name="GenerateDuplicateList">
<xsl:param name="PSByRelDef"/>
<xsl:param name="PSByType"/>
<!--CASE 1: Properties are directly referenced-->
<xsl:for-each select="msxsl:node-set($PSByType)/ifc:IfcPropertySet/ifc:HasProperties/ifc:IfcPropertySingleValue">
<xsl:variable name="Name" select="@Name"/>
<xsl:variable name="psetName" select="../../@Name"/>
<xsl:variable name="psetGlobalID" select="../../@GlobalId"/>
<xsl:for-each select="msxsl:node-set($PSByRelDef)/ifc:IfcPropertySet/ifc:HasProperties/ifc:IfcPropertySingleValue">
<xsl:variable name="RelDefPropertyName" select="@Name"/>
<xsl:variable name="RelDefPropertySetName" select="../../@Name"/>
<xsl:if test="current()[contains(../../@Name, $psetName)]">
<xsl:if test="$Name = $RelDefPropertyName">
<xsl:text>
</xsl:text>
<xsl:value-of select="$psetGlobalID"/>:<xsl:value-of select="$psetName"/>:<xsl:value-of select="$Name"/>
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
<!--CASE 2: Properties are defined by relation-->
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template name="ConcatPsetCollections">
<xsl:param name="PSByRelDef"/>
<xsl:param name="PSByType"/>
<xsl:copy-of select="$PSByRelDef"/>
<xsl:copy-of select="$PSByType"/>
</xsl:template>
</xsl:stylesheet>
@echo off
cscript IfcBoiler.js //Nologo %1
/*
* ifcXML.js
*
* JScript zur zur Transformation einer Quelldatei zur designierten Zieldatei mithilfe xsl stylesheet
*/
var args = WScript.Arguments;
if (args.length == 0) {
WScript.Echo("Syntaxfehler.");
WScript.Quit();
}
// command-line argumente auslesen
filename = args(0); // Quelldatei
try {
// XML Objekt fr die Quelldatei erzeugen
var xml = new ActiveXObject("Msxml2.DOMDocument.6.0");
xml.async = false;
xml.validateOnParse = true;
xml.load(filename);
WScript.Echo("source XML load succeeded.");
// Einlesevorgang Quelldatei error handling
if (xml.parseError.errorCode != 0) {
WScript.Echo(xml.parseError.reason);
WScript.Quit()
}
// XSLT-Stylesheet laden
var xsl = new ActiveXObject("Msxml2.DOMDocument.6.0");
xsl.async = false;
xsl.resolveExternals = true; // xsl:include zulassen
xsl.setProperty("AllowXsltScript", true); // Skripte erlauben
xsl.validateOnParse = true;
xsl.load("..\\Main\\xsl\\Main.xsl"); // "Statisch verdrahteter" Einstiegspunkt in XSLT Geflecht
WScript.Echo("XSL load succeeded.");
// Einlesevorgang XSLT error handling
if (xsl.parseError.errorCode != 0) {
WScript.Echo(xsl.parseError.reason);
WScript.Quit()
}
// Objekt fr Zieldokument erzeugen
var result = new ActiveXObject("Msxml2.DOMDocument.6.0");
// Quelldatei TRANSFORMieren
WScript.Echo("Started Transformation.");
xml.transformNodeToObject(xsl.documentElement, result);
WScript.Echo("Transformation succeeded.");
// Zieldokument in UTF-8-Stream schreiben
var utf8Stream = new ActiveXObject("ADODB.Stream");
fso = new ActiveXObject("Scripting.FileSystemObject");
utf8Stream.Type = 2; // adTypeText
utf8Stream.Charset = "utf-8"
utf8Stream.LineSeparator = 10; // adLF
utf8Stream.Open();
utf8Stream.WriteText(result.xml);
utf8Stream.Position = 3; // Byte Order Mark berspringen
utf8Stream.SaveToFile("output\\" + fso.GetBaseName(filename) + ".simxml", 2); // adSaveCreateOverWrite
WScript.Echo("Transformation result saved to OUTPUT folder.");
utf8Stream.Close();
}
catch (err) {
WScript.Echo(err.description);
}
<?xml version="1.0" encoding="utf-8"?>
<ifcXML xmlns="http://www.buildingsmart-tech.org/ifcXML/IFC4/final" xmlns:ifc="http://www.buildingsmart-tech.org/ifcXML/IFC4/final" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.buildingsmart-tech.org/ifcXML/IFC4/final file:///C:/BLM.DEV/BLM.INVENTORY/XSD/IFC4/ifcXML4.xsd" id="ifcXML4">
<!--Containing Topological Element-->
<IfcSpaceType id="i2077"/>
<!--Topological Ref Element-->
<IfcRelContainedInSpatialStructure id="i33247">
<RelatedElements>
<IfcBuildingElementProxy/>
</RelatedElements>
<RelatingStructure xsi:nil="true" xsi:type="IfcSpace" ref="i2077"/>
</IfcRelContainedInSpatialStructure>
<!--The Element of Interest-->
<IfcBoiler id="i2464" Name="Boiler IFC4 Schema:Allgemein:929683" GlobalId="3WU0Up2sv6WPUm6U7AO_fO"/>
<!--Direct Related PropertySet | NOTE: NO additional decomposions (e.g. IfcRelDefinesByType via IfcBoilerTYPE)!-->
<IfcRelDefinesByProperties id="i2517" GlobalId="2PenJPNsHFQO2iEPuHvWsX">
<RelatedObjects xsi:type="ifc:IfcBoiler" ref="i2464"/>
<RelatingPropertyDefinition>
<IfcPropertySetDefinitionSet-wrapper>
<IfcPropertySet xsi:nil="true" ref="i10001"/>
<IfcPropertySet xsi:nil="true" ref="i10002"/>
</IfcPropertySetDefinitionSet-wrapper>
</RelatingPropertyDefinition>
</IfcRelDefinesByProperties>
<!-- The PropertySets of Interest, ONLY (we don't want generic IFC2SimModel Mapping - is out of scope AND NOT intended by using SimModfel as INTERMEDIATE "Model in the Middle" EneffBIM concept!)-->
<IfcPropertySet Name="Pset_BoilerTypeCommon" id="i10001">
<HasProperties>
<IfcPropertySingleValue Name="EnergySource">
<NominalValue>
<IfcLabel-wrapper>GAS</IfcLabel-wrapper>
</NominalValue>
</IfcPropertySingleValue>
<IfcPropertySingleValue Name="OperatingMode">
<NominalValue>
<IfcLabel-wrapper>MODULATING</IfcLabel-wrapper>
</NominalValue>
</IfcPropertySingleValue>
<IfcPropertySingleValue Name="PartialLoadEfficiencyCurves">
<NominalValue>
<IfcLabel-wrapper>0.</IfcLabel-wrapper>
</NominalValue>
</IfcPropertySingleValue>
<!--<IfcPropertySingleValue Name="WaterStorageCapacity" Description="BLMDEV_todo: additional unit info needed">
<NominalValue>
<IfcVolumeMeasure-wrapper>0.</IfcVolumeMeasure-wrapper>
</NominalValue>
</IfcPropertySingleValue>-->
<IfcPropertySingleValue ref="i10003"/>
<IfcPropertySingleValue Name="WaterInletTemperatureRange">
<NominalValue>
<IfcLabel-wrapper>328.15</IfcLabel-wrapper>
</NominalValue>
</IfcPropertySingleValue>
<IfcPropertySingleValue Name="OutletTemperatureRange">
<NominalValue>
<IfcLabel-wrapper>343.15</IfcLabel-wrapper>
</NominalValue>
</IfcPropertySingleValue>
</HasProperties>
</IfcPropertySet>
<!-- rel object-->
<!-- property object-->
<IfcPropertySingleValue Name="WaterStorageCapacity" Description="BLMDEV_todo: additional unit info needed" id="i10003">
<NominalValue>
<IfcVolumeMeasure-wrapper>20</IfcVolumeMeasure-wrapper>
</NominalValue>
</IfcPropertySingleValue>
<IfcPropertySet Name="Pset_BoilerTypeWater" id="i10002">
<HasProperties>
<IfcPropertyTableValue Name="HeatOutput" Description="3rd property in table">
<DefiningValues>
<IfcEnergyMeasure-wrapper>1</IfcEnergyMeasure-wrapper>
<IfcThermodynamicTemperatureMeasure-wrapper>1</IfcThermodynamicTemperatureMeasure-wrapper>
</DefiningValues>
</IfcPropertyTableValue>
<IfcPropertyTableValue Name="NominalEfficiency" Description="3rd property in table">
<DefiningValues>
<IfcEnergyMeasure-wrapper>1</IfcEnergyMeasure-wrapper>
<IfcThermodynamicTemperatureMeasure-wrapper>1</IfcThermodynamicTemperatureMeasure-wrapper>
</DefiningValues>
</IfcPropertyTableValue>
</HasProperties>
</IfcPropertySet>
</ifcXML>
<?xml version="1.0" encoding="utf-8"?>
<ifcXML xmlns="http://www.buildingsmart-tech.org/ifcXML/IFC4/final" xmlns:ifc="http://www.buildingsmart-tech.org/ifcXML/IFC4/final" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.buildingsmart-tech.org/ifcXML/IFC4/final file:///C:/BLM.DEV/BLM.INVENTORY/XSD/IFC4/ifcXML4.xsd" id="ifcXML4">
<!--Containing Topological Element-->
<IfcSpaceType id="i2077"/>
<!--Topological Ref Element-->
<IfcRelContainedInSpatialStructure id="i33247">
<RelatedElements>
<IfcBuildingElementProxy/>
</RelatedElements>
<RelatingStructure xsi:nil="true" xsi:type="IfcSpace" ref="i2077"/>
</IfcRelContainedInSpatialStructure>
<!--The Element of Interest-->
<IfcBoiler id="i2464" Name="Boiler IFC4 Schema:Allgemein:929683" GlobalId="3WU0Up2sv6WPUm6U7AO_fO"/>
<IfcRelDefinesByType id="i32979" GlobalId="1vJIFPeIn68ugHpSzeSsYx">
<RelatedObjects>
<IfcBoiler ref="i2464"/>
</RelatedObjects>
<RelatingType xsi:type="IfcBoilerType" ref="i2440"/>
</IfcRelDefinesByType>
<!-- define Type for common information regarding all refernced Boiler -->
<IfcBoilerType id="i2440">
<HasPropertySets>
<IfcPropertySet xsi:nil="true" ref="i10001"/>
<IfcPropertySet xsi:nil="true" ref="i10002"/>
</HasPropertySets>
</IfcBoilerType>
<!--Related PropertySet defined by general Type | NOTE: NO additional decomposions (e.g. IfcRelDefinesByType via IfcBoilerTYPE)!-->
<!--<IfcRelDefinesByProperties id="i2517" GlobalId="2PenJPNsHFQO2iEPuHvWsX">
<RelatedObjects xsi:type="ifc:IfcBoiler" ref="i2464"/>
<RelatingPropertyDefinition>
<IfcPropertySetDefinitionSet-wrapper>
<IfcPropertySet xsi:nil="true" ref="i10001"/>
<IfcPropertySet xsi:nil="true" ref="i10002"/>
</IfcPropertySetDefinitionSet-wrapper>
</RelatingPropertyDefinition>
</IfcRelDefinesByProperties>-->
<!-- The PropertySets of Interest, ONLY (we don't want generic IFC2SimModel Mapping - is out of scope AND NOT intended by using SimModfel as INTERMEDIATE "Model in the Middle" EneffBIM concept!)-->
<IfcPropertySet Name="Pset_BoilerTypeCommon" id="i10001">
<HasProperties>
<IfcPropertySingleValue Name="EnergySource">
<NominalValue>
<IfcLabel-wrapper>GAS</IfcLabel-wrapper>
</NominalValue>
</IfcPropertySingleValue>
<IfcPropertySingleValue Name="OperatingMode">
<NominalValue>
<IfcLabel-wrapper>MODULATING</IfcLabel-wrapper>
</NominalValue>
</IfcPropertySingleValue>
<IfcPropertySingleValue Name="PartialLoadEfficiencyCurves">
<NominalValue>
<IfcLabel-wrapper>0.</IfcLabel-wrapper>
</NominalValue>
</IfcPropertySingleValue>
<!--<IfcPropertySingleValue Name="WaterStorageCapacity" Description="BLMDEV_todo: additional unit info needed">
<NominalValue>
<IfcVolumeMeasure-wrapper>0.</IfcVolumeMeasure-wrapper>
</NominalValue>
</IfcPropertySingleValue>-->
<IfcPropertySingleValue ref="i10003"/>
<IfcPropertySingleValue Name="WaterInletTemperatureRange">
<NominalValue>
<IfcLabel-wrapper>328.15</IfcLabel-wrapper>
</NominalValue>
</IfcPropertySingleValue>
<IfcPropertySingleValue Name="OutletTemperatureRange">
<NominalValue>
<IfcLabel-wrapper>343.15</IfcLabel-wrapper>
</NominalValue>
</IfcPropertySingleValue>
</HasProperties>
</IfcPropertySet>
<!-- rel object-->
<!-- property object-->
<IfcPropertySingleValue Name="WaterStorageCapacity" Description="BLMDEV_todo: additional unit info needed" id="i10003">
<NominalValue>
<IfcVolumeMeasure-wrapper>20</IfcVolumeMeasure-wrapper>
</NominalValue>
</IfcPropertySingleValue>
<IfcPropertySet Name="Pset_BoilerTypeWater" id="i10002">
<HasProperties>
<IfcPropertyTableValue Name="HeatOutput" Description="3rd property in table">
<DefiningValues>
<IfcEnergyMeasure-wrapper>1</IfcEnergyMeasure-wrapper>
<IfcThermodynamicTemperatureMeasure-wrapper>1</IfcThermodynamicTemperatureMeasure-wrapper>
</DefiningValues>
</IfcPropertyTableValue>
<IfcPropertyTableValue Name="NominalEfficiency" Description="3rd property in table">
<DefiningValues>
<IfcEnergyMeasure-wrapper>1</IfcEnergyMeasure-wrapper>
<IfcThermodynamicTemperatureMeasure-wrapper>1</IfcThermodynamicTemperatureMeasure-wrapper>
</DefiningValues>
</IfcPropertyTableValue>
</HasProperties>
</IfcPropertySet>
</ifcXML>
<?xml version="1.0"?>
<SimModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.lbl.gov/namespaces/Sim/Model" xmlns:simcore="http://www.lbl.gov/namespaces/Sim/SimModelCore" xmlns:simres="http://www.lbl.gov/namespaces/Sim/ResourcesGeneral" xmlns:simgeom="http://www.lbl.gov/namespaces/Sim/ResourcesGeometry" xmlns:simbldg="http://www.lbl.gov/namespaces/Sim/BuildingModel" xmlns:simmep="http://www.lbl.gov/namespaces/Sim/MepModel" SimModelVersion="19-Feb-15" SimModelSchemaVersion="1.150219" SimModelUnitsVersion="12-Jan-15" SimModelUnitDefaultsVersion="12-Jan-15" SimModelSchemaIDKey="Simergy v1.5.0.18438">
<SimFlowPlant_Boiler_BoilerHotWater RefId="ID75124">
<simcore:SimUniqueID>e707e683-068b-40f5-878a-d0f5ef5513e0</simcore:SimUniqueID>
<simcore:SimModelType>Boiler</simcore:SimModelType>
<simcore:SimModelSubtype>BoilerHotWater</simcore:SimModelSubtype>
<simcore:SimModelName>BLR-1(5)</simcore:SimModelName>
<simcore:SourceModelSchema>Simergy v1.5.0.18438</simcore:SourceModelSchema>
<simcore:SourceModelObjectType>SIM:SimFlowPlant</simcore:SourceModelObjectType>
<simcore:IsTemplateObject>true</simcore:IsTemplateObject>
<simcore:AssignedToGroups>ID74373</simcore:AssignedToGroups>
<simcore:Tag>BLR-1</simcore:Tag>
<simmep:SimFlowPlant_Name>BLR-1</simmep:SimFlowPlant_Name>
<simmep:SimFlowPlant_FuelType>NaturalGas</simmep:SimFlowPlant_FuelType>
<simmep:SimFlowPlant_NomCap>-2147483648</simmep:SimFlowPlant_NomCap>
<simmep:SimFlowPlant_NomThermalEff>0.8</simmep:SimFlowPlant_NomThermalEff>
<simmep:SimFlowPlant_EfficiencyCurveTempEvaluationVar>LeavingBoiler</simmep:SimFlowPlant_EfficiencyCurveTempEvaluationVar>
<simmep:SimFlowPlant_NrmlizedBoilerEffCurveName>ID79689</simmep:SimFlowPlant_NrmlizedBoilerEffCurveName>
<simmep:SimFlowPlant_DesignWaterOutletTemp>82.222214</simmep:SimFlowPlant_DesignWaterOutletTemp>
<simmep:SimFlowPlant_DesignWaterFlowRate>-2147483648</simmep:SimFlowPlant_DesignWaterFlowRate>
<simmep:SimFlowPlant_MinPartLoadRatio>0</simmep:SimFlowPlant_MinPartLoadRatio>
<simmep:SimFlowPlant_MaxPartLoadRatio>1.2</simmep:SimFlowPlant_MaxPartLoadRatio>
<simmep:SimFlowPlant_OptimumPartLoadRatio>1</simmep:SimFlowPlant_OptimumPartLoadRatio>
<simmep:SimFlowPlant_WaterOutletUpTempLimit>99.99999</simmep:SimFlowPlant_WaterOutletUpTempLimit>
<simmep:SimFlowPlant_BoilerFlowMode>VariableFlow</simmep:SimFlowPlant_BoilerFlowMode>
<simmep:SimFlowPlant_SizingFactor>0.5</simmep:SimFlowPlant_SizingFactor>
</SimFlowPlant_Boiler_BoilerHotWater>
</SimModel>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- KIT Tool | EneffBIM converter (Author KIT BLM 2015)-->
<!-- XSLT-Stylesheet Transformation from IfcBoiler to the aquivalent SimModel type -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.lbl.gov/namespaces/Sim/Model" xmlns:simcore="http://www.lbl.gov/namespaces/Sim/SimModelCore" xmlns:simres="http://www.lbl.gov/namespaces/Sim/ResourcesGeneral" xmlns:simgeom="http://www.lbl.gov/namespaces/Sim/ResourcesGeometry" xmlns:simbldg="http://www.lbl.gov/namespaces/Sim/BuildingModel" xmlns:simmep="http://www.lbl.gov/namespaces/Sim/MepModel" xmlns:ifc="http://www.buildingsmart-tech.org/ifcXML/IFC4/Add1" exclude-result-prefixes="xsl ifc">
<xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<!--the IfcBoiler template-->
<xsl:template match="ifc:IfcBoiler">
<xsl:param name="KeyPool"/>
<xsl:if test="$KeyPool != ''">
<xsl:variable name="simelemname">
<xsl:call-template name="getSimElementName">
<xsl:with-param name="KeyPool" select="$KeyPool"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="targetelements">
<!--<xsl:element name="simcore:SimUniqueID">TTT</xsl:element>-->
<!-- generate current's target elements specific fields and attributes (e.g. UniqueId)-->
<!--<xsl:copy>-->
<xsl:call-template name="resolvekeypool">
<xsl:with-param name="KeyPoolSnippet" select="$KeyPool"/>
<xsl:with-param name="elemname" select="'name'"/>
</xsl:call-template><!--</xsl:copy>-->
</xsl:variable>
<!--Call the Generic Generation Template-->
<xsl:call-template name="GenerateIfcElement">
<xsl:with-param name="KeyPool" select="$KeyPool"/>
<xsl:with-param name="simelemname" select="$simelemname"/>
<xsl:with-param name="pregens" select="$targetelements"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="utf-8"?>
<!-- XSLT-Stylesheet Transformation of the ifcBoiler type to the SimModel aquivalent Type-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.lbl.gov/namespaces/Sim/Model" xmlns:simcore="http://www.lbl.gov/namespaces/Sim/SimModelCore" xmlns:simres="http://www.lbl.gov/namespaces/Sim/ResourcesGeneral" xmlns:simgeom="http://www.lbl.gov/namespaces/Sim/ResourcesGeometry" xmlns:simbldg="http://www.lbl.gov/namespaces/Sim/BuildingModel" xmlns:simmep="http://www.lbl.gov/namespaces/Sim/MepModel" xmlns:ifc="http://www.buildingsmart-tech.org/ifcXML/IFC4/Add1" exclude-result-prefixes="xsl ifc">
<xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<!--the IfcBoiler template-->
<xsl:template match="ifc:IfcBuilding" name="GetIfcBuilding" mode="traverse">
<!--Check wether matched Boiler is instance (else ignore reference object with @ref="...")-->
<xsl:if test="current()[@GlobalId]">
<!--@id -> This is misplaced: here only generation - eval wether id/ref (or Tag/ObjectType) should not take place here -> because by calling template current() is implicitly transfered and the attributes are commonly inherited from base class (so the resolving templates e.g. IfcType can check them uniformly)-->
<xsl:for-each select=".">
<!--<xsl:element name="SimBuilding">-->
<!--<xsl:value-of select="$KeyPool"/>-->
<xsl:if test="current()/ifc:IsDecomposedBy/ifc:IfcRelAggregates/ifc:RelatedObjects != ''">
<!--<xsl:variable name="BuildRelatedObjects" select="current()/ifc:IsDecomposedBy/ifc:IfcRelAggregates/ifc:RelatedObjects"/>
<xsl:for-each select="$BuildRelatedObjects/ifc:IfcBuildingStorey">
<xsl:call-template name="GetIfcBuildingStorey">
</xsl:call-template>
</xsl:for-each>-->
<xsl:for-each select="current()/ifc:IsDecomposedBy/ifc:IfcRelAggregates/ifc:RelatedObjects/node()">
<xsl:apply-templates select="current()" mode="traverse"/>
</xsl:for-each>
</xsl:if>
<!--</xsl:element>-->
</xsl:for-each>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="utf-8"?>
<!-- XSLT-Stylesheet Transformation of the IfcBuildingStory type to the SimModel aquivalent Type-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.lbl.gov/namespaces/Sim/Model" xmlns:simcore="http://www.lbl.gov/namespaces/Sim/SimModelCore" xmlns:simres="http://www.lbl.gov/namespaces/Sim/ResourcesGeneral" xmlns:simgeom="http://www.lbl.gov/namespaces/Sim/ResourcesGeometry" xmlns:simbldg="http://www.lbl.gov/namespaces/Sim/BuildingModel" xmlns:simmep="http://www.lbl.gov/namespaces/Sim/MepModel" xmlns:ifc="http://www.buildingsmart-tech.org/ifcXML/IFC4/Add1" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="xsl ifc msxsl">
<xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<!--the IfcBuildingStory template-->
<xsl:template match="ifc:IfcBuildingStorey" name="GetIfcBuildingStorey" mode="traverse">
<!--Check wether matched IfcBuildingStory is instance (else ignore reference object with @ref="...")-->
<xsl:choose>
<xsl:when test="current()[@GlobalId]">
<xsl:for-each select=".">
<xsl:if test="current()/ifc:ContainsElements/ifc:IfcRelContainedInSpatialStructure/ifc:RelatedElements">
<xsl:for-each select="current()/ifc:ContainsElements/ifc:IfcRelContainedInSpatialStructure/ifc:RelatedElements/node()">
<!--<xsl:call-template name="KeyPoolHelper">
<xsl:with-param name="currentElement" select="name()"/>
</xsl:call-template>-->
<xsl:copy-of select="current()"/>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:when test="current()/@ref">
<xsl:variable name="refid" select="current()/@ref"/>
<!--CASE 2 (ref-id): NOT NESTED-->
<xsl:for-each select="msxsl:node-set($allsourceobjects)/descendant::ifc:IfcBuildingStorey"><!--//*/ifc:IfcBuildingStorey-->
<xsl:if test="current()[contains(@id,$refid)]">
<!--a recursive "self-call" would be quite nice here ;) for now copied from above, thus redundant -->
<xsl:if test="current()[@GlobalId]">
<xsl:for-each select=".">
<xsl:if test="current()/ifc:ContainsElements/ifc:IfcRelContainedInSpatialStructure/ifc:RelatedElements">
<!--TODO refId-->
<!--<xsl:variable name="BuildRelatedObjects" select="current()/ifc:ContainsElements/ifc:IfcRelContainedInSpatialStructure/ifc:RelatedElements"/>
<xsl:for-each select="$BuildRelatedObjects">
<xsl:copy-of select="node()"/>
</xsl:for-each>-->
<xsl:for-each select="current()/ifc:ContainsElements/ifc:IfcRelContainedInSpatialStructure/ifc:RelatedElements/node()">
<xsl:copy-of select="current()"/>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
@echo off
cscript IfcBuildingSystem.js //Nologo %1
/*
* ifcXML.js
*
* JScript zur zur Transformation einer Quelldatei zur designierten Zieldatei mithilfe xsl stylesheet
*/
var args = WScript.Arguments;
if (args.length == 0) {
WScript.Echo("Syntaxfehler.");
WScript.Quit();
}
// command-line argumente auslesen
filename = args(0); // Quelldatei
try {
// XML Objekt fr die Quelldatei erzeugen
var xml = new ActiveXObject("Msxml2.DOMDocument.6.0");
xml.async = false;
xml.validateOnParse = true;
xml.load(filename);
WScript.Echo("source XML load succeeded.");
// Einlesevorgang Quelldatei error handling
if (xml.parseError.errorCode != 0) {
WScript.Echo(xml.parseError.reason);
WScript.Quit()
}
// XSLT-Stylesheet laden
var xsl = new ActiveXObject("Msxml2.DOMDocument.6.0");
xsl.async = false;
xsl.resolveExternals = true; // xsl:include zulassen
xsl.setProperty("AllowXsltScript", true); // Skripte erlauben
xsl.validateOnParse = true;
xsl.load("..\\Main\\xsl\\Main.xsl"); // "Statisch verdrahteter" Einstiegspunkt in XSLT Geflecht
WScript.Echo("XSL load succeeded.");
// Einlesevorgang XSLT error handling
if (xsl.parseError.errorCode != 0) {
WScript.Echo(xsl.parseError.reason);
WScript.Quit()
}
// Objekt fr Zieldokument erzeugen
var result = new ActiveXObject("Msxml2.DOMDocument.6.0");
// Quelldatei TRANSFORMieren
WScript.Echo("Started Transformation.");
xml.transformNodeToObject(xsl.documentElement, result);
WScript.Echo("Transformation succeeded.");
// Zieldokument in UTF-8-Stream schreiben
var utf8Stream = new ActiveXObject("ADODB.Stream");
fso = new ActiveXObject("Scripting.FileSystemObject");
utf8Stream.Type = 2; // adTypeText
utf8Stream.Charset = "utf-8"
utf8Stream.LineSeparator = 10; // adLF
utf8Stream.Open();
utf8Stream.WriteText(result.xml);
utf8Stream.Position = 3; // Byte Order Mark berspringen
utf8Stream.SaveToFile("output\\" + fso.GetBaseName(filename) + ".simxml", 2); // adSaveCreateOverWrite
WScript.Echo("Transformation result saved to OUTPUT folder.");
utf8Stream.Close();
}
catch (err) {
WScript.Echo(err.description);
}
<?xml version="1.0" encoding="utf-8"?>
<!-- XSLT-Stylesheet Transformation from IfcBuildingSystem to the aquivalent SimModel type-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.lbl.gov/namespaces/Sim/Model" xmlns:simcore="http://www.lbl.gov/namespaces/Sim/SimModelCore" xmlns:simres="http://www.lbl.gov/namespaces/Sim/ResourcesGeneral" xmlns:simgeom="http://www.lbl.gov/namespaces/Sim/ResourcesGeometry" xmlns:simbldg="http://www.lbl.gov/namespaces/Sim/BuildingModel" xmlns:simmep="http://www.lbl.gov/namespaces/Sim/MepModel" xmlns:ifc="http://www.buildingsmart-tech.org/ifcXML/IFC4/Add1" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="xsl ifc">
<xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<!--the IfcBuildingSystem template-->
<xsl:template match="ifc:IfcBuildingSystem">
<xsl:param name="KeyPool"/>
<xsl:if test="$KeyPool != ''">
<xsl:variable name="simelemname">
<xsl:call-template name="getSimElementName">
<xsl:with-param name="KeyPool" select="$KeyPool"/>
</xsl:call-template>
</xsl:variable>
<!--Call the Generic Generation Template-->
<xsl:call-template name="GenerateIfcElement">
<xsl:with-param name="KeyPool" select="$KeyPool"/>
<xsl:with-param name="simelemname" select="$simelemname"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
/*
* ifcXML.js
*
* JScript zur zur Transformation einer Quelldatei zur designierten Zieldatei mithilfe xsl stylesheet
*/
var args = WScript.Arguments;
if (args.length == 0) {
WScript.Echo("Syntaxfehler.");
WScript.Quit();
}
// command-line argumente auslesen
filename = args(0); // Quelldatei
try {
// XML Objekt fr die Quelldatei erzeugen
var xml = new ActiveXObject("Msxml2.DOMDocument.6.0");