Saturday, October 3, 2020

What's a Battery? 2. Opportunity cost in the Two-Period Case: No Initial Storage

    A battery whose value is realized over two periods, starting from no initial storage (i.e., C0 = 0 or Cmin if the battery is represented as having a nonzero minimum energy state, but Cmin is not usable during period 0 or period 1) cannot discharge in period 0, assuming each period allows only one directional decision on energy usage.  If a single period can include both charge and discharge, then there may be multiple values associated with a single net charge or discharge, and the maximum net value may be taken as the value associated with an equivalent single decision to charge or discharge. 

    Period 0 requires a net charge greater than or equal to zero, and only the net energy resulting from the Period 0 charge is available at the beginning of Period 1.  The option value OValue(e1) is associated with the energy above Cmin available at the beginning of Period 1. 

    In the pure two-period model, energy remaining at the end of Period 1 has no value, so that the optionality value must exceed the energy value for the battery to be used for its optionality rather than its energy in Period 1; with no loss of generality, the option value may be taken to include energy value DValue(e1) if the energy value exceeds the option value.

    The battery in this case must receive, or expect to receive, revenues in Period 1 that exceed the costs of storing energy in Period 0.  If prices are known with certainty, the battery can be scheduled to charge enough to cover maximum discharge in Period 1 if the arbitrage is profitable.  In the case that prices are not known, a schedule may not yield profits with certainty, though it may in expectation.  Of course, I want to apply this model to the case of participation in an energy market, that is to say a case of repeated market runs, but I’ll note the model at this point isn’t quite ready to be used for that purpose: for one thing, when a battery charges because of expected revenues from discharge, but doesn’t discharge, that alters the next market run’s initial storage from the “no initial storage” case.

    The issue of end-of-horizon storage can be assumed away by requiring the battery be returned to its “no initial storage” state at the end of Period 1.  We can imagine real world cases that approximate such a constraint, such as batteries with operational constraints that require zero storage at the end of the scheduling horizon (perhaps because the use for charging in each repeated market’s “Period 0” is contractually required, as it is for solar+storage hybrid resources), or system conditions that very reliably make use of a battery’s entire storage capacity by the end of the scheduling horizon.  In such cases, every day is a new day unless the battery operator is employing game-theoretic strategies that yield differential outcomes against other strategic players (i.e., partial or no combined charge-discharge schedules on some days in exchange for other more lucrative days).

    Aside from making a self-scheduling discharge to charge and then discharge based on forecast values (more typically, electricity prices), another application of the “no initial storage” case that doesn’t require modeling of repeated market runs is to use the concept of a contingent two-part bid, often referred to as an “arbitrage bid” by those who would like to see something like it implemented in wholesale markets.  The contingent two-part bid consists of a paired charge bid and discharge bid, such as that one of the two bids is accepted only if the other is also accepted.  The beauty of reducing the battery model to two periods with no initial storage is that it reveals the difficulties, not to say impracticality, of accepting contingent two-part bids from more than one battery: although the difference between “discharge price” and “charge price,” also known as the arbitrage, can be nicely ordered among batteries, there is not necessarily a monotonic ordering of the bid pairs behind these arbitrages based on the market objective function (usually the minimization of total electricity costs required to match total supply and total demand).  In fact, contingent bids for multiple two-period batteries would require a mixed integer linear program formulation which by itself could be an arbitrarily hard combinatoric problem: potentially harder, in other words, than the traditional electric system unit commitment problem that serves as the backbone of all modern electricity markets.

    This very simple model allows consideration of a contentious point in the calculation of “default energy bids” that may in principle be imposed on batteries as a version of cost-based bidding by system operators or regulators, in cases where market power is or might be exercised to the disadvantage of the market as a whole.  The California ISO, in its ESDER 4 market enhancements initiative, proposed a default energy bid calculation as

    DEB = max( charging cost/efficiency + a variable cost term, opportunity cost of discharge)

    In the two period case, it’s clear that the variable cost term can be adjusted for any single market run to equal (opportunity cost of discharge – charging cost/efficiency), so that the first term in the maximum equals the second.  Discussion of the DEB calculation has focused on the question of whether the opportunity cost term is needed or legitimate in the day ahead market, when the CAISO as system operator can at least in theory determine the optimal combination of charging and discharge that maximizes the value of the battery. 

    A proposal not to include opportunity cost in the DEB calculation must be based on an assumption that a variable cost component, which as a “master file” parameter does not vary from one day to the next, is equivalent to an opportunity cost component based on the anticipated benefit of using the battery in the current market versus reserving it for future use.  But the terms are clearly not equivalent under any price uncertainty: in particular, the combination of a charging cost term that varies daily (per the DEB proposal) with an invariant variable cost term will clearly not be equivalent to an opportunity cost term that varies daily.  

    It is clear that a battery operator’s objective (and it might be supposed, the CAISO’s long-term objective) should be to see the battery discharged in markets with the highest values over the lifetime of the battery, and that the variable cost term by itself would not lead to such highest value discharges; instead, it would lead to the battery being discharged in every market for which discharge was economic (i.e., had non-negative net revenue) until the battery’s degradation made such discharge impossible.   

