recipe

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package recipe implements FameView-style 配方 (recipe) management: named sets of tag values that can be saved to disk, loaded back, applied (downloaded) to the process, and captured from live tags.

Recipes are common in batch process control: an operator selects a named recipe ("Cola", "Diet") and downloads its setpoints to the controller. Here a Recipe is a tag -> value map; Apply writes each value into the tag registry via core.Tag.SetValue, and RW-bound tags then push the setpoint to the device. Capture does the reverse — it snapshots the current live values of a set of tags into a new named Recipe.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(r Recipe, tags *core.TagDB)

Apply downloads r into tags: each Values[tag] is written to its tag via SetValue, creating the tag on first use. RW-bound tags then push the new setpoint to the device.

Types

type Book

type Book struct {
	Recipes []Recipe `json:"recipes"`
}

Book is an ordered collection of recipes, persisted as one JSON file.

func Load

func Load(path string) (*Book, error)

Load reads a book previously written by Save.

func (*Book) Add

func (b *Book) Add(r Recipe)

Add appends r, replacing in place any existing recipe with the same Name.

func (*Book) Delete

func (b *Book) Delete(name string) bool

Delete removes the recipe named name, reporting whether one was removed.

func (*Book) Get

func (b *Book) Get(name string) (Recipe, bool)

Get returns the recipe named name and whether it was found.

func (*Book) List

func (b *Book) List() []string

List returns the names of every recipe in book order.

func (*Book) Save

func (b *Book) Save(path string) error

Save writes the book to path as indented JSON.

type Recipe

type Recipe struct {
	Name   string             `json:"name"`
	Values map[string]float64 `json:"values"`
}

Recipe is a named set of tag -> value setpoints.

func Capture

func Capture(name string, tags *core.TagDB, names []string) Recipe

Capture snapshots the current value of each named tag into a new Recipe. A tag that does not yet exist is created and captured as 0.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL