|
Motion Master 6.0.0-alpha.111
Next-generation motion control software
|
Plant identification: the model of a motor and its load that auto-tuning computes gains from, and the pure functions around its measurement, its fit and its file. More...
#include <chrono>#include <cstdint>#include <expected>#include <functional>#include <nlohmann/json.hpp>#include <optional>#include <span>#include <string>#include <string_view>#include <vector>#include "node/somanet_drive.h"Go to the source code of this file.
Classes | |
| struct | mm::node::PlantMeasurement |
| The recorded response of a drive to a chirp, in the units the fit takes. More... | |
| struct | mm::node::PlantModelFit |
| A plant model as the fit returns it: a transfer function from torque to velocity. More... | |
| struct | mm::node::PlantModelChirp |
| The chirp a plant model was identified with, stored beside the model. More... | |
| struct | mm::node::PlantModel |
| An identified plant model: the transfer function from torque in Nm to velocity in rad/s, and the chirp it came from. More... | |
Namespaces | |
| namespace | mm |
| namespace | mm::node |
Typedefs | |
| using | mm::node::PlantModelFitFn = std::function< std::expected< PlantModelFit, std::string >(const PlantMeasurement &measurement, double startFrequencyHz, double endFrequencyHz)> |
| Fits a plant model to a measurement. | |
Functions | |
| void | mm::node::to_json (nlohmann::json &j, const PlantModelChirp &chirp) |
| void | mm::node::to_json (nlohmann::json &j, const PlantModel &model) |
| std::expected< std::chrono::milliseconds, std::string > | mm::node::plantIdentificationStreamDuration (std::chrono::milliseconds transitionTime) |
How long the HRD stream must run for a chirp of transitionTime. | |
| PlantMeasurement | mm::node::convertPlantMeasurement (std::span< const HrdSystemIdentificationSample > samples, uint32_t ratedTorqueMilliNm) |
| Converts a recording into the units the fit takes. | |
| std::expected< std::optional< std::string >, std::string > | mm::node::checkPlantMeasurementAmplitudes (const PlantMeasurement &measurement, uint32_t ratedTorqueMilliNm) |
| Checks that the recording excited the plant enough for a fit. | |
| bool | mm::node::isStablePlantModel (std::span< const double > denominator) |
| Whether a model with this denominator is stable. | |
| std::string | mm::node::plantModelCsv (const PlantModel &model) |
Renders a model as the text of kPlantModelFile. | |
| std::expected< PlantModel, std::string > | mm::node::parsePlantModelCsv (std::string_view text) |
Reads the text of kPlantModelFile. | |
Variables | |
| constexpr std::string_view | mm::node::kPlantModelFile = "plant_model.csv" |
| The file on the drive that holds the identified plant model. | |
| constexpr std::chrono::milliseconds | mm::node::kChirpPaddingMs {200} |
| Recording time added around the chirp. | |
| constexpr double | mm::node::kMinMeanAbsTorquePermil = 10.0 |
| Mean absolute torque, in per mille of rated torque, below which a recording is refused. | |
| constexpr double | mm::node::kMinMeanAbsVelocityRadPerSecond = 0.5 |
| Mean absolute velocity, in rad/s, below which a recording is refused. | |
| constexpr double | mm::node::kLowMeanAbsVelocityRadPerSecond = 6.0 |
| Mean absolute velocity, in rad/s, below which a recording is accepted with a warning, because a higher amplitude would give a better model. | |
Plant identification: the model of a motor and its load that auto-tuning computes gains from, and the pure functions around its measurement, its fit and its file.
The fit itself runs in the auto-tuning program, and the client that talks to it lives outside mm::node. So this header names only the shape of that call, PlantModelFitFn. The composition root supplies the function, and the procedure body calls it without knowing what stands behind it. Everything else here is a pure function: a transform from one value to another, with no device involved, which is what makes it testable without one.