Sunday, September 27, 2020

What’s a Battery? 1. Definition and Formulation (the Two Period Case)

               First principles: a battery is a machine with limited capacity to store energy, whose primary purpose is to store energy for later use.  This definition captures the need for a battery to be a machine (excluding living creatures whose metabolic functions might be described in this way); whose capacity is limited (i.e., the boundaries of the description of the machine must include its limits, in contrast to hypothetical machines with internal capabilities to increase their capacities, such as systems storing compressed gasses or liquids in underground caverns of unknown size); with a primary purpose of storing energy (as opposed to machines for which storage is an incidental function or part of a different productive process); and whose storage is for use later in time (i.e., it is unable to borrow energy from a later point in time for use now, although a current use could certainly be accompanied by a plan to add back to available energy at a later time).

From this definition a simple formal math representation may be derived.  A battery’s limited capacity may be represented by C.  At least two time periods should be designated, a period in which energy is stored and a later period in which energy is used.  If the entire capacity of a battery is considered usable, then efficiency losses during use (sometimes called “discharge”) are internalized in the representation of available energy e; that is, energy up to the amount e is considered usable, although in fact the energy required to create e “units of usable energy,” whatever that means, might be larger than e.  If the process (sometimes called “charging”) of storing e units of usable energy required e units of energy, that process would be perfectly efficient with respect to this representation.  In general, ec units of energy are required to store e units of energy, where ec > e.  If e/ec does not vary depending on current storage or the amount stored in a given period, e/ec may be considered a constant efficiency factor denoted eff.  The amount of energy required to charge the battery fully may be represented by EC, where EC > C, and EC*eff=C for constant eff.

The implications of this simplest battery model for representing decisions about whether to charge or discharge are:

1.      A battery may begin the current period in a state of energy storage C0 between 0 and C.

2.      The battery may charge up to (C – C0) units of energy in the current period.  Charging will require an amount of energy greater than (C – C0) and less than EC.

3.      The battery may discharge up to C0 units of energy in the current period.

4.      The battery operator may decide to retain or increase energy stored until the end of the current period in order to have the option of using it in a future period.

5.      The optionality of future use does not equate to future use.

The economic value of this simple battery is maximized when the charge/discharge decisions made in the current period 0 and the later period 1 are such that they maximize the objective function “Maximize (Value of discharge in period 0 – Cost of charge in period 0) + (Value of optionality of discharge in period 1)”, which may be written

     Max DValue(d0) – Cost(ec0) + OValue(e1)

    where 1. d0 <= C0

               2. ec0 * eff = c0 < (C – C0)

               3. e1 = C0 + ec0 * eff – d0

               3. OValue(e1) >= DValue(e1)

Constraint 3 is a statement that the value of either optionality or energy beyond period 1 is zero, so that if the battery is used not for energy but some other purpose covered by “optionality,” that optionality must have a value higher than the value of discharged energy in that period.  The optionality value may be considered to include the value of energy beyond the horizon of the problem to be solved: i.e., it includes a liquidation value.

Tuesday, June 2, 2020

Last Whole Earth Wayback Machine

Periodically I pull out my big fat copy of The Last Whole Earth Catalog and peer back into my youthful history, into what on this day I must call the history of my white privilege.  The particular privilege I enjoyed in my youth was certainly never available to people of color in the day, and today it isn't even available to most white kids: it was the privilege of economic security so assured that I could choose not to work, not to aspire, to waste my time and not worry about the effect of that malingering on my future. 

