Welcome to the TRNSYS Users Forum.

The forum is a place where people can interact and have discussions about different topics involving the use of the TRNSYS software package. Here you can post topics for discussion or questions on using TRNSYS and get advice from other users or TRNSYS experts. This forum is not intended for detailed technical support. Users should contact their distributor’s hotline for such assistance.

Some tips for success on using the forum:

  • Follow the Forum Rules posted in Forum Administration.
  • There are categories for different types of topics and questions. Post your topic or question into the proper category.
  • Before posting a topic or question search the existing topics  (and the TRNSYS Users listserv archive or Post archive) to see if a similar topic or question has already been answered.
  • Use a descriptive topic name. Don’t use attention getting subjects, they don’t get attention and only annoy people.
  • State the version of TRNSYS and which add-ons your are using.
  • Include enough specific details for your topic of question to be answered. Just posting “Why am I getting an error?” without describing the specific error and what you are trying to do when you get the error will not receive a response that fixes your issue.
  • Remember when people help you, they are doing you a favor. Be patient, help people out by posting good descriptions of what you need help with, and be polite even if a response does not solve your issue.
  • Moderators may edit your post for clarity or move your topic to a more appropriate category.

Notifications
Clear all

Evaporation tank with resistances

1 Posts
1 Users
0 Reactions
575 Views
0
Topic starter

Hello everyone,

 
I am trying to develop a code for a new Type that simulates a tank connected to a freshwater source, with three electric resistances inside of it in order to produce steam.
 
It's operation follows this path: 
- By pushing a button, the tank is switched on, letting water inside the tank. 
- When the water reaches the minimum level of the tank (there's a sensor that sends a signal to the machinery operating the system), the three resistances switch on.
- There is another sensor that sends another signal when the water level reaches the maximum capacity of the tank. When this sensor detects liquid, the inlet flow is shut down.
- When the water level goes down lower than the minimum capacity, the inlet flow is switched on again.
- There is also a thermometer that measures the temperature inside the tank. If that temperature is lower than the maximum temperature, the resistances are switched on. Once we reach maximum temperature, they are switched off, until the minimum temperature is reached and the resistances are switched on again.
 
My main question is: since the water level is measured by sensors, how can I write down the commands that allow the resistances and inlet flow switching on and off? There will be calculations inside, but the main problem I face is this lack of knowledge for incorporating sensor's coding inside this new Type and if this signals should be an input with a proper dimension.
 
Thanks in advance for your time, hopefully somebody can help me with this issue.
 
Kind Regards,
 
Pablo Calleja
1 Answer
0
Topic starter

Pablo,

  Interesting problem! I think there are two ways that you can go about this.

One is to write a tank model that has an outputs for (at least) the liquid temperature and the normalized fill level (0 if the tank is empty and 1 if the tank is full) as well as inputs for the amount of energy being added to the liquid by the resistance heaters and for the inlet water temperature and flow rate. You'll then use equations, thermostat models, and maybe some resistance heater models to deal with the controls outside of the tank model. You might be able to get started down this route using Type39 (which is a variable volume tank model). If you are using Trnsys18 then Type39 has an input that allows you to add heat. I am not sure that it did in v17. The problem with Type39 is that it doesn't treat the steam production part of your tank; that model assumes that the liquid stays liquid no matter what its temperature. The advantage of this method is that you can use the hysteresis that is already built into thermostat models and don't have to worry about programming that into your own code. It also makes the controls a little more flexible perhaps because they are easier to change in the input file than they are by modifying your Type's internal coding.

The other is that you can handle all of the controls entirely inside the code of your Type. The idea would be similar in that you'd calculate an internal variable that says how full the tank is. Once the tank gets to the minimum fill level then internal variables would determine whether or not the heaters should be on or not and how much energy is being added to the liquid. You'll need to build hysteresis into the code. That means that you'll want the heaters to turn on if the fill level is high enough and if the tank temperature is lower than your setpoint temperature minus some small delta T. And you'll want your heaters to turn off only once the tank temperature rises to your setpoint temperature plus some small delta T. This will prevent the heaters from turning on and off repeatedly when the tank temperature is right at the setpoint. You may also need to add some hysteresis on the tank fill level. If the heaters turn on and water evaporates then the fill level may drop below the "allow heaters" level again. 

For the next part, you may want to refer to the 07-ProgrammersGuide manual and specifically to section 7.4.4.18. For the sensor coding, you'll need to keep track of the tank's liquid volume inside your code. Each timestep your code will recall the amount of liquid that was present at the end of the previous timestep (look at the access function getDynamicArrayValueLastTimestep(:)  ). You'll then do a mass balance taking into account the amount of liquid that came in during the timestep and the amount the left as steam. Knowing the total volume of the tank and the present mass of liquid, you'll be able to determine the fill level that you need for your controls. At the end of your calculations (just before you set the outputs) you'll call setDynamicArrayValueThisIteration(:,:) and store the liquid mass that is present at the end of the timestep. That way the value will be present the next time your code executed and needs to know the starting mass.

Two side notes:

1. you'll need to do the same thing with the temperature of the liquid. Get the temperature of liquid at the end of the previous timestep, compute your new temperature based on an energy balance and then store the end of timestep temperature.

2. base your calculations on the average mass and average temperature of the tank over the timestep.

kind regards,

 David

 

Share: