Wednesday 15 May 2019

Blender Script: Change Object Visibility Each Frame

Here's a script to make visible only one object per frame in Blender. Visibility goes on for a single object and off for the rest.


import bpy
def ani_handler(scene):
    obj_len = len(scene.objects.values())
    for i, obj in enumerate(scene.objects.values()):
        # obj.hide_set(i != ((scene.frame_current-1) % obj_len)) # Blender 2.80
        obj.hide = (i != ((scene.frame_current-1) % obj_len)) #Blender 2.79b
bpy.app.handlers.frame_change_post.append(ani_handler)



Here's a second iteration of the script, this time it only changes visibility for objects with a specific name. In this case Cube

import bpy
def ani_handler(scene):
    name = 'Cube'
    objs = [obj for obj in scene.objects.values() if name in obj.name]
    for i, obj in enumerate(objs):
        obj.hide_set(i != ((scene.frame_current-1) % len(objs))) # Blender 2.80
        # obj.hide = (i != ((scene.frame_current-1) % obj_len)) #Blender 2.79b
bpy.app.handlers.frame_change_pre.append(ani_handler) 

Sunday 10 March 2019

Notes on EV Batteries Second Life


"Batteries with 70% to 80% of their rated capacity are considered to be less useful in EVs and are typically removed from applications at around five years of use. Moreover, these retired batteries are costly to dispose of and the recycling rate of retired batteries is less than 2%" Hu, S., Sun, H., Peng, F., Zhou, W., Cao, W., Su, A., . . . Sun, M. (2018). Optimization Strategy for Economic Power Dispatch Utilizing Retired EV Batteries as Flexible Loads. Energies, 11(7), 1657. doi:10.3390/en11071657 "However, even with the continued rise of Li- ion battery development and commercialization, the recycling industry is lagging; approximately 95% of Li-ion batteries are landfilled instead of recycled upon reaching end of life." Heelan, J., Gratz, E., Zheng, Z., Wang, Q., Chen, M., Apelian, D., & Wang, Y. (2016). Current and Prospective Li-Ion Battery Recycling and Recovery Processes. Jom, 68(10), 2632-2638. doi:10.1007/s11837-016-1994-y "Renewable energy technologies are a promising way to mitigate the consequences of climate change and the depletability of resources. However, the intermittent electricity output from technologies like solar photovoltaic systems is volatile and depends on daytimes or local weather conditions. Energy storage technologies can help to match supply and demand." "Although battery costs have declined, could not find evidence that investments in battery storage were profitable under present conditions. The costs per kWh decrease further if used battery storage units are taken into consideration. In this case, the benefits from lower costs have to be balanced with the downsides (e.g., lower capacity and efficiency, earlier replacement need of used battery systems)." "the energy generation from PV systems strongly depends on time of day and local weather conditions and brings an element of uncertainty to the power grid. Furthermore, the peak in energy generation around noon produces a mismatch in demand and supply and is a threat to the stability of the electricity system. The mismatch exists because the power supply generated by PV systems is highest during the day with a peak around noon, whereas power demand is low during the day and increases in the evening hours. The use of storage technologies and smart grid technologies represents a promising way to shift energy demand from the evening hours to the hours with a surplus of renewable energy generation." "In the automotive industry the “second life” of retired batteries from electric vehicles is a much debated issue, and nearly all of the major car manufacturers are currently determining possible applications for their batteries after they have reached a capacity between 70-80% through aging during their “first life” in the vehicle. Most industry experts expect them to be used as stationary storage for renewable energy production, since they still retain significant capacity." Madlener, R., & Kirmas, A. (2017). Economic Viability of Second Use Electric Vehicle Batteries for Energy Storage in Residential Applications. Energy Procedia, 105, 3806-3815. doi:10.1016/j.egypro.2017.03.890 "The market for electric-drive vehicles (EDVs), including hybrid electric vehicles (HEVs), plug-in hybrids (PHEVs), and electric, pure battery-powered vehicles (EVs), is expected to experience significant and rapid growth over the coming decades. In the year 2013 all EDVs together represent about 1.44 percent of annual vehicle sales in Canada, about 0.09 percent in Mexico and about 3.81 percent in the US, and numbers are expected to grow rapidly in the coming years." "As the market for EDVs expands, there will be a vital opportunity to recapture and recycle the materials used in EDV batteries (nickel, cobalt, steel and other valuable components) once they reach end of life (EOL)." "It is projected that about 276,000 EDV batteries will reach EOL in North America in 2015. Most of these batteries are likely to be nickel metal hydride (NiMH), which is the predominant battery chemistry used in HEVs. By 2030, almost 1.5 million EDV batteries will reach EOL. By that time, close to half the EOL EDV batteries will be lithium-based, with the remainder being NiMH batteries." "In the last ten years, the market in North America for hybrid electric vehicles (HEVs), plug-in hybrid vehicles (PHEVs) and electric vehicles (EVs), which are collectively referred to as electric-drive vehicles (EDVs), has surged. Annual sales of HEVs reached almost 520,000 units in North America in 2013. Most of the sales were in the US, more than 495,000 units, or about 3.2 percent of all vehicle sales. HEV unit sales were about 23,000 in Canada in 2013, representing 1.32 percent of all vehicles sales. Available information indicates that about 1,000 units were sold in Mexico in 2013, representing about 0.09 percent of annual vehicle sales. Several factors have contributed to this rising market penetration of EDVs, including greater consumer preference for fuel-efficient cars; increasing gasoline prices; advances in battery technology; low-carbon fuel standards; and government support in the form of tax incentives and rebate programs." "EDVs today use either nickel metal hydride (NiMH) or lithium-ion (Li-ion) batteries. In 2013, about 80 percent of HEVs used NiMH batteries. The remaining 20 percent of HEVs and all PHEVs and EVs use Li-ion batteries, though the exact chemistry often varies. Research and development on new and emerging battery technologies, to reduce the cost and extend their useful lifecycle, is ongoing." "There are currently only a handful of companies that have the technology and capacity to process these batteries: Retriev, Raw Materials Company, and Glencore/Xstrata in Canada; Sitrasa and TES-AMM in Mexico; and Inmetco, Retriev, Umicore, and MCT in the US. These companies are particularly interested in recovering valuable metals such as nickel (from NiMH batteries) and cobalt from Li-ion batteries. Industry players expressed a concern that new battery chemistries under development at this time may contain less-valuable components in the future, thereby reducing the incentive for effective recycling. "At EOL, retired EDV batteries still retain about 80 percent of their capacity. While they are no longer suitable for vehicular use, these EOL EDV batteries may still have reasonable energy storage and standby power capabilities that could be used for residential and commercial electric-power management, power-grid stabilization, and renewable energy system firming. Considerable research is underway in the US and elsewhere to fully explore this potential. Directing used EDV batteries to second-use applications could benefit the environment by delaying the recycling of batteries and fully utilizing their capabilities prior to recycling. Over the long term, recycling and refurbishing of EDV batteries will play an important role in reducing the costs of EDVs." "Toyota (the dominant player in the HEV market at this time) uses a NiMH battery for its HEVs, although, as do other manufacturers, it uses a lithium-based battery for PHEVs and EVs. Ford uses a lithium-based battery for its HEVs (Ford Fusion and Ford C-Max). Hyundai also uses a lithium-based battery for its Sonata HEV. Each manufacturer bases the decision on a number of factors. Toyota tested lithium-based batteries in their HEVs but decided to continue to use NiMH batteries. Based on the US market share of each auto manufacturer (the US is by far the largest market for HEVs in North America, as discussed later in this section), about 19 percent of HEVs use Li-ion batteries and about 81 percent of HEVs use NiMH batteries. This value excludes PHEVs, which all use Li-ion batteries." "Many different lithium-ion (Li-ion) chemistries are currently available and are being tested to improve the design and performance and lower the costs of these batteries. Li-ion battery manufacturing facilities are being established in the US with financial support from a US$2.4 billion grant program established by the Obama administration to promote electrical vehicles." - New Technologies In Development Listed in Paper Diaz, J. C. (2015). Gestion écologiquement rationnelle des batteries en fin de cycle de vie provenant de véhicules à propulsion électrique en Amérique du Nord. Montréal, Québec: Commission de coopération environnementale. "The first EV was seen on the road shortly after the invention of rechargeable lead–acid batteries and electric motors in the late 1800s [4]. In the early years of 1900s, there was a golden period of EVs. At that time, the number of EVs was almost double that of gasoline power cars. However, EVs almost disappeared and gave the whole market to internal combustion engine (ICE) cars by 1920 due to the limitations of heavy weight, short trip range, long charging time, and poor durability of batteries at that time." "the current two major battery technologies used in EVs are nickel metal hydride (NiMH) and lithium ion (Li-ion). Nearly all HEVs available in the market today use NiMH batteries because of its mature technology. Due to the potential of obtaining higher specific energy and energy density, the adoption of Li-ion batteries is expected to grow fast in EVs, particularly in PHEVs and BEVs. It should be noted that there are several types of Li-ion batteries based on similar but certainly different chemistry." "The high value of specific energy of gasoline gives a conventional ICE powered vehicle a range of 300–400 miles with a full tank of gasoline. Gasoline has a theoretical specific energy of 13,000 Wh/kg, which is over 100 times higher than the specific energy of 120 Wh/kg of typical Li-ion batteries. It would be too big and heavy to have a battery pack with the same amount of energy as a full tank (e.g., 16 gallons) of gasoline. However, since the electric propulsion is much more efficient than an ICE, less energy is needed to propel an EV. Considering the efficiency of 80% for EV propulsion and 20% for ICE, the total amount of energy stored for EV can be a quarter of what a regular ICE powered vehicle needs for the same mileage. Based on the current battery technology, it is not practical to consider a pure BEV with a mile range of 300–400 miles since it would require a battery pack larger than 100 kWh that can weigh over 900 kg. Nevertheless, it is realistic to have a battery pack around 30 kWh to achieve 100 mile range even based on current battery technologies." "Depth of Discharge (DOD). DOD is used to indicate the percentage of the total battery capacity that has been discharged. For deep-cycle batteries, they can be discharged to 80% or higher of DOD. The higher the DOD, the shorter the cycle life. To achieve a higher cycle life, a larger battery can be used for a lower DOD during normal operations." "Various battery chemistries have been proposed as the energy source to power electrical vehicles since the 1990 California Zero Emission Vehicle was mandated, which required 2 and 10% of the automobiles sold to be zero emission in 1998 and 2003, respectively. These battery chemistries included improved lead–acid, nickel–cadmium, nickel–zinc, NiMH, zinc–bromine, zinc–chlorine, zinc–air, sodium–sulfur, sodium–metal chloride, and, later, Li-ion batteries, with each of these chemistries having its own advantages and disadvantages. Towards the end of the last century, the competition between battery chemistries was resolved with General Motor’s choice of NiMH for its EV-1 pure electrical vehicles. In the following decade, the technology of the HEV developed by Toyota and Honda matured and gained popularity through its combination of fuel economy, acceptable pricing, and clean safety record. Up to this date of 2011, the leading battery chemistry in these HEVs remains NiMH. As the concerns over greenhouse gas emissions and fossil energy shortages grow in the recent years, the development target has shifted from HEV to PHEV, with the eventual target being a purely battery-powered EV. The requirement of a higher energy density in PHEVs and EVs reopens the discussion for automobile battery technologies, giving Li-ion battery chemistry another chance at entering the electric car battery market. In this section, the underlying principles, the current market status, and the future developmental trends of NiMH and Li-ion batteries are discussed." Rodrigo Garcia-Valle, R. (2016). Electric vehicle integration into modern power networks. Place of publication not identified: SPRINGER-VERLAG NEW YORK. doi:https://www.springer.com/gp/book/9781461401339


Saturday 12 January 2019

Uno Menos (Redux)

I found my source files for "Menos Uno". I'm uploading them to HitRECord to remix it and make something new out of it.











Saturday 5 January 2019

Dr Eco (Redux)

I found the source files of Dr Eco and I'm re-rendering it (it used to be 640x480).


Wednesday 6 September 2017

Hit Record

I recently joined HitRecord, a social network/production house create by Joseph Gordon Levitt and his brother. The prerogative is that everything you share (audio, music, video, animation, illustration, etc) can be re-used/re-mixed, and at the same time you can do the same with all the uploaded data. This is one of my first records on the platform, which is a re interpretation of Jagama's Robot

Saturday 24 June 2017

Matt Sanbrook's Batman/Catwoman read by Processing Sketch

This week I stole Matt Sanbrook's Batman/Catwoman Image


I processed the image with a Processing Sketch and here's my result:


Saturday 17 June 2017

Jake (Adventure Time) - Blender 3D

Jake from Adventure Time








Processing / Blender Experiments



With the help of some tutorials on how to translate an image to 3D depending on its brightness, I came up with some tests. Renders were done with Blender and Lightwave. I used a Batman and a Joker image to test the results.

Using Motion Blur / Image Map

The Joker

Image Mapped Render

Positive + Negative

Negative

Positive







Thursday 1 May 2014

More Creative Coding

I Continue to experiment with Processing. These are not big variants from the previous post but the results are somehow different. I like these better.

Sigo experimentando con Processing. Estos videos no tienen cambios muy grandes a los del escrito anterior pero los resultados me han gustado mas.


This video is the shortest and less detailed. I liked how even without great detail is pretty obvious - 2:01




This video is a realistic illustration of Frankenstein, again processing uses an image as reference and interprets the closest color - 4:25




This is a long video, processing scans a Mega Man image and interprets it. I wish I'd done only the silhouette - 10:06 (too long, isn't it?)