Last Whole Earth youth culture was a mix of love-ins, hippie-by-mail culture, and ultimately going to an experimental college where almost everyone's aspirations were pretty similar to my own.  But the catalog allowed all sorts of other weird stuff to enter the mix. 

When I perused the volume a couple of days ago, the first item my eyes alit upon was an entry for a Craftsman half-inch heavy duty drill costing under $50, which led me to look immediately for its equivalent on Amazon today: looks like the comparable item costs about $250, which doesn't seem a bad scaling for fifty years.  I was struck by its having been Sears house brand at the time, more or less the equivalent of Amazon's house brand products (though the latter have all been shoddily made in my experience), with the Last Whole Earth Catalog itself acting as the mystical soul-transmigrator which transmits essence of Sears to essence of Amazon. 

In fact, a lot of my high school infatuation with the Catalog probably sprang from a similar obsessive infatuation with the fat Sears catalogs that came to our house before Christmas (I was mesmerized by the toy section, of course, but also by the pages of fishing equipment that I never had the least use for); and the Amazon algorithms strive for the same serendipitous associations the Catalog achieved by means of its amateurish yet sublime editors and reviewers.

My second draw at the well brought something more sinister to light, the draw that libertarianism had for scruffy as well as fascistic baby boomers.  Ayn Rand and Milton Friedman are cited with approval by the reviewers (and by Stewart Brand, the presiding host of the book) as saying true things about power and the economy. 

In retrospect, that bias might help to explain both the half century of growth in the tech sector, and the kind of libertarianism now practiced by Trumpist baby boomers who probably have some nostalgia for their excesses of the 1970's when they're not attending evangelical services or target practice.  The judgments of that era, like those of today's know-nothings, were from the gut and very prone to flush the good (such as civil rights and poverty reductions achieved) out with the visibly bad  (Vietnam as seen by both hippies and fascists).  We really must be more thoughtful than that now.


Sunday, May 31, 2020

Network Effect

I finished reading Martha Wells' new Murderbot novel Network Effect this morning.  The previous books in the series, the Murderbot Diaries, are four... novellas is what they were called when as a voracious reader of science-fiction I made my way through all the early Nebula award winners.  And in terms of the criteria for awards in science-fiction, that is what they are, all under 40,000 words.  The earlier Murderbot stories were however all published as individual books, so it might be more accurate to refer to them as short novels, without any of the embellishments that once implied not only a shorter word count, but also a particular kind of dramatic form peculiarly its own.

The Nebula awards, and the Hugo awards as well, set out a continuum of short story, then novelette, then novella, then novel.  Novellas were defined as being between 15,000 and 40,000 words, not enough to amount to a novel as defined by science-fiction publishers, but far in excess of the tautness of the short story format.  In mathematical terms, a novella occupies a finite interval of possible narrative length whereas the novel can be infinitely long; hence a novella must partake of the finitude of the short story even as it stretches.  Commonly, a novella used to serve as a kind of trial run for a full-length novel (and the novelette, when not just a long short story, could similarly serve as a kind of outline).  In the case of the Murderbot Diaries, however, the stories are each fully realized and contribute to the development of the protagonist, which culminates in Network Effect.

Thus another way to approach the Murderbot books is as a single serial work, and for those interested in reading them, it's pretty important to do so in their intended order.  Martha Wells is a marvelous author of serial works -- I can make that assertion based on the complete arc to date of the Murderbot books, as well as based on another book of hers I've read, The Wizard Hunters, first in her series "The Fall of Ile-Rien."  Wells takes full advantage of the ability to refer to events offstage, which have a resonance whether one has read the original source or not, in adding dimension to events and characters who would otherwise require too much space or not move the story along at just the right pace.  In the Murderbot stories the pace is almost always hell-bent, but the Ile-Rien book used the same devices in a much more leisurely and intricate way.

But the greatest strength and pleasure of the Murderbot stories is, as I suggested, the realization of the central character, both human and not, one of the best usages of the artificially intelligent superhero trope you'll ever encounter.  Depending on your tolerance or need for science-fictional escapism, you should definitely put them on your list.

Saturday, May 30, 2020

The Lady from Shanghai

