Coding: Take your Tas Modelling to the next level with Excel
Dim model As TAS3D.T3DDocument
Set model = New TAS3D.T3DDocument
model.Building.Name = "Hello, World!"
When EDSL sponsored the CIBSE Building Simulation Awards 2020, I noticed that almost all of the candidates had one thing in common; the use of Python scripts, macros and other programming tools to supercharge their modelling capability.
There’s no doubt coding is going to form an important part of the energy modelling of the future, but many feel overwhelmed by the prospect and don’t know where to start. Sound familiar? If so, this blog post series is for you.
In this series of blog posts, i’ll explain how to get started with the Tas Application Programming Interface – no prior experience required. The tools you’ll need to get started? A copy of Tas Engineering and Microsoft Excel.
Which programming languages are supported?
The Tas API has been part of Tas Engineering since the very beginning, which makes it extremely powerful. It uses features built into the Micorsoft Windows operating system which means it can be used with almost every programming language that will run on your PC, including:
With so much choice available and with Visual Basic for Applications (VBA) being fairly old, it’s a fair question! I chose Excel because:
- Almost everyone has it
- Excel is a great way to store data
- The language is very similar to VB.net (very modern)
Almost everyone has it – you don’t need to waste time downloading, installing and setting up complicated development environments on every computer you’re using or want to run your program on.
Storing Data – When your clients send you data for internal conditions, how often does arrive as an Excel document? Wouldn’t it be great if you could press a button in excel and have the data go straight into your TBD file?
Language Similarity – As VBA is so similar to VB.net, when you’re ready to transition to a more modern and more powerful language, it’ll be a breeze. All the techniques I’ll teach you are transferrable, as most modern programming languages have a surprising amount in common!
What will I learn?
In this series of blog posts, I’ll teach you the basics of the Tas Programming Interface using practical examples of automating every day tasks.
We’ll start with the 3D modeller, and how to quickly create zones and zone groups in your Tas3D file directly from excel.
We’ll then run a daylight calculation, and write the lux levels to an Excel spreadsheet.
Next we’ll export our model and merge it with our TBD file.
When we get to the Building Designer, we’ll write a macro to quickly and effortlessly create Internal Conditions.
We’ll also write a macro to read/write heating and cooling loads from zones.
We’ll then simulate the TBD file to TSD.
We’ll write a script to extract results to a table, and process the data to look for certain values.
In order to teach you how to do these things, i’ll also need to teach you the basics of Object Oriented Programming — i’ll teach you the basics of variables, loops and conditions.
I’ll also introduce you to the Excel API!
I'm stuck! Help!
If, at any time along the way, you feel a bit lost and confused and run into any difficulty with the exercises in this tutorial series, don’t panic — I’m here to help. Just email the support team, mention this blog and your message will find its way to me and I’ll see what I can do.
If you do run into any difficulty and are able to resolve it, I’d still like to hear about it so I can improve the content for other learners such as yourself!