Friday being "family movie night" here, we watched Orson Welles' The Lady from Shanghai this week, it being the May entry in Charla's 2020 film noir calendar.  I have to place it among the strangest movies I've seen, up there with the entire ouevres of David Lynch or Luis Bunuel or Maya Deren.  I received it as a complete surprise, never having been warned of its strangeness.

Thinking about movies like The Lady from Shanghai made in the period right after the end of World War II, I hypothesize that creative ferment had multiple sources and could yield messy results.  I wanted to be smart here and refer to the specific technological advances that must have happened in movies over the course of the war years, but my googlesearch didn't yield anything specific. 

It seems clear from the variety of locations used over the movie's journey from New York to San Francisco that the freedom to travel (after the restrictions imposed by the war) was liberating for Orson Welles' creative juice-flowings.  The movie includes a whole anthology of mini-movies enclosed in the overarching structure of the story.  The Caribbean picnic, the Acapulco layover, the Chinese theater... each of these sequences is etched in my memory album already.  These sequences and others are masterpieces of cinematography, really, attested to by the fact that the best article I've found on the web about the movie so far focuses on the cinematographer rather than Welles.

What is puzzling about The Lady from Shanghai is that the acting is stylized to the point of being inhuman, the writing laugh-out-loud pretentious, and the story a gobbledygook mishmash of fantasy and plot points that makes no sense except in an assumed dream world within the cranium of Orson Welles.  Puzzling because Columbia must have known they were taking a flyer on a story both unsympathetic and confusing, with only the face and body of Rita Hayworth to pull in the masses.

Hypothesis one: The Lady from Shanghai takes its liberties from the world of "theater" (pronounced in as high-falutin a manner as possible) in which primadonna actors pronounce and enunciate and preen and strut rather than interact or attempt to convince the audience that what they are doing is natural.  This fits an image I still have of the decade prior to my birth as a period, now identified as "middle-brow," in which the number of Americans who hungered for intellectual nourishment and high art was greater than ever before or since, and that ambition was fostered because it fit our Cold War need for exceptionalism so well.

Hypothesis two: Orson Welles made movies as a hybrid of radio and visual scene construction, and wasn't concerned about the seamless integration of the two.  If you were to listen to the dialogue of The Lady from Shanghai on the radio, the anti-naturalistic speaking of the actors would be exactly what was expected and needed for transmission over the era's highly unreliable networks; the lack of visual cues would probably sometimes, but not always, make the story more confusing and wild than it already is.

Hypothesis three: Welles' anti-naturalism is a deliberate attempt to bring the incredible into a contemporary environment, a form of mythologizing or mythic storytelling that can't be judged by any normal criteria of credibility.  The character played by Welles combines superhuman capabilities and charisma with seeming passivity in the face of others' manipulations: he's a mix of Odysseus, Orpheus and Hercules (at a minimum).  And Rita Hayworth plays multiple incarnations of the Goddess over the course of the film and up through its stupefying conclusion.

So good and so bad...  I'm not willing to recommend the movie, but I recommend that you watch it.

Thursday, May 28, 2020

Escape from Facebook?

On Facebook today I wrote my status as:

Trying to figure out how I can stay connected with my friends and not support the evil that is Mark Zuckerberg.

This in response to Zuckerberg's personal defence of Trump's lying advertisements on his platform versus the comments posted on Twitter indicating that the Donald's allegations of the fraudulent nature of mail-in voting are themselves false and harmful.

Beyond that, Zuckerberg has been raising funds for Trump, and taking personal meetings. That adds up to more than the expected trimming political behavior of corporate moguls (not to say that that might not be pretty evil in itself).

I got lots of helpful comments to my post on Facebook, as well as one old friend from many years back contacting me on LinkedIn to encourage my separation from FB. Among the comments was one from my sister:

Or how about an Alva mailing list or newsletter? Is that too old fashioned? I'd subscribe!!

Considering that comment, I realized that I can attempt to do just that with this blog, which has been moribund as you'll see for more than a year, but which was intended to serve just such a purpose, once upon a time.  So I'm starting up my blog journal once again.  Consider it an Alva mailing list or newsletter.  And I promise to try to keep it up if some of my friends subscribe; and I promise even harder to try to keep it up if some of my friends occasionally comment on my posts.  The equivalent of a "Like" or emoji would be perfectly fine...

And if you choose to do the same, I will subscribe to your blog too.

What do